|
ra8-firmware 0.1.0
Bare-metal firmware for the Renesas RA8 family (RA8D2 / RA8P1)
|
On-silicon HIL: ra8_widget compositor + ra8_app framework (#145/#146). More...
#include <stddef.h>#include <stdint.h>#include "ra8_app.h"#include "ra8_board_ek_ra8d2.h"#include "ra8_boot_entry.h"#include "ra8_box.h"#include "ra8_cgc.h"#include "ra8_err.h"#include "ra8_gfx.h"#include "ra8_isr.h"#include "ra8_mstp.h"#include "ra8_time.h"#include "ra8_ui.h"#include "ra8_widget.h"Go to the source code of this file.
Data Structures | |
| struct | wa_fill_t |
| A solid-fill widget: renders one colour into its rect via ra8_gfx. More... | |
| struct | wa_app_state_t |
| Per-app state: its widget tree + a focus-lifecycle counter. More... | |
Enumerations | |
| enum | wa_consts_t : uint32_t { k_wa_uart_baud = 115200U , k_wa_fb_w = 160U , k_wa_fb_h = 120U , k_wa_statusbar_h = 16U , k_wa_col_bg = 0x101018U , k_wa_col_status = 0x808088U , k_wa_col_library = 0x3050C0U , k_wa_col_reader = 0xC05030U , k_wa_fnv_offset = 0x811C9DC5U , k_wa_fnv_prime = 0x01000193U , k_wa_hex_nibbles = 8U , k_wa_nibble_bits = 4U , k_wa_nibble_mask = 0x0FU , k_wa_dec_ten = 10U } |
| Console / layout knobs (no magic numbers). More... | |
| enum | wa_app_id_t : uint16_t { k_wa_app_library = 1U , k_wa_app_reader = 2U } |
| Registered app ids. More... | |
Functions | |
| static void | wa_print (const uint8_t *msg, uint32_t len) |
| Emit a byte run on the SCI8 console. | |
| static void | wa_panic_halt (const uint8_t *msg, uint32_t len) |
| Print the fail banner and trap (ra8_emulator halts on the BKPT). | |
| static uint32_t | wa_framebuffer_hash (void) |
| FNV-1a hash over the composited framebuffer. | |
| static void | wa_print_hex (uint32_t value) |
| Print a 32-bit value as 8 upper-case hex digits. | |
| static void | wa_fill_render (ra8_widget_t *w) |
| Widget render callback: fill the widget's rect with its colour. | |
| 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_app_render (const ra8_app_t *a) |
| App.render: lay out + composite the app's widget tree. | |
| static void | wa_app_enter (ra8_app_t *a) |
| static void | wa_app_leave (ra8_app_t *a) |
| 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_verify_or_halt (uint32_t lib_crc, uint32_t rdr_crc) |
| Assert distinct composites, a fired lifecycle, and a partial flush. | |
| void | main (void) |
| App entry: register two widget-tree apps, launch + composite each. | |
Variables | |
| static uint16_t | s_framebuffer [(size_t) k_wa_fb_h *(size_t) k_wa_fb_w] |
| RGB565 framebuffer all widgets composite into. | |
| static wa_app_state_t | s_library |
| static wa_app_state_t | s_reader |
| static const uint8_t | k_msg_boot [] = "widget-app-hil: boot\r\n" |
| static const uint8_t | k_msg_fail [] = "widget-app-hil: FAIL init\r\n" |
| static const uint8_t | k_msg_freg [] = "widget-app-hil: FAIL register\r\n" |
| static const uint8_t | k_msg_fcrc [] = "widget-app-hil: FAIL crc-equal\r\n" |
| static const uint8_t | k_msg_flife [] = "widget-app-hil: FAIL lifecycle\r\n" |
| static const uint8_t | k_msg_fdmg [] = "widget-app-hil: FAIL damage\r\n" |
| static const uint8_t | k_msg_pre [] = "widget-app-hil: apps=2 lib=" |
| static const uint8_t | k_msg_rdr [] = " rdr=" |
| static const uint8_t | k_msg_flush [] = " flush=160x16 hint=fast" |
| static const uint8_t | k_msg_ok [] = " PASS\r\n" |
| static const ra8_widget_vtable_t | k_wa_fill_vt |
| Shared vtable for the solid-fill widget. | |
| static const ra8_app_vtable_t | k_wa_app_vt |
| Shared app lifecycle vtable. | |
On-silicon HIL: ra8_widget compositor + ra8_app framework (#145/#146).
End-to-end on the M85, proving the widget/app foundation works on-target:
The console banner on success is:
widget-app-hil: apps=2 lib=<8hex> rdr=<8hex> flush=160x16 hint=fast PASS
Deterministic (fixed composition through deterministic layout + fills), so the ra8_emulator banner is the regression net. Any failure prints a FAIL banner and halts on a BKPT before PASS.
[Ring 6 / App] {World: NS}
Definition in file main.c.
| enum wa_app_id_t : uint16_t |
| enum wa_consts_t : uint32_t |
Console / layout knobs (no magic numbers).
| void main | ( | void | ) |
App entry: register two widget-tree apps, launch + composite each.
The application entry point Reset_Handler hands control to.
Definition at line 284 of file main.c.
References k_msg_boot, k_msg_fail, k_msg_flush, k_msg_freg, k_msg_ok, k_msg_pre, k_msg_rdr, k_ra8_gfx_format_rgb565, k_ra8_ok, k_wa_app_library, k_wa_app_reader, k_wa_app_vt, k_wa_col_library, k_wa_col_reader, k_wa_fb_h, k_wa_fb_w, ra8_app_register(), ra8_app_registry_init(), ra8_gfx_init(), ra8_isr_globals_enable(), s_framebuffer, s_library, s_reader, wa_panic_halt(), wa_print(), wa_print_hex(), wa_run_two_apps(), wa_setup_or_halt(), wa_state_init(), and wa_verify_or_halt().
|
static |
App.render: lay out + composite the app's widget tree.
Definition at line 186 of file main.c.
References k_ra8_widget_axis_col, k_ra8_widget_refresh_quality, k_wa_col_bg, k_wa_fb_h, k_wa_fb_w, ra8_gfx_clear(), ra8_widget_invalidate(), ra8_widget_layout_stack(), ra8_widget_render_dirty(), and wa_app_state_t::widgets.
|
static |
Widget render callback: fill the widget's rect with its colour.
Definition at line 151 of file main.c.
References ra8_gfx_rect().
|
static |
FNV-1a hash over the composited framebuffer.
Definition at line 127 of file main.c.
References k_wa_fnv_offset, k_wa_fnv_prime, and s_framebuffer.
Referenced by wa_run_two_apps().
|
static |
Print the fail banner and trap (ra8_emulator halts on the BKPT).
Definition at line 117 of file main.c.
References wa_print().
Referenced by main(), wa_run_two_apps(), wa_setup_or_halt(), and wa_verify_or_halt().
|
static |
Emit a byte run on the SCI8 console.
Definition at line 111 of file main.c.
References ra8_board_uart_console_write().
Referenced by main(), wa_panic_halt(), and wa_print_hex().
|
static |
Print a 32-bit value as 8 upper-case hex digits.
Definition at line 139 of file main.c.
References k_wa_dec_ten, k_wa_hex_nibbles, k_wa_nibble_bits, k_wa_nibble_mask, and wa_print().
Referenced by main().
|
static |
Launch + composite both apps, returning each composite's hash.
Definition at line 238 of file main.c.
References k_msg_freg, k_ra8_ok, k_wa_app_library, k_wa_app_reader, ra8_app_launch(), ra8_app_render(), wa_framebuffer_hash(), and wa_panic_halt().
Referenced by main().
|
static |
Bring up clocks/MSTP/time + the SCI8 console; halt on failure.
Definition at line 220 of file main.c.
References k_msg_fail, k_ra8_clock_id_cpuclk0, k_ra8_ok, k_wa_uart_baud, ra8_board_uart_console_init(), ra8_cgc_get_clock_hz(), ra8_cgc_init(), ra8_mstp_init(), ra8_time_init(), and wa_panic_halt().
Referenced by main().
|
static |
Build one app's widget tree: status bar (fixed) over content (flex).
Definition at line 165 of file main.c.
References wa_fill_t::color, wa_app_state_t::content_fill, wa_app_state_t::enters, k_wa_col_status, k_wa_fill_vt, k_wa_statusbar_h, wa_app_state_t::leaves, wa_app_state_t::status_fill, and wa_app_state_t::widgets.
Referenced by main().
|
static |
Assert distinct composites, a fired lifecycle, and a partial flush.
Definition at line 254 of file main.c.
References ra8_ui_rect_t::h, k_msg_fcrc, k_msg_fdmg, k_msg_flife, k_ra8_widget_refresh_fast, k_ra8_widget_refresh_none, k_wa_fb_w, k_wa_statusbar_h, ra8_widget_damage(), ra8_widget_invalidate(), s_library, s_reader, ra8_ui_rect_t::w, wa_panic_halt(), and ra8_ui_rect_t::y.
Referenced by main().
|
static |
|
static |
|
static |
|
static |
Definition at line 104 of file main.c.
Referenced by wa_verify_or_halt().
|
static |
Definition at line 103 of file main.c.
Referenced by wa_verify_or_halt().
|
static |
|
static |
Definition at line 101 of file main.c.
Referenced by main(), and wa_run_two_apps().
|
static |
|
static |
|
static |
Shared app lifecycle vtable.
Definition at line 209 of file main.c.
Referenced by main().
|
static |
Shared vtable for the solid-fill widget.
Definition at line 158 of file main.c.
Referenced by wa_state_init().
|
static |
Definition at line 96 of file main.c.
Referenced by main(), wa_verify_or_halt(), wd_register_apps(), and wd_selfcheck().
|
static |