I’m using VSCode and PLatformIO to build a medium-sized project that is highly configurable and uses conditional compilation to do much of the configuration. I would like to find a way to, as part of a build, output the result of all of the C preprocessor work so that I can see the final value of the #defined macros. Does PlatformIO offer a way to do that?
This is a burden of the compiler, not PlatformIO.
You probably want to add an environment where you only attempt to compile one file which uses all the macros you want to inspect and add the
-E switch using
build_flags to get the output after preprocessing?
I will try that. Where will the resulting file be placed? In .pioenvs?
Output will be on terminal only if you just execute the “build” task. You can however script is so that it gets redirected in the file, i.e. something like
pio run -v -e special_env > output.log 2&>1, depending on the used OS.