ra8-firmware 0.1.0
Bare-metal firmware for the Renesas RA8 family (RA8D2 / RA8P1)
Loading...
Searching...
No Matches
ra8_exception_last_t Struct Reference

Fixed-SRAM post-mortem snapshot of the most recent fault or NMI. More...

#include <ra8_exception.h>

Collaboration diagram for ra8_exception_last_t:

Data Fields

uint32_t magic
 k_ra8_exc_magic_valid when valid.
uint32_t exc_number
 Architectural exception number.
ra8_exception_frame_t frame
 Stacked GPR frame.
ra8_exception_diagnostics_t diag
 SCB fault-status snapshot.
uintptr_t frame_ptr
 Raw stack pointer at entry.
uint32_t nmisr
 ICU NMISR cause (NMI path only).

Detailed Description

Fixed-SRAM post-mortem snapshot of the most recent fault or NMI.

Populated unconditionally at the very top of ra8_exception_report() BEFORE any function call that might itself fault (logging, ITM access, etc.). A debugger can recover the original-fault PC, LR, SP, frame pointer, SCB diagnostics, and (for NMIs) the ICU NMISR cause from this struct even when the log backend is unavailable or causes a secondary fault.

Invariant
magic == k_ra8_exc_magic_valid only after every other field has been written for the current event.
nmisr is non-zero only for records written through ra8_exception_report_nmi() (a hardware NMISR of zero is indistinguishable from "not an NMI" by design – check exc_number == 2 for the event class).
// Debugger / post-mortem usage:
// (gdb) print g_ra8_exception_last
// magic 0xFA17DEAD => trust frame/diag; exc_number names the class.
See also
ra8_exception_report()
ra8_exception_report_nmi()
Since
0.1.0

Definition at line 135 of file ra8_exception.h.

Field Documentation

◆ diag

ra8_exception_diagnostics_t ra8_exception_last_t::diag

SCB fault-status snapshot.

Definition at line 139 of file ra8_exception.h.

Referenced by fc_make_synth().

◆ exc_number

uint32_t ra8_exception_last_t::exc_number

Architectural exception number.

Definition at line 137 of file ra8_exception.h.

Referenced by fc_make_synth(), fc_print_record(), and main().

◆ frame

ra8_exception_frame_t ra8_exception_last_t::frame

Stacked GPR frame.

Definition at line 138 of file ra8_exception.h.

Referenced by fc_make_synth(), fc_print_record(), and main().

◆ frame_ptr

uintptr_t ra8_exception_last_t::frame_ptr

Raw stack pointer at entry.

Definition at line 140 of file ra8_exception.h.

◆ magic

uint32_t ra8_exception_last_t::magic

k_ra8_exc_magic_valid when valid.

Definition at line 136 of file ra8_exception.h.

Referenced by fc_make_synth().

◆ nmisr

uint32_t ra8_exception_last_t::nmisr

ICU NMISR cause (NMI path only).

Definition at line 141 of file ra8_exception.h.


The documentation for this struct was generated from the following file: