Skip to content

Commit

Permalink
fix(cmake): remove .elf extension from generated .bin and .hex
Browse files Browse the repository at this point in the history
Signed-off-by: Frederic Pillon <frederic.pillon@st.com>
  • Loading branch information
fpistm committed Jul 18, 2024
1 parent 4d6df7d commit 8554e3e
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions cmake/convert_file.cmake
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
cmake_minimum_required(VERSION 3.21)
function(elf2bin ELFTGT)
get_filename_component(ELFTGT_WE ${ELFTGT} NAME_WE)
add_custom_command(TARGET ${ELFTGT} POST_BUILD
COMMAND ${CMAKE_OBJCOPY} -O binary $<TARGET_FILE:${ELFTGT}> $<TARGET_FILE:${ELFTGT}>.bin
COMMAND ${CMAKE_OBJCOPY} -O binary $<TARGET_FILE:${ELFTGT}> $<TARGET_FILE_DIR:${ELFTGT}>/${ELFTGT_WE}.bin
)
set_property(TARGET ${ELFTGT} APPEND PROPERTY ADDITIONAL_CLEAN_FILES "$<TARGET_FILE:${ELFTGT}>.bin")
set_property(TARGET ${ELFTGT} APPEND PROPERTY ADDITIONAL_CLEAN_FILES "$<TARGET_FILE_DIR:${ELFTGT}>/${ELFTGT_WE}.bin")
endfunction()

function(elf2hex ELFTGT)
get_filename_component(ELFTGT_WE ${ELFTGT} NAME_WE)
add_custom_command(TARGET ${ELFTGT} POST_BUILD
COMMAND ${CMAKE_OBJCOPY} -O ihex $<TARGET_FILE:${ELFTGT}> $<TARGET_FILE:${ELFTGT}>.hex
COMMAND ${CMAKE_OBJCOPY} -O ihex $<TARGET_FILE:${ELFTGT}> $<TARGET_FILE_DIR:${ELFTGT}>/${ELFTGT_WE}.hex
)
set_property(TARGET ${ELFTGT} APPEND PROPERTY ADDITIONAL_CLEAN_FILES "$<TARGET_FILE:${ELFTGT}>.hex")
set_property(TARGET ${ELFTGT} APPEND PROPERTY ADDITIONAL_CLEAN_FILES "$<TARGET_FILE_DIR:${ELFTGT}>/${ELFTGT_WE}.hex")
endfunction()

function(gv2svg GVFILE ENGINE)
Expand Down

0 comments on commit 8554e3e

Please sign in to comment.