Usually I work with the Arduino MEGA2560. Therefore I have my standard platformIO.ini file where I can switch the build options between release and debug. For debugging I’m using the avr8-stub debugger of Jan Dolinay. The library of the debugger is located in "lib_extra_dirs ". It’s working fine. Now I was testing a new Arduino nano board with the same project but neither release- nore debug-build can be compiled successfully.
In debug mode it is correct. But in release mode the code where the error occures should not be compiled because it is excluded by a ‘#if SW_DEBUG == true’ statement. This seams to be ignored even it is shown in hover:
My platformIO.ini file looks like this:
platform = atmelavr
;board = megaatmega2560
;board_build.mcu = atmega2560
board = nanoatmega328
board_build.mcu = atmega328p
framework = arduino
build_type = debug
debug_tool = avr-stub
build_type = release
Can anybody give any advise or is it a bug in platformIO?
If you conditionally include a library based on a macro, set
Thank you for your quick reply. This doesn’t seem to be the solution. Sometimes it works, sometimes it doesn’t. But that’s not how software works. I’m working on a version to make the bug reproducible.
I suppose that I ran into Issue #4152. I have found a work arround by first changing the build flags in platformIO.ini from:
build_flags = -DSW_DEBUG=true to:
in the [end:debug] section.
Second I changed all occurences in my project from #if SW_DEBUG == true to #ifdef SW_DEBUG. Then it worked perfectly as expected.
If you are still interested in my project leave a note and you’ll get it. (How can I send it?)
If it worked out then it’s good, no need to post the project here. It would however be interesting as a reference in issue #4152 with a short description of how the sub-library was included and what change made it work so that the LDF recognized the dependency. You can upload the project any way you want, be it a github repo, or the project folder zipped and uploaded to Google Drive or dropbox or whatever.