|
ra8-firmware 0.1.0
Bare-metal firmware for the Renesas RA8 family (RA8D2 / RA8P1)
|
RA8D2 NMI handler – record the ICU cause instead of a bare trap. More...
#include <stdint.h>#include "ra8_attributes.h"#include "ra8_exception.h"#include "ra8_icu_regs.h"Go to the source code of this file.
Functions | |
| static void | internal_nmi_report (const ra8_exception_frame_t *frame) |
| Read the ICU NMI cause and hand off to the common fault record. | |
| void | NMI_Handler (void) |
| Cortex-M85 NMI handler (vector table slot 2). | |
RA8D2 NMI handler – record the ICU cause instead of a bare trap.
The RA8D2 funnels its non-maskable interrupt sources through the ICU: IWDT/WDT underflow or refresh error, the PVD1/PVD2 voltage monitors, main/sub oscillation-stop detection, the NMI pin, bus errors, common/local memory (SRAM ECC) errors, CPU lockup, FPU exception, MRAM MRC/MRE read errors, and the inter-processor NMI. Which sources reach the core is chosen in NMIER; the latched cause lives in NMISR.
Historically every per-app vector_table.c weak-aliased NMI_Handler to Default_Handler – a bare bkpt + wfi trap – so the single most safety-relevant interrupt on the chip (the watchdog biting, an ECC error, a brown-out) produced zero diagnostics. The strong handler in this file overrides that weak alias tree-wide, exactly the way the shared SecureFault_Handler does:
NMISR is deliberately NOT acknowledged (no NMICLR write): the handler never returns, and leaving the status latched preserves the evidence for a post-mortem debugger attach.
Definition in file nmi_exception.c.
|
static |
Read the ICU NMI cause and hand off to the common fault record.
Runs as the C half of the NMI trampoline below (external linkage is required for the asm tail-branch to name it). Reads NMISR exactly once and forwards it, with the interrupted context's stacked frame, into ra8_exception_report_nmi(). The register is read here – not in libs/ra8_core – because NMISR is an RA8D2 ICU register, outside the ARM-architectural scope of the core exception module.
| [in] | frame | Stacked exception frame the NMI entry pushed (selected MSP/PSP resident); forwarded verbatim. |
Definition at line 78 of file nmi_exception.c.
References ra8_exception_report_nmi(), and ra8_icu_nmisr().
| void NMI_Handler | ( | void | ) |
Cortex-M85 NMI handler (vector table slot 2).
Strong definition overriding the weak NMI_Handler alias in every per-app vector_table.c. Naked trampoline in the exact shape of the HardFault/MemManage/BusFault/UsageFault/SecureFault trampolines: tst lr, #4 selects the interrupted stack (MSP when EXC_RETURN[2] = 0, else PSP) into r0 and control tail-branches into internal_nmi_report(), which appends the ICU cause. Naked asm is required: only assembly can read EXC_RETURN and the banked stack pointers before the compiler touches any register.
Definition at line 109 of file nmi_exception.c.