Using command line #define to control debug options causes crash??
Posted: Thu Oct 27, 2016 5:17 am
I wanted to turn off some of the chibios debug options for a release build, so I swapped out some of the TRUE values in chconf.h with a #define I specified in the makefile. (I added it to the UDEFS list like -DMYDEBUG=TRUE). I know the #define is getting picked up because other portions of my code are able to use it just fine. When I compile with my debug flag set to TRUE, my program crashes almost immediately, and it wasn't until I literally stripped out all of my code that I realized the problem lied elsewhere. With no other code than the minimal chibios startup code, my project crashes immediately upon entering chThdSleepMilliseconds() with a SV#8 apparently after entering the IRQ_HANDLER. Even stranger is specifying FALSE for my debug flag works as expected, and of course removing my definition and specifying TRUE directly works too. What am I missing? I would think if this was some kind of #define ordering/precedence issue the compiler would have complained that it couldn't find the symbol, but instead everything checks out and the program just crashes. I can obviously work around this for now, but I'd love to know why I'm seeing this behavior.