lynxis lazus has uploaded this change for review.

View Change

sysmoOCTSIM: define own IRQ handlers

Previous: In case of an fault, nmi or an uncatched IRQ, the OCTSIM
would go into a while(1) loop and would require a power cycle.
Use a generic panic handler

Change-Id: If8476fd4a784312a0597ddd0b7eb54a7ebf94868
---
M sysmoOCTSIM/main.c
1 file changed, 36 insertions(+), 2 deletions(-)

git pull ssh://gerrit.osmocom.org:29418/osmo-ccid-firmware refs/changes/25/42225/1
diff --git a/sysmoOCTSIM/main.c b/sysmoOCTSIM/main.c
index e641822..1c424b0 100644
--- a/sysmoOCTSIM/main.c
+++ b/sysmoOCTSIM/main.c
@@ -41,7 +41,11 @@

volatile bool break_on_panic = false;

-static void panic_handler(const char *fmt, va_list args)
+/* To have the panic handler as simple as possible to also call
+ * in cases of stack overflow, etc, have a _panic_handler() with
+ * no arguments.
+ */
+static inline void _panic_handler(void)
{
if (break_on_panic) {
__asm("BKPT #0"); /* wait for JTAG/SWD */
@@ -51,10 +55,40 @@
}
}

+static void panic_handler(const char *fmt, va_list args)
+{
+ _panic_handler();
+}
+
+/* Use functions to have the fault type available in the backtrace. */
+void NonMaskableInt_Handler(void)
+{
+ _panic_handler();
+}
+
+void HardFault_Handler(void)
+{
+ _panic_handler();
+}
+
+void BusFault_Handler(void)
+{
+ _panic_handler();
+}
+
+void UsageFault_Handler(void)
+{
+ _panic_handler();
+}
+
+void Fallback_Handler(void)
+{
+ _panic_handler();
+}
+
extern struct ccid_slot_ops iso_fsm_slot_ops;
static struct ccid_instance g_ci;

-
static void ccid_app_init(void);

static void board_init(void)

To view, visit change 42225. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-MessageType: newchange
Gerrit-Project: osmo-ccid-firmware
Gerrit-Branch: master
Gerrit-Change-Id: If8476fd4a784312a0597ddd0b7eb54a7ebf94868
Gerrit-Change-Number: 42225
Gerrit-PatchSet: 1
Gerrit-Owner: lynxis lazus <lynxis@fe80.eu>