56typedef enum : uint32_t {
74typedef enum : uint16_t {
99static const uint8_t
k_msg_boot[] =
"widget-app-hil: boot\r\n";
100static const uint8_t
k_msg_fail[] =
"widget-app-hil: FAIL init\r\n";
101static const uint8_t
k_msg_freg[] =
"widget-app-hil: FAIL register\r\n";
102static const uint8_t
k_msg_fcrc[] =
"widget-app-hil: FAIL crc-equal\r\n";
103static const uint8_t
k_msg_flife[] =
"widget-app-hil: FAIL lifecycle\r\n";
104static const uint8_t
k_msg_fdmg[] =
"widget-app-hil: FAIL damage\r\n";
105static const uint8_t
k_msg_pre[] =
"widget-app-hil: apps=2 lib=";
111static void wa_print(
const uint8_t* msg, uint32_t len)
120 __asm__
volatile(
"bkpt #0");
122 __asm__
volatile(
"wfi");
132 for (
size_t i = 0U; i < n; i++) {
153 const uint32_t color = ((
const wa_fill_t*)w->ctx)->color;
154 (void)
ra8_gfx_rect(w->rect.x, w->rect.y, w->rect.w, w->rect.h, color,
true);
222 uint32_t cpuclk0_hz = 0U;
257 if (lib_crc == rdr_crc) {
268 uint16_t ndirty = 0U;
319 uint32_t lib_crc = 0U;
320 uint32_t rdr_crc = 0U;
332 __asm__
volatile(
"wfi");
void main(void)
Secure fallback main entry point.
static const uint8_t k_msg_pre[]
static const uint8_t k_msg_ok[]
static const uint8_t k_msg_boot[]
static const uint8_t k_msg_fcrc[]
static const uint8_t k_msg_fail[]
static uint16_t s_framebuffer[(size_t) k_panel_height_px *(size_t) k_panel_width_px]
1024x600 RGB565 framebuffer in external SDRAM (GLCDC scans this).
static mg_reader_t s_reader
The pan/zoom viewer over the tiled page.
static const uint8_t k_msg_fdmg[]
wa_app_id_t
Registered app ids.
@ k_wa_app_reader
EPUB reader app.
@ k_wa_app_library
Library / home app.
static const uint8_t k_msg_freg[]
static void wa_app_leave(ra8_app_t *a)
static void wa_fill_render(ra8_widget_t *w)
Widget render callback: fill the widget's rect with its colour.
static void wa_panic_halt(const uint8_t *msg, uint32_t len)
Print the fail banner and trap (ra8_emulator halts on the BKPT).
wa_consts_t
Console / layout knobs (no magic numbers).
@ k_wa_fb_w
Framebuffer width, pixels.
@ k_wa_col_bg
Framebuffer clear colour.
@ k_wa_nibble_bits
Bits per hex nibble.
@ k_wa_fnv_offset
FNV-1a 32-bit offset basis.
@ k_wa_dec_ten
Hex digit / decimal split.
@ k_wa_hex_nibbles
Hex digits in a 32-bit value.
@ k_wa_statusbar_h
Status-bar widget height.
@ k_wa_nibble_mask
Low-nibble mask.
@ k_wa_col_reader
Reader content fill (orange).
@ k_wa_fnv_prime
FNV-1a 32-bit prime.
@ k_wa_uart_baud
Console baud.
@ k_wa_col_status
Status-bar fill (gray).
@ k_wa_fb_h
Framebuffer height, pixels.
@ k_wa_col_library
Library content fill (blue).
static uint32_t wa_framebuffer_hash(void)
FNV-1a hash over the composited framebuffer.
static void wa_setup_or_halt(void)
Bring up clocks/MSTP/time + the SCI8 console; halt on failure.
static void wa_run_two_apps(ra8_app_registry_t *reg, uint32_t *out_lib, uint32_t *out_rdr)
Launch + composite both apps, returning each composite's hash.
static void wa_print_hex(uint32_t value)
Print a 32-bit value as 8 upper-case hex digits.
static void wa_state_init(wa_app_state_t *st, uint32_t content_color)
Build one app's widget tree: status bar (fixed) over content (flex).
static void wa_verify_or_halt(uint32_t lib_crc, uint32_t rdr_crc)
Assert distinct composites, a fired lifecycle, and a partial flush.
static void wa_print(const uint8_t *msg, uint32_t len)
Emit a byte run on the SCI8 console.
static void wa_app_enter(ra8_app_t *a)
static const ra8_widget_vtable_t k_wa_fill_vt
Shared vtable for the solid-fill widget.
static const uint8_t k_msg_flush[]
static const ra8_app_vtable_t k_wa_app_vt
Shared app lifecycle vtable.
static wa_app_state_t s_library
static void wa_app_render(const ra8_app_t *a)
App.render: lay out + composite the app's widget tree.
static const uint8_t k_msg_flife[]
static const uint8_t k_msg_rdr[]
Zero-heap app framework: lifecycle + static registry + launcher (#146).
ra8_err_t ra8_app_launch(ra8_app_registry_t *reg, uint16_t id)
Launch (focus) the app with id, running the focus lifecycle.
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_render(ra8_app_registry_t *reg)
Run the focused app's render (on-target; no-op if none / NULL).
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).
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.
Bounded, allocation-free box-model layout for e-reader chrome.
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.
Software 2D graphics primitives layered on top of a caller-ownedframebuffer (DRW / D/AVE 2D / GLCDC r...
@ k_ra8_gfx_format_rgb565
16-bit RGB565, little-endian in memory.
ra8_err_t ra8_gfx_clear(uint32_t color)
Fill the bound framebuffer's clip region with a single colour.
ra8_err_t ra8_gfx_init(void *fb, uint16_t width, uint16_t height, ra8_gfx_format_t format)
Bind ra8_gfx to a caller-owned framebuffer.
ra8_err_t ra8_gfx_rect(int32_t x, int32_t y, int32_t w, int32_t h, uint32_t color, bool filled)
Draw an axis-aligned rectangle.
NVIC + ICU IELSR allocator.
void ra8_isr_globals_enable(void)
Globally enable maskable interrupts (PRIMASK = 0).
Ref-counted Module Stop Control wrapper for the RA8D2.
ra8_err_t ra8_mstp_init(void)
Re-establish the ra8_mstp ref-count table from current hardware state.
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.
Bounded UI interaction core: hit-testing, screen stack, paging.
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).
One node in a box tree (caller-owned).
Axis-aligned rectangle in framebuffer pixel coordinates.
int32_t w
Width (pixels, >= 0).
int32_t h
Height (pixels, >= 0).
int32_t y
Top edge (pixels).
Per-app state: its widget tree + a focus-lifecycle counter.
uint32_t enters
Times on_enter fired.
wa_fill_t status_fill
Status-bar colour.
wa_fill_t content_fill
Content colour (per app).
uint32_t leaves
Times on_leave fired.
ra8_widget_t widgets[2]
[0] status bar, [1] content.
A solid-fill widget: renders one colour into its rect via ra8_gfx.
uint32_t color
0xRRGGBB fill.