Build: IAR support
- This patch contains IAR specific changes to a few source files,
mostly #pragmas to allow calling external functions from inline.
- Startup code and linker scripts
- cmake files
- cmsis file for the IAR compiler
Other targets are added in later commits
There are still lots of warnings generated for non-standard C, which
I plan to address in later updates
- Cleaned out some dead definitions in the common linker script in
preparation for psoc64 integration.
- Made sure that .rodata from tfm_its_secure_api.o is placed in
TFM_UNPRIV_CODE, which otherwised caused a memory management fault
in test TFM_ITS_TEST_2023 when compiled without optimization.
- Added dummy initializers to tfm_secure_irq_handlers.inc.template to
avoid illegal empty arrays.
- Reworked the iovec_args_t struct handling in tfm_func_api.c, which
was causing runtime errors when compiled with optimization.
According to the compiler developers the old implemetation is
illegal, you are not allowed to use the address of a scalar as an
address outside of that scalar.
- Added conditional around ".syntax unified" in tfm_nspm_ipc.c.
- Added "template" attribute for the IAR linker script in
tfm_generated_file_list.yaml.
- Cleaned up some indentation and tab/space issues
Change-Id: I8599d461f62194bc734e472a28d7111ba3b5046a
Signed-off-by: TTornblom <thomas.tornblom@iar.com>
diff --git a/CommonConfig.cmake b/CommonConfig.cmake
index aea576a..0763abc 100644
--- a/CommonConfig.cmake
+++ b/CommonConfig.cmake
@@ -17,7 +17,7 @@
if(NOT DEFINED COMPILER)
message(FATAL_ERROR "ERROR: COMPILER is not set in command line")
-elseif((NOT ${COMPILER} STREQUAL "ARMCLANG") AND (NOT ${COMPILER} STREQUAL "GNUARM"))
+elseif((NOT ${COMPILER} STREQUAL "ARMCLANG") AND (NOT ${COMPILER} STREQUAL "GNUARM") AND (NOT ${COMPILER} STREQUAL "IARARM"))
message(FATAL_ERROR "ERROR: Compiler \"${COMPILER}\" is not supported.")
endif()
@@ -82,7 +82,11 @@
# core acts as secure core in multi-core scenario.
# leave CMSE_FLAGS undefined
else()
- set (CMSE_FLAGS "-mcmse")
+ if(${COMPILER} STREQUAL "IARARM")
+ set (CMSE_FLAGS "--cmse")
+ else()
+ set (CMSE_FLAGS "-mcmse")
+ endif()
# Clear multi-core test setting
set (TFM_MULTI_CORE_TEST OFF)
@@ -126,6 +130,27 @@
#wchar, so the warning can be suppressed.
embedded_set_target_link_flags(TARGET ${tgt} FLAGS -Wl,-check-sections,-fatal-warnings,--gc-sections,--no-wchar-size-warning,--print-memory-usage --entry=Reset_Handler --specs=nano.specs)
endfunction()
+elseif(${COMPILER} STREQUAL "IARARM")
+ #Use any IARARM version found on PATH. Note: Only versions supported by the
+ #build system will work. A file cmake/Common/CompilerIARARMXY.cmake
+ #must be present with a matching version.
+ include("Common/FindIARARM")
+ include("Common/${IARARM_MODULE}")
+
+ set (COMMON_COMPILE_FLAGS -e --dlib_config=full --vla --silent -DNO_TYPEOF ${CMSE_FLAGS})
+ ##Shared compiler and linker settings.
+ function(config_setting_shared_compiler_flags tgt)
+ embedded_set_target_compile_flags(TARGET ${tgt} LANGUAGE C FLAGS ${COMMON_COMPILE_FLAGS} "-DImage$$= " "-DLoad$$LR$$= " "-D$$ZI$$Base=$$Base" "-D$$ZI$$Limit=$$Limit" "-D$$RO$$Base=$$Base" "-D$$RO$$Limit=$$Limit" "-D$$RW$$Base=$$Base" "-D$$RW$$Limit=$$Limit" "-D_DATA$$RW$$Base=_DATA$$Base" "-D_DATA$$RW$$Limit=_DATA$$Limit" "-D_DATA$$ZI$$Base=_DATA$$Base" "-D_DATA$$ZI$$Limit=_DATA$$Limit" "-D_STACK$$ZI$$Base=_STACK$$Base" "-D_STACK$$ZI$$Limit=_STACK$$Limit" )
+ endfunction()
+
+ ##Shared linker settings.
+ function(config_setting_shared_linker_flags tgt)
+ #--no-wchar-size-warning flag is added because TF-M sources are compiled
+ #with short wchars, however the standard library is compiled with normal
+ #wchar, and this generates linker time warnings. TF-M code does not use
+ #wchar, so the warning can be suppressed.
+ embedded_set_target_link_flags(TARGET ${tgt} FLAGS --silent --semihosting --redirect __write=__write_buffered)
+ endfunction()
endif()
#Create a string from the compile flags list, so that it can be used later