STM32 RTOS
0.2.3
Bare-metal preemptive RTOS for STM32F446RE
Toggle main menu visibility
Loading...
Searching...
No Matches
fault.h
Go to the documentation of this file.
1
20
#ifndef FAULT_H
21
#define FAULT_H
22
23
#include "
scb_reg.h
"
24
25
#include <stdbool.h>
26
#include <stdint.h>
27
32
34
typedef
struct
FaultRecord_t
35
{
36
uint32_t
exception
;
37
uint32_t
exc_return
;
38
uint32_t
cfsr
;
39
uint32_t
hfsr
;
40
uint32_t
mmfar
;
41
uint32_t
bfar
;
45
bool
frame_valid
;
46
uint32_t
r0
;
47
uint32_t
r1
;
48
uint32_t
r2
;
49
uint32_t
r3
;
50
uint32_t
r12
;
51
uint32_t
lr
;
52
uint32_t
pc
;
53
uint32_t
xpsr
;
54
}
FaultRecord_t
;
55
57
extern
FaultRecord_t
faultRecord
;
58
69
void
faultEnable
(
ScbRegisters_t
*scb);
70
84
void
faultCapture
(
FaultRecord_t
*record,
const
ScbRegisters_t
*scb,
const
uint32_t *frame,
85
uint32_t exc_return);
86
88
89
#endif
/* FAULT_H */
faultEnable
void faultEnable(ScbRegisters_t *scb)
Give MemManage, BusFault and UsageFault their own handlers, and trap integer division by zero.
Definition
fault.c:14
faultCapture
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.
Definition
fault.c:20
faultRecord
FaultRecord_t faultRecord
Filled by Fault_Handler; read it from the debugger.
Definition
fault.c:12
scb_reg.h
SCB and FPU context-control registers (PM0214, SCB and FPU chapters).
FaultRecord_t
What Fault_Handler saw.
Definition
fault.h:35
FaultRecord_t::bfar
uint32_t bfar
BFAR; the fault address only if CFSR.BFARVALID.
Definition
fault.h:41
FaultRecord_t::exception
uint32_t exception
ICSR.VECTACTIVE: 3 HardFault, 4 MemManage, 5 BusFault, 6 UsageFault.
Definition
fault.h:36
FaultRecord_t::lr
uint32_t lr
Stacked LR: the faulting function's return address.
Definition
fault.h:51
FaultRecord_t::r1
uint32_t r1
Stacked R1.
Definition
fault.h:47
FaultRecord_t::frame_valid
bool frame_valid
The registers below were read from the stacked frame.
Definition
fault.h:45
FaultRecord_t::pc
uint32_t pc
Stacked PC: the faulting instruction, or the next one for an imprecise fault.
Definition
fault.h:52
FaultRecord_t::mmfar
uint32_t mmfar
MMFAR; the fault address only if CFSR.MMARVALID.
Definition
fault.h:40
FaultRecord_t::xpsr
uint32_t xpsr
Stacked xPSR.
Definition
fault.h:53
FaultRecord_t::exc_return
uint32_t exc_return
LR on entry; bit 2 set means the frame is on PSP.
Definition
fault.h:37
FaultRecord_t::cfsr
uint32_t cfsr
CFSR: MMFSR (7:0), BFSR (15:8), UFSR (31:16).
Definition
fault.h:38
FaultRecord_t::r0
uint32_t r0
Stacked R0.
Definition
fault.h:46
FaultRecord_t::r2
uint32_t r2
Stacked R2.
Definition
fault.h:48
FaultRecord_t::r3
uint32_t r3
Stacked R3.
Definition
fault.h:49
FaultRecord_t::r12
uint32_t r12
Stacked R12.
Definition
fault.h:50
FaultRecord_t::hfsr
uint32_t hfsr
HFSR: FORCED means a configurable fault escalated.
Definition
fault.h:39
ScbRegisters_t
SCB register block.
Definition
scb_reg.h:41
drivers
inc
fault.h
Generated by
1.18.0