89typedef enum : uint32_t {
178#ifndef APP_SHELL_SETTINGS
180#define APP_SHELL_SETTINGS (1)
188typedef enum : uint16_t {
199typedef enum : uint16_t {
301#if APP_SHELL_SETTINGS
536#if APP_SHELL_SETTINGS
571 for (uint16_t i = 0U; i < n; i++) {
574 if (app !=
nullptr) {
575 ra8_log_info_val(app->name, app->removable ?
"removable" :
"core", (uint32_t)app->id);
618 return (depth == 0U);
661 bool handled =
false;
674 return (depth == 1U);
677#if APP_SHELL_SETTINGS
771 return (depth == 0U);
774#if APP_SHELL_SETTINGS
863#if APP_SHELL_SETTINGS
871#if APP_SHELL_SETTINGS
880 if (act ==
nullptr) {
933 ra8_log_info(
"app_shell",
"VCOM console init failed -- HIL banner unavailable");
951 __asm__
volatile(
"wfi");
void main(void)
Secure fallback main entry point.
static void app_stub_on_leave(ra8_app_t *a)
Stub on_leave: count the focus loss and log it.
static ra8_app_nav_t s_nav
Navigation back-stack layered over s_reg.
static ra8_app_t s_reader_app
The core reader app instance (registered into s_reg).
static uint16_t s_nav_stack[k_app_nav_cap]
Caller-owned storage backing the navigation back-stack (app ids).
@ k_app_id_settings
Optional settings app (removable).
@ k_app_id_reader
Core EPUB-reader app (non-removable).
static app_launch_ctx_t s_reader_ctx
Stub state for the core reader app.
static app_launch_ctx_t s_settings_ctx
Stub state for the optional settings app.
static void app_stub_on_enter(ra8_app_t *a)
Stub on_enter: count the focus gain and log it.
static const ra8_app_vtable_t k_app_stub_vt
Shared lifecycle vtable for every stub app (behaviour keyed off ctx).
static void app_stub_render(const ra8_app_t *a)
Stub render: count the frame and log it (stands in for drawing).
static bool app_stub_on_input(ra8_app_t *a, const ra8_widget_event_t *ev)
Stub on_input: count the event, consume only the "back" button.
static ra8_app_t s_settings_app
The optional settings app instance (registered into s_reg).
@ k_app_btn_back
Button id a chrome routes to mean "go back".
@ k_app_nav_cap
Back-stack depth (history of focused apps).
@ k_app_reg_cap
Registry storage slots (reader + settings).
app_shell_hil_t
VCOM-console line rate for the deterministic HIL success banner.
@ k_app_shell_hil_baud
VCOM console line rate (8N1).
static bool app_shell_uninstall_demo(void)
Exercise the run-time "core uninstallable" rule: refuse core, unmount one.
static bool app_shell_register(void)
Initialise the registry + back-stack and register every app.
static bool app_shell_hil_console_init(void)
Bring up the SCI8 / J-Link OB VCOM console for the HIL success banner.
static void app_shell_hil_emit_pass(void)
Emit the deterministic HIL success banner over the VCOM console.
static app_shell_ctx_t s_library_ctx
Stub state for the core library app.
static ra8_app_t s_library_app
The core library app instance (registered into s_reg).
static bool app_shell_back_to_root(void)
Press "back" to the root: pop to library and confirm the empty trail.
static bool app_shell_open_reader(void)
Open reader from library, then route a back-button event to it.
static void app_stub_deinit(ra8_app_t *a)
Stub deinit: count the teardown and log it (wired, not yet fired).
app_shell_id_t
Registered app ids (launch keys).
@ k_app_id_library
Core file/book organizer (non-removable).
static ra8_err_t app_stub_init(ra8_app_t *a)
Stub init: count the one-time setup and log it (runs at register).
static bool app_shell_settings_round_trip(void)
Open settings from reader, then go "back" to reader.
static void app_shell_log_menu(void)
Log the launcher "menu": every registered app, its id, and its class.
static void app_shell_banner(void)
Emit the PASS banner: app count, library enters, and the PASS line.
static bool app_shell_launch_library(void)
Launcher: list the apps then launch library by its registry index.
app_shell_const_t
Capacities, the launcher tile index, and the chrome button id.
@ k_app_idx_library
Registry index of library (first registered).
static bool app_shell_selfcheck(void)
Run the whole deterministic launcher + navigate + back-stack surface.
static bool app_shell_add(ra8_app_t *app, app_shell_ctx_t *ctx, uint16_t id, const char *name, bool removable)
Build one app instance from the shared vtable and register it.
static const uint8_t k_app_shell_pass_banner[]
Deterministic, run-to-run-stable HIL success banner (uart_scrape gate).
Zero-heap app framework: lifecycle + static registry + launcher (#146).
ra8_err_t ra8_app_nav_init(ra8_app_nav_t *nav, ra8_app_registry_t *reg, uint16_t *storage, uint16_t cap)
Bind a navigation back-stack to a registry + caller-owned storage.
ra8_err_t ra8_app_nav_back(ra8_app_nav_t *nav, bool *out_popped)
Return to the most recently pushed app (pop the back-stack).
ra8_err_t ra8_app_register(ra8_app_registry_t *reg, ra8_app_t *app)
Register an app (calls its init once) and add it to the registry.
ra8_err_t ra8_app_nav_go_index(ra8_app_nav_t *nav, uint16_t idx)
Focus the app at registry index idx (launcher select-by-position).
ra8_err_t ra8_app_nav_go(ra8_app_nav_t *nav, uint16_t id)
Focus app id, pushing the outgoing app onto the back-stack.
ra8_err_t ra8_app_count(const ra8_app_registry_t *reg, uint16_t *out_count)
Number of registered apps (for the launcher to list).
ra8_err_t ra8_app_state(const ra8_app_registry_t *reg, uint16_t id, ra8_app_state_t *out_state)
Report an app's lifecycle state, derived from the registry.
ra8_err_t ra8_app_at(const ra8_app_registry_t *reg, uint16_t idx, ra8_app_t **out_app)
Get the app at registry index idx (launcher enumeration).
ra8_err_t ra8_app_uninstall(ra8_app_registry_t *reg, uint16_t id)
Uninstall (unmount) a removable, non-focused app from the registry.
ra8_err_t ra8_app_route_input(ra8_app_registry_t *reg, const ra8_widget_event_t *ev, bool *out_handled)
Route an input event to the focused app.
ra8_err_t ra8_app_nav_depth(const ra8_app_nav_t *nav, uint16_t *out_depth)
Current back-stack depth (apps the user can still go back through).
ra8_err_t ra8_app_active(const ra8_app_registry_t *reg, ra8_app_t **out_app)
Get the currently focused app.
ra8_err_t ra8_app_render(ra8_app_registry_t *reg)
Run the focused app's render (on-target; no-op if none / NULL).
ra8_app_state_t
Lifecycle state of one app within the framework's state machine.
@ k_ra8_app_state_foreground
Mounted and focused (the active app).
@ k_ra8_app_state_unmounted
Not registered (initial / after uninstall).
ra8_err_t ra8_app_registry_init(ra8_app_registry_t *reg, ra8_app_t **storage, uint16_t cap)
Bind a registry to caller-owned pointer storage (empty, no focus).
Annotation-attribute framework macros for ra8-firmware.
#define RA8_LOOP_BOUND(ceiling)
NASA Power-of-10 Rule 2: bind ONE loop to a compile-time ceiling.
I/O-expander, USB, camera, external-memory, MIPI-DSI, UART console, and Ethernet portion of the EK-RA...
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.
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_init(void)
Configure the clock tree to a safe default.
Error Code Definitions for ra8-firmware.
@ k_ra8_err_not_supported
Requested feature not compiled in, not wired, or not supported by this MCU variant.
@ 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.
static const ra8_io_fsfmt_t * s_reg[(uint32_t) k_ra8_io_fsfmt_max]
Registered formats, in probe priority order.
static ra8_isr_slot_t s_slots[k_ra8_isr_slot_count]
Per-slot dispatch table.
Lightweight Logging Interface for ra8-firmware.
void ra8_log_init(void)
Initialise the logging backend.
#define ra8_log_info_val(tag, message, value)
RA8 log info val.
#define ra8_log_info(tag, message)
RA8 log info.
Per-app stub state: a display name + lifecycle-call counters.
const char * name
Display name + ITM log tag (non-NULL).
uint32_t inits
Times init fired (at register).
uint32_t inputs
Times on_input fired.
uint32_t enters
Times on_enter fired.
uint32_t leaves
Times on_leave fired.
uint32_t deinits
Times deinit fired (teardown).
uint32_t renders
Times render fired.
A bounded back-stack of app ids layered over a registry (zero-heap).
Fixed table of registered apps + the focused index.
One app instance + its metadata (caller-owned, static).
App lifecycle callbacks (shared by all instances of one app).