42 #if USE_HARD_FAULT_RECOVERY
45 #define BCKP_SECTION ".ram5"
46 #define IN_BCKP_SECTION(var) var __attribute__ ((section(BCKP_SECTION), aligned(8)))
48 #error "No backup ram available"
50 IN_BCKP_SECTION(
volatile bool hard_fault);
57 CH_IRQ_HANDLER(HardFault_Handler)
63 CH_IRQ_HANDLER(NMI_Handler)
69 CH_IRQ_HANDLER(MemManage_Handler)
75 CH_IRQ_HANDLER(BusFault_Handler)
81 CH_IRQ_HANDLER(UsageFault_Handler)
87 bool recovering_from_hard_fault;
97 PRINT_CONFIG_MSG(
"We are running luftboot, the interrupt vector is being relocated.")
100 SCB_VTOR = 0x00004000;
103 SCB_VTOR = 0x00002000;
117 #if USE_HARD_FAULT_RECOVERY
120 RCC->AHB1ENR |= RCC_AHB1ENR_BKPSRAMEN;
121 PWR->CSR |= PWR_CSR_BRE;
122 while ((PWR->CSR & PWR_CSR_BRR) == 0) ;
126 recovering_from_hard_fault =
false;
127 if (!(RCC->CSR & RCC_CSR_SFTRSTF)) {
130 }
else if ((RCC->CSR & RCC_CSR_SFTRSTF) && !hard_fault) {
135 recovering_from_hard_fault =
true;
139 RCC->CSR = RCC_CSR_RMVF;
PRINT_CONFIG_MSG("USE_INS_NAV_INIT defaulting to TRUE")
Arch independent mcu ( Micro Controller Unit ) utilities.