You can try to use a special version of standard libraries called newlib-nano
. To enable it you need to add a special linker flag to the file with default configuration for your board, it’s located here:
c:\Users\YOUR_USER\.platformio\packages\framework-mbed\platformio\variants\BLUEPILL_F103C8\BLUEPILL_F103C8.json
(Windows)
/home/YOUR_USER/.platformio/packages/framework-mbed/platformio/variants/BLUEPILL_F103C8/BLUEPILL_F103C8.json
(Linux)
Navigate to the section build_flags
and add "--specs=nano.specs
to the ld
section:
"ld": [
"-mcpu=cortex-m3",
"-mthumb",
"-Wl,--gc-sections",
"-Wl,--wrap,main",
"-Wl,--wrap,_malloc_r",
"-Wl,--wrap,_free_r",
"-Wl,--wrap,_realloc_r",
"-Wl,--wrap,_memalign_r",
"-Wl,--wrap,_calloc_r",
"-Wl,--wrap,exit",
"-Wl,--wrap,atexit",
"-Wl,-n",
"--specs=nano.specs"
]
But these changes will be overwritten with next release of the mbed framework.