aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorØyvind Rønningstad <oyvind.ronningstad@nordicsemi.no>2020-04-02 15:34:50 +0200
committerAnton Komlev <Anton.Komlev@arm.com>2020-06-19 14:21:17 +0000
commit762415cf8eb5515a5bb4daa391ecb9c0e9a7db60 (patch)
treef732c86ab971a36d8e0dd7469da1673eac17fa54
parente409401fdf0e769516cd784de6000a8eaa16b2b2 (diff)
downloadtrusted-firmware-m-762415cf8eb5515a5bb4daa391ecb9c0e9a7db60.tar.gz
Build: Create hex and elf files of executables
Install hex and elf files to the same location as the axf and bin files Change-Id: I20a54560e733df875705f98b0ec3c3a1f5a01657 Signed-off-by: Øyvind Rønningstad <oyvind.ronningstad@nordicsemi.no>
-rw-r--r--app/CMakeLists.txt10
-rw-r--r--bl2/ext/mcuboot/CMakeLists.txt10
-rw-r--r--cmake/Common/CompilerArmClangCommon.cmake8
-rw-r--r--cmake/Common/CompilerGNUARMCommon.cmake8
-rw-r--r--secure_fw/CMakeLists.txt10
5 files changed, 46 insertions, 0 deletions
diff --git a/app/CMakeLists.txt b/app/CMakeLists.txt
index 980965d3f6..b2bd166a81 100644
--- a/app/CMakeLists.txt
+++ b/app/CMakeLists.txt
@@ -300,6 +300,12 @@ function(set_up_app_build)
#Generate binary file from axf
compiler_generate_binary_output(${EXE_NAME})
+ #Generate intel hex file from axf
+ compiler_generate_hex_output(${EXE_NAME})
+
+ #Generate elf file from axf
+ compiler_generate_elf_output(${EXE_NAME})
+
#Generate MCUBoot compatible payload
if (BL2)
mcuboot_create_boot_payload(S_BIN ${S_BIN}
@@ -373,10 +379,14 @@ function(set_up_app_build)
#Collect executables to common location: build/install/outputs/
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${EXE_NAME}.axf
${CMAKE_CURRENT_BINARY_DIR}/${EXE_NAME}.bin
+ ${CMAKE_CURRENT_BINARY_DIR}/${EXE_NAME}.hex
+ ${CMAKE_CURRENT_BINARY_DIR}/${EXE_NAME}.elf
DESTINATION outputs/${TARGET_PLATFORM}/)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${EXE_NAME}.axf
${CMAKE_CURRENT_BINARY_DIR}/${EXE_NAME}.bin
+ ${CMAKE_CURRENT_BINARY_DIR}/${EXE_NAME}.hex
+ ${CMAKE_CURRENT_BINARY_DIR}/${EXE_NAME}.elf
DESTINATION outputs/fvp/)
endfunction()
diff --git a/bl2/ext/mcuboot/CMakeLists.txt b/bl2/ext/mcuboot/CMakeLists.txt
index faa1010653..f073e6b603 100644
--- a/bl2/ext/mcuboot/CMakeLists.txt
+++ b/bl2/ext/mcuboot/CMakeLists.txt
@@ -187,6 +187,12 @@ endif()
#Generate binary file from axf
compiler_generate_binary_output(${PROJECT_NAME})
+#Generate intel hex file from axf
+compiler_generate_hex_output(${PROJECT_NAME})
+
+#Generate elf file from axf
+compiler_generate_elf_output(${PROJECT_NAME})
+
message("- MCUBOOT_REPO: '${MCUBOOT_REPO}'.")
message("- MCUBOOT_IMAGE_NUMBER: '${MCUBOOT_IMAGE_NUMBER}'.")
message("- MCUBOOT_UPGRADE_STRATEGY: '${MCUBOOT_UPGRADE_STRATEGY}'.")
@@ -237,10 +243,14 @@ endif()
#Collect executables to common location: build/install/outputs/
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}.axf
${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}.bin
+ ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}.hex
+ ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}.elf
DESTINATION outputs/${TARGET_PLATFORM}/)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}.axf
${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}.bin
+ ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}.hex
+ ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}.elf
DESTINATION outputs/fvp/)
#Finally let cmake system apply changes after the whole project is defined.
diff --git a/cmake/Common/CompilerArmClangCommon.cmake b/cmake/Common/CompilerArmClangCommon.cmake
index 49379fff41..517e6e859c 100644
--- a/cmake/Common/CompilerArmClangCommon.cmake
+++ b/cmake/Common/CompilerArmClangCommon.cmake
@@ -186,6 +186,14 @@ function(compiler_generate_binary_output TARGET)
add_custom_command(TARGET ${TARGET} POST_BUILD COMMAND ${CMAKE_ARMCCLANG_FROMELF} ARGS --bincombined --output=$<TARGET_FILE_DIR:${TARGET}>/${TARGET}.bin $<TARGET_FILE:${TARGET}>)
endfunction()
+function(compiler_generate_hex_output TARGET)
+ add_custom_command(TARGET ${TARGET} POST_BUILD COMMAND ${CMAKE_ARMCCLANG_FROMELF} ARGS --i32combined --output=$<TARGET_FILE_DIR:${TARGET}>/${TARGET}.hex $<TARGET_FILE:${TARGET}>)
+endfunction()
+
+function(compiler_generate_elf_output TARGET)
+ add_custom_command(TARGET ${TARGET} POST_BUILD COMMAND ${CMAKE_ARMCCLANG_FROMELF} ARGS --elf --output=$<TARGET_FILE_DIR:${TARGET}>/${TARGET}.elf $<TARGET_FILE:${TARGET}>)
+endfunction()
+
# Function for creating a new target that preprocesses a .c file
#INPUTS:
# SRC - (mandatory) - file to be preprocessed
diff --git a/cmake/Common/CompilerGNUARMCommon.cmake b/cmake/Common/CompilerGNUARMCommon.cmake
index 6d427ecbfc..be1ac8faae 100644
--- a/cmake/Common/CompilerGNUARMCommon.cmake
+++ b/cmake/Common/CompilerGNUARMCommon.cmake
@@ -191,6 +191,14 @@ function(compiler_generate_binary_output TARGET)
add_custom_command(TARGET ${TARGET} POST_BUILD COMMAND ${CMAKE_GNUARM_OBJCOPY} ARGS -O binary $<TARGET_FILE:${TARGET}> $<TARGET_FILE_DIR:${TARGET}>/${TARGET}.bin)
endfunction()
+function(compiler_generate_hex_output TARGET)
+ add_custom_command(TARGET ${TARGET} POST_BUILD COMMAND ${CMAKE_GNUARM_OBJCOPY} ARGS -O ihex $<TARGET_FILE:${TARGET}> $<TARGET_FILE_DIR:${TARGET}>/${TARGET}.hex)
+endfunction()
+
+function(compiler_generate_elf_output TARGET)
+ add_custom_command(TARGET ${TARGET} POST_BUILD COMMAND ${CMAKE_GNUARM_OBJCOPY} ARGS -O elf32-little $<TARGET_FILE:${TARGET}> $<TARGET_FILE_DIR:${TARGET}>/${TARGET}.elf)
+endfunction()
+
# Function for creating a new target that preprocesses a .c file
#INPUTS:
# SRC - (mandatory) - file to be preprocessed
diff --git a/secure_fw/CMakeLists.txt b/secure_fw/CMakeLists.txt
index 5dc4cfce58..38a0bb22b2 100644
--- a/secure_fw/CMakeLists.txt
+++ b/secure_fw/CMakeLists.txt
@@ -331,6 +331,12 @@ function(set_up_secure_fw_build)
#Generate binary file from executable
compiler_generate_binary_output(${EXE_NAME})
+ #Generate intel hex file from axf
+ compiler_generate_hex_output(${EXE_NAME})
+
+ #Generate elf file from axf
+ compiler_generate_elf_output(${EXE_NAME})
+
if (NOT DEFINED TFM_MULTI_CORE_TOPOLOGY OR NOT TFM_MULTI_CORE_TOPOLOGY)
#Configure where we put the CMSE veneers generated by the compiler.
set(S_VENEER_FILE "${CMAKE_CURRENT_BINARY_DIR}/${VENEER_NAME}")
@@ -491,10 +497,14 @@ function(set_up_secure_fw_build)
install(FILES ${MY_BINARY_DIR}/${EXE_NAME}.axf
${MY_BINARY_DIR}/${EXE_NAME}.bin
+ ${MY_BINARY_DIR}/${EXE_NAME}.hex
+ ${MY_BINARY_DIR}/${EXE_NAME}.elf
DESTINATION outputs/${TARGET_PLATFORM}/)
install(FILES ${MY_BINARY_DIR}/${EXE_NAME}.axf
${MY_BINARY_DIR}/${EXE_NAME}.bin
+ ${MY_BINARY_DIR}/${EXE_NAME}.hex
+ ${MY_BINARY_DIR}/${EXE_NAME}.elf
DESTINATION outputs/fvp/)
endfunction()