Issue #18: Implement writing and reading boot status structure from backup RAM

This commit is contained in:
2020-09-05 16:32:31 +02:00
parent 7434554319
commit 3df0631ffc
3 changed files with 59 additions and 5 deletions

View File

@@ -21,6 +21,8 @@
#include <reflow-controller/oven-driver.h>
#include <reflow-controller/digio.h>
#include <reflow-controller/safety/fault.h>
#include <reflow-controller/safety/safety-memory.h>
#include <helper-macros/helper-macros.h>
void HardFault_Handler(void)
{
@@ -36,6 +38,8 @@ void HardFault_Handler(void)
void panic_mode(void)
{
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
*/
@@ -44,6 +48,11 @@ void panic_mode(void)
oven_driver_apply_power_level();
/* TODO: implement panic mode */
if (!safety_memory_get_boot_status(&boot_status)) {
boot_status.reset_from_panic = 0xFFFFFFFF;
(void)safety_memory_set_boot_status(&boot_status);
}
while (1);
}