58typedef enum : uint16_t {
66typedef enum : uint32_t {
72typedef enum : uint8_t {
78typedef enum : uint32_t {
84typedef enum : uint8_t {
150 __asm__
volatile(
"wfi");
203 uint32_t cpuclk0_hz = 0U;
266#ifndef RA8_OFF_TARGET
326 const uint16_t first_halfwd = *insn;
349 __asm__
volatile(
"tst lr, #4 \n"
354 "bl internal_mpu_simple_fault_recover \n"
void main(void)
Secure fallback main entry point.
static volatile uint8_t s_fault_pending
Set non-zero by the recovering MemManage handler so the main loop can emit the user-visible "fault ha...
static ra8_err_t internal_mpu_simple_probe(void)
Probe the RO region with a write – expected to fault on silicon.
static void internal_mpu_simple_emit_banner(void)
Emit the banner once after the recovering handler fires.
void MemManage_Handler(void)
static void internal_mpu_simple_setup_or_halt(void)
Bring CGC + SysTick + LEDs + the SCI8 console UART up.
volatile uint32_t g_mpu_simple_fault_count
HIL diagnostic counter – incremented by the recovering MemManage handler every time the deliberate RO...
@ k_mpu_simple_mair0_word
Slot 0 = Normal WB RW-allocate.
@ k_mpu_simple_region_size
Smallest legal Armv8-M MPU region.
mpu_simple_frame_t
Stacked-frame layout for an Armv8-M exception entry (no FP).
@ k_mpu_simple_frame_pc_idx
r0..r3, r12, lr, PC, xPSR.
static const ra8_mpu_region_t s_regions[]
One-region RO descriptor covering s_ro_buffer.
static uint8_t s_ro_buffer[k_mpu_simple_region_size]
32-byte aligned scratch buffer the RO region will cover.
thumb_decode_t
Thumb-2 first-halfword decode constants.
@ k_thumb2_prefix_11110
32-bit Thumb-2 first-halfword prefix 0b11110.
@ k_thumb2_prefix_11111
32-bit Thumb-2 first-halfword prefix 0b11111.
@ k_thumb2_prefix_11101
32-bit Thumb-2 first-halfword prefix 0b11101.
@ k_thumb_hi5_shift
Shift to the top 5 bits of the halfword.
@ k_thumb_hi5_mask
Mask for the top 5 bits.
mpu_simple_timing_t
Heartbeat cadence + UART line rate.
@ k_mpu_simple_period_ms
MPU simple period ms.
@ k_mpu_simple_baud
MPU simple baud.
static void internal_mpu_simple_panic_halt(void)
Park the CPU after a fatal UART, clock, LED, or MPU setup failure.
volatile uint32_t g_mpu_simple_match
HIL liveness counter – incremented by main() on every loop iteration after the RO probe + fault-recov...
mpu_simple_attr_t
MAIR slot encoding + probe sentinel.
@ k_mpu_simple_attr_normal_wb
MPU simple attr normal wb.
@ k_mpu_simple_probe_byte
Sentinel byte written by internal_mpu_simple_probe.
static const uint8_t s_mpu_simple_banner[]
Greeting line for the "fault handled" banner.
static void internal_mpu_simple_fault_recover(uint32_t *frame)
Recovering MemManage handler.
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_led_toggle(ra8_board_led_id_t led)
Toggle led's output state.
ra8_err_t ra8_board_led_init(ra8_board_led_id_t led)
Configure led as a digital output, initial level low (off).
ra8_err_t ra8_board_led_on(ra8_board_led_id_t led)
Drive led HIGH (light it).
@ k_ra8_board_led2
LED2, GREEN, P303 (jumper E26).
@ k_ra8_board_led1
LED1, BLUE, P600 (jumper E27).
@ k_ra8_board_led3
LED3, RED, PA07 (jumper E28).
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_get_clock_hz(ra8_clock_id_t id, uint32_t *out_hz)
Query the current frequency of a clock-tree domain.
@ k_ra8_clock_id_cpuclk0
Cortex-M85 CPUCLK0.
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.
@ k_ra8_err_hw_error
Generic hardware fault detected (error flag set, fault interrupt).
ra8_err_codes_t ra8_err_t
Canonical error-return type used by every ra8-firmware API.
NVIC + ICU IELSR allocator.
void ra8_isr_globals_enable(void)
Globally enable maskable interrupts (PRIMASK = 0).
Cortex-M85 Memory Protection Unit (MPU) configuration helper.
@ k_ra8_mpu_perm_ro
Read-only at this privilege level.
ra8_err_t ra8_mpu_configure(const ra8_mpu_cfg_t *cfg)
Program every MPU region from a static configuration.
@ k_ra8_mpu_attr_idx_0
MAIR0 byte 0.
@ k_ra8_mpu_share_inner
Inner shareable.
static ra8_power_profile_config_t s_cfg
Cached copy of the caller-supplied configuration.
SysTick-based tick counter, delay and timestamp helpers.
ra8_err_t ra8_time_init(uint32_t cpu_hz)
Initialise SysTick for a 1 kHz tick interrupt.
void ra8_delay_ms(uint32_t ms)
Busy-wait for at least ms milliseconds.
Whole-MPU static configuration block.
Static descriptor for one Armv8-M MPU region.