platform: nordic_nrf: Use aliased default IRQ handlers

Currently we are generating dozens of default IRQ Handlers that each
just spin. In sum, 256 bytes of IRQ handlers that do nothing.

In this patch we save these bytes by using the alias attribute.

Now there is only one default IRQ handler placed in flash and all the
default IRQ handlers alias to it.

I tried to place the duplicated default_tfm_IRQHandler in the common
startup.c, but it did not work. I am not certain, but I think this is
due to a problem with the way we link in TF-M.

Change-Id: Ifd3a67ac2276fa8d7ceec29482f8cec02b2cbd54
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 d117847..873361d 100644
--- a/platform/ext/target/nordic_nrf/common/core/startup.h
+++ b/platform/ext/target/nordic_nrf/common/core/startup.h
@@ -24,10 +24,7 @@
 void __PROGRAM_START(void) __NO_RETURN;
 
 #define DEFAULT_IRQ_HANDLER(handler_name)  \
-void __WEAK handler_name(void) __NO_RETURN; \
-void handler_name(void) { \
-    while(1); \
-}
+__NO_RETURN void __attribute__((weak, alias("default_tfm_IRQHandler"))) handler_name(void);
 
 __NO_RETURN void Reset_Handler(void);
 
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 34dd99c..83a4c36 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
@@ -28,6 +28,10 @@
 #endif
 #include "startup.h"
 
+__NO_RETURN __attribute__((naked)) void default_tfm_IRQHandler(void) {
+    while(1);
+}
+
 DEFAULT_IRQ_HANDLER(NMI_Handler)
 DEFAULT_IRQ_HANDLER(HardFault_Handler)
 DEFAULT_IRQ_HANDLER(MemManage_Handler)
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 32be195..71a6b79 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
@@ -25,6 +25,10 @@
 #include "hw_init.h"
 #include "startup.h"
 
+__NO_RETURN __attribute__((naked)) void default_tfm_IRQHandler(void) {
+    while(1);
+}
+
 DEFAULT_IRQ_HANDLER(NMI_Handler)
 DEFAULT_IRQ_HANDLER(HardFault_Handler)
 DEFAULT_IRQ_HANDLER(MemManage_Handler)