lynxis lazus has uploaded this change for review.
Rework default IRQ handler and osmo panic handler
Don't break on panic by default. Using a variable allows
to set it by SWD or later by a usb message.
Use the same handler for osmo panics as well as unknown IRQ.
Including faults (bus, hard).
Change-Id: Ibcabe0c58ff14ebe76159470dd90fdef064febea
---
M sysmoOCTSIM/gcc/gcc/startup_same54.c
M sysmoOCTSIM/include/same54.h
M sysmoOCTSIM/main.c
3 files changed, 17 insertions(+), 4 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-ccid-firmware refs/changes/16/42616/1
diff --git a/sysmoOCTSIM/gcc/gcc/startup_same54.c b/sysmoOCTSIM/gcc/gcc/startup_same54.c
index 097a1c4..943c965 100644
--- a/sysmoOCTSIM/gcc/gcc/startup_same54.c
+++ b/sysmoOCTSIM/gcc/gcc/startup_same54.c
@@ -668,11 +668,18 @@
;
}
+volatile bool break_on_panic = false;
+
/**
* \brief Default interrupt handler for unused IRQs.
*/
void Dummy_Handler(void)
{
- while (1) {
+ if (break_on_panic)
+ __asm("BKPT #0"); /* wait for JTAG/SWD */
+ else {
+ NVIC_SystemReset();
+ while (1)
+ ;
}
}
diff --git a/sysmoOCTSIM/include/same54.h b/sysmoOCTSIM/include/same54.h
index 7da756e..c99d91f 100644
--- a/sysmoOCTSIM/include/same54.h
+++ b/sysmoOCTSIM/include/same54.h
@@ -47,4 +47,10 @@
#error Library does not support the specified device.
#endif
+#include <stdbool.h>
+
+/* Either reset or break on panic/unknown irq. Default is reset. */
+extern volatile bool break_on_panic;
+void Dummy_Handler(void);
+
#endif /* _SAME54_ */
diff --git a/sysmoOCTSIM/main.c b/sysmoOCTSIM/main.c
index 7873c86..02feeb6 100644
--- a/sysmoOCTSIM/main.c
+++ b/sysmoOCTSIM/main.c
@@ -38,9 +38,9 @@
#include "ccid_device.h"
#include "usb_descriptors.h"
-static void bdg_bkptpanic(const char *fmt, va_list args)
+static void panic_handler(const char *fmt, va_list args)
{
- __asm("BKPT #0");
+ Dummy_Handler();
}
extern struct ccid_slot_ops iso_fsm_slot_ops;
@@ -600,7 +600,7 @@
int main(void)
{
- osmo_set_panic_handler(&bdg_bkptpanic);
+ osmo_set_panic_handler(&panic_handler);
#if 0
CoreDebug->DEMCR |= CoreDebug_DEMCR_TRCENA_Msk ; //| /* tracing*/
////CoreDebug_DEMCR_MON_EN_Msk; /* mon interupt catcher */
To view, visit change 42616. To unsubscribe, or for help writing mail filters, visit settings.