diff options
| author | Michal Hanus <mikehanus@protonmail.com> | 2025-04-19 22:50:44 +0200 |
|---|---|---|
| committer | Michal Hanus <mikehanus@protonmail.com> | 2025-04-19 22:50:44 +0200 |
| commit | 9078b7ec09b135f091cb951ed234bf013c9c838e (patch) | |
| tree | ba953e144c2dd42d327a83720cdfc9fb5bb9fe34 /nrfdemo/builddk/tfm/api_ns/cmake | |
| parent | 2e13c372f1419f08dab7797b244681f889dd9bcf (diff) | |
bme680 added
Diffstat (limited to 'nrfdemo/builddk/tfm/api_ns/cmake')
6 files changed, 0 insertions, 1133 deletions
diff --git a/nrfdemo/builddk/tfm/api_ns/cmake/set_extensions.cmake b/nrfdemo/builddk/tfm/api_ns/cmake/set_extensions.cmake deleted file mode 100644 index 50db7c6..0000000 --- a/nrfdemo/builddk/tfm/api_ns/cmake/set_extensions.cmake +++ /dev/null @@ -1,12 +0,0 @@ -#------------------------------------------------------------------------------- -# Copyright (c) 2020, Arm Limited and Contributors. All rights reserved. -# -# SPDX-License-Identifier: BSD-3-Clause -# -#------------------------------------------------------------------------------- - -set(CMAKE_C_OUTPUT_EXTENSION ".o") -set(CMAKE_C_OUTPUT_EXTENSION_REPLACE 1) - -set(CMAKE_ASM_OUTPUT_EXTENSION ".o") -set(CMAKE_ASM_OUTPUT_EXTENSION_REPLACE 1) diff --git a/nrfdemo/builddk/tfm/api_ns/cmake/spe_config.cmake b/nrfdemo/builddk/tfm/api_ns/cmake/spe_config.cmake deleted file mode 100644 index 2103c30..0000000 --- a/nrfdemo/builddk/tfm/api_ns/cmake/spe_config.cmake +++ /dev/null @@ -1,90 +0,0 @@ -#------------------------------------------------------------------------------- -# Copyright (c) 2023, Arm Limited. All rights reserved. -# -# SPDX-License-Identifier: BSD-3-Clause -# -#------------------------------------------------------------------------------- - -# This CMake script template contains the set of options settled on secure side -# build but necessary for building the non-secure side too. - -# TF-M Profile -set(TFM_PROFILE CACHE STRING "The TF-M profile") - -set(TFM_PARTITION_INTERNAL_TRUSTED_STORAGE OFF CACHE BOOL "Enable Internal Trusted Storage partition") -set(TFM_PARTITION_CRYPTO ON CACHE BOOL "Enable Crypto partition") -set(TFM_PARTITION_INITIAL_ATTESTATION OFF CACHE BOOL "Enable Initial Attestation partition") -set(TFM_PARTITION_PROTECTED_STORAGE OFF CACHE BOOL "Enable Protected Storage partition") -set(TFM_PARTITION_PLATFORM ON CACHE BOOL "Enable Platform partition") -set(TFM_PARTITION_FIRMWARE_UPDATE OFF CACHE BOOL "Enable firmware update partition") -set(TFM_PARTITION_NS_AGENT_MAILBOX OFF CACHE BOOL "Enable the Mailbox agents") - -# The options necessary for signing the final image -set(BL2 FALSE) -set(BL2_HEADER_SIZE 0x000) -set(BL2_TRAILER_SIZE 0x000) -set(MCUBOOT_IMAGE_NUMBER 1) -set(MCUBOOT_CONFIRM_IMAGE ) -set(MCUBOOT_ENC_IMAGES ) -set(MCUBOOT_ENC_KEY_LEN ) -set(MCUBOOT_KEY_ENC ) -set(MCUBOOT_MEASURED_BOOT ON) -set(MCUBOOT_ALIGN_VAL ) -set(MCUBOOT_UPGRADE_STRATEGY ) -set(MCUBOOT_S_IMAGE_MIN_VER ) - -set(MCUBOOT_MEASURED_BOOT ON) -set(MCUBOOT_HW_KEY ) - -set(MCUBOOT_SECURITY_COUNTER_S ) -set(MCUBOOT_IMAGE_VERSION_S ) -set(MCUBOOT_KEY_S ) - -set(MCUBOOT_SECURITY_COUNTER_NS ) -set(MCUBOOT_IMAGE_VERSION_NS ) -set(MCUBOOT_KEY_NS ) -set(PLATFORM_DEFAULT_IMAGE_SIGNING ON) - -# The common options describing a platform configuration - -set(TFM_PLATFORM ../../../../../../../nrf/modules/trusted-firmware-m/tfm_boards/nrf9120 CACHE STRING "Platform to build TF-M for. Must be either a relative path from [TF-M]/platform/ext/target, or an absolute path.") -set(CONFIG_TFM_USE_TRUSTZONE ON CACHE BOOL "Use TrustZone") -set(CONFIG_TFM_SPM_BACKEND SFN CACHE STRING "The SPM backend") -set(TFM_MULTI_CORE_TOPOLOGY OFF CACHE BOOL "Platform has multi core") -set(PSA_FRAMEWORK_HAS_MM_IOVEC OFF CACHE BOOL "Enable the MM-IOVEC feature") -set(TFM_ISOLATION_LEVEL 1 CACHE STRING "The TFM isolation level") - -set(PLATFORM_DEFAULT_CRYPTO_KEYS FALSE CACHE BOOL "Use the default crypto keys") -set(PLATFORM_DEFAULT_UART_STDOUT ON CACHE BOOL "Use default uart stdout implementation.") - -# Testing related options. - -set(TEST_PSA_API CACHE STRING "Which (if any) of the PSA API tests should be compiled") -set(PSA_ARCH_TESTS_PATH /home/mike/Documents/ncs/v2.7.0/modules/tee/tf-m/trusted-firmware-m/../psa-arch-tests CACHE PATH "Path to PSA arch test repository if it was give to SPE build") -set(INCLUDE_PANIC_TESTS CACHE BOOL "Include panic tests") - -set(ATTEST_KEY_BITS 256 CACHE STRING "The size of the initial attestation key in bits") -set(SYMMETRIC_INITIAL_ATTESTATION OFF CACHE BOOL "Use symmetric crypto for inital attestation") -set(ATTEST_INCLUDE_TEST_CODE OFF CACHE BOOL "Include minimal development tests in the initial attestation regression test suite") -set(TFM_MBEDCRYPTO_PSA_CRYPTO_CONFIG_PATH /home/mike/Documents/ncs/v2.7.0/conexio-firmware-sdk/samples/conexio_stratus/mqtt_control/builddk/modules/nrf/subsys/nrf_security/src/include/generated/nrf-psa-crypto-want-config.h CACHE STRING "Config to use psa crypto setting for Mbed Crypto") -set(CC312_LEGACY_DRIVER_API_ENABLED CACHE BOOL "This variable controls whether the legacy driver interface is used for CC-312") - -set(TFM_FWU_BOOTLOADER_LIB mcuboot CACHE STRING "Bootloader configure file for Firmware Update partition") - -# Other common options - -# Coprocessor settings -# It is difficult to sort out coprocessor settings and their dependencies. -# Export all the essential settings and therefore NS users don't have to figure them out again or -# include other config files. -# Also export other coprocessor settings to enable NS integration to validate the whole settings -# and toolchain compatibility via installed cp_config_check.cmake. -set(CONFIG_TFM_ENABLE_FP OFF CACHE BOOL "Enable/disable FP usage") -set(CONFIG_TFM_ENABLE_MVE OFF CACHE BOOL "Enable/disable integer MVE usage") -set(CONFIG_TFM_ENABLE_MVE_FP OFF CACHE BOOL "Enable/disable floating-point MVE usage") -set(CONFIG_TFM_FLOAT_ABI soft) -set(CONFIG_TFM_ENABLE_CP10CP11 OFF CACHE BOOL "Make FPU and MVE operational when SPE and/or NSPE require FPU or MVE usage. This alone only enables the coprocessors CP10-CP11, whereas CONFIG_TFM_FLOAT_ABI=hard along with CONFIG_TFM_ENABLE_FP, CONFIG_TFM_ENABLE_MVE or CONFIG_TFM_ENABLE_MVE_FP compiles the code with hardware FP or MVE instructions and ABI.") -set(CONFIG_TFM_LAZY_STACKING OFF CACHE BOOL "Enable/disable lazy stacking") - -set(TFM_VERSION 2.0.0) -set(TFM_NS_MANAGE_NSID OFF) diff --git a/nrfdemo/builddk/tfm/api_ns/cmake/spe_export.cmake b/nrfdemo/builddk/tfm/api_ns/cmake/spe_export.cmake deleted file mode 100644 index bca7480..0000000 --- a/nrfdemo/builddk/tfm/api_ns/cmake/spe_export.cmake +++ /dev/null @@ -1,105 +0,0 @@ -# Generated by CMake - -if("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}" LESS 2.5) - message(FATAL_ERROR "CMake >= 2.6.0 required") -endif() -cmake_policy(PUSH) -cmake_policy(VERSION 2.6...3.19) -#---------------------------------------------------------------- -# Generated CMake target import file. -#---------------------------------------------------------------- - -# Commands may need to know the format version. -set(CMAKE_IMPORT_FILE_VERSION 1) - -# Protect against multiple inclusion, which would fail when already imported targets are added once more. -set(_targetsDefined) -set(_targetsNotDefined) -set(_expectedTargets) -foreach(_expectedTarget tfm_config psa_crypto_config psa_interface) - list(APPEND _expectedTargets ${_expectedTarget}) - if(NOT TARGET ${_expectedTarget}) - list(APPEND _targetsNotDefined ${_expectedTarget}) - endif() - if(TARGET ${_expectedTarget}) - list(APPEND _targetsDefined ${_expectedTarget}) - endif() -endforeach() -if("${_targetsDefined}" STREQUAL "${_expectedTargets}") - unset(_targetsDefined) - unset(_targetsNotDefined) - unset(_expectedTargets) - set(CMAKE_IMPORT_FILE_VERSION) - cmake_policy(POP) - return() -endif() -if(NOT "${_targetsDefined}" STREQUAL "") - message(FATAL_ERROR "Some (but not all) targets in this export set were already defined.\nTargets Defined: ${_targetsDefined}\nTargets not yet defined: ${_targetsNotDefined}\n") -endif() -unset(_targetsDefined) -unset(_targetsNotDefined) -unset(_expectedTargets) - - -# The installation prefix configured by this project. -set(_IMPORT_PREFIX "/home/mike/Documents/ncs/v2.7.0/conexio-firmware-sdk/samples/conexio_stratus/mqtt_control/builddk/tfm/api_ns") - -# Create imported target tfm_config -add_library(tfm_config INTERFACE IMPORTED) - -set_target_properties(tfm_config PROPERTIES - INTERFACE_COMPILE_DEFINITIONS "\$<\$<STREQUAL:,CRYPTO>:PSA_API_TEST_CRYPTO>;\$<\$<STREQUAL:,IPC>:PSA_API_TEST_IPC>;PROJECT_CONFIG_HEADER_FILE=\"/home/mike/Documents/ncs/v2.7.0/conexio-firmware-sdk/samples/conexio_stratus/mqtt_control/builddk/modules/nrf/modules/trusted-firmware-m/tfm_config.h\";\$<\$<OR:\$<BOOL:OFF>,\$<BOOL:0>>:CONFIG_TFM_CONNECTION_POOL_ENABLE>;TFM_PARTITION_LOG_LEVEL=TFM_PARTITION_LOG_LEVEL_SILENCE;\$<\$<BOOL:>:TFM_SP_LOG_RAW_ENABLED>;TFM_PARTITION_CRYPTO;TFM_PARTITION_PLATFORM;TFM_PARTITION_NS_AGENT_TZ;\$<\$<STREQUAL:,IPC>:PSA_API_TEST_IPC>;\$<\$<STREQUAL:PSA_ALG_CCM,PSA_ALG_GCM>:PS_CRYPTO_AEAD_ALG_GCM>;\$<\$<STREQUAL:PSA_ALG_CCM,PSA_ALG_CCM>:PS_CRYPTO_AEAD_ALG_CCM>;\$<\$<BOOL:ON>:PS_ENCRYPTION>;CRYPTO_HW_ACCELERATOR" - INTERFACE_LINK_LIBRARIES "psa_crypto_config" -) - -# Create imported target psa_crypto_config -add_library(psa_crypto_config INTERFACE IMPORTED) - -# Create imported target psa_interface -add_library(psa_interface INTERFACE IMPORTED) - -set_target_properties(psa_interface PROPERTIES - INTERFACE_COMPILE_DEFINITIONS "\$<\$<BOOL:>:CONFIG_TFM_ENABLE_CTX_MGMT>;\$<\$<BOOL:1>:TFM_ISOLATION_LEVEL=1>;\$<\$<BOOL:ON>:CONFIG_TFM_USE_TRUSTZONE>;\$<\$<BOOL:OFF>:TFM_MULTI_CORE_TOPOLOGY>;\$<\$<BOOL:OFF>:CONFIG_TFM_PARTITION_META>;\$<\$<BOOL:>:TFM_MULTI_CORE_TEST>" - INTERFACE_INCLUDE_DIRECTORIES "${_IMPORT_PREFIX}/interface/include" - INTERFACE_LINK_LIBRARIES "tfm_config" -) - -if(CMAKE_VERSION VERSION_LESS 3.0.0) - message(FATAL_ERROR "This file relies on consumers using CMake 3.0.0 or greater.") -endif() - -# Load information for each installed configuration. -get_filename_component(_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH) -file(GLOB CONFIG_FILES "${_DIR}/spe_export-*.cmake") -foreach(f ${CONFIG_FILES}) - include(${f}) -endforeach() - -# Cleanup temporary variables. -set(_IMPORT_PREFIX) - -# Loop over all imported files and verify that they actually exist -foreach(target ${_IMPORT_CHECK_TARGETS} ) - foreach(file ${_IMPORT_CHECK_FILES_FOR_${target}} ) - if(NOT EXISTS "${file}" ) - message(FATAL_ERROR "The imported target \"${target}\" references the file - \"${file}\" -but this file does not exist. Possible reasons include: -* The file was deleted, renamed, or moved to another location. -* An install or uninstall procedure did not complete successfully. -* The installation package was faulty and contained - \"${CMAKE_CURRENT_LIST_FILE}\" -but not all the files it references. -") - endif() - endforeach() - unset(_IMPORT_CHECK_FILES_FOR_${target}) -endforeach() -unset(_IMPORT_CHECK_TARGETS) - -# This file does not depend on other imported targets which have -# been exported from the same project but in a separate export set. - -# Commands beyond this point should not need to know the version. -set(CMAKE_IMPORT_FILE_VERSION) -cmake_policy(POP) diff --git a/nrfdemo/builddk/tfm/api_ns/cmake/toolchain_ns_ARMCLANG.cmake b/nrfdemo/builddk/tfm/api_ns/cmake/toolchain_ns_ARMCLANG.cmake deleted file mode 100644 index 66af662..0000000 --- a/nrfdemo/builddk/tfm/api_ns/cmake/toolchain_ns_ARMCLANG.cmake +++ /dev/null @@ -1,379 +0,0 @@ -#------------------------------------------------------------------------------- -# Copyright (c) 2023, Arm Limited. All rights reserved. -# -# SPDX-License-Identifier: BSD-3-Clause -# -#------------------------------------------------------------------------------- -cmake_minimum_required(VERSION 3.15) - -SET(CMAKE_SYSTEM_NAME Generic) - -set(CMAKE_C_COMPILER_FORCED TRUE) -set(CMAKE_CXX_COMPILER_FORCED TRUE) - -if(NOT DEFINED CROSS_COMPILE) - set(CROSS_COMPILE arm-none-eabi CACHE STRING "Cross-compiler prefix") -endif() - -set(CMAKE_C_COMPILER armclang) -set(CMAKE_CXX_COMPILER armclang) -set(CMAKE_ASM_COMPILER armasm) - -# This variable name is a bit of a misnomer. The file it is set to is included -# at a particular step in the compiler initialisation. It is used here to -# configure the extensions for object files. Despite the name, it also works -# with the Ninja generator. -set(CMAKE_USER_MAKE_RULES_OVERRIDE ${CMAKE_CURRENT_LIST_DIR}/set_extensions.cmake) - -if(NOT DEFINED CMAKE_OBJCOPY) - set(CMAKE_OBJCOPY ${CROSS_COMPILE}-objcopy CACHE FILEPATH "Path to objcopy") -endif() - -# Set compiler ID explicitly as it's not detected at this moment -set(CMAKE_C_COMPILER_ID ARMClang) - -macro(tfm_toolchain_reset_compiler_flags) - set_property(DIRECTORY PROPERTY COMPILE_OPTIONS "") - - add_compile_options( - $<$<OR:$<COMPILE_LANGUAGE:C>,$<COMPILE_LANGUAGE:CXX>>:-Wno-ignored-optimization-argument> - $<$<OR:$<COMPILE_LANGUAGE:C>,$<COMPILE_LANGUAGE:CXX>>:-Wno-unused-command-line-argument> - $<$<OR:$<COMPILE_LANGUAGE:C>,$<COMPILE_LANGUAGE:CXX>>:-Wall> - # Don't error when the MBEDTLS_NULL_ENTROPY warning is shown - $<$<OR:$<COMPILE_LANGUAGE:C>,$<COMPILE_LANGUAGE:CXX>>:-Wno-error=cpp> - $<$<OR:$<COMPILE_LANGUAGE:C>,$<COMPILE_LANGUAGE:CXX>>:-c> - $<$<OR:$<COMPILE_LANGUAGE:C>,$<COMPILE_LANGUAGE:CXX>>:-fdata-sections> - $<$<OR:$<COMPILE_LANGUAGE:C>,$<COMPILE_LANGUAGE:CXX>>:-ffunction-sections> - $<$<OR:$<COMPILE_LANGUAGE:C>,$<COMPILE_LANGUAGE:CXX>>:-fno-builtin> - $<$<OR:$<COMPILE_LANGUAGE:C>,$<COMPILE_LANGUAGE:CXX>>:-fshort-enums> - $<$<OR:$<COMPILE_LANGUAGE:C>,$<COMPILE_LANGUAGE:CXX>>:-fshort-wchar> - $<$<OR:$<COMPILE_LANGUAGE:C>,$<COMPILE_LANGUAGE:CXX>>:-funsigned-char> - $<$<OR:$<COMPILE_LANGUAGE:C>,$<COMPILE_LANGUAGE:CXX>>:-masm=auto> - $<$<OR:$<COMPILE_LANGUAGE:C>,$<COMPILE_LANGUAGE:CXX>>:-nostdlib> - $<$<COMPILE_LANGUAGE:C>:-std=c99> - $<$<COMPILE_LANGUAGE:CXX>:-std=c++11> - $<$<COMPILE_LANGUAGE:ASM>:--cpu=${CMAKE_ASM_CPU_FLAG}> - $<$<AND:$<COMPILE_LANGUAGE:C>,$<BOOL:${TFM_DEBUG_SYMBOLS}>>:-g> - $<$<AND:$<COMPILE_LANGUAGE:CXX>,$<BOOL:${TFM_DEBUG_SYMBOLS}>>:-g> - ) -endmacro() - -set(MEMORY_USAGE_FLAG --info=summarysizes,sizes,totals,unused,veneers) - -macro(tfm_toolchain_reset_linker_flags) - set_property(DIRECTORY PROPERTY LINK_OPTIONS "") - - add_link_options( - ${MEMORY_USAGE_FLAG} - --strict - --symbols - --xref - $<$<AND:$<VERSION_GREATER:${TFM_ISOLATION_LEVEL},1>,$<STREQUAL:"${TEST_PSA_API}","IPC">>:--no-merge> - # Suppress link warnings that are consistant (and therefore hopefully - # harmless) - # https://developer.arm.com/documentation/100074/0608/linker-errors-and-warnings/list-of-the-armlink-error-and-warning-messages - # Empty region description - --diag_suppress=6312 - # Ns section matches pattern - --diag_suppress=6314 - # Duplicate input files - --diag_suppress=6304 - # Pattern only matches removed unused sections. - --diag_suppress=6329 - ) -endmacro() - -macro(tfm_toolchain_set_processor_arch) - if (DEFINED TFM_SYSTEM_PROCESSOR) - set(CMAKE_SYSTEM_PROCESSOR ${TFM_SYSTEM_PROCESSOR}) - - if (TFM_SYSTEM_ARCHITECTURE STREQUAL "armv8.1-m.main") - message(WARNING "MVE is not yet supported using ARMCLANG") - string(APPEND CMAKE_SYSTEM_PROCESSOR "+nomve") - endif() - - if (DEFINED TFM_SYSTEM_DSP) - if(NOT TFM_SYSTEM_DSP) - string(APPEND CMAKE_SYSTEM_PROCESSOR "+nodsp") - endif() - endif() - - # ARMCLANG specifies that '+nofp' is available on following M-profile cpus: - # 'cortex-m4', 'cortex-m7', 'cortex-m33', 'cortex-m35p', 'cortex-m55' and 'cortex-m85'. - # Build fails if other M-profile cpu, such as 'cortex-m23', is added with '+nofp'. - # Explicitly list those cpu to align with ARMCLANG description. - if (NOT CONFIG_TFM_FLOAT_ABI STREQUAL "hard" AND - (TFM_SYSTEM_PROCESSOR STREQUAL "cortex-m4" - OR TFM_SYSTEM_PROCESSOR STREQUAL "cortex-m7" - OR TFM_SYSTEM_PROCESSOR STREQUAL "cortex-m33" - OR TFM_SYSTEM_PROCESSOR STREQUAL "cortex-m35p" - OR TFM_SYSTEM_PROCESSOR STREQUAL "cortex-m55" - OR TFM_SYSTEM_PROCESSOR STREQUAL "cortex-m85")) - string(APPEND CMAKE_SYSTEM_PROCESSOR "+nofp") - endif() - - string(REGEX REPLACE "\\+nodsp" ".no_dsp" CMAKE_ASM_CPU_FLAG "${CMAKE_SYSTEM_PROCESSOR}") - string(REGEX REPLACE "\\+nomve" ".no_mve" CMAKE_ASM_CPU_FLAG "${CMAKE_ASM_CPU_FLAG}") - string(REGEX REPLACE "\\+nofp" ".no_fp" CMAKE_ASM_CPU_FLAG "${CMAKE_ASM_CPU_FLAG}") - else() - set(CMAKE_ASM_CPU_FLAG ${TFM_SYSTEM_ARCHITECTURE}) - - # Armasm uses different syntax than armclang for architecture targets - string(REGEX REPLACE "\\armv" "" CMAKE_ASM_CPU_FLAG "${CMAKE_ASM_CPU_FLAG}") - string(REGEX REPLACE "\\armv" "" CMAKE_ASM_CPU_FLAG "${CMAKE_ASM_CPU_FLAG}") - - # Modifiers are additive instead of subtractive (.fp Vs .no_fp) - if (TFM_SYSTEM_DSP) - string(APPEND CMAKE_ASM_CPU_FLAG ".dsp") - endif() - - if (CONFIG_TFM_FLOAT_ABI STREQUAL "hard") - string(APPEND CMAKE_ASM_CPU_FLAG ".fp") - endif() - endif() - - # CMAKE_SYSTEM_ARCH is an ARMCLANG CMAKE internal variable, used to set - # compile and linker flags up until CMake 3.21 where CMP0123 was introduced: - # https://cmake.org/cmake/help/latest/policy/CMP0123.html - # This behavior is overwritten by setting CMAKE_C_FLAGS in - # tfm_toolchain_reload_compiler. - # Another use of this variable is to statisfy a requirement for ARMCLANG to - # set either the target CPU or the Architecture. This variable needs to be - # set to allow targeting architectures without a specific CPU. - set(CMAKE_SYSTEM_ARCH ${TFM_SYSTEM_ARCHITECTURE}) - - set(CMAKE_C_COMPILER_TARGET arm-${CROSS_COMPILE}) - set(CMAKE_CXX_COMPILER_TARGET arm-${CROSS_COMPILE}) - set(CMAKE_ASM_COMPILER_TARGET arm-${CROSS_COMPILE}) - - # MVE is currently not supported in case of armclang - if (TFM_SYSTEM_ARCHITECTURE STREQUAL "armv8.1-m.main") - string(APPEND CMAKE_SYSTEM_ARCH "+nomve") - endif() - - if (DEFINED TFM_SYSTEM_DSP) - if(NOT TFM_SYSTEM_DSP) - string(APPEND CMAKE_SYSTEM_ARCH "+nodsp") - endif() - endif() - - # Cmake's ARMClang support has several issues with compiler validation. To - # avoid these, we set the list of supported -mcpu and -march variables to - # the ones we intend to use so that the validation will never fail. - include(Compiler/ARMClang) - set(CMAKE_C_COMPILER_PROCESSOR_LIST ${CMAKE_SYSTEM_PROCESSOR}) - set(CMAKE_C_COMPILER_ARCH_LIST ${CMAKE_SYSTEM_ARCH}) - set(CMAKE_CXX_COMPILER_PROCESSOR_LIST ${CMAKE_SYSTEM_PROCESSOR}) - set(CMAKE_CXX_COMPILER_ARCH_LIST ${CMAKE_SYSTEM_ARCH}) - set(CMAKE_ASM_COMPILER_PROCESSOR_LIST ${CMAKE_SYSTEM_PROCESSOR}) - set(CMAKE_ASM_COMPILER_ARCH_LIST ${CMAKE_SYSTEM_ARCH}) -endmacro() - -macro(tfm_toolchain_reload_compiler) - tfm_toolchain_set_processor_arch() - tfm_toolchain_reset_compiler_flags() - tfm_toolchain_reset_linker_flags() - - unset(CMAKE_C_FLAGS_INIT) - unset(CMAKE_CXX_FLAGS_INIT) - unset(CMAKE_C_LINK_FLAGS) - unset(CMAKE_ASM_FLAGS_INIT) - unset(CMAKE_ASM_LINK_FLAGS) - unset(__mcpu_flag_set) - unset(__march_flag_set) - - include(Compiler/ARMClang) - __compiler_armclang(C) - include(Compiler/ARMCC-ASM) - __compiler_armcc(ASM) - - if (CMAKE_C_COMPILER_VERSION VERSION_LESS 6.13) - message(FATAL_ERROR "Please select newer Arm compiler version starting from 6.13.") - endif() - - if (CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 6.15 AND - CMAKE_C_COMPILER_VERSION VERSION_LESS 6.18) - message(FATAL_ERROR "Armclang 6.15~6.17 may cause MemManage fault." - " This defect has been fixed since Armclang 6.18." - " See [SDCOMP-59788] in Armclang 6.18 release note for details." - " Please use other Armclang versions instead.") - endif() - - set(CMAKE_ASM_FLAGS ${CMAKE_ASM_FLAGS_INIT}) - - if (DEFINED TFM_SYSTEM_PROCESSOR) - set(CMAKE_C_FLAGS "-mcpu=${CMAKE_SYSTEM_PROCESSOR}") - set(CMAKE_C_LINK_FLAGS "--cpu=${CMAKE_SYSTEM_PROCESSOR}") - set(CMAKE_CXX_LINK_FLAGS "--cpu=${CMAKE_SYSTEM_PROCESSOR}") - set(CMAKE_ASM_LINK_FLAGS "--cpu=${CMAKE_SYSTEM_PROCESSOR}") - # But armlink doesn't support this +dsp syntax - string(REGEX REPLACE "\\+nodsp" "" CMAKE_C_LINK_FLAGS "${CMAKE_C_LINK_FLAGS}") - string(REGEX REPLACE "\\+nodsp" "" CMAKE_CXX_LINK_FLAGS "${CMAKE_CXX_LINK_FLAGS}") - string(REGEX REPLACE "\\+nodsp" "" CMAKE_ASM_LINK_FLAGS "${CMAKE_ASM_LINK_FLAGS}") - # And uses different syntax for +nofp - string(REGEX REPLACE "\\+nofp" ".no_fp" CMAKE_C_LINK_FLAGS "${CMAKE_C_LINK_FLAGS}") - string(REGEX REPLACE "\\+nofp" ".no_fp" CMAKE_CXX_LINK_FLAGS "${CMAKE_CXX_LINK_FLAGS}") - string(REGEX REPLACE "\\+nofp" ".no_fp" CMAKE_ASM_LINK_FLAGS "${CMAKE_ASM_LINK_FLAGS}") - - string(REGEX REPLACE "\\+nomve" ".no_mve" CMAKE_C_LINK_FLAGS "${CMAKE_C_LINK_FLAGS}") - string(REGEX REPLACE "\\+nomve" ".no_mve" CMAKE_CXX_LINK_FLAGS "${CMAKE_CXX_LINK_FLAGS}") - string(REGEX REPLACE "\\+nomve" ".no_mve" CMAKE_ASM_LINK_FLAGS "${CMAKE_ASM_LINK_FLAGS}") - else() - set(CMAKE_C_FLAGS "-march=${CMAKE_SYSTEM_ARCH}") - set(CMAKE_CXX_FLAGS "-march=${CMAKE_SYSTEM_ARCH}") - endif() - - # This flag is used to check if toolchain has fixed VLLDM vulnerability - # Check command will fail if C flags consist of keyword other than cpu/arch type. - set(CP_CHECK_C_FLAGS ${CMAKE_C_FLAGS}) - - if (CONFIG_TFM_FLOAT_ABI STREQUAL "hard") - set(COMPILER_CP_C_FLAG "-mfloat-abi=hard") - if (CONFIG_TFM_ENABLE_FP) - set(COMPILER_CP_C_FLAG "-mfloat-abi=hard -mfpu=${CONFIG_TFM_FP_ARCH}") - set(COMPILER_CP_ASM_FLAG "--fpu=${CONFIG_TFM_FP_ARCH_ASM}") - # armasm and armlink have the same option "--fpu" and are both used to - # specify the target FPU architecture. So the supported FPU architecture - # names can be shared by armasm and armlink. - set(LINKER_CP_OPTION "--fpu=${CONFIG_TFM_FP_ARCH_ASM}") - endif() - else() - set(COMPILER_CP_C_FLAG "-mfpu=softvfp") - set(COMPILER_CP_ASM_FLAG "--fpu=softvfp") - set(LINKER_CP_OPTION "--fpu=SoftVFP") - endif() - - string(APPEND CMAKE_C_FLAGS " " ${COMPILER_CP_C_FLAG}) - string(APPEND CMAKE_ASM_FLAGS " " ${COMPILER_CP_ASM_FLAG}) - string(APPEND CMAKE_C_LINK_FLAGS " " ${LINKER_CP_OPTION}) - string(APPEND CMAKE_ASM_LINK_FLAGS " " ${LINKER_CP_OPTION}) - - # Workaround for issues with --depend-single-line with armasm and Ninja - if (CMAKE_GENERATOR STREQUAL "Ninja") - set( CMAKE_DEPFILE_FLAGS_ASM "--depend=<OBJECT>.d") - endif() - - set(CMAKE_C_FLAGS_MINSIZEREL "-Oz -DNDEBUG") -endmacro() - -# Configure environment for the compiler setup run by cmake at the first -# `project` call in <tfm_root>/CMakeLists.txt. After this mandatory setup is -# done, all further compiler setup is done via tfm_toolchain_reload_compiler() -tfm_toolchain_set_processor_arch() -tfm_toolchain_reset_compiler_flags() -tfm_toolchain_reset_linker_flags() - -macro(add_convert_to_bin_target target) - get_target_property(bin_dir ${target} RUNTIME_OUTPUT_DIRECTORY) - - add_custom_target(${target}_bin - SOURCES ${bin_dir}/${target}.bin - ) - add_custom_command(OUTPUT ${bin_dir}/${target}.bin - DEPENDS ${target} - COMMAND fromelf - --bincombined $<TARGET_FILE:${target}> - --output=${bin_dir}/${target}.bin - ) - - add_custom_target(${target}_elf - SOURCES ${bin_dir}/${target}.elf - ) - add_custom_command(OUTPUT ${bin_dir}/${target}.elf - DEPENDS ${target} - COMMAND fromelf - --elf $<TARGET_FILE:${target}> - --output=${bin_dir}/${target}.elf - ) - - add_custom_target(${target}_hex - SOURCES ${bin_dir}/${target}.hex - ) - add_custom_command(OUTPUT ${bin_dir}/${target}.hex - DEPENDS ${target} - COMMAND fromelf - --i32combined $<TARGET_FILE:${target}> - --output=${bin_dir}/${target}.hex - ) - - add_custom_target(${target}_binaries - ALL - DEPENDS ${target}_bin - DEPENDS ${target}_elf - DEPENDS ${target}_hex - ) -endmacro() - -# Specify the scatter file used to link `target`. -# Behaviour for handling scatter files is so wildly divergent between compilers -# that this macro is required. -# -# Vendor platform can set a scatter file as property INTERFACE_LINK_DEPENDS of platform_ns. -# `target` can fetch the scatter file from platform_ns. -# -# Alternatively, NS build can call target_add_scatter_file() with the install directory of -# scatter files. -# target_add_scatter_file(target, install_dir) -# -# target_add_scatter_file() fetch a scatter file from the install directory. -macro(target_add_scatter_file target) - - # Try if scatter_file is passed from platform_ns - get_target_property(scatter_file - platform_ns - INTERFACE_LINK_DEPENDS - ) - - # If scatter_file is not passed from platform_ns - # Try if any scatter file is exported in install directory - # The intall directory is passed as an optinal argument - if(${scatter_file} STREQUAL "scatter_file-NOTFOUND") - set(install_dir ${ARGN}) - list(LENGTH install_dir nr_install_dir) - - # If nr_install_dir == 1, search for sct file under install dir - if(${nr_install_dir} EQUAL 1) - file(GLOB scatter_file "${install_dir}/*.sct") - endif() - endif() - - if(NOT EXISTS ${scatter_file}) - message(FATAL_ERROR "Unable to find NS scatter file ${scatter_file}") - endif() - - add_library(${target}_scatter OBJECT) - target_sources(${target}_scatter - PRIVATE - ${scatter_file} - ) - - # Cmake cannot use generator expressions in the - # set_source_file_properties command, so instead we just parse the regex - # for the filename and set the property on all files, regardless of if - # the generator expression would evaluate to true or not. - string(REGEX REPLACE ".*>:(.*)>$" "\\1" SCATTER_FILE_PATH "${scatter_file}") - set_source_files_properties(${SCATTER_FILE_PATH} - PROPERTIES - LANGUAGE C - ) - - target_link_options(${target} - PRIVATE - --scatter=$<TARGET_OBJECTS:${target}_scatter> - ) - - target_link_libraries(${target}_scatter - PRIVATE - platform_region_defs - ) - - target_compile_options(${target}_scatter - PRIVATE - -E - -xc - ) - - add_dependencies(${target} ${target}_scatter) - set_target_properties(${target} PROPERTIES LINK_DEPENDS $<TARGET_OBJECTS:${target}_scatter>) - -endmacro() diff --git a/nrfdemo/builddk/tfm/api_ns/cmake/toolchain_ns_GNUARM.cmake b/nrfdemo/builddk/tfm/api_ns/cmake/toolchain_ns_GNUARM.cmake deleted file mode 100644 index 4e1ea0f..0000000 --- a/nrfdemo/builddk/tfm/api_ns/cmake/toolchain_ns_GNUARM.cmake +++ /dev/null @@ -1,320 +0,0 @@ -#------------------------------------------------------------------------------- -# Copyright (c) 2020-2023, Arm Limited. All rights reserved. -# -# SPDX-License-Identifier: BSD-3-Clause -# -#------------------------------------------------------------------------------- - -set(CMAKE_SYSTEM_NAME Generic) - -set(CMAKE_C_COMPILER_FORCED TRUE) -set(CMAKE_CXX_COMPILER_FORCED TRUE) - -if(NOT DEFINED CROSS_COMPILE) - set(CROSS_COMPILE arm-none-eabi CACHE STRING "Cross-compiler prefix") -endif() - -find_program(CMAKE_C_COMPILER ${CROSS_COMPILE}-gcc) -find_program(CMAKE_CXX_COMPILER ${CROSS_COMPILE}-g++) - -if(CMAKE_C_COMPILER STREQUAL "CMAKE_C_COMPILER-NOTFOUND") - message(FATAL_ERROR "Could not find compiler: '${CROSS_COMPILE}-gcc'") -endif() - -if(CMAKE_CXX_COMPILER STREQUAL "CMAKE_CXX_COMPILER-NOTFOUND") - message(FATAL_ERROR "Could not find compiler: '${CROSS_COMPILE}-g++'") -endif() - -set(CMAKE_ASM_COMPILER ${CMAKE_C_COMPILER}) - -# Set compiler ID explicitly as it's not detected at this moment -set(CMAKE_C_COMPILER_ID GNU) - -# This variable name is a bit of a misnomer. The file it is set to is included -# at a particular step in the compiler initialisation. It is used here to -# configure the extensions for object files. Despite the name, it also works -# with the Ninja generator. -set(CMAKE_USER_MAKE_RULES_OVERRIDE ${CMAKE_CURRENT_LIST_DIR}/set_extensions.cmake) - -# CMAKE_C_COMPILER_VERSION is not guaranteed to be defined. -EXECUTE_PROCESS( COMMAND ${CMAKE_C_COMPILER} -dumpversion OUTPUT_VARIABLE GCC_VERSION ) - -# ===================== Set toolchain CPU and Arch ============================= - -if (DEFINED TFM_SYSTEM_PROCESSOR) - if(TFM_SYSTEM_PROCESSOR MATCHES "cortex-m85" AND GCC_VERSION VERSION_LESS "13.0.0") - # GNUARM until version 13 does not support the -mcpu=cortex-m85 flag - message(WARNING "Cortex-m85 is only supported from GCC13. " - "Falling back to -march usage for earlier versions.") - else() - set(CMAKE_SYSTEM_PROCESSOR ${TFM_SYSTEM_PROCESSOR}) - - if (DEFINED TFM_SYSTEM_DSP) - if (NOT TFM_SYSTEM_DSP) - string(APPEND CMAKE_SYSTEM_PROCESSOR "+nodsp") - endif() - endif() - # GCC specifies that '+nofp' is available on following M-profile cpus: 'cortex-m4', - # 'cortex-m7', 'cortex-m33', 'cortex-m35p' and 'cortex-m55'. - # Build fails if other M-profile cpu, such as 'cortex-m23', is added with '+nofp'. - # Explicitly list those cpu to align with GCC description. - if(GCC_VERSION VERSION_GREATER_EQUAL "8.0.0") - if(NOT CONFIG_TFM_ENABLE_FP AND - (TFM_SYSTEM_PROCESSOR STREQUAL "cortex-m4" - OR TFM_SYSTEM_PROCESSOR STREQUAL "cortex-m7" - OR TFM_SYSTEM_PROCESSOR STREQUAL "cortex-m33" - OR TFM_SYSTEM_PROCESSOR STREQUAL "cortex-m35p" - OR TFM_SYSTEM_PROCESSOR STREQUAL "cortex-m55")) - string(APPEND CMAKE_SYSTEM_PROCESSOR "+nofp") - endif() - endif() - - if(TFM_SYSTEM_ARCHITECTURE STREQUAL "armv8.1-m.main") - if(NOT CONFIG_TFM_ENABLE_MVE) - string(APPEND CMAKE_SYSTEM_PROCESSOR "+nomve") - endif() - if(NOT CONFIG_TFM_ENABLE_MVE_FP) - string(APPEND CMAKE_SYSTEM_PROCESSOR "+nomve.fp") - endif() - endif() - endif() - -endif() - -# CMAKE_SYSTEM_ARCH variable is not a built-in CMAKE variable. It is used to -# set the compile and link flags when TFM_SYSTEM_PROCESSOR is not specified. -# The variable name is choosen to align with the ARMCLANG toolchain file. -set(CMAKE_SYSTEM_ARCH ${TFM_SYSTEM_ARCHITECTURE}) - -if(TFM_SYSTEM_ARCHITECTURE STREQUAL "armv8.1-m.main") - if(CONFIG_TFM_ENABLE_MVE) - string(APPEND CMAKE_SYSTEM_ARCH "+mve") - endif() - if(CONFIG_TFM_ENABLE_MVE_FP) - string(APPEND CMAKE_SYSTEM_ARCH "+mve.fp") - endif() -endif() - -if (DEFINED TFM_SYSTEM_DSP) - # +nodsp modifier is only supported from GCC version 8. - if(GCC_VERSION VERSION_GREATER_EQUAL "8.0.0") - # armv8.1-m.main arch does not have +nodsp option - if ((NOT TFM_SYSTEM_ARCHITECTURE STREQUAL "armv8.1-m.main") AND - NOT TFM_SYSTEM_DSP) - string(APPEND CMAKE_SYSTEM_ARCH "+nodsp") - endif() - endif() -endif() - -if(GCC_VERSION VERSION_GREATER_EQUAL "8.0.0") - if(CONFIG_TFM_ENABLE_FP) - string(APPEND CMAKE_SYSTEM_ARCH "+fp") - endif() -endif() - -if (GCC_VERSION VERSION_LESS 7.3.1) - message(FATAL_ERROR "Please use newer GNU Arm compiler version starting from 7.3.1.") -endif() - -if (GCC_VERSION VERSION_EQUAL 10.2.1) - message(FATAL_ERROR "GNU Arm compiler version 10-2020-q4-major has an issue in CMSE support." - " Select other GNU Arm compiler versions instead." - " See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99157 for the issue detail.") -endif() - -# GNU Arm compiler version greater equal than *11.3.Rel1* -# has a linker issue that required system calls are missing, -# such as _read and _write. Add stub functions of required -# system calls to solve this issue. -if (GCC_VERSION VERSION_GREATER_EQUAL 11.3.1) - set(CONFIG_GNU_SYSCALL_STUB_ENABLED TRUE) -endif() - -if (CMAKE_SYSTEM_PROCESSOR) - set(CMAKE_C_FLAGS_INIT "-mcpu=${CMAKE_SYSTEM_PROCESSOR}") - set(CMAKE_CXX_FLAGS_INIT "-mcpu=${CMAKE_SYSTEM_PROCESSOR}") - set(CMAKE_ASM_FLAGS_INIT "-mcpu=${CMAKE_SYSTEM_PROCESSOR}") - set(CMAKE_C_LINK_FLAGS "-mcpu=${CMAKE_SYSTEM_PROCESSOR}") - set(CMAKE_ASM_LINK_FLAGS "-mcpu=${CMAKE_SYSTEM_PROCESSOR}") -else() - set(CMAKE_C_FLAGS_INIT "-march=${CMAKE_SYSTEM_ARCH}") - set(CMAKE_CXX_FLAGS_INIT "-march=${CMAKE_SYSTEM_ARCH}") - set(CMAKE_ASM_FLAGS_INIT "-march=${CMAKE_SYSTEM_ARCH}") - set(CMAKE_C_LINK_FLAGS "-march=${CMAKE_SYSTEM_ARCH}") - set(CMAKE_ASM_LINK_FLAGS "-march=${CMAKE_SYSTEM_ARCH}") -endif() - -set(CMAKE_C_FLAGS ${CMAKE_C_FLAGS_INIT}) -set(CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS_INIT}) -set(CMAKE_ASM_FLAGS ${CMAKE_ASM_FLAGS_INIT}) - -set(COMPILER_CP_FLAG "-mfloat-abi=soft") -set(LINKER_CP_OPTION "-mfloat-abi=soft") - -if(CONFIG_TFM_FLOAT_ABI STREQUAL "hard") - set(COMPILER_CP_FLAG "-mfloat-abi=hard") - set(LINKER_CP_OPTION "-mfloat-abi=hard") - if(CONFIG_TFM_ENABLE_FP OR CONFIG_TFM_ENABLE_MVE_FP) - string(APPEND COMPILER_CP_FLAG " " "-mfpu=${CONFIG_TFM_FP_ARCH}") - string(APPEND LINKER_CP_OPTION " " "-mfpu=${CONFIG_TFM_FP_ARCH}") - endif() -endif() - -string(APPEND CMAKE_C_FLAGS " " ${COMPILER_CP_FLAG}) -string(APPEND CMAKE_ASM_FLAGS " " ${COMPILER_CP_FLAG}) -string(APPEND CMAKE_C_LINK_FLAGS " " ${LINKER_CP_OPTION}) -string(APPEND CMAKE_ASM_LINK_FLAGS " " ${LINKER_CP_OPTION}) - -# For GNU Arm Embedded Toolchain doesn't emit __ARM_ARCH_8_1M_MAIN__, adding this macro manually. -add_compile_definitions($<$<STREQUAL:${TFM_SYSTEM_ARCHITECTURE},armv8.1-m.main>:__ARM_ARCH_8_1M_MAIN__>) - -# GNU Arm compiler version greater equal than *11.3.Rel1* -# has a linker issue that required system calls are missing, -# such as _read and _write. Add stub functions of required -# system calls to solve this issue. -if (GCC_VERSION VERSION_GREATER_EQUAL 11.3.1) - set(CONFIG_GNU_SYSCALL_STUB_ENABLED TRUE) -endif() - -add_compile_options( - -specs=nano.specs - -Wall - -Wno-format - -Wno-return-type - -Wno-unused-but-set-variable - -c - -fdata-sections - -ffunction-sections - -fno-builtin - -fshort-enums - -funsigned-char - -mthumb - -nostdlib - $<$<COMPILE_LANGUAGE:C>:-std=c99> - $<$<COMPILE_LANGUAGE:CXX>:-std=c++11> - $<$<AND:$<COMPILE_LANGUAGE:C>,$<BOOL:${TFM_DEBUG_SYMBOLS}>>:-g> - $<$<AND:$<COMPILE_LANGUAGE:CXX>,$<BOOL:${TFM_DEBUG_SYMBOLS}>>:-g> -) - -add_link_options( - --entry=Reset_Handler - -specs=nano.specs - LINKER:-check-sections - LINKER:-fatal-warnings - LINKER:--gc-sections - LINKER:--no-wchar-size-warning - LINKER:--print-memory-usage - LINKER:-Map=tfm_ns.map -) - -# Specify the linker script used to link `target`. -# Behaviour for handling linker scripts is so wildly divergent between compilers -# that this macro is required. -# -# Vendor platform can set a linker script as property INTERFACE_LINK_DEPENDS of platform_ns. -# `target` can fetch the linker script from platform_ns. -# -# Alternatively, NS build can call target_add_scatter_file() with the install directory of -# linker script. -# target_add_scatter_file(target, install_dir) -# -# target_add_scatter_file() fetch a linker script from the install directory. -macro(target_add_scatter_file target) - - get_target_property(scatter_file - platform_ns - INTERFACE_LINK_DEPENDS - ) - - # If scatter_file is not passed from platform_ns - # Try if any linker script is exported in install directory - # The intall directory is passed as an optinal argument - if(${scatter_file} STREQUAL "scatter_file-NOTFOUND") - set(install_dir ${ARGN}) - list(LENGTH install_dir nr_install_dir) - - # If nr_install_dir == 1, search for sct file under install dir - if(${nr_install_dir} EQUAL 1) - file(GLOB scatter_file "${install_dir}/*.ld") - endif() - endif() - - if(NOT EXISTS ${scatter_file}) - message(FATAL_ERROR "Unable to find NS scatter file ${scatter_file}") - endif() - - add_library(${target}_scatter OBJECT) - target_sources(${target}_scatter - PRIVATE - ${scatter_file} - ) - - set_source_files_properties(${scatter_file} PROPERTIES - LANGUAGE C - KEEP_EXTENSION True) - - target_compile_options(${target}_scatter - PRIVATE - -E - -P - -xc - ) - - target_link_libraries(${target}_scatter - PRIVATE - platform_region_defs - ) - - add_dependencies(${target} ${target}_scatter) - - target_link_options(${target} - PRIVATE - -T $<TARGET_OBJECTS:${target}_scatter> - ) - -endmacro() - -macro(add_convert_to_bin_target target) - get_target_property(bin_dir ${target} RUNTIME_OUTPUT_DIRECTORY) - - add_custom_target(${target}_bin - SOURCES ${bin_dir}/${target}.bin - ) - add_custom_command(OUTPUT ${bin_dir}/${target}.bin - DEPENDS ${target} - COMMAND ${CMAKE_OBJCOPY} - -O binary $<TARGET_FILE:${target}> - ${bin_dir}/${target}.bin - ) - - add_custom_target(${target}_elf - SOURCES ${bin_dir}/${target}.elf - ) - add_custom_command(OUTPUT ${bin_dir}/${target}.elf - DEPENDS ${target} - COMMAND ${CMAKE_OBJCOPY} - -O elf32-littlearm $<TARGET_FILE:${target}> - ${bin_dir}/${target}.elf - ) - - add_custom_target(${target}_hex - SOURCES ${bin_dir}/${target}.hex - ) - add_custom_command(OUTPUT ${bin_dir}/${target}.hex - DEPENDS ${target} - COMMAND ${CMAKE_OBJCOPY} - -O ihex $<TARGET_FILE:${target}> - ${bin_dir}/${target}.hex - ) - - add_custom_target(${target}_binaries - ALL - DEPENDS ${target}_bin - DEPENDS ${target}_elf - DEPENDS ${target}_hex - ) -endmacro() - -# A dummy macro to align with Armclang workaround -macro(tfm_toolchain_reload_compiler) -endmacro() diff --git a/nrfdemo/builddk/tfm/api_ns/cmake/toolchain_ns_IARARM.cmake b/nrfdemo/builddk/tfm/api_ns/cmake/toolchain_ns_IARARM.cmake deleted file mode 100644 index 9c99f67..0000000 --- a/nrfdemo/builddk/tfm/api_ns/cmake/toolchain_ns_IARARM.cmake +++ /dev/null @@ -1,227 +0,0 @@ -#------------------------------------------------------------------------------- -# Copyright (c) 2023, Arm Limited. All rights reserved. -# -# SPDX-License-Identifier: BSD-3-Clause -# -#------------------------------------------------------------------------------- - -cmake_minimum_required(VERSION 3.22) -cmake_policy(SET CMP0115 NEW) - -SET(CMAKE_SYSTEM_NAME Generic) -set(CMAKE_SYSTEM_PROCESSOR ${TFM_SYSTEM_PROCESSOR}) - -if(CROSS_COMPILE) - set(CMAKE_C_COMPILER_TARGET arm-${CROSS_COMPILE}) - set(CMAKE_ASM_COMPILER_TARGET arm-${CROSS_COMPILE}) -else() - set(CMAKE_C_COMPILER_TARGET arm-arm-none-eabi) - set(CMAKE_ASM_COMPILER_TARGET arm-arm-none-eabi) -endif() - -set(CMAKE_C_COMPILER iccarm) -set(CMAKE_CXX_COMPILER iccarm) -set(CMAKE_ASM_COMPILER iasmarm) - -set(CMAKE_C_FLAGS_DEBUG "-r -On") - -# This variable name is a bit of a misnomer. The file it is set to is included -# at a particular step in the compiler initialisation. It is used here to -# configure the extensions for object files. Despite the name, it also works -# with the Ninja generator. -set(CMAKE_USER_MAKE_RULES_OVERRIDE ${CMAKE_CURRENT_LIST_DIR}/set_extensions.cmake) - -macro(tfm_toolchain_reset_compiler_flags) - set_property(DIRECTORY PROPERTY COMPILE_OPTIONS "") - - add_compile_options( - $<$<COMPILE_LANGUAGE:C,CXX>:-e> - $<$<COMPILE_LANGUAGE:C,CXX>:--dlib_config=full> - $<$<COMPILE_LANGUAGE:C,CXX>:--silent> - $<$<COMPILE_LANGUAGE:C,CXX>:-DNO_TYPEOF> - $<$<COMPILE_LANGUAGE:C,CXX>:-D_NO_DEFINITIONS_IN_HEADER_FILES> - $<$<COMPILE_LANGUAGE:C,CXX>:--diag_suppress=Pe546,Pe940,Pa082,Pa084> - $<$<COMPILE_LANGUAGE:C,CXX>:--no_path_in_file_macros> - "$<$<COMPILE_LANGUAGE:C,CXX,ASM>:SHELL:--fpu none>" - $<$<AND:$<COMPILE_LANGUAGE:C,CXX,ASM>,$<BOOL:${TFM_DEBUG_SYMBOLS}>,$<CONFIG:Release,MinSizeRel>>:-r> - ) -endmacro() - -macro(tfm_toolchain_reset_linker_flags) - set_property(DIRECTORY PROPERTY LINK_OPTIONS "") - - add_link_options( - --silent - --semihosting - --redirect __write=__write_buffered - --diag_suppress=lp005 - "SHELL:--fpu none" - ) -endmacro() - -macro(tfm_toolchain_set_processor_arch) - if(${TFM_SYSTEM_PROCESSOR} STREQUAL "cortex-m0plus") - set(CMAKE_SYSTEM_PROCESSOR Cortex-M0+) - else() - set(CMAKE_SYSTEM_PROCESSOR ${TFM_SYSTEM_PROCESSOR}) - endif() - - if (DEFINED TFM_SYSTEM_DSP) - if(NOT TFM_SYSTEM_DSP) - string(APPEND CMAKE_SYSTEM_PROCESSOR ".no_dsp") - endif() - endif() -endmacro() - -macro(tfm_toolchain_reload_compiler) - tfm_toolchain_set_processor_arch() - tfm_toolchain_reset_compiler_flags() - tfm_toolchain_reset_linker_flags() - - unset(CMAKE_C_FLAGS_INIT) - unset(CMAKE_C_LINK_FLAGS) - unset(CMAKE_ASM_FLAGS_INIT) - unset(CMAKE_ASM_LINK_FLAGS) - - set(CMAKE_C_FLAGS_INIT "--cpu ${CMAKE_SYSTEM_PROCESSOR}") - set(CMAKE_ASM_FLAGS_INIT "--cpu ${CMAKE_SYSTEM_PROCESSOR}") - set(CMAKE_C_LINK_FLAGS "--cpu ${CMAKE_SYSTEM_PROCESSOR}") - set(CMAKE_ASM_LINK_FLAGS "--cpu ${CMAKE_SYSTEM_PROCESSOR}") - - set(CMAKE_C_FLAGS ${CMAKE_C_FLAGS_INIT}) - set(CMAKE_ASM_FLAGS ${CMAKE_ASM_FLAGS_INIT}) - - # Can't use the highest optimization with IAR on v8.1m arch because of the - # compilation bug in mbedcrypto - if ((CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL "9.20") AND - (CMAKE_C_COMPILER_VERSION VERSION_LESS_EQUAL "9.32.1") AND - ((TFM_SYSTEM_PROCESSOR STREQUAL "cortex-m85") OR - (TFM_SYSTEM_PROCESSOR STREQUAL "cortex-m55")) AND - (NOT (CMAKE_BUILD_TYPE STREQUAL "Debug"))) - message(FATAL_ERROR "Only debug build available for M55 and M85" - " cores with IAR version between 9.20 and 9.32.1") - endif() - -endmacro() - -# Configure environment for the compiler setup run by cmake at the first -# `project` call in <tfm_root>/CMakeLists.txt. After this mandatory setup is -# done, all further compiler setup is done via tfm_toolchain_reload_compiler() -tfm_toolchain_reload_compiler() - -# Specify the scatter file used to link `target`. -# Behaviour for handling scatter files is so wildly divergent between compilers -# that this macro is required. -# -# Vendor platform can set a scatter file as property INTERFACE_LINK_DEPENDS of platform_ns. -# `target` can fetch the scatter file from platform_ns. -# -# Alternatively, NS build can call target_add_scatter_file() with the install directory of -# scatter files. -# target_add_scatter_file(target, install_dir) -# -# target_add_scatter_file() fetch a scatter file from the install directory. -macro(target_add_scatter_file target) - # Try if scatter_file is passed from platform_ns - get_target_property(scatter_file - platform_ns - INTERFACE_LINK_DEPENDS - ) - - # If scatter_file is not passed from platform_ns - # Try if any scatter file is exported in install directory - # The intall directory is passed as an optinal argument - if(${scatter_file} STREQUAL "scatter_file-NOTFOUND") - set(install_dir ${ARGN}) - list(LENGTH install_dir nr_install_dir) - - # If nr_install_dir == 1, search for .icf file under install dir - if(${nr_install_dir} EQUAL 1) - file(GLOB scatter_file "${install_dir}/*.icf") - endif() - endif() - - if(NOT EXISTS ${scatter_file}) - message(FATAL_ERROR "Unable to find NS scatter file ${scatter_file}") - endif() - - add_library(${target}_scatter OBJECT) - target_sources(${target}_scatter - PRIVATE - ${scatter_file} - ) - # Cmake cannot use generator expressions in the - # set_source_file_properties command, so instead we just parse the regex - # for the filename and set the property on all files, regardless of if - # the generator expression would evaluate to true or not. - string(REGEX REPLACE ".*>:(.*)>$" "\\1" SCATTER_FILE_PATH "${scatter_file}") - set_source_files_properties(${SCATTER_FILE_PATH} - PROPERTIES - LANGUAGE C - ) - - target_link_options(${target} - PRIVATE - --config $<TARGET_OBJECTS:${target}_scatter> - ) - - add_dependencies(${target} - ${target}_scatter - ) - - set_target_properties(${target} PROPERTIES LINK_DEPENDS $<TARGET_OBJECTS:${target}_scatter>) - - target_link_libraries(${target}_scatter - PRIVATE - platform_region_defs - ) - - target_compile_options(${target}_scatter - PRIVATE - --preprocess=sn $<TARGET_OBJECTS:${target}_scatter> - ) -endmacro() - -macro(add_convert_to_bin_target target) - get_target_property(bin_dir ${target} RUNTIME_OUTPUT_DIRECTORY) - - add_custom_target(${target}_bin - SOURCES ${bin_dir}/${target}.bin - ) - add_custom_command(OUTPUT ${bin_dir}/${target}.bin - DEPENDS ${target} - COMMAND ielftool - --silent - --bin $<TARGET_FILE:${target}> - ${bin_dir}/${target}.bin - ) - - add_custom_target(${target}_elf - SOURCES ${bin_dir}/${target}.elf - ) - add_custom_command(OUTPUT ${bin_dir}/${target}.elf - DEPENDS ${target} - COMMAND ielftool - --silent - $<TARGET_FILE:${target}> - ${bin_dir}/${target}.elf - ) - - add_custom_target(${target}_hex - SOURCES ${bin_dir}/${target}.hex - ) - add_custom_command(OUTPUT ${bin_dir}/${target}.hex - DEPENDS ${target} - COMMAND ielftool - --silent - --ihex $<TARGET_FILE:${target}> - ${bin_dir}/${target}.hex - ) - - add_custom_target(${target}_binaries - ALL - DEPENDS ${target}_bin - DEPENDS ${target}_elf - DEPENDS ${target}_hex - ) -endmacro() |
