|
ra8-firmware 0.1.0
Bare-metal firmware for the Renesas RA8 family (RA8D2 / RA8P1)
|
Default implementation of the fatal-error sink. More...
Go to the source code of this file.
Functions | |
| static void | internal_disable_irq (void) |
| Architectural __disable_irq: PRIMASK write. | |
| static void | internal_bkpt (void) |
| Architectural __BKPT(0) wrapper. | |
| static void | internal_wfi (void) |
| Architectural __WFI wrapper used inside the halt loop. | |
| void | ra8_fatal_error (const char *tag, const char *message, uint32_t err) |
| Fatal-error trap: log and halt the system. | |
Default implementation of the fatal-error sink.
Default implementation of ra8_fatal_error(). This function is called for every assertion failure and every failed RA8_ERROR_CHECK. It:
The function is marked __attribute__((weak)) so that field builds can override it to trigger a watchdog reset or a safety-halt recovery sequence without editing this file.
Definition in file ra8_error_handler.c.
|
inlinestatic |
Architectural __BKPT(0) wrapper.
bkpt #0 halts execution when a debugger is attached. Without a debugger the instruction faults to the HardFault handler, which is acceptable – by the time we reach this function we have already decided that continuing is unsafe.
Definition at line 76 of file ra8_error_handler.c.
References RA8_INTERNAL.
Referenced by ra8_fatal_error().
|
inlinestatic |
Architectural __disable_irq: PRIMASK write.
Inline assembly that sets PRIMASK.PM, masking every maskable interrupt at the NVIC level. Kept as a static inline here so ra8_error_handler.c does not pull in a full CMSIS dependency – it is intentionally self-contained so a failure in CMSIS init cannot prevent the fault handler from running.
Definition at line 51 of file ra8_error_handler.c.
References RA8_INTERNAL.
Referenced by ra8_fatal_error().
|
inlinestatic |
Architectural __WFI wrapper used inside the halt loop.
Issues a wfi so the CPU drops into sleep until the next exception. Used inside the post-fault halt loop so the MCU is not burning power spinning.
The whole definition – not just its body – sits inside the on-target guard because the sole call site is the firmware halt loop below, which is itself compiled only off the fake path. A host build that kept an empty definition would carry a function nothing calls, which -Wunused-function reports.
Definition at line 106 of file ra8_error_handler.c.
References RA8_INTERNAL.
Referenced by ra8_fatal_error().
| void ra8_fatal_error | ( | const char * | tag, |
| const char * | message, | ||
| uint32_t | err ) |
Fatal-error trap: log and halt the system.
Report a fatal error, log it, and halt.
Disables interrupts, emits a best-effort error line plus the numeric err code, then traps via BKPT and an infinite loop (or __builtin_trap on the off-target host so unit tests fail loudly instead of spinning forever).
| [in] | tag | NUL-terminated module/component tag. |
| [in] | message | NUL-terminated short failure description. |
| [in] | err | Numeric error code (typically a ra8_err_t value). |
Definition at line 133 of file ra8_error_handler.c.
References internal_bkpt(), internal_disable_irq(), internal_wfi(), ra8_log_error, and ra8_log_error_val.
Referenced by _sbrk().