37typedef enum : uint32_t {
87typedef enum : uint32_t {
180typedef enum : uint32_t {
190 __asm__
volatile(
"wfi");
291 uint32_t cpuclk0_hz = 0U;
328 uint32_t jedec_id = 0U;
338 uint32_t counter = 0U;
340 uint32_t echoed = 0U;
342 if (err ==
k_ra8_ok && echoed == counter) {
void main(void)
Secure fallback main entry point.
volatile uint32_t g_fj_expander_err
Return code from the best-effort U15 Octo-SPI-active override.
static void flash_journal_setup_or_halt(void)
Run all init-time bring-up that must complete before the loop.
volatile uint32_t g_fj_last_echoed
Last counter value read back from flash.
fj_err_sentinel_t
Sentinel for g_fj_expander_err meaning "no error captured yet".
@ k_fj_err_none
Fj error none.
volatile uint32_t g_fj_last_step
Last round-trip step value (J-Link memprobe diagnostic).
static void flash_journal_panic_halt(void)
Park the CPU after a fatal init failure.
static uint32_t flash_journal_unpack(const uint8_t *rec)
Decode the counter from a 16-byte record.
flash_journal_const_t
Demo tunables.
@ k_journal_xspi_instance
Journal XSPI instance.
@ k_journal_record_bytes
Journal record bytes.
@ k_journal_record_addr
Journal record address.
@ k_journal_byte_mask
Journal byte mask.
@ k_journal_counter_bytes
Journal counter bytes.
@ k_journal_byte_shift
Journal byte shift.
@ k_journal_period_ms
Journal period ms.
volatile uint32_t g_fj_last_counter
Last counter the firmware tried to write.
volatile uint32_t g_fj_match
HIL liveness counter – incremented on every successful erase -> program -> read-back -> compare round...
static ra8_err_t flash_journal_round_trip(uint32_t counter, uint32_t *echoed)
Erase + program + read-back round-trip of one record.
static void flash_journal_pack(uint32_t counter, uint8_t *rec)
Pack a counter into a 16-byte record (little-endian + padding).
volatile uint32_t g_fj_mismatch
HIL failure counter – incremented on any erase, program, or read failure, or when the read-back bytes...
fj_step_t
Step codes for g_fj_last_step (erase/program/read/compare chain).
@ k_fj_step_compare_ok
Read-back matched.
@ k_fj_step_read_failed
Record read-back failed.
@ k_fj_step_compare_mismatch
Read-back differed (data error).
@ k_fj_step_init
No round-trip run yet.
@ k_fj_step_program_ok
Record program succeeded.
@ k_fj_step_read_ok
Record read-back succeeded.
@ k_fj_step_program_failed
Record program failed.
@ k_fj_step_erase_ok
Sector erase succeeded.
@ k_fj_step_erase_failed
Sector erase failed.
volatile uint32_t g_fj_jedec_id
One-shot JEDEC ID read at boot (memprobe diagnostic).
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).
@ k_ra8_board_led2
LED2, GREEN, P303 (jumper E26).
@ k_ra8_board_led1
LED1, BLUE, P600 (jumper E27).
ra8_err_t ra8_board_io_expander_set_octospi_active(void)
Program the U15 I/O expander to request the Octo-SPI SW4 layout.
ra8_err_t ra8_board_xspi_pins_init(void)
Route the 12 OCTA bus pins to the xSPI peripheral and pulse RESET_L.
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).
@ k_ra8_xspi_lio_1s1s1s
1S-1S-1S extended SPI.
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.
xSPI / Octo-SPI driver (flash read/program/erase + ID/status)
ra8_err_t ra8_xspi_flash_program(uint8_t instance, uint32_t flash_addr, const uint8_t *data, uint32_t len)
Program (write) len bytes at flash_addr.
ra8_err_t ra8_xspi_init(uint8_t instance, ra8_xspi_lio_mode_t mode)
Initialise an xSPI instance in the chosen link-layer IO mode.
ra8_err_t ra8_xspi_flash_read(uint8_t instance, uint32_t flash_addr, uint8_t *buf, uint32_t len)
Read len bytes from external flash into buf.
ra8_err_t ra8_xspi_flash_erase_sector(uint8_t instance, uint32_t flash_addr)
Erase the 4 KiB sector containing flash_addr.
ra8_err_t ra8_xspi_flash_read_id(uint8_t instance, uint32_t *out_id)
Read the JEDEC ID (opcode 0x9F), returning 24 bits in a uint32_t.