platform: nordic_nrf: Use the correct SPU_IRQHandler
There is a build system bug where the wrong IRQ handler is used for
the SPU.
trusted-firmware-m/platform/ext/target/nordic_nrf/common/core/faults.c
defines the symbol SPU_IRQHandler.
And the intention is for this to be used.
But the linker never checks faults.c for undefined symbols because it
already has a weak symbol for SPU_IRQHandler from the startup file to
satisfy itself.
For the weak symbol to work properly faults.c needs to be linked into
the build either because it provides some symbol that is undefined, or
through the use of --whole-archive as Zephyr does.
Until TF-M uses --whole-archive, weak symbols will not work as
intended.
Change-Id: Ifd3a67ac2276fa8d7ceec29482f8cec12b2cac64
Signed-off-by: Sebastian Bøe <sebastian.boe@nordicsemi.no>
diff --git a/platform/ext/target/nordic_nrf/common/core/startup.h b/platform/ext/target/nordic_nrf/common/core/startup.h
index 0afa58a..239e37f 100644
--- a/platform/ext/target/nordic_nrf/common/core/startup.h
+++ b/platform/ext/target/nordic_nrf/common/core/startup.h
@@ -28,6 +28,8 @@
__NO_RETURN void Reset_Handler(void);
+void SPU_IRQHandler(void);
+
/*
* The default irq handler is used as a backup in case of
* misconfiguration.
diff --git a/platform/ext/target/nordic_nrf/common/nrf5340/gcc/startup_nrf5340.c b/platform/ext/target/nordic_nrf/common/nrf5340/gcc/startup_nrf5340.c
index cae5dac..a8062e3 100644
--- a/platform/ext/target/nordic_nrf/common/nrf5340/gcc/startup_nrf5340.c
+++ b/platform/ext/target/nordic_nrf/common/nrf5340/gcc/startup_nrf5340.c
@@ -51,7 +51,6 @@
DEFAULT_IRQ_HANDLER(FPU_IRQHandler)
DEFAULT_IRQ_HANDLER(CACHE_IRQHandler)
-DEFAULT_IRQ_HANDLER(SPU_IRQHandler)
DEFAULT_IRQ_HANDLER(CLOCK_POWER_IRQHandler)
DEFAULT_IRQ_HANDLER(SERIAL0_IRQHandler)
DEFAULT_IRQ_HANDLER(SERIAL1_IRQHandler)
@@ -91,6 +90,10 @@
DEFAULT_IRQ_HANDLER(KMU_IRQHandler)
DEFAULT_IRQ_HANDLER(CRYPTOCELL_IRQHandler)
+#if defined(DOMAIN_NS) || defined(BL2)
+DEFAULT_IRQ_HANDLER(SPU_IRQHandler)
+#endif
+
#if defined ( __GNUC__ )
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wpedantic"
diff --git a/platform/ext/target/nordic_nrf/common/nrf91/gcc/startup_nrf91.c b/platform/ext/target/nordic_nrf/common/nrf91/gcc/startup_nrf91.c
index 581e1c4..5575654 100644
--- a/platform/ext/target/nordic_nrf/common/nrf91/gcc/startup_nrf91.c
+++ b/platform/ext/target/nordic_nrf/common/nrf91/gcc/startup_nrf91.c
@@ -46,7 +46,6 @@
DEFAULT_IRQ_HANDLER(PendSV_Handler)
DEFAULT_IRQ_HANDLER(SysTick_Handler)
-DEFAULT_IRQ_HANDLER(SPU_IRQHandler)
DEFAULT_IRQ_HANDLER(CLOCK_POWER_IRQHandler)
DEFAULT_IRQ_HANDLER(UARTE0_SPIM0_SPIS0_TWIM0_TWIS0_IRQHandler)
DEFAULT_IRQ_HANDLER(UARTE1_SPIM1_SPIS1_TWIM1_TWIS1_IRQHandler)
@@ -78,6 +77,10 @@
DEFAULT_IRQ_HANDLER(KMU_IRQHandler)
DEFAULT_IRQ_HANDLER(CRYPTOCELL_IRQHandler)
+#if defined(DOMAIN_NS) || defined(BL2)
+DEFAULT_IRQ_HANDLER(SPU_IRQHandler)
+#endif
+
#if defined ( __GNUC__ )
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wpedantic"