Custom Board mbed-framework

Hello everyone,

I have relatively successfully created a custom board for platformio (boards/myboard.json) and for mbed (custom_boards.json + subfolder src/TARGET_MYBOARD) using the instruction.
Unfortunately I can’t access the existing system_clock.c because my crystal has 25Mhz and this is not allowed for the STM32L496xx. So I have included the system_clock.c and cmsis_nvic.h in the TARGET folder. By adding the folder in platformio.ini, everything compiled perfectly.

With the exclusion of the STM32L496ZG folder, however, I am also missing the GCC and ARM startup and linker scripts. When I put them in the TARGET folder and refer to the linker script via build_flags (-T), I get an error from the linker because it can’t handle the “#include” (why does the linker script say something like that?).

Does anyone have an idea how I can add a linker script to my CustomBoard? (The linker scripts from mbed seem to be treated differently by the build system if they contain c-code)?

I found a part in platformio-build.py (line 250-270) where a LinkerScript is preprocessed. I assume this is where the #include and #defines are resolved and a LinkerScript is generated.

I have tried to specify the unprocessed script in the platformio.ini under board_build.ldscript, unfortunately without success. Is there a way to specify such a script?

It is now running with a pre-compiled linker script, but it would still be interesting to be able to include the compilation in the platformio process, or whether something like this is already possible in another way.