62typedef enum : uint32_t {
70static const char s_readme_text[] =
"ra8_fs FAT on OSPI flash via LevelX.\r\n";
101 __asm__
volatile(
"wfi");
114 uint32_t cpuclk0_hz = 0U;
139 if (s == (
const char*)0) {
146#ifndef RA8_OFF_TARGET
191 LX_NULL) != LX_SUCCESS) {
192 demo_print(
"[fs] lx_nor_flash_format failed\r\n");
197 demo_print(
"[fs] lx_nor_flash_open failed\r\n");
222 demo_print(
"[fs] lx_fs_backend_bind failed\r\n");
227 opts.
label =
"RA8FS";
254 demo_print(
"[fs] ra8_fs_open(read) failed\r\n");
268 if (
memcmp(buf, &expected[off], (
size_t)got) != 0) {
275 ok = ok && (off == (uint32_t)
strlen(expected));
316 demo_print(
"[fs] ra8_fs_write_file failed\r\n");
320 demo_print(
"[fs] ra8_fs_write_file failed\r\n");
339 demo_print(
"[fs] delete did not remove the file\r\n");
357 demo_print(
"[fs] formatting + opening LevelX on OSPI flash\r\n");
361 demo_print(
"[fs] formatting + mounting FAT volume\r\n");
389 static CHAR s_mutex_name[] =
"ra8_fs";
392 (void)first_unused_memory;
394 lx_nor_flash_initialize();
403 demo_print(
"[fs] ra8_fs_set_lock failed\r\n");
430 demo_print(
"[fs] booting ThreadX + ra8_fs on OSPI flash...\r\n");
432#ifndef RA8_OFF_TARGET
void main(void)
Secure fallback main entry point.
static TX_THREAD s_demo_thread
demo_config_t
Compile-time settings for the HTTPS client demo.
@ k_demo_thread_stack
Demo thread stack.
static UCHAR s_demo_stack[k_demo_thread_stack]
void tx_application_define(void *first_unused_memory)
ThreadX system-define hook: build worker thread + byte pool.
static LX_NOR_FLASH s_nor_flash
LevelX control block (statically allocated – NASA P10 Rule 3).
static void demo_print(const char *msg)
Print a NUL-terminated string on the demo's UART stream.
static void demo_setup_or_halt(void)
Bring up CGC + SysTick + the SCI8 console; halt forever on any failure.
static void demo_panic_halt(void)
Halt forever in WFI – used as a panic stop on init failure.
static CHAR s_thread_name[]
static void demo_thread_entry(ULONG thread_input)
ThreadX worker entry: PSA + NetX up, connect, run the TLS session.
static const char s_scratch_path[]
Path of the file that is deleted and confirmed gone.
static bool demo_read_verify(ra8_fs_mount_t *mount, const char *path, const char *expected)
Read path back and verify its bytes equal expected.
static void demo_fs_lock_acquire(void *ctx)
ra8_fs lock-seam acquire: block on the ThreadX mutex.
static void demo_list_entry(const char *name, uint8_t attr, uint64_t size, void *ctx)
ra8_fs_listdir callback: print one root-directory entry name.
static TX_MUTEX s_fs_mutex
ThreadX mutex the ra8_fs lock seam is bound to (#608).
static void demo_fs_lock_release(void *ctx)
ra8_fs lock-seam release: hand the ThreadX mutex back.
static void demo_file_ops(ra8_fs_mount_t *mount)
Run the file-ops sequence; print the pass banner only if all pass.
@ k_demo_file_chunk
Read-back chunk for verification.
static bool demo_fs_format_mount(ra8_fs_backend_t *out_backend, ra8_fs_mount_t **out_mount)
Bind the backend, lay down + mount a FAT volume on the LevelX partition.
static const char s_readme_path[]
Path of the file that is read back and verified.
static char s_lx_flash_name[]
static const char s_readme_text[]
Test payload written into both demo files.
static bool demo_lx_open(void)
Format + open the LevelX NOR partition on the OSPI flash.
ra8_fs block-device backend over a LevelX wear-levelled NOR partition
ra8_err_t lx_fs_backend_bind(LX_NOR_FLASH *nor_flash, ra8_fs_backend_t *out)
Expose an open LevelX NOR flash as an ra8_fs block-device backend.
LevelX NOR-flash driver shim that bridges LevelX onto the RA8 ra8_xspi HAL (EK-RA8D2 ISSI IS25LX512M ...
UINT lx_nor_driver_ra8_xspi_initialize(LX_NOR_FLASH *nor_flash)
LevelX NOR driver-initialise entry point bridging onto ra8_xspi.
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_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_not_found
Requested item not found (lookup / search missed).
int memcmp(const void *a, const void *b, size_t n)
Compare bytes in two memory areas.
size_t strlen(const char *s)
Calculate string length.
Minimal FAT12/FAT16/FAT32 filesystem adapter (read + write).
ra8_err_t ra8_fs_format(const ra8_fs_backend_t *backend, const ra8_fs_format_opts_t *opts)
Format a block device as a fresh, empty FAT12/FAT16/FAT32/exFAT volume.
ra8_err_t ra8_fs_listdir(const ra8_fs_mount_t *handle, const char *path, ra8_fs_listdir_cb_t cb, void *ctx)
Enumerate directory entries; invoke cb once per visible entry.
ra8_err_t ra8_fs_mount(const ra8_fs_backend_t *backend, ra8_fs_mount_t **out_handle)
Mount a FAT volume from a block-device backend, auto-selecting the first partition.
ra8_err_t ra8_fs_read(ra8_fs_file_t *file, uint8_t *buf, uint32_t max_len, uint32_t *got_len)
Read up to max_len bytes; advance the cluster chain on cluster crossings.
ra8_err_t ra8_fs_stat(const ra8_fs_mount_t *handle, const char *path, ra8_fs_stat_t *out)
Report what a path names – file or directory – without opening it.
ra8_err_t ra8_fs_unlink(const ra8_fs_mount_t *handle, const char *path)
Delete a file: mark its dir entry deleted and free its clusters.
ra8_err_t ra8_fs_open(ra8_fs_mount_t *handle, const char *path, ra8_fs_mode_t mode, ra8_fs_file_t **out_file)
Open or create a file by path, 8.3 or long.
ra8_err_t ra8_fs_unmount(ra8_fs_mount_t *handle)
Unmount a previously mounted volume and release its slot.
ra8_err_t ra8_fs_close(ra8_fs_file_t *file)
Close an open file, stamping its final modification time.
ra8_err_t ra8_fs_write_file(ra8_fs_mount_t *handle, const char *path, const uint8_t *data, uint32_t len)
Create a whole file in one call (provisioning helper).
ra8_err_t ra8_fs_set_lock(const ra8_fs_lock_t *lock)
Install (or remove) the lock taken around every public ra8_fs call.
@ k_ra8_fs_type_fat12
count_of_clusters < 4085.
@ k_ra8_fs_mode_read
Read-only, must exist.
NVIC + ICU IELSR allocator.
void ra8_isr_globals_enable(void)
Globally enable maskable interrupts (PRIMASK = 0).
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.
char CHAR
ThreadX-compatible CHAR (host stub).
unsigned long ULONG
ThreadX-compatible unsigned long (host stub).
Opaque mutex stand-in for the host build.
Opaque thread stand-in for the host build.
Block-device interface that ra8_fs runs on top of.
Dependency-injection seam for mutual exclusion around the public API.
Cached parse of one mounted FAT volume.
What ra8_fs_stat() read out of a directory entry.