From: drowe67 Date: Tue, 9 Sep 2014 02:10:08 +0000 (+0000) Subject: added ring of death to trap and signal nasty errors, asserts, as an aid to debugging... X-Git-Url: http://git.whiteaudio.com/gitweb/?a=commitdiff_plain;h=9992a6f1768b25beed67696aade8232be540d313;p=freetel-svn-tracking.git added ring of death to trap and signal nasty errors, asserts, as an aid to debugging failure git-svn-id: https://svn.code.sf.net/p/freetel/code@1833 01035d8c-6547-0410-b346-abe4f91aad63 --- diff --git a/codec2-dev/stm32/inc/sm1000_leds_switches.h b/codec2-dev/stm32/inc/sm1000_leds_switches.h index 9b259c77..12542ce3 100644 --- a/codec2-dev/stm32/inc/sm1000_leds_switches.h +++ b/codec2-dev/stm32/inc/sm1000_leds_switches.h @@ -39,6 +39,6 @@ int switch_ptt(void); int switch_select(void); int switch_back(void); -void ColorfulRingOfDeath(void); +void ColorfulRingOfDeath(int code); #endif diff --git a/codec2-dev/stm32/src/sm1000_leds_switches.c b/codec2-dev/stm32/src/sm1000_leds_switches.c index 13ac803c..bb2ab801 100644 --- a/codec2-dev/stm32/src/sm1000_leds_switches.c +++ b/codec2-dev/stm32/src/sm1000_leds_switches.c @@ -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); }