|
ra8-firmware 0.1.0
Bare-metal firmware for the Renesas RA8 family (RA8D2 / RA8P1)
|
ra8_io fabric over on-chip extra-MRAM (data flash) backend (#155/#156). More...
#include <stdint.h>#include <string.h>#include "ra8_attributes.h"#include "ra8_board_ek_ra8d2.h"#include "ra8_board_ek_ra8d2_console_stream.h"#include "ra8_boot_entry.h"#include "ra8_cgc.h"#include "ra8_check.h"#include "ra8_err.h"#include "ra8_flash.h"#include "ra8_io.h"#include "ra8_log.h"#include "ra8_time.h"Go to the source code of this file.
Enumerations | |
| enum | demo_const_t : uint32_t { k_demo_uart_baud = 115200U , k_demo_mram_base = (uint32_t)k_ra8_flash_extra_start , k_demo_disk_blocks = 24U , k_demo_test_lba = 0U , k_demo_block_count = 1U , k_demo_payload = 512U , k_demo_seed_mul = 5U , k_demo_seed_add = 3U , k_demo_mrcfreq_mhz = 200U , k_demo_mrefreq_mhz = 100U } |
| Console + volume + MRAM knobs (no magic numbers). More... | |
Functions | |
| static void | internal_demo_print (const char *msg) |
| Print a NUL-terminated string on the demo's UART stream. | |
| static void | internal_demo_setup_or_halt (void) |
| Bring up CGC + SysTick + the board console; halt forever on failure. | |
| static ra8_err_t | internal_demo_open (void) |
| Bring up the MRAM controller and bind the MRAM block device. | |
| static ra8_err_t | internal_demo_roundtrip (void) |
| Erase a block, program a pattern into it, read it back, and compare. | |
| void | main (void) |
| Firmware entry point. | |
Variables | |
| static ra8_io_blockdev_t | s_bd |
| Block-device handle + its MRAM backend state. | |
| static ra8_io_blockdev_mram_state_t | s_mstate |
| static ra8_io_stream_t | s_uart |
| Console output stream; the board owns the sink behind it. | |
| static const char *const | s_tag = "ra8_io_mram_demo" |
| Module log tag. | |
ra8_io fabric over on-chip extra-MRAM (data flash) backend (#155/#156).
Proves the ra8_io fabric over the RA8D2's on-chip extra MRAM at k_ra8_flash_extra_start (0x02E07600, HUM Ch 59.7.4.5 Table 59.15 p 3592) – programmed through the MACI command sequencer. Same block-device vtable as the other ra8_io demos; only the backend differs (ra8_io_blockdev_mram instead of RAM/SD/OSPI).
The demo exercises the backend directly through the ra8_io block-device layer, which is the right level for this special-purpose non-volatile store (the FAT layer is already proven over the RAM / SD / OSPI / SDRAM backends):
ra8_emulator models the MACI program/erase sequence (board_periph_mram.c), so the round-trip runs headless: a successful run prints ra8_io_mram_demo: 512-byte block erase/program/read on extra MRAM PASS.
Definition in file main.c.
| enum demo_const_t : uint32_t |
Console + volume + MRAM knobs (no magic numbers).
|
static |
Bring up the MRAM controller and bind the MRAM block device.
Initialises the MRAM controller (ra8_flash_init) and binds an erase-before-write block device over the fenced 12 KiB window.
| k_ra8_ok | The MRAM block device s_bd is ready. |
| (other) | The first failing bring-up step's error code. |
Definition at line 149 of file main.c.
References k_demo_disk_blocks, k_demo_mram_base, k_demo_mrcfreq_mhz, k_demo_mrefreq_mhz, k_ra8_ok, ra8_flash_init(), RA8_INTERNAL, ra8_io_blockdev_mram_init(), RA8_RETURN_ON_ERROR, s_bd, s_mstate, and s_tag.
Referenced by main().
|
static |
Print a NUL-terminated string on the demo's UART stream.
Thin wrapper over ra8_io_stream_puts bound to s_uart.
| [in] | msg | NUL-terminated ASCII string (CR/LF supplied by the caller). |
msg is non-NULL and NUL-terminated. msg are queued on the UART stream. Definition at line 94 of file main.c.
References RA8_INTERNAL, ra8_io_stream_puts(), and s_uart.
|
static |
Erase a block, program a pattern into it, read it back, and compare.
Drives the ra8_io block-device layer directly: erase one 512-byte logical block to 0xFF, program a deterministic pattern, read it back, and verify byte-for-byte – the full MRAM erase + program + read path.
| k_ra8_ok | The block round-tripped intact. |
| k_ra8_err_checksum_mismatch | The read-back bytes differed. |
| (other) | The first failing block-device call's code. |
Definition at line 187 of file main.c.
References k_demo_block_count, k_demo_payload, k_demo_seed_add, k_demo_seed_mul, k_demo_test_lba, k_ra8_err_checksum_mismatch, k_ra8_ok, memcmp(), RA8_INTERNAL, ra8_io_blockdev_erase(), ra8_io_blockdev_read(), ra8_io_blockdev_write(), RA8_RETURN_ON_ERROR, s_bd, and s_tag.
Referenced by internal_demo_run(), and main().
|
static |
Bring up CGC + SysTick + the board console; halt forever on failure.
Initialises clocks, reads the CPU rate, starts the time base, and hands the console over to the BSP – which owns the channel, the PD02 / PD03 routing and the live-PCLKA bit-rate solve – then binds it as an ra8_io stream.
Definition at line 118 of file main.c.
References k_demo_uart_baud, k_ra8_clock_id_cpuclk0, k_ra8_ok, ra8_board_console_stream(), ra8_board_uart_console_init(), ra8_cgc_get_clock_hz(), ra8_cgc_init(), RA8_INTERNAL, ra8_time_init(), and s_uart.
| void main | ( | void | ) |
Firmware entry point.
The application entry point Reset_Handler hands control to.
Initialises logging + console, brings up the MRAM volume, runs the program/erase round-trip, and prints a single PASS/FAIL verdict.
Definition at line 226 of file main.c.
References internal_demo_open(), internal_demo_print(), internal_demo_roundtrip(), internal_demo_setup_or_halt(), k_ra8_ok, ra8_board_uart_console_flush(), ra8_io_log_attach(), ra8_log_init(), and s_uart.
|
static |
|
static |
|
static |
|
static |