Restructure panic mode and hardfault calls
This commit is contained in:
parent
2f6590416d
commit
b619fc5600
@ -26,14 +26,16 @@
|
|||||||
|
|
||||||
void HardFault_Handler(void)
|
void HardFault_Handler(void)
|
||||||
{
|
{
|
||||||
/* This is a non recoverable fault. Hang here */
|
/* This is a non recoverable fault. Stop the oven */
|
||||||
|
|
||||||
oven_driver_set_power(0);
|
oven_driver_set_power(0);
|
||||||
oven_driver_apply_power_level();
|
oven_driver_apply_power_level();
|
||||||
|
|
||||||
|
/* Set the error led */
|
||||||
led_set(0, 1);
|
led_set(0, 1);
|
||||||
|
|
||||||
while (1);
|
/* Try the real panic mode */
|
||||||
|
panic_mode();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Overwrite default handler. Go to panic mode */
|
/* Overwrite default handler. Go to panic mode */
|
||||||
@ -44,12 +46,9 @@ void __int_default_handler(void)
|
|||||||
|
|
||||||
void panic_mode(void)
|
void panic_mode(void)
|
||||||
{
|
{
|
||||||
|
/* This variable is static, because I don't want it to be on the stack */
|
||||||
static struct safety_memory_boot_status IN_SECTION(.ccm.bss) boot_status;
|
static struct safety_memory_boot_status IN_SECTION(.ccm.bss) boot_status;
|
||||||
|
|
||||||
/* Panic mode is esentially the same as a hardfault,
|
|
||||||
* but it can be expected, that more functionality is still usable
|
|
||||||
*/
|
|
||||||
|
|
||||||
oven_driver_set_power(0);
|
oven_driver_set_power(0);
|
||||||
oven_driver_apply_power_level();
|
oven_driver_apply_power_level();
|
||||||
|
|
||||||
@ -59,6 +58,6 @@ void panic_mode(void)
|
|||||||
(void)safety_memory_set_boot_status(&boot_status);
|
(void)safety_memory_set_boot_status(&boot_status);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Let the watchdog do the rest */
|
||||||
while (1);
|
while (1);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user