|
ra8-firmware 0.1.0
Bare-metal firmware for the Renesas RA8 family (RA8D2 / RA8P1)
|
Headless on-silicon HIL gate for the GLCDC layer-1 render path. More...
#include <stdint.h>#include "ra8_board_ek_ra8d2.h"#include "ra8_boot_entry.h"#include "ra8_cgc.h"#include "ra8_display_pal.h"#include "ra8_display_pal_lcd.h"#include "ra8_err.h"#include "ra8_glcdc.h"#include "ra8_isr.h"#include "ra8_mstp.h"#include "ra8_panel.h"#include "ra8_panel_timing.h"#include "ra8_time.h"Go to the source code of this file.
Enumerations | |
| enum | glcdc_hil_geom_t : uint16_t { k_gh_fb_w = 512U , k_gh_fb_h = 512U , k_gh_x_thickness = 4U } |
| Framebuffer geometry constants. More... | |
| enum | glcdc_hil_color_t : uint16_t { k_gh_color_bg = 0x001FU , k_gh_color_x = 0xFFE0U , k_gh_color_border = 0xFFFFU } |
| RGB565 palette for the deterministic render pattern. More... | |
| enum | glcdc_hil_console_t : uint32_t { k_gh_uart_baud = 115200U , k_gh_fnv_offset = 2166136261U , k_gh_fnv_prime = 16777619U , k_gh_hex_nibbles = 8U , k_gh_nibble_bits = 4U , k_gh_nibble_mask = 0x0FU , k_gh_dec_ten = 10U } |
| SCI8 J-Link OB console + text-format constants. More... | |
Functions | |
| static void | gh_print (const uint8_t *msg, uint32_t len) |
| Emit a byte run on the SCI8 console. | |
| static void | gh_panic_halt (void) |
| Park forever in WFI after a fatal init error. | |
| static void | gh_print_hex (uint32_t value) |
Print value as 8 uppercase hex digits. | |
| static void | gh_print_uint (uint32_t value) |
| Print a small unsigned integer in decimal. | |
| static void | gh_fb_fill (uint16_t color) |
Fill the whole framebuffer with color. | |
| static void | gh_draw_x (uint16_t color) |
Draw a thick corner-to-corner X in color. | |
| static void | gh_draw_border (uint16_t color) |
Draw a 1-px border around the whole framebuffer in color. | |
| static void | gh_render_pattern (void) |
| Paint the full deterministic render pattern. | |
| static uint32_t | gh_framebuffer_hash (void) |
| FNV-1a-32 over the rendered framebuffer bytes. | |
| static bool | gh_glcdc_programmed (void) |
| Bring the GLCDC layer-1 path up and prove it is programmed. | |
| static void | gh_setup_or_halt (void) |
| Bring up clocks/MSTP/time + the SCI8 console; halt on failure. | |
| void | main (void) |
| App entry: paint, bring the GLCDC up, hash, print the banner. | |
Variables | |
| static uint16_t | s_framebuffer [(uint32_t) k_gh_fb_w *(uint32_t) k_gh_fb_h] |
| Render target in internal SRAM, 64-byte AXI-burst aligned so the GLCDC's AXI fetches are clean. | |
| static const display_cfg_t | k_gh_display_cfg |
| Display PAL config selecting the GLCDC LCD backend. | |
| volatile uint32_t | g_glcdc_hil_ok = 0U |
| 1 once the GLCDC layer-1 render path is confirmed programmed. | |
| volatile uint32_t | g_glcdc_hil_crc = 0U |
| FNV-1a-32 of the rendered framebuffer (the on-bench baseline). | |
| volatile uint32_t | g_glcdc_hil_status = 0U |
| Last GLCDC SYS_STAT snapshot (diagnostic; not part of the CRC). | |
| volatile uint32_t | g_glcdc_hil_heartbeat = 0U |
| Bumps on every idle-loop pass after a passing render. | |
| static const uint8_t | k_gh_msg_boot [] = "glcdc-hil: boot\r\n" |
| static const uint8_t | k_gh_msg_fail_init [] = "glcdc-hil: FAIL init\r\n" |
| static const uint8_t | k_gh_msg_fail_glcdc [] = "glcdc-hil: FAIL glcdc\r\n" |
| static const uint8_t | k_gh_msg_pre [] = "glcdc-hil: layer1=ok dim=" |
| static const uint8_t | k_gh_msg_x [] = "x" |
| static const uint8_t | k_gh_msg_crc [] = " crc=" |
| static const uint8_t | k_gh_msg_pass [] = " PASS\r\n" |
Headless on-silicon HIL gate for the GLCDC layer-1 render path.
ereader_chrome gates the software rasteriser (ra8_box + ra8_gfx into an SRAM buffer) but never touches the display controller. This app closes the remaining gap: it proves the GLCDC hardware layer-1 render path is programmed and scanning a real framebuffer, deterministically and headlessly, with no human looking at the panel.
Sequence:
Fold an FNV-1a-32 hash over the whole framebuffer and emit the result on the SCI8 J-Link OB console:
glcdc-hil: layer1=ok dim=512x512 crc=<8 hex> PASS
The HIL gate (hil.conf, uart_scrape) asserts that line. The render is deterministic (integer paint into a zeroed static buffer), so the CRC is the same every boot; the layer1=ok ... PASS tail is only emitted once the GLCDC programming asserts above all hold – any GLCDC bring-up failure prints glcdc-hil: FAIL glcdc and trips the gate's negative match.
On ra8_emulator the panel compositor reads the GLCDC GR1 framebuffer registers to build the panel image, so a --ppm snapshot also shows the painted pattern – independent confirmation that the GR1 registers point at the buffer. The same FNV-1a-32 globals are exported for --dump-sym memprobe.
Definition in file main.c.
| enum glcdc_hil_color_t : uint16_t |
| enum glcdc_hil_console_t : uint32_t |
SCI8 J-Link OB console + text-format constants.
| enum glcdc_hil_geom_t : uint16_t |
Framebuffer geometry constants.
512x512 RGB565 (0.5 MiB) sits in internal SRAM and is composited top-left over the BG plane – the same size lcd_draw_x uses, since the 1024x600 panel framebuffer (1.2 MiB) does not fit on-chip and SDRAM bring-up is a separate task.
| Enumerator | |
|---|---|
| k_gh_fb_w | Framebuffer width, pixels. |
| k_gh_fb_h | Framebuffer height, pixels. |
| k_gh_x_thickness | Diagonal-X half thickness, pixels. |
|
static |
Draw a 1-px border around the whole framebuffer in color.
Definition at line 263 of file main.c.
References k_gh_fb_h, k_gh_fb_w, and s_framebuffer.
Referenced by gh_render_pattern().
|
static |
Draw a thick corner-to-corner X in color.
Definition at line 244 of file main.c.
References k_gh_fb_h, k_gh_fb_w, k_gh_x_thickness, and s_framebuffer.
Referenced by gh_render_pattern().
|
static |
Fill the whole framebuffer with color.
Definition at line 236 of file main.c.
References k_gh_fb_h, k_gh_fb_w, and s_framebuffer.
Referenced by gh_render_pattern().
|
static |
FNV-1a-32 over the rendered framebuffer bytes.
Definition at line 289 of file main.c.
References k_gh_fnv_offset, k_gh_fnv_prime, and s_framebuffer.
Referenced by main().
|
static |
Bring the GLCDC layer-1 path up and prove it is programmed.
Runs display_init (full GLCDC bring-up) then asserts three independent facts: the init succeeded with a live handle, the bound framebuffer the backend reports is our exact buffer (GR1 fetch points here), and the GLCDC SYS_STAT register is reachable. The status mask itself is snapshotted for diagnostics but deliberately excluded from the deterministic banner because it is a live, free-running register.
| true | GLCDC layer-1 is programmed and scanning s_framebuffer. |
| false | Any bring-up or binding assertion failed. |
Definition at line 328 of file main.c.
References display_get_framebuffer(), display_init(), g_glcdc_hil_status, k_gh_display_cfg, k_ra8_ok, display_fb_t::pixels, ra8_glcdc_get_status(), and s_framebuffer.
Referenced by main().
|
static |
Park forever in WFI after a fatal init error.
Definition at line 191 of file main.c.
References gh_print(), and k_gh_msg_fail_init.
Referenced by gh_setup_or_halt().
|
static |
Emit a byte run on the SCI8 console.
Definition at line 185 of file main.c.
References ra8_board_uart_console_write().
Referenced by gh_panic_halt(), gh_print_hex(), gh_print_uint(), and main().
|
static |
Print value as 8 uppercase hex digits.
Definition at line 200 of file main.c.
References gh_print(), k_gh_dec_ten, k_gh_hex_nibbles, k_gh_nibble_bits, and k_gh_nibble_mask.
Referenced by main().
|
static |
Print a small unsigned integer in decimal.
Definition at line 212 of file main.c.
References gh_print(), and k_gh_dec_ten.
Referenced by main().
|
static |
Paint the full deterministic render pattern.
Definition at line 278 of file main.c.
References gh_draw_border(), gh_draw_x(), gh_fb_fill(), k_gh_color_bg, k_gh_color_border, and k_gh_color_x.
Referenced by main().
|
static |
Bring up clocks/MSTP/time + the SCI8 console; halt on failure.
Definition at line 353 of file main.c.
References gh_panic_halt(), k_gh_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: paint, bring the GLCDC up, hash, print the banner.
The application entry point Reset_Handler hands control to.
Definition at line 384 of file main.c.
References g_glcdc_hil_crc, g_glcdc_hil_heartbeat, g_glcdc_hil_ok, gh_framebuffer_hash(), gh_glcdc_programmed(), gh_print(), gh_print_hex(), gh_print_uint(), gh_render_pattern(), gh_setup_or_halt(), k_gh_fb_h, k_gh_fb_w, k_gh_msg_boot, k_gh_msg_crc, k_gh_msg_fail_glcdc, k_gh_msg_pass, k_gh_msg_pre, k_gh_msg_x, and ra8_isr_globals_enable().
| volatile uint32_t g_glcdc_hil_crc = 0U |
| volatile uint32_t g_glcdc_hil_heartbeat = 0U |
| volatile uint32_t g_glcdc_hil_ok = 0U |
| volatile uint32_t g_glcdc_hil_status = 0U |
Last GLCDC SYS_STAT snapshot (diagnostic; not part of the CRC).
Definition at line 161 of file main.c.
Referenced by gh_glcdc_programmed().
|
static |
Display PAL config selecting the GLCDC LCD backend.
Backend-agnostic: re-pointing iface at a different backend (e.g. an e-ink controller) is the only change needed to gate that path instead. The panel timing is the board BSP's EK-RA8D2 descriptor.
Definition at line 128 of file main.c.
Referenced by gh_glcdc_programmed().
|
static |
|
static |
|
static |
|
static |
Definition at line 172 of file main.c.
Referenced by gh_panic_halt().
|
static |
|
static |
|
static |