From f2bdee356b12d8b5e76f752ba5e618adc6d25d9a Mon Sep 17 00:00:00 2001 From: Ioannis Glaropoulos Date: Thu, 12 Apr 2018 14:33:52 +0200 Subject: [PATCH] arch: arm: export entry veneers When building a Secure firmware image, instruct the linker to generate a symbol table with the entry veneers, to allow a Non Secure firmware image to access Secure Entry functions via the entry veneers. Signed-off-by: Ioannis Glaropoulos --- arch/arm/core/Kconfig | 10 ++++++++++ arch/arm/core/cortex_m/tz/CMakeLists.txt | 16 ++++++++++++++++ 2 files changed, 26 insertions(+) diff --git a/arch/arm/core/Kconfig b/arch/arm/core/Kconfig index 02c0b437694..1e2c08358f3 100644 --- a/arch/arm/core/Kconfig +++ b/arch/arm/core/Kconfig @@ -123,6 +123,16 @@ config ARM_NSC_REGION_BASE_ADDRESS a Non-Secure Callable section, depending on the available security atttribution unit (SAU or IDAU) for a given SOC. +config ARM_ENTRY_VENEERS_LIB_NAME + string "Entry Veneers symbol file" + depends on ARM_FIRMWARE_HAS_SECURE_ENTRY_FUNCS + default "libentryveneers.a" + help + Library file to store the symbol table for + the entry veneers. The library may be used + for building a Non-Secure firmware with + access to Secure Entry functions. + endmenu menu "Architecture Floating Point Options" diff --git a/arch/arm/core/cortex_m/tz/CMakeLists.txt b/arch/arm/core/cortex_m/tz/CMakeLists.txt index 6bebdcccda8..2e6ff46fc3b 100644 --- a/arch/arm/core/cortex_m/tz/CMakeLists.txt +++ b/arch/arm/core/cortex_m/tz/CMakeLists.txt @@ -2,4 +2,20 @@ # Security Extensions. This option is required when building a Secure firmware. zephyr_compile_options(-mcmse) +if(CONFIG_ARM_FIRMWARE_HAS_SECURE_ENTRY_FUNCS) + +# --out-implib and --cmse-implib instruct the linker to produce +# an import library that consists of a relocatable file containing +# only a symbol table with the entry veneers. The library may be used +# when building a Non-Secure image which shall have access to Secure +# Entry functions. + zephyr_ld_options( + ${LINKERFLAGPREFIX},--out-implib=${CONFIG_ARM_ENTRY_VENEERS_LIB_NAME} + ) + + zephyr_ld_options( + ${LINKERFLAGPREFIX},--cmse-implib + ) +endif() + zephyr_sources(arm_core_tz.c)