ra8-firmware 0.1.0
Bare-metal firmware for the Renesas RA8 family (RA8D2 / RA8P1)
Loading...
Searching...
No Matches
ra8_exception.h
Go to the documentation of this file.
1
37
38#pragma once
39
40#ifdef __cplusplus
41extern "C" {
42#endif
43
44#include <stdint.h>
45
56typedef struct {
57 uint32_t r0;
58 uint32_t r1;
59 uint32_t r2;
60 uint32_t r3;
61 uint32_t r12;
62 uint32_t lr;
63 uint32_t pc;
64 uint32_t xpsr;
66
79typedef struct {
80 uint32_t cfsr;
81 uint32_t hfsr;
82 uint32_t dfsr;
83 uint32_t bfar;
84 uint32_t mmfar;
85 uint32_t afsr;
86 uint32_t sfsr;
87 uint32_t sfar;
89
102typedef enum : uint32_t {
103 k_ra8_exc_magic_valid = 0xFA17DEADUL,
105
143
158
178typedef void (*ra8_exception_persist_fn)(const volatile ra8_exception_last_t* decoded);
179
204
219
233[[noreturn]] void ra8_exception_report(const ra8_exception_frame_t* frame, uint32_t exc_number);
234
277[[noreturn]] void ra8_exception_report_nmi(const ra8_exception_frame_t* frame, uint32_t nmisr);
278
279#ifdef __cplusplus
280}
281#endif
void ra8_exception_set_persist_hook(ra8_exception_persist_fn hook)
Register (or clear) the post-decode fault-persistence hook.
void ra8_exception_report_nmi(const ra8_exception_frame_t *frame, uint32_t nmisr)
Report an NMI with its ICU cause register, then halt.
void ra8_exception_capture_diagnostics(ra8_exception_diagnostics_t *out)
Read the current SCB fault-status registers.
void(* ra8_exception_persist_fn)(const volatile ra8_exception_last_t *decoded)
Post-decode persistence sink invoked once the snapshot is complete.
ra8_exception_magic_t
Sentinel marking a fully-written g_ra8_exception_last snapshot.
@ k_ra8_exc_magic_valid
Snapshot is fully populated.
volatile ra8_exception_last_t g_ra8_exception_last
The one fixed-SRAM ra8_exception_last_t snapshot instance.
void ra8_exception_report(const ra8_exception_frame_t *frame, uint32_t exc_number)
Emit a full fault dump over the log backend.
SCB fault-status register snapshot.
uint32_t dfsr
Debug Fault Status Register.
uint32_t sfar
SecureFault Address Reg (if SFSR.SFARVALID).
uint32_t hfsr
HardFault Status Register.
uint32_t bfar
BusFault Address Register (if BFARVALID).
uint32_t sfsr
SecureFault Status Register (RAZ from NS).
uint32_t afsr
Auxiliary Fault Status Register.
uint32_t cfsr
Configurable Fault Status Register.
uint32_t mmfar
MemManage Fault Address Reg (if MMARVALID).
Stacked registers pushed by the Cortex-M exception entry.
uint32_t r1
General-purpose register R1.
uint32_t xpsr
Program status register.
uint32_t r0
General-purpose register R0.
uint32_t pc
Program counter at fault.
uint32_t r12
Scratch register R12.
uint32_t lr
Link register (return addr).
uint32_t r2
General-purpose register R2.
uint32_t r3
General-purpose register R3.
Fixed-SRAM post-mortem snapshot of the most recent fault or NMI.
uint32_t magic
k_ra8_exc_magic_valid when valid.
uintptr_t frame_ptr
Raw stack pointer at entry.
uint32_t nmisr
ICU NMISR cause (NMI path only).
uint32_t exc_number
Architectural exception number.
ra8_exception_diagnostics_t diag
SCB fault-status snapshot.
ra8_exception_frame_t frame
Stacked GPR frame.