I am trying to get NUCLEO-L011K4 working with mbed-os 6 with bare-metal profile.
This Board was supported some versions ago. So I created a new custom board as described in the docs. You can see the Directory structure here:
Most of the files are copies of the implementation in the earlier mbed-os versions and from ST.
Also the entry in custom_targets.json is a modified copy from earlier mbed-os:
As far as I can remember programs created for this target with the online compiler in the past could be exported only for the uARM toolchain, which is not supported by Mbed OS 6 (supported_toolchains).
Try to build your program with the GCC ARM compiler to check whether that one is usable.
When reading the Mbed documentation about Using small C libraries in Mbed OS bare metal I found some info about Scatter file for Arm toolchain that could be useful.
I fixed it. There was another Directory in my Project with another linker script for backup reason. Somehow the build script found this one and throws the error.
After removing the directory, it is linking correctly and successful runs on the Board!
But keep in mind, that mbed-os - even the bare-metal configuration (which is enabled in this files) - will take a lot of your Flash and RAM and there is not much space for your application. Thats why i stopped development with mbed for this platform and swichted to stm32cubeIDE