Using command line #define to control debug options causes crash?? Topic is solved

ChibiOS public support forum for all topics not covered by a specific support forum.

Moderators: RoccoMarco, lbednarz, tfAteba

Post Reply
jayalfredprufrock
Posts: 36
Joined: Tue Jan 13, 2015 6:33 am
Has thanked: 8 times

Using command line #define to control debug options causes crash??

Post by jayalfredprufrock »

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.
User avatar
Giovanni
Site Admin
Posts: 14895
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 997 times

Re: Using command line #define to control debug options causes crash??

Post by Giovanni »

Hi,

Make sure that the project is cleaned and rebuilt AND put the defines in both C and ASM definitions, chconf.h is also included by assembler modules.

Giovanni
jayalfredprufrock
Posts: 36
Joined: Tue Jan 13, 2015 6:33 am
Has thanked: 8 times

Re: Using command line #define to control debug options causes crash??

Post by jayalfredprufrock »

Ahh I must be missing the ASM definition. Knew it was something silly like that. As always, thanks for your support and patience!
Post Reply