Hi Max,
If I can bother you once more. I’ve copied the generated files (sources, headers, linker scripts, startup file) from Xpresso generated project to a library and a project in VScode/platformio.
I also removed the platform=zephyr line in the platform.ini.
I had some compiler (linker) issues because the Xpresso generated linker scripts link to some libraries which are not present or different in the toolchain used by VScode/platformio.
My VScode/platformio uses:
toolchain-gccarmnoneeabi 1.70201.0 (7.2.1)
My Xpresso uses:
gcc/arm-none-eabi/9.3.1
I found this in the .map file in the xpresso project config, so I think the gcc version is 9.3.1 in Xpresso versus 7.2.1 in platformio.
But the good part is, I don’t need these libraries that were included in the linker script:
GROUP (
"libgcc.a"
"libc_nano.a"
"libstdc++_nano.a"
"libm.a"
"crtn.o"
"crtend.o"
)
So when I simply delete the above group in the linker script, i can compile and link without issues.
My main is the most trivial application (just to check if I can run and step through with debugger)
int main()
{
while (1) {}
}
When I then upload and debug my program it crashes on boot. I added a while (1) {}
in the ResetISR()
function to see if it gets there. It doesn’t.
When I debug my program, it hangs here:
??@0x0020b9ca (Unknown Source:0)
??@0x0020c3b6 (Unknown Source:0)
Running this small project from Xpresso and putting breakpoints in ResetISR
, I can see that the ResetISR
is at 0x600022dc.
The linker script sends the program to external flash:
__base_BOARD_FLASH = 0x60000000 ; /* BOARD_FLASH */
Given this information, would you have any idea where to begin? Is this a result of using the wrong tool chain in VScode/pio? As far as I can tell, the code, linker scripts, and startup code are identical. (except from the included libraries in the linker script which I deleted, but I’m pretty sure that’s irrelevant to this problem).
Any hints/thought would be greatly appreciated