Boot: integrate MCUBoot with TF-M to act as a BL2 bootloader
Modifications in MCUBoot to be aligned with BL2 requirements in TF-M:
-- OS dependency was removed, no need to copy any OS repo to build it
-- CMSIS serial driver is used
-- flash driver interface is aligned with original version
-- S and NS images are handeled as a single binary blob
-- automatic image concatenation and signing at build time
-- authentication based on SHA256 and RSA-2048 digital signature
-- mbedTLS library is used for cryptographic operation
-- static analyser warnings fixed in some files
Change-Id: I54891762eac8d0df634e954ff19a9505b16f3028
Signed-off-by: Tamas Ban <tamas.ban@arm.com>
diff --git a/cmake/Common/CompilerArmClangCommon.cmake b/cmake/Common/CompilerArmClangCommon.cmake
index 4059bdf..bf8bc29 100644
--- a/cmake/Common/CompilerArmClangCommon.cmake
+++ b/cmake/Common/CompilerArmClangCommon.cmake
@@ -83,9 +83,9 @@
function(compiler_merge_library)
set( _OPTIONS_ARGS ) #Option (on/off) arguments.
- set( _ONE_VALUE_ARGS DEST) #Single option arguments.
- set( _MULTI_VALUE_ARGS LIBS) #List arguments
- cmake_parse_arguments(_MY_PARAMS "${_OPTIONS_ARGS}" "${_ONE_VALUE_ARGS}" "${_MULTI_VALUE_ARGS}" ${ARGN} )
+ set( _ONE_VALUE_ARGS DEST) #Single option arguments.
+ set( _MULTI_VALUE_ARGS LIBS) #List arguments
+ cmake_parse_arguments(_MY_PARAMS "${_OPTIONS_ARGS}" "${_ONE_VALUE_ARGS}" "${_MULTI_VALUE_ARGS}" ${ARGN} )
#Check passed parameters
if(NOT _MY_PARAMS_DEST)
@@ -109,11 +109,15 @@
#Mark each library file as a generated external object. This is needed to
#avoid error because CMake has no info how these can be built.
SET_SOURCE_FILES_PROPERTIES(
- ${_MY_PARAMS_LIBS}
- PROPERTIES
- EXTERNAL_OBJECT true
- GENERATED true)
+ ${_MY_PARAMS_LIBS}
+ PROPERTIES
+ EXTERNAL_OBJECT true
+ GENERATED true)
#Add additional input to target
target_sources(${_MY_PARAMS_DEST} PRIVATE ${_MY_PARAMS_LIBS})
endfunction()
+
+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()
diff --git a/cmake/Compiler/ARMClang.cmake b/cmake/Compiler/ARMClang.cmake
index 5390a98..3d494f0 100644
--- a/cmake/Compiler/ARMClang.cmake
+++ b/cmake/Compiler/ARMClang.cmake
@@ -17,6 +17,7 @@
find_program(CMAKE_ARMCCLANG_LINKER armlink HINTS "${_CMAKE_C_TOOLCHAIN_LOCATION}" "${_CMAKE_CXX_TOOLCHAIN_LOCATION}" )
find_program(CMAKE_ARMCCLANG_AR armar HINTS "${_CMAKE_C_TOOLCHAIN_LOCATION}" "${_CMAKE_CXX_TOOLCHAIN_LOCATION}" )
+find_program(CMAKE_ARMCCLANG_FROMELF fromelf HINTS "${_CMAKE_C_TOOLCHAIN_LOCATION}" "${_CMAKE_CXX_TOOLCHAIN_LOCATION}" )
set(CMAKE_LINKER "${CMAKE_ARMCCLANG_LINKER}" CACHE FILEPATH "The ARMCC linker" FORCE)
mark_as_advanced(CMAKE_ARMCCLANG_LINKER)