|
ra8-firmware 0.1.0
Bare-metal firmware for the Renesas RA8 family (RA8D2 / RA8P1)
|
Headless on-silicon HIL gate for the e-reader chrome render pipeline. More...
#include <stdint.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_gfx_font.h"#include "ra8_isr.h"#include "ra8_mstp.h"#include "ra8_time.h"#include "ra8_ui.h"Go to the source code of this file.
Enumerations | |
| enum | chrome_hil_cfg_t : uint32_t { k_ch_fb_w = 320U , k_ch_fb_h = 240U , k_ch_uart_baud = 115200U , k_ch_max_nodes = 16U , k_ch_cell_count = 4U , k_ch_status_h = 28U , k_ch_root_pad = 8U , k_ch_grid_pad = 6U , k_ch_grid_gap = 8U , k_ch_cell_pad = 8U , k_ch_border_w = 1U , k_ch_fnv_offset = 2166136261U , k_ch_fnv_prime = 16777619U , k_ch_hex_nibbles = 8U , k_ch_nibble_bits = 4U , k_ch_nibble_mask = 0x0FU , k_ch_dec_ten = 10U } |
| Framebuffer + console + render geometry constants. More... | |
| enum | chrome_hil_color_t : uint32_t { k_ch_col_page = 0xF4F0E8U , k_ch_col_bar = 0x303860U , k_ch_col_bar_tx = 0xFFFFFFU , k_ch_col_cell = 0xC8D8F0U , k_ch_col_edge = 0x283048U , k_ch_col_ink = 0x101010U } |
| Chrome palette (0xRRGGBB; ra8_gfx down-converts to RGB565). More... | |
Functions | |
| static void | ch_print (const uint8_t *msg, uint32_t len) |
| Emit a byte run on the SCI8 console. | |
| static void | ch_panic_halt (void) |
| Park forever in WFI after a fatal init error. | |
| static void | ch_print_hex (uint32_t value) |
Print value as 8 uppercase hex digits + a trailing EOL. | |
| static void | ch_print_uint (uint32_t value) |
| Print a small unsigned integer in decimal. | |
| static int16_t | ch_build_chrome (ra8_box_tree_t *tree) |
| Build the status-bar-over-grid chrome tree; return the root index. | |
| static void | ch_fill (const ra8_ui_rect_t *r, uint32_t color) |
Fill a rectangle by drawing h horizontal spans. | |
| static void | ch_border (const ra8_ui_rect_t *r, uint32_t color) |
| Draw a 1-pixel border around a rectangle. | |
| static void | ch_render (const ra8_box_tree_t *tree) |
| Render the laid-out tree: per node, fill + border + label. | |
| static uint32_t | ch_framebuffer_hash (void) |
| FNV-1a-32 over the rendered framebuffer bytes. | |
| static void | ch_setup_or_halt (void) |
| Bring up clocks/MSTP/time + the SCI8 console; halt on failure. | |
| void | main (void) |
| App entry: render the chrome to SRAM, hash it, print over UART. | |
Variables | |
| static uint16_t | s_framebuffer [(size_t) k_ch_fb_h *(size_t) k_ch_fb_w] |
| RGB565 render target in internal SRAM. | |
| static ra8_box_t | s_box_nodes [k_ch_max_nodes] |
| Box-tree node storage. | |
| static const char * | s_label [k_ch_max_nodes] |
| Per-node label (NULL = no text), indexed by box-tree node. | |
| static const char *const | k_ch_titles [k_ch_cell_count] |
| Demo shelf titles (public-domain). | |
| static const uint8_t | k_msg_boot [] = "ereader-hil: boot\r\n" |
| static const uint8_t | k_msg_fail [] = "ereader-hil: FAIL init\r\n" |
| static const uint8_t | k_msg_pre [] = "ereader-hil: chrome boxes=" |
| static const uint8_t | k_msg_crc [] = " crc=" |
| static const uint8_t | k_msg_eol [] = "\r\n" |
Headless on-silicon HIL gate for the e-reader chrome render pipeline.
The e-reader chrome (#76 box model + #80 interaction) is golden-validated on the ra8_emulator. This app closes the on-hardware gap: it exercises the real ra8_box layout + ra8_gfx software render on the actual RA8D2, deterministically, with no panel / SDRAM / touch / SD dependency.
It builds a representative chrome screen as an ra8_box tree (a status bar over a 2-column grid of "book" cells), lays it out with ra8_box_layout, renders the boxes (fill + 1-px border) and labels (bundled ra8_gfx_font_8x16) into a static RGB565 framebuffer in internal SRAM, then folds an FNV-1a-32 hash over the whole framebuffer and prints it over the SCI8 J-Link OB console:
ereader-hil: chrome boxes=<N> crc=<8 hex>
The HIL gate (hil.conf, uart_scrape) asserts that hash equals the baseline captured on-bench – so any drift in the box-model math, the software rasteriser, or the toolchain output flags a regression on real silicon. Deterministic: integer layout + a fixed bitmap font + a zeroed static framebuffer give the same hash every boot.
Definition in file main.c.
| enum chrome_hil_cfg_t : uint32_t |
Framebuffer + console + render geometry constants.
| enum chrome_hil_color_t : uint32_t |
Chrome palette (0xRRGGBB; ra8_gfx down-converts to RGB565).
|
static |
Draw a 1-pixel border around a rectangle.
Definition at line 212 of file main.c.
References ra8_ui_rect_t::h, ra8_gfx_line(), ra8_ui_rect_t::w, ra8_ui_rect_t::x, and ra8_ui_rect_t::y.
Referenced by ch_render().
|
static |
Build the status-bar-over-grid chrome tree; return the root index.
Definition at line 163 of file main.c.
References k_ch_border_w, k_ch_cell_count, k_ch_cell_pad, k_ch_col_bar, k_ch_col_cell, k_ch_col_edge, k_ch_col_page, k_ch_grid_gap, k_ch_grid_pad, k_ch_max_nodes, k_ch_root_pad, k_ch_status_h, k_ch_titles, k_ra8_box_grid, k_ra8_box_leaf, k_ra8_box_none, k_ra8_box_stack_v, ra8_box_add(), ra8_box_tree_init(), s_box_nodes, and s_label.
Referenced by main().
|
static |
Fill a rectangle by drawing h horizontal spans.
Definition at line 204 of file main.c.
References ra8_ui_rect_t::h, ra8_gfx_line(), ra8_ui_rect_t::w, ra8_ui_rect_t::x, and ra8_ui_rect_t::y.
Referenced by ch_render().
|
static |
FNV-1a-32 over the rendered framebuffer bytes.
Definition at line 250 of file main.c.
References k_ch_fnv_offset, k_ch_fnv_prime, and s_framebuffer.
Referenced by main().
|
static |
Park forever in WFI after a fatal init error.
Definition at line 118 of file main.c.
References ch_print(), and k_msg_fail.
Referenced by ch_setup_or_halt(), and main().
|
static |
Emit a byte run on the SCI8 console.
Definition at line 112 of file main.c.
References ra8_board_uart_console_write().
Referenced by ch_panic_halt(), ch_print_hex(), ch_print_uint(), and main().
|
static |
Print value as 8 uppercase hex digits + a trailing EOL.
Definition at line 127 of file main.c.
References ch_print(), k_ch_dec_ten, k_ch_hex_nibbles, k_ch_nibble_bits, and k_ch_nibble_mask.
Referenced by main().
|
static |
Print a small unsigned integer in decimal.
Definition at line 139 of file main.c.
References ch_print(), and k_ch_dec_ten.
Referenced by main().
|
static |
Render the laid-out tree: per node, fill + border + label.
Definition at line 223 of file main.c.
References ch_border(), ch_fill(), ra8_box_tree_t::count, k_ch_cell_pad, k_ch_col_bar, k_ch_col_bar_tx, k_ch_col_ink, k_ch_col_page, k_ra8_box_no_colour, ra8_box_tree_t::nodes, ra8_gfx_clear(), ra8_gfx_font_8x16, ra8_gfx_text_out(), and s_label.
Referenced by main().
|
static |
Bring up clocks/MSTP/time + the SCI8 console; halt on failure.
Definition at line 267 of file main.c.
References ch_panic_halt(), k_ch_uart_baud, k_ra8_clock_id_cpuclk0, k_ra8_ok, ra8_board_uart_console_init(), ra8_cgc_get_clock_hz(), ra8_cgc_init(), ra8_mstp_init(), and ra8_time_init().
Referenced by main().
| void main | ( | void | ) |
App entry: render the chrome to SRAM, hash it, print over UART.
The application entry point Reset_Handler hands control to.
Definition at line 292 of file main.c.
References ch_build_chrome(), ch_framebuffer_hash(), ch_panic_halt(), ch_print(), ch_print_hex(), ch_print_uint(), ch_render(), ch_setup_or_halt(), ra8_box_tree_t::count, k_ch_fb_h, k_ch_fb_w, k_msg_boot, k_msg_crc, k_msg_eol, k_msg_pre, k_ra8_gfx_format_rgb565, k_ra8_ok, ra8_box_layout(), ra8_gfx_init(), ra8_isr_globals_enable(), and s_framebuffer.
|
static |
Demo shelf titles (public-domain).
Definition at line 95 of file main.c.
Referenced by ch_build_chrome().
|
static |
|
static |
|
static |
|
static |
Per-node label (NULL = no text), indexed by box-tree node.
Definition at line 92 of file main.c.
Referenced by ch_build_chrome(), ch_render(), er_add_book_tile(), er_build_library(), er_build_nav(), er_build_toolbar(), er_render_boxnodes(), and er_reset_side_tables().