Hi Michael,

 

These functions come from the CMSIS repo in the core_*.h headers (e.g. core_cm55.h for a Cortex-M55), via the tfm_hal_device_header.h header.

 

You need to supply a standard CMSIS device header (see platform/ext/target/arm/mps4/corstone315/device/include/corstone315.h for example), that includes the appropriate core_*.h header. Then use your platform CMakeLists.txt to define CMSIS_device_header="[plat_name].h" so that tfm_hal_device_header.h automatically includes it.

 

Kind regards,

Jamie

 

From: Michael Khoyilar via TF-M <tf-m@lists.trustedfirmware.org>
Sent: Friday, June 14, 2024 12:02 AM
To: tf-m@lists.trustedfirmware.org
Subject: [TF-M] New to TF-M

 

Hi all

 

I am porting a new SoC to TF-M platform. I know I have missed something in my platform files that I am getting following error message, can someone please guide me. Thanks

 

Built target manifest_tool

[  3%] Building C object platform/CMakeFiles/platform_s.dir/ext/common/uart_stdout.o

[  4%] Building C object platform/CMakeFiles/platform_s.dir/ext/common/template/nv_counters.o

[  6%] Building C object platform/CMakeFiles/platform_s.dir/ext/common/template/flash_otp_nv_counters_backend.o

[  6%] Building C object platform/CMakeFiles/platform_s.dir/ext/common/template/otp_flash.o

[  7%] Building C object platform/CMakeFiles/platform_s.dir/ext/common/provisioning.o

[  8%] Linking C static library libplatform_s.a

[ 12%] Built target platform_s

[ 13%] Building C object secure_fw/partitions/lib/runtime/CMakeFiles/tfm_sprt.dir/service_api.o

[ 13%] Building C object secure_fw/partitions/lib/runtime/CMakeFiles/tfm_sprt.dir/__/__/__/spm/core/psa_interface_sfn.o

[ 13%] Building C object secure_fw/partitions/lib/runtime/CMakeFiles/tfm_sprt.dir/__/__/__/__/interface/src/tfm_psa_call.o

[ 14%] Linking C static library libtfm_sprt.a

[ 17%] Built target tfm_sprt

[ 17%] Building C object secure_fw/spm/CMakeFiles/tfm_spm.dir/core/tfm_boot_data.o

[ 17%] Building C object secure_fw/spm/CMakeFiles/tfm_spm.dir/core/utilities.o

[ 18%] Building C object secure_fw/spm/CMakeFiles/tfm_spm.dir/core/arch/tfm_arch.o

[ 18%] Building C object secure_fw/spm/CMakeFiles/tfm_spm.dir/core/main.o

[ 19%] Building C object secure_fw/spm/CMakeFiles/tfm_spm.dir/core/spm_ipc.o

[ 19%] Building C object secure_fw/spm/CMakeFiles/tfm_spm.dir/core/rom_loader.o

[ 20%] Building C object secure_fw/spm/CMakeFiles/tfm_spm.dir/core/psa_api.o

[ 20%] Building C object secure_fw/spm/CMakeFiles/tfm_spm.dir/core/psa_call_api.o

[ 20%] Building C object secure_fw/spm/CMakeFiles/tfm_spm.dir/core/psa_version_api.o

[ 21%] Building C object secure_fw/spm/CMakeFiles/tfm_spm.dir/core/psa_read_write_skip_api.o

[ 21%] Building C object secure_fw/spm/CMakeFiles/tfm_spm.dir/core/backend_sfn.o

[ 23%] Building C object secure_fw/spm/CMakeFiles/tfm_spm.dir/core/tfm_svcalls.o

[ 23%] Building C object secure_fw/spm/CMakeFiles/tfm_spm.dir/core/tfm_pools.o

[ 24%] Building C object secure_fw/spm/CMakeFiles/tfm_spm.dir/ns_client_ext/tfm_spm_ns_ctx.o

[ 24%] Building C object secure_fw/spm/CMakeFiles/tfm_spm.dir/core/spm_local_connection.o

[ 24%] Building C object secure_fw/spm/CMakeFiles/tfm_spm.dir/core/arch/tfm_arch_v8m_main.o

[ 25%] Building C object secure_fw/spm/CMakeFiles/tfm_spm.dir/__/__/platform/ext/common/tfm_hal_nvic.o

C:/trusted-firmware-m/platform/ext/common/tfm_hal_nvic.c: In function 'tfm_hal_irq_enable':

C:/trusted-firmware-m/platform/ext/common/tfm_hal_nvic.c:21:5: warning: implicit declaration of function 'NVIC_EnableIRQ' [-Wimplicit-function-declaration]

   21 |     NVIC_EnableIRQ((IRQn_Type)irq_num);

      |     ^~~~~~~~~~~~~~

C:/trusted-firmware-m/platform/ext/common/tfm_hal_nvic.c:21:21: error: 'IRQn_Type' undeclared (first use in this function)

   21 |     NVIC_EnableIRQ((IRQn_Type)irq_num);

      |                     ^~~~~~~~~

C:/trusted-firmware-m/platform/ext/common/tfm_hal_nvic.c:21:21: note: each undeclared identifier is reported only once for each function it appears in

C:/trusted-firmware-m/platform/ext/common/tfm_hal_nvic.c:21:31: error: expected ')' before 'irq_num'

   21 |     NVIC_EnableIRQ((IRQn_Type)irq_num);

      |                   ~           ^~~~~~~

      |                               )

C:/trusted-firmware-m/platform/ext/common/tfm_hal_nvic.c: In function 'tfm_hal_irq_disable':

C:/trusted-firmware-m/platform/ext/common/tfm_hal_nvic.c:28:5: warning: implicit declaration of function 'NVIC_DisableIRQ' [-Wimplicit-function-declaration]

   28 |     NVIC_DisableIRQ((IRQn_Type)irq_num);

      |     ^~~~~~~~~~~~~~~

C:/trusted-firmware-m/platform/ext/common/tfm_hal_nvic.c:28:22: error: 'IRQn_Type' undeclared (first use in this function)

   28 |     NVIC_DisableIRQ((IRQn_Type)irq_num);

      |                      ^~~~~~~~~

C:/trusted-firmware-m/platform/ext/common/tfm_hal_nvic.c:28:32: error: expected ')' before 'irq_num'

   28 |     NVIC_DisableIRQ((IRQn_Type)irq_num);

      |                    ~           ^~~~~~~

      |                                )

C:/trusted-firmware-m/platform/ext/common/tfm_hal_nvic.c: In function 'tfm_hal_irq_clear_pending':

C:/trusted-firmware-m/platform/ext/common/tfm_hal_nvic.c:35:5: warning: implicit declaration of function 'NVIC_ClearPendingIRQ' [-Wimplicit-function-declaration]

   35 |     NVIC_ClearPendingIRQ((IRQn_Type)irq_num);

      |     ^~~~~~~~~~~~~~~~~~~~

C:/trusted-firmware-m/platform/ext/common/tfm_hal_nvic.c:35:27: error: 'IRQn_Type' undeclared (first use in this function)

   35 |     NVIC_ClearPendingIRQ((IRQn_Type)irq_num);

      |                           ^~~~~~~~~

C:/trusted-firmware-m/platform/ext/common/tfm_hal_nvic.c:35:37: error: expected ')' before 'irq_num'

   35 |     NVIC_ClearPendingIRQ((IRQn_Type)irq_num);