I have a project for a STM32F767 which compiles and works just fine under STM32 Cube IDE. I'm using the "-u _printf_float" option to show floating point values on an OLED.
However I switched to VS Code several months ago and I really enjoy this IDE. Unfortunately I'm not able to add the "-u _printf_float" option to the build process.
What I tried so far:
- I added the following line to the CMakeLists.txt file:
set_target_properties(${PROJECT_NAME} PROPERTIES COMPILE_FLAGS "-u _printf_float")
- In the
target_compile_options(${TARGET_NAME} PRIVATE
and thetarget_link_options( ${TARGET_NAME} PRIVATE
section of the st-project.cmake sections I added:
"$<$<CONFIG:Debug>:-u _printf_float>"
"$<$<NOT:$<CONFIG:Debug>>:-u _printf_float>"
Do anyone has any idea, how to let cmake / ninja know, that I want to add "-u _printf_float" as a parameter during the build process?
THX in advance
I just found the solution:
I added the option to the gcc-arm-none-eabi.cmake file like this:
set(FLAGS "-fdata-sections -ffunction-sections --specs=nano.specs -Wl,--gc-sections -u _printf_float")