55typedef enum : uint32_t {
75static const char*
const s_tag =
"ra8_io_mram_demo";
120 uint32_t cpuclk0_hz = 0U;
154 .ecc_encoder_enable =
true,
155 .ecc_decoder_enable =
true};
163 "mram blockdev init");
206 if (
memcmp(got, data,
sizeof(data)) != 0) {
239 "ra8_io_mram_demo: 512-byte block erase/program/read on extra MRAM PASS\r\n");
void main(void)
Secure fallback main entry point.
static void internal_demo_print(const char *s)
Convenience wrapper to write a NUL-terminated string to SCI8.
static void internal_demo_setup_or_halt(void)
Bring CGC + the J-Link OB VCOM console + on-board Ethernet + RSIP up.
demo_const_t
Console + volume + payload knobs (no magic numbers).
@ k_demo_payload
Source bytes (compressible).
@ k_demo_disk_blocks
256 KiB per volume (FAT12).
@ k_demo_uart_baud
Console baud.
@ k_demo_seed_mul
Test-pattern multiplier.
static ra8_io_stream_t s_uart
UART output stream + its sink state.
static ra8_io_blockdev_t s_bd
Block-device handle + its RAM backend state.
static ra8_io_blockdev_mram_state_t s_mstate
@ k_demo_mram_base
Extra-MRAM OTP window base (0x02E07600).
@ k_demo_mrefreq_mhz
Extra-MRAM advertised clock (MHz).
@ k_demo_mrcfreq_mhz
Code-MRAM advertised clock (MHz).
static ra8_err_t internal_demo_open(void)
Bring up the MRAM controller and bind the MRAM block device.
@ k_demo_seed_add
Test-pattern additive bias.
@ k_demo_block_count
Blocks erased/written/read.
@ k_demo_test_lba
Logical block under test.
static ra8_err_t internal_demo_roundtrip(void)
Erase a block, program a pattern into it, read it back, and compare.
static const char * s_tag
Logging / check tag.
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.
EK-RA8D2 debug console as an ra8_io_stream byte sink.
ra8_err_t ra8_board_console_stream(ra8_io_stream_t *out)
Bind the J-Link OB VCOM console into a caller-owned stream handle.
ra8_err_t ra8_board_uart_console_init(uint32_t baud)
Configure SCI8 + PD02/PD03 as the debug-console UART.
ra8_err_t ra8_board_uart_console_flush(void)
Block until every byte queued on the J-Link OB VCOM console has finished clocking out on the wire.
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.
Validation and Error-Checking Macros for ra8-firmware.
#define RA8_RETURN_ON_ERROR(err, tag, message)
Early return on error, propagating the code upward.
Error Code Definitions for ra8-firmware.
@ k_ra8_err_checksum_mismatch
Stored / transmitted checksum does not match computed value.
@ k_ra8_ok
Success – operation completed with all postconditions satisfied.
ra8_err_codes_t ra8_err_t
Canonical error-return type used by every ra8-firmware API.
Code MRAM + Extra MRAM + Option-Setting driver – DANGEROUS, brick-capable.
ra8_err_t ra8_flash_init(const ra8_flash_cfg_t *cfg)
Initialise the MRAM controller for safe read access.
@ k_ra8_flash_extra_start
First legal Program target (FSBL setting).
int memcmp(const void *a, const void *b, size_t n)
Compare bytes in two memory areas.
ra8_io – unified peripheral-agnostic I/O fabric (umbrella header).
ra8_err_t ra8_io_blockdev_read(const ra8_io_blockdev_t *bd, uint32_t lba, uint32_t count, uint8_t *buf)
Read count logical blocks starting at lba into buf.
ra8_err_t ra8_io_blockdev_write(const ra8_io_blockdev_t *bd, uint32_t lba, uint32_t count, const uint8_t *buf)
Write count logical blocks from buf starting at lba.
ra8_err_t ra8_io_blockdev_erase(const ra8_io_blockdev_t *bd, uint32_t lba, uint32_t count)
Erase count blocks starting at lba to the medium's erase value.
ra8_err_t ra8_io_blockdev_mram_init(ra8_io_blockdev_t *bd, ra8_io_blockdev_mram_state_t *state, uintptr_t base_addr, uint32_t block_count, bool read_only)
Bind a hard-fenced MRAM block-device backend into a caller handle.
ra8_err_t ra8_io_log_attach(ra8_io_stream_t *s)
Route ra8_log output to a bound ra8_io stream.
ra8_err_t ra8_io_stream_puts(ra8_io_stream_t *s, const char *str)
Write a NUL-terminated string (without the NUL) to the bound sink.
Lightweight Logging Interface for ra8-firmware.
void ra8_log_init(void)
Initialise the logging backend.
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.
Initialisation descriptor for ra8_flash_init.
Caller-owned private state for an MRAM block device.
Caller-allocated block-device handle binding a backend to its context.
Caller-allocated byte-stream handle binding a sink to its context.