Solved
How to create HEX or BIN file for separate flashing?
Currently the extention only builds an ELF file.
How can I tell cmake to not only build an ELF file but also a HEX or BIN file?
Currently the extention only builds an ELF file.
How can I tell cmake to not only build an ELF file but also a HEX or BIN file?
So, to answer my own question, I got it working by appending the following lines to `CMakeLists.txt` in the project folder:
# Convert output to hex and binary
add_custom_command(TARGET ${CMAKE_PROJECT_NAME} POST_BUILD
COMMAND ${CMAKE_OBJCOPY} -O ihex $<TARGET_FILE:${CMAKE_PROJECT_NAME}> ${CMAKE_PROJECT_NAME}.hex
)
# Convert to bin file -> add conditional check?
add_custom_command(TARGET ${CMAKE_PROJECT_NAME} POST_BUILD
COMMAND ${CMAKE_OBJCOPY} -O binary $<TARGET_FILE:${CMAKE_PROJECT_NAME}> ${CMAKE_PROJECT_NAME}.bin
)Snipped cortesy of https://github.com/MaJerle/stm32-cube-cmake-vscode
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.