49#define RA8_EXCEPTION_HALT(tag, msg, exc) ra8_fatal_error((tag), (msg), (exc))
52#define RA8_EXCEPTION_HALT(tag, msg, exc) \
57 internal_exception_halt_loop(); \
65typedef enum : uint32_t {
160#ifndef RA8_OFF_TARGET
182 __asm__
volatile(
"cpsid i" :::
"memory");
184 __asm__
volatile(
"wfi");
222 if (frame !=
nullptr) {
280 if (frame !=
nullptr) {
Annotation-attribute framework macros for ra8-firmware.
#define RA8_INTERNAL
Marker that a function is intended to be static (file-local).
@ k_ra8_ok
Success – operation completed with all postconditions satisfied.
Centralised fatal-error sink.
void ra8_exception_set_persist_hook(ra8_exception_persist_fn hook)
Implementation of ra8_exception_set_persist_hook() – store the sink pointer.
void ra8_exception_report_nmi(const ra8_exception_frame_t *frame, uint32_t nmisr)
Implementation of ra8_exception_report_nmi() – stage the ICU cause, then chain.
static ra8_exception_persist_fn s_ra8_exception_persist
Registered post-decode persistence sink, or nullptr when disarmed.
static void internal_exception_halt_loop(void)
Spin halt with a known PC at a named symbol.
ra8_exc_num_t
Architectural exception numbers this module special-cases.
@ k_ra8_exc_num_nmi
NMI vector slot – carries an ICU NMISR cause.
static void internal_log_fault_dump(const ra8_exception_frame_t *frame, uint32_t exc_number, const ra8_exception_diagnostics_t *diag, uint32_t nmisr)
Best-effort log dump of a captured fault record.
void ra8_exception_capture_diagnostics(ra8_exception_diagnostics_t *out)
Implementation of ra8_exception_capture_diagnostics() – routes the SCB fault-status read through the ...
static volatile uint32_t s_ra8_exception_nmi_stage
NMISR cause staged by ra8_exception_report_nmi() for the record.
void ra8_exception_report(const ra8_exception_frame_t *frame, uint32_t exc_number)
Implementation of ra8_exception_report() – fault dump + halt.
#define RA8_EXCEPTION_HALT(tag, msg, exc)
RA8 EXCEPTION HALT.
Cortex-M85 CPU exception diagnostic helpers.
void(* ra8_exception_persist_fn)(const volatile ra8_exception_last_t *decoded)
Post-decode persistence sink invoked once the snapshot is complete.
@ 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.
Lightweight Logging Interface for ra8-firmware.
#define ra8_log_error_val(tag, message, value)
RA8 log error val.
Cortex-M85 System Control Block: VTOR relocation + fault-status decode.
ra8_err_t ra8_scb_read_fault_status(ra8_scb_fault_status_t *out)
Read the Cortex-M85 SCB fault-status registers into one struct.
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.
One snapshot of the Cortex-M85 SCB fault-status registers.
uint32_t mmfar
MemManage Fault Address Register (if CFSR.MMARVALID).
uint32_t dfsr
Debug Fault Status Register.
uint32_t hfsr
HardFault Status Register.
uint32_t afsr
Auxiliary Fault Status Register.
uint32_t cfsr
Configurable Fault Status Register (MMFSR|BFSR|UFSR).
uint32_t sfsr
SecureFault Status Register (Secure-banked, RAZ NS).
uint32_t bfar
BusFault Address Register (if CFSR.BFARVALID).
uint32_t sfar
SecureFault Address Register (if SFSR.SFARVALID).