57typedef enum : uint32_t {
64typedef enum : uintptr_t {
69typedef enum : uint32_t {
73static const uint8_t
s_msg_boot[] =
"fault-div0: boot\r\n";
74static const uint8_t
s_msg_fail[] =
"fault-div0: FAIL init\r\n";
75static const uint8_t
s_msg_armed[] =
"fault-div0: trap armed\r\n";
76static const uint8_t
s_msg_unarmed[] =
"fault-div0: FAIL trap not armed\r\n";
77static const uint8_t
s_msg_survived[] =
"fault-div0: survived divide quotient=";
78static const uint8_t
s_msg_emu_tail[] =
" (trap not modelled -- ra8_emulator)\r\n";
183 __asm__
volatile(
"bkpt #0");
185 __asm__
volatile(
"wfi");
206 k_fd_dec_digits = 10U,
208 uint8_t buf[k_fd_dec_digits];
214 while ((value > 0U) && (n < (uint32_t)k_fd_dec_digits)) {
215 buf[n] = (uint8_t)(
'0' + (value % (uint32_t)k_fd_dec_base));
217 value /= (uint32_t)k_fd_dec_base;
219 for (uint32_t i = 0U; i < n; i++) {
279 __asm__
volatile(
"wfi");
void main(void)
Secure fallback main entry point.
static const uint8_t s_msg_boot[]
Console marker emitted after core and peripheral setup.
static const uint8_t s_msg_fail[]
Diagnostic emitted when the VFS round-trip fails.
static void internal_setup_or_halt(void)
Bring up clocks, MSTP, delay timing, and the board console.
static void internal_panic_halt(void)
Park the core after an unrecoverable ADC demo failure.
static volatile uint32_t s_fd_dividend
Volatile numerator so the divide executes at run time.
static volatile uint32_t s_fd_divisor
Volatile zero divisor – the UDIV of this value must trap.
volatile uint32_t g_fd_heartbeat
Bumps forever in the survival idle loop – liveness for probes.
fd_scb_addr_t
ARMv8-M SCB register addresses this app reads.
@ k_fd_scb_ccr_addr
Configuration and Control Register.
fd_ccr_bits_t
CCR bits checked by the arming probe.
@ k_fd_ccr_div_0_trp
ARMv8-M CCR.DIV_0_TRP – divide-by-zero traps.
static void internal_print(const uint8_t *msg, uint32_t len)
Emit a byte run on the SCI8 console.
static const uint8_t s_msg_unarmed[]
static void internal_log_sink(void *ctx, uint8_t byte)
ra8_log byte sink: forward every log byte to the SCI8 console.
static const uint8_t s_msg_survived[]
static void internal_print_uint(uint32_t value)
Print a small unsigned integer in decimal (quotient display).
static const uint8_t s_msg_emu_tail[]
volatile uint32_t g_fd_quotient
Quotient observed when the trap did NOT fire (emulator survival path).
static const uint8_t s_msg_armed[]
fd_consts_t
Console + divide-test knobs (no magic numbers).
@ k_fd_dividend
Numerator for the guarded zero-divide.
@ k_fd_divisor
The zero divisor that must trap on silicon.
@ k_fd_uart_baud
SCI8 J-Link VCOM console baud.
Annotation-attribute framework macros for ra8-firmware.
#define RA8_INTERNAL
Marker that a function is intended to be static (file-local).
Board-support layer for the Renesas EK-RA8D2 v1 evaluation kit.
ra8_err_t ra8_board_uart_console_write(const uint8_t *data, size_t len)
Polled blocking write to the J-Link OB VCOM console.
ra8_err_t ra8_board_uart_console_init(uint32_t baud)
Configure SCI8 + PD02/PD03 as the debug-console UART.
Boot entry points shared between a vector table and its startup code.
High-level Clock Generation Circuit driver.
ra8_err_t ra8_cgc_init(void)
Configure the clock tree to a safe default.
Error Code Definitions for ra8-firmware.
@ k_ra8_ok
Success – operation completed with all postconditions satisfied.
NVIC + ICU IELSR allocator.
void ra8_isr_globals_enable(void)
Globally enable maskable interrupts (PRIMASK = 0).
Lightweight Logging Interface for ra8-firmware.
void ra8_log_set_byte_sink(ra8_log_byte_sink_fn_t fn, void *ctx)
Install (or clear) an optional byte sink for log output.
Ref-counted Module Stop Control wrapper for the RA8D2.
ra8_err_t ra8_mstp_init(void)
Re-establish the ra8_mstp ref-count table from current hardware state.