I just encountered a very bad and as it seems not well documented limitation of the "smart build" feature. If the variable USE_SMART_BUILD is set to "yes" in the Makefile, os/rt/rt.mk will parse the chconf.h file. This parsing is incorrect, though, as it searches for all lines containing the phrase '#define', not starting with this phrase. As a result, lines like
Code: Select all
//#define CH_CFG_USE_EVENTS
A solution to the given example would be to modify the according line in rt.mk from
Code: Select all
CHCONF := $(strip $(shell cat chconf.h | egrep -e "\#define"))
Code: Select all
CHCONF := $(strip $(shell cat chconf.h | egrep -e "^\#define"))
Code: Select all
/*commend*/#define CH_CFG_USE_EVENTS
My situation is actually a bit more complex and reveals another strong limitation of the smart build feature. I have multiple projects with mostly redundant chconf.h files. Hence I wanted to introduce a common header, which is included by each chconf.h. Since smart build will only scan the 'main' chconf.h of each project but not any included files, it completely fails in this case.
I defined
Code: Select all
#define CH_CFG_USE_EVENTS TRUE
Code: Select all
//#define CH_CFG_USE_EVENTS TRUE
Given these strong limitations and the fact that smart build merely skips compilation of no more than up to 13 "empty" .c files (content is ignored due to the defines), I wonder about the benefit of this feature. If you build a single project, there will probably hardly be any speedup measurable, but if you build multiple projects the feature is very prone to break compilation (or rather linking). Personally, I probably spent more time in searching for the cause of my issues than the feature ever saved me. So in my opinion, smart build should be removed from ChibiOS.
Thomas