|
STM32 RTOS 0.2.3
Bare-metal preemptive RTOS for STM32F446RE
|
Configurable fault enables and the fault record. More...
Data Structures | |
| struct | FaultRecord_t |
| What Fault_Handler saw. More... | |
Typedefs | |
| typedef struct FaultRecord_t | FaultRecord_t |
| What Fault_Handler saw. | |
Functions | |
| void | faultEnable (ScbRegisters_t *scb) |
| Give MemManage, BusFault and UsageFault their own handlers, and trap integer division by zero. | |
| void | faultCapture (FaultRecord_t *record, const ScbRegisters_t *scb, const uint32_t *frame, uint32_t exc_return) |
Fill record from the fault status registers and the stacked frame. | |
Variables | |
| FaultRecord_t | faultRecord |
| Filled by Fault_Handler; read it from the debugger. | |
| FaultRecord_t | faultRecord |
| Filled by Fault_Handler; read it from the debugger. | |
Configurable fault enables and the fault record.
| typedef struct FaultRecord_t FaultRecord_t |
What Fault_Handler saw.
All zero until the first fault.
| void faultEnable | ( | ScbRegisters_t * | scb | ) |
Give MemManage, BusFault and UsageFault their own handlers, and trap integer division by zero.
Sets SHCSR.MEMFAULTENA, BUSFAULTENA and USGFAULTENA, and CCR.DIV_0_TRP. Without the trap, SDIV/UDIV by zero quietly return 0. Other bits are kept.
| scb | SCB block (e.g. SCB). |
Definition at line 14 of file fault.c.
References ScbRegisters_t::CCR, faultEnable(), SCB_CCR_DIV_0_TRP, SCB_SHCSR_BUSFAULTENA, SCB_SHCSR_MEMFAULTENA, SCB_SHCSR_USGFAULTENA, and ScbRegisters_t::SHCSR.
Referenced by faultEnable().
| void faultCapture | ( | FaultRecord_t * | record, |
| const ScbRegisters_t * | scb, | ||
| const uint32_t * | frame, | ||
| uint32_t | exc_return ) |
Fill record from the fault status registers and the stacked frame.
Called by Fault_Handler with the frame from MSP or PSP, as EXC_RETURN bit 2 selects. The frame is read only if CFSR.MSTKERR and STKERR are clear: when stacking failed, the frame is missing and reading it could fault again inside HardFault, which locks up the core.
| record | Receives the record; every field is written. |
| scb | SCB block (e.g. SCB); read only, so the status bits stay set for the debugger. |
| frame | The stacked R0, R1, R2, R3, R12, LR, PC, xPSR, in that order. |
| exc_return | LR on handler entry. |
Definition at line 20 of file fault.c.
References ScbRegisters_t::BFAR, FaultRecord_t::bfar, ScbRegisters_t::CFSR, FaultRecord_t::cfsr, FaultRecord_t::exc_return, FaultRecord_t::exception, faultCapture(), FaultRecord_t::frame_valid, ScbRegisters_t::HFSR, FaultRecord_t::hfsr, ScbRegisters_t::ICSR, FaultRecord_t::lr, ScbRegisters_t::MMFAR, FaultRecord_t::mmfar, FaultRecord_t::pc, FaultRecord_t::r0, FaultRecord_t::r1, FaultRecord_t::r12, FaultRecord_t::r2, FaultRecord_t::r3, SCB_CFSR_MSTKERR, SCB_CFSR_STKERR, SCB_ICSR_VECTACTIVE_Msk, SCB_ICSR_VECTACTIVE_Pos, and FaultRecord_t::xpsr.
Referenced by faultCapture().
|
extern |
| FaultRecord_t faultRecord |