50typedef enum : uint32_t {
69static const uint8_t
k_msg_boot[] =
"ereader-imgfmt-hil: boot\r\n";
70static const uint8_t
k_msg_fail[] =
"ereader-imgfmt-hil: FAIL init\r\n";
71static const uint8_t
k_msg_dbmp[] =
"ereader-imgfmt-hil: FAIL bmp\r\n";
72static const uint8_t
k_msg_dgif[] =
"ereader-imgfmt-hil: FAIL gif\r\n";
73static const uint8_t
k_msg_pre[] =
"ereader-imgfmt-hil: bmp=";
78static void ef_print(
const uint8_t* msg, uint32_t len)
87 __asm__
volatile(
"bkpt #0");
89 __asm__
volatile(
"wfi");
99 for (
size_t i = 0U; i < n; i++) {
120 uint32_t cpuclk0_hz = 0U;
195 const uint32_t bmp_crc =
197 const uint32_t gif_crc =
207 __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_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 uint8_t s_img_arena[k_cm_arena_bytes]
Zero-heap bump arena in SDRAM backing the PNG page decode.
static void ef_print(const uint8_t *msg, uint32_t len)
Emit a byte run on the SCI8 console.
static const uint8_t k_msg_dgif[]
static const uint8_t k_msg_dbmp[]
static const uint8_t k_msg_gif[]
static uint32_t ef_framebuffer_hash(void)
FNV-1a hash over the rendered framebuffer.
static void ef_print_hex(uint32_t value)
Print a 32-bit value as 8 upper-case hex digits.
static void ef_setup_or_halt(void)
Bring up clocks/MSTP/time + the SCI8 console; halt on failure.
ef_consts_t
Console / render knobs (no magic numbers).
@ k_ef_fnv_prime
FNV-1a 32-bit prime.
@ k_ef_nibble_bits
Bits per hex nibble.
@ k_ef_arena_bytes
Image decode scratch, bytes.
@ k_ef_dec_ten
Hex digit / decimal split.
@ k_ef_nibble_mask
Low-nibble mask.
@ k_ef_hex_nibbles
Hex digits in a 32-bit value.
@ k_ef_fb_h
Framebuffer height, pixels.
@ k_ef_col_bg
Framebuffer clear colour.
@ k_ef_fb_w
Framebuffer width, pixels.
@ k_ef_uart_baud
Console baud.
@ k_ef_fnv_offset
FNV-1a 32-bit offset basis.
static uint32_t ef_decode_and_hash(const uint8_t *bytes, size_t len, const uint8_t *fail_msg, uint32_t fail_len)
Clear the framebuffer, decode+scale+blit one image, hash the result.
static void ef_panic_halt(const uint8_t *msg, uint32_t len)
Print the fail banner and trap (ra8_emulator halts on the BKPT).
Baked BMP + GIF test images for the ereader_imgfmt gate.
static const uint8_t k_gif[k_gif_len]
Baked 40x30 four-quadrant GIF image.
static const uint8_t k_bmp[k_bmp_len]
Baked 40x30 four-quadrant BMP image.
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.
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.
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.
Zero-heap raster image decode + scale + blit for reflow (#106).
ra8_err_t ra8_img_decode_blit(ra8_img_arena_t *arena, const uint8_t *bytes, size_t len, int32_t dst_x, int32_t dst_y, int32_t box_w, int32_t box_h, int32_t *out_w, int32_t *out_h)
Decode bytes and blit it, scaled to fit, into the bound framebuffer.
Caller-owned bump arena backing a single image decode.