Usinb build flags in Platformio

I’ve been trying to compile some C++ code to an Arduino Zero, however, it requires using some build flags that are not included in Platformio. However, when I try to set the language build flag “-x” it does not include the language after it and the build does not complete. How do I get the -x c++ flag to carry over into the json build file?
Thank you!

I am seeing a similar issue. I need to attach a -ggdb flag to avr-gcc so I can utilize gdb output files for debugging purposes.

I’m not using avr-gcc, but arm-none-eabi-g++. How are you attaching your flag?

right now I am trying to attach it via the build_flags option in the platformio.ini file. But that is definitely not working.

okay did a bunch of crap today with further testing. here is what i have found…

the correct path to attach additional compilation options is definitely the build_flags = … option.

However, I cannot for the life of me get pio run to generate the correct debugging symbols. For me, I have to attach a -g flag to the avr-gcc call such that the linker file wil lbe generated with the proper symbols for debugging. So I set my build_flags to…

build_flags = -g

compiles fine, when I go to debug using gdb and avarice I still have no symbols.

Finally I was so fed up with testing things in gdb and avarice I went around platformio and directly compiled my project using avr-gcc. With the avr-gcc generated .elf file I was able to get symbolic debugging working first try using avarice and gdb.

So there is obviously a problem with the way I am attaching my flags in platformio, or there is an actual problem with build options in platformio.

I think it’s a problem with the build options but I don’t know where to look in the code to go about changing these options. Even when I try to set the generated .json file to include the proper build flags and then freeze its state, not allowing the rewrite from Platformio, it still creates another .josz file with the incorrect build flags!

Yeah, I think for now I am just going to use eclipse and create my own make instructions directly. Hopefully this issue gets some attention and gets resolved in the next release.

What is your board? Have you tried PIO Unified Debugger?

Custom board based on a moteino