Skip to content

Commit

Permalink
provisioning: Use ConvertElfToBin CMake module
Browse files Browse the repository at this point in the history
ConvertElfToBin CMake module is used to convert
provisioning data elf file to binary file.

Signed-off-by: Ahmed Ismail <[email protected]>
  • Loading branch information
AhmedIsmail02 authored and urutva committed Oct 11, 2023
1 parent 87b8ea1 commit b42cdcf
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions Projects/aws-iot-example/provisioning/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -41,17 +41,19 @@ if(${CMAKE_C_COMPILER_ID} STREQUAL "GNU")
"-nostartfiles"
)
target_add_scatter_file(provisioning_data ${CMAKE_CURRENT_SOURCE_DIR}/provisioning_data.ld)
set(provisioning_elf_to_bin_cmd ${GCC_ELF2BIN} -O binary ${CMAKE_CURRENT_BINARY_DIR}/provisioning_data${CMAKE_EXECUTABLE_SUFFIX} ${CMAKE_CURRENT_BINARY_DIR}/provisioning_data.bin)
else()
target_add_scatter_file(provisioning_data ${CMAKE_CURRENT_SOURCE_DIR}/provisioning_data.sct)
set(provisioning_elf_to_bin_cmd ${ARM_ELF2BIN} --bin --output ${CMAKE_CURRENT_BINARY_DIR}/provisioning_data.bin ${CMAKE_CURRENT_BINARY_DIR}/provisioning_data${CMAKE_EXECUTABLE_SUFFIX} --bincombined)
endif()

list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/Tools/cmake)
include(ConvertElfToBin)

add_custom_command(OUTPUT provisioning_data.bin
DEPENDS $<TARGET_FILE_DIR:provisioning_data>/provisioning_data${CMAKE_EXECUTABLE_SUFFIX}
COMMAND ${provisioning_elf_to_bin_cmd}
)

target_elf_to_bin(provisioning_data provisioning_data)

add_custom_target(provisioning_data_bin ALL
SOURCES provisioning_data.bin
)
Expand Down

0 comments on commit b42cdcf

Please sign in to comment.