From 9f68daeafd7b662c96d6fdf61c83222248e3ed9f Mon Sep 17 00:00:00 2001 From: Georgios Vasilakis Date: Mon, 5 Aug 2024 11:55:00 +0200 Subject: [PATCH] [nrf noup] platform: nordic_nrf: Fix SPU include for 54l fixup! [nrf noup] platform: nordic_nrf: Add support for 54l Include the SPU header for the NRF54L which it does not have the define NRF_SPU. Signed-off-by: Georgios Vasilakis --- .../common/core/cmsis_drivers/Driver_USART.c | 2 +- .../nordic_nrf/common/core/target_cfg.c | 25 ++++--------------- 2 files changed, 6 insertions(+), 21 deletions(-) diff --git a/platform/ext/target/nordic_nrf/common/core/cmsis_drivers/Driver_USART.c b/platform/ext/target/nordic_nrf/common/core/cmsis_drivers/Driver_USART.c index bf2ca6852..1f10862c3 100644 --- a/platform/ext/target/nordic_nrf/common/core/cmsis_drivers/Driver_USART.c +++ b/platform/ext/target/nordic_nrf/common/core/cmsis_drivers/Driver_USART.c @@ -28,7 +28,7 @@ #define ARRAY_SIZE(arr) (sizeof(arr)/sizeof(arr[0])) #endif -#if !(DOMAIN_NS == 1U) && defined(CONFIG_TFM_LOG_SHARE_UART) && defined(NRF_SPU) +#if !(DOMAIN_NS == 1U) && defined(CONFIG_TFM_LOG_SHARE_UART) && (defined(NRF_SPU) || defined(NRF_SPU00)) #define SPU_CONFIGURE_UART #include #endif diff --git a/platform/ext/target/nordic_nrf/common/core/target_cfg.c b/platform/ext/target/nordic_nrf/common/core/target_cfg.c index aa312858e..9c40e780b 100644 --- a/platform/ext/target/nordic_nrf/common/core/target_cfg.c +++ b/platform/ext/target/nordic_nrf/common/core/target_cfg.c @@ -872,6 +872,9 @@ enum tfm_plat_err_t init_debug(void) return TFM_PLAT_ERR_SUCCESS; } +#define NRF_UARTE_INSTANCE(id) NRF_UARTE ## id +#define NRF_UARTE_INSTANCE_GET(id) NRF_UARTE_INSTANCE(id) + /*----------------- NVIC interrupt target state to NS configuration ----------*/ enum tfm_plat_err_t nvic_interrupt_target_state_cfg(void) { @@ -893,26 +896,8 @@ enum tfm_plat_err_t nvic_interrupt_target_state_cfg(void) #endif #ifdef SECURE_UART1 -#if NRF_SECURE_UART_INSTANCE == 0 - /* UARTE0 is a secure peripheral, so its IRQ has to target S state */ - NVIC_ClearTargetState(NRFX_IRQ_NUMBER_GET(NRF_UARTE0)); -#elif NRF_SECURE_UART_INSTANCE == 1 - /* UARTE1 is a secure peripheral, so its IRQ has to target S state */ - NVIC_ClearTargetState(NRFX_IRQ_NUMBER_GET(NRF_UARTE1)); -#elif NRF_SECURE_UART_INSTANCE == 30 - /* UARTE30 is a secure peripheral, so its IRQ has to target S state */ - NVIC_ClearTargetState(NRFX_IRQ_NUMBER_GET(NRF_UARTE30)); -#elif NRF_SECURE_UART_INSTANCE == 00 - NVIC_ClearTargetState(NRFX_IRQ_NUMBER_GET(NRF_UARTE00)); -#elif NRF_SECURE_UART_INSTANCE == 20 - NVIC_ClearTargetState(NRFX_IRQ_NUMBER_GET(NRF_UARTE20)); -#elif NRF_SECURE_UART_INSTANCE == 21 - NVIC_ClearTargetState(NRFX_IRQ_NUMBER_GET(NRF_UARTE21)); -#elif NRF_SECURE_UART_INSTANCE == 22 - NVIC_ClearTargetState(NRFX_IRQ_NUMBER_GET(NRF_UARTE22)); -#elif NRF_SECURE_UART_INSTANCE == 30 - NVIC_ClearTargetState(NRFX_IRQ_NUMBER_GET(NRF_UARTE30)); -#endif + /* IRQ for the selected secure UART has to target S state */ + NVIC_ClearTargetState(NRFX_IRQ_NUMBER_GET(NRF_UARTE_INSTANCE_GET(NRF_SECURE_UART_INSTANCE))); #endif return TFM_PLAT_ERR_SUCCESS;