I’ve been trying to trace down a PIO build issue and I’ve run across something that I don’t understand. If I manually run the PIO’s compile command I come up with a different result than if PIO runs the compile itself. In other words, say I touch a single cpp file and run pio run -v
it’ll compile that file and link it together and output the commands used. But if I compare the cpp object file that PIO generated with the one that I get from running pio run -v
compile command manually I get a different object file. By different I mean the size might vary and/or the symbol table of the object file is different. This is very consistent.
Is PIO modifying the object file once it’s compiled? Or is is the pio run -v
not displaying the correct compile command.
I have some evidence for the latter. Several times the output of pio run -v
appears corrupted in that two of the compile flags are combined. For instance, -mcpu=cortex-m7 -mthumb
comes out as -mcpu=cortex-m7-mthumb
. When this problem occurs it’s always the same problem — combining compiler flags. Obviously, this isn’t the command that is being used internally since you’d get a compiler error.
I wish I could provide a simple test case but I haven’t been able to generate one yet. But I’ve been seeing this behavior off and on for several weeks now. In particular I would like to know why PIO generators different object files than if I run the commands manually. Any advice on how to debug this further?