free-pdk / free-pdk-examples

Code Examples for Padauk MCUs using the free-pdk/SDCC toolchain
17 stars 10 forks source link

include structure #7

Open cpldcpu opened 4 years ago

cpldcpu commented 4 years ago

I think the includes should be structured in a way where they clearly separate system wide includes and local ones.

Right now there are some files like "millis.h" that are in the include root directory and are included with include "". If these are to be used system wide, I would suggest to put them into pdk/ or pdk/util. Otherwise they should reside within the example code directory.

serisman commented 4 years ago

I'll have to think about this a bit more.

I don't think they should go into pdk/ repo because they are more of a minimal framework than device definitions, and we aren't suggesting that they get included into SDCC.

Also, they need to be refactored so there isn't 'code' in .h files. This probably means a lib/ folder with some changes to the Makefiles in order to compile and link each independent method as their own .a (lib) files. This will allow SDCC to only include methods when they are actually used. Currently there is an issue where SDCC will include the methods within the .h files multiple times (once per .c file that references a .h file).