|
ra8-firmware 0.1.0
Bare-metal firmware for the Renesas RA8 family (RA8D2 / RA8P1)
|
On-silicon HIL: epub parse layer runs on the target (#139). More...
#include <stddef.h>#include <stdint.h>#include "epub.h"#include "epub_fixture.h"#include "ra8_board_ek_ra8d2.h"#include "ra8_boot_entry.h"#include "ra8_cgc.h"#include "ra8_err.h"#include "ra8_isr.h"#include "ra8_mstp.h"#include "ra8_time.h"Go to the source code of this file.
Enumerations | |
| enum | ep_consts_t : uint32_t { k_ep_uart_baud = 115200U , k_ep_expect_chap = 2U , k_ep_chap_cap = 4096U , k_ep_crc_init = 0xFFFFFFFFU , k_ep_crc_poly = 0xEDB88320U , k_ep_crc_bits = 8U , k_ep_hex_nibbles = 8U , k_ep_nibble_bits = 4U , k_ep_nibble_mask = 0x0FU , k_ep_dec_ten = 10U } |
| Console / parse knobs (no magic numbers). More... | |
Functions | |
| static void | ep_print (const uint8_t *msg, uint32_t len) |
| Emit a byte run on the SCI8 console. | |
| static void | ep_panic_halt (const uint8_t *msg, uint32_t len) |
| Print the fail banner and trap (ra8_emulator halts on the BKPT). | |
| static uint32_t | ep_crc32 (const uint8_t *data, size_t len) |
CRC-32 (reflected, poly 0xEDB88320) over data. | |
| static void | ep_print_hex (uint32_t value) |
| Print a 32-bit value as 8 upper-case hex digits. | |
| static void | ep_print_uint (uint32_t value) |
| Print a small unsigned integer in decimal. | |
| static void | ep_setup_or_halt (void) |
| Bring up clocks/MSTP/time + the SCI8 console; halt on failure. | |
| static uint16_t | ep_parse_or_halt (uint32_t *out_crc) |
| Open the baked EPUB, verify the spine, load + CRC chapter 0. | |
| void | main (void) |
| App entry: parse the baked EPUB on silicon, print the banner. | |
Variables | |
| static epub_book_t | s_book |
| Opened book (large – file-scope, not on the stack). | |
| static uint8_t | s_chapter [k_ep_chap_cap] |
| Chapter-0 XHTML scratch (file-scope to keep the stack small). | |
| static const uint8_t | k_msg_boot [] = "epub-parse-hil: boot\r\n" |
| static const uint8_t | k_msg_fail [] = "epub-parse-hil: FAIL init\r\n" |
| static const uint8_t | k_msg_open [] = "epub: FAIL open\r\n" |
| static const uint8_t | k_msg_chap [] = "epub: FAIL chapters\r\n" |
| static const uint8_t | k_msg_load [] = "epub: FAIL load\r\n" |
| static const uint8_t | k_msg_meta [] = "epub: FAIL meta\r\n" |
| static const uint8_t | k_msg_pre [] = "epub: chapters=" |
| static const uint8_t | k_msg_crc [] = " ch0_crc=" |
| static const uint8_t | k_msg_ok [] = " PASS\r\n" |
On-silicon HIL: epub parse layer runs on the target (#139).
First firmware app to exercise epub (+ vendored miniz ZIP + bounded XML reader) on real silicon. The EPUB parse path is byte-twiddling C/C++ that has only ever run on the x86 host; this gate runs it on the EK-RA8D2.
It opens a baked known-good .epub (the seed_two_chapters fuzzer seed) in memory, exercising both miniz allocation paths through the zero-heap epub_miniz_alloc static arena – epub_open (ZIP central directory) and epub_load_chapter (DEFLATE decompressor) – then CRC-32s chapter 0's decompressed XHTML and reads the Dublin Core metadata. The console banner is:
epub: chapters=2 ch0_crc=<8hex> PASS
Deterministic (a fixed blob through a deterministic parser), so the banner is identical on host, ra8_emulator, and silicon. Any failure on any path prints a FAIL banner and halts on a BKPT before the PASS line, so the gate is exact.
[Ring 7 / App] {World: NS}
Definition in file main.c.
| enum ep_consts_t : uint32_t |
Console / parse knobs (no magic numbers).
|
static |
CRC-32 (reflected, poly 0xEDB88320) over data.
Definition at line 89 of file main.c.
References k_ep_crc_bits, k_ep_crc_init, and k_ep_crc_poly.
Referenced by ep_parse_or_halt().
|
static |
Print the fail banner and trap (ra8_emulator halts on the BKPT).
Definition at line 79 of file main.c.
References ep_print().
|
static |
Open the baked EPUB, verify the spine, load + CRC chapter 0.
Exercises both miniz allocation paths through the static arena: the open (central directory) and the chapter load (DEFLATE decompressor). Halts on any failure before returning.
| [out] | out_crc | Receives the CRC-32 of chapter 0's decompressed XHTML. |
Definition at line 162 of file main.c.
References ep_crc32(), ep_panic_halt(), epub_get_chapter_count(), epub_get_metadata(), epub_load_chapter(), epub_open(), k_ep_chap_cap, k_ep_expect_chap, k_epub_fixture, k_epub_fixture_len, k_msg_chap, k_msg_load, k_msg_meta, k_msg_open, k_ra8_ok, s_book, and s_chapter.
Referenced by main().
|
static |
Emit a byte run on the SCI8 console.
Definition at line 73 of file main.c.
References ra8_board_uart_console_write().
Referenced by ep_panic_halt(), ep_print_hex(), ep_print_uint(), and main().
|
static |
Print a 32-bit value as 8 upper-case hex digits.
Definition at line 103 of file main.c.
References ep_print(), k_ep_dec_ten, k_ep_hex_nibbles, k_ep_nibble_bits, and k_ep_nibble_mask.
Referenced by main().
|
static |
Print a small unsigned integer in decimal.
Definition at line 115 of file main.c.
References ep_print(), and k_ep_dec_ten.
Referenced by main().
|
static |
Bring up clocks/MSTP/time + the SCI8 console; halt on failure.
Definition at line 134 of file main.c.
References ep_panic_halt(), k_ep_uart_baud, k_msg_fail, 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: parse the baked EPUB on silicon, print the banner.
The application entry point Reset_Handler hands control to.
Definition at line 194 of file main.c.
References ep_parse_or_halt(), ep_print(), ep_print_hex(), ep_print_uint(), ep_setup_or_halt(), k_msg_boot, k_msg_crc, k_msg_ok, k_msg_pre, and ra8_isr_globals_enable().
|
static |
|
static |
Definition at line 65 of file main.c.
Referenced by ep_parse_or_halt(), and est_open_or_halt().
|
static |
Definition at line 63 of file main.c.
Referenced by al_setup_or_halt(), bm_setup_or_halt(), bs_setup_or_halt(), ch_panic_halt(), ec_setup_or_halt(), ef_setup_or_halt(), ep_setup_or_halt(), erb_setup_or_halt(), es_setup_or_halt(), est_setup_or_halt(), ez_bringup_clocks(), ez_bringup_panel(), fc_setup_or_halt(), iic_setup_or_halt(), imp_panic(), iu_panic_halt(), iv_panic_halt(), kb_setup_or_halt(), lk_setup_or_halt(), main(), mg_bringup_clocks(), mg_bringup_panel(), sd_setup_or_halt(), sh_panic_halt(), tb_setup_or_halt(), and wa_setup_or_halt().
|
static |
Definition at line 66 of file main.c.
Referenced by ep_parse_or_halt().
|
static |
Definition at line 67 of file main.c.
Referenced by ep_parse_or_halt().
|
static |
Definition at line 64 of file main.c.
Referenced by ec_render_cover_or_halt(), ep_parse_or_halt(), est_open_or_halt(), and main().
|
static |
|
static |