added ring of death to trap and signal nasty errors, asserts, as an aid to debugging...
authordrowe67 <drowe67@01035d8c-6547-0410-b346-abe4f91aad63>
Tue, 9 Sep 2014 02:10:08 +0000 (02:10 +0000)
committerdrowe67 <drowe67@01035d8c-6547-0410-b346-abe4f91aad63>
Tue, 9 Sep 2014 02:10:08 +0000 (02:10 +0000)
git-svn-id: https://svn.code.sf.net/p/freetel/code@1833 01035d8c-6547-0410-b346-abe4f91aad63

codec2-dev/stm32/inc/sm1000_leds_switches.h
codec2-dev/stm32/src/sm1000_leds_switches.c

index 9b259c7723a335ba4cdab006cd2c5674bbf77205..12542ce360fd0ba856118631e33daf4e35eaabed 100644 (file)
@@ -39,6 +39,6 @@ int switch_ptt(void);
 int switch_select(void);
 int switch_back(void);
 
-void ColorfulRingOfDeath(void);
+void ColorfulRingOfDeath(int code);
 
 #endif
index 13ac803cb24c8f75e496003591c7d6f5e85c4055..bb2ab80108fef7bf18cb448053d79c84f6df502e 100644 (file)
@@ -116,11 +116,14 @@ int switch_back(void) {
   might help with debugging.
 */
 
-void ColorfulRingOfDeath(void) {
+int mycode; /* examine this with debugger if it dies */
+
+void ColorfulRingOfDeath(int code) {
+    mycode = code;
     uint16_t ring = 1;
     while (1) {
         uint32_t count = 0;
-        while (count++ < 500000);
+        while (count++ < 5000000);
 
         GPIOD->BSRRH = (ring << 12);
         ring = ring << 1;
@@ -130,3 +133,7 @@ void ColorfulRingOfDeath(void) {
         GPIOD->BSRRL = (ring << 12);
     }
 }
+void HardFault_Handler(void) { ColorfulRingOfDeath(1); }
+void MemManage_Handler(void) { ColorfulRingOfDeath(2); }
+void BusFault_Handler(void)  { ColorfulRingOfDeath(3); }
+void UsageFault_Handler(void){ ColorfulRingOfDeath(4); }