ra8-firmware 0.1.0
Bare-metal firmware for the Renesas RA8 family (RA8D2 / RA8P1)
Loading...
Searching...
No Matches
main.c File Reference

On-target WebP decode smoke test (ra8_webp over vendored libwebp). More...

#include <stdint.h>
#include "ra8_board_ek_ra8d2.h"
#include "ra8_boot_entry.h"
#include "ra8_cgc.h"
#include "ra8_err.h"
#include "ra8_mstp.h"
#include "ra8_time.h"
#include "ra8_webp.h"
#include "ra8_webp_arena.h"
Include dependency graph for main.c:

Go to the source code of this file.

Enumerations

enum  webp_demo_consts_t : uint32_t {
  k_webp_demo_baud = 115200U ,
  k_webp_demo_dim = 8U ,
  k_webp_demo_bpp = 4U ,
  k_webp_demo_stride = k_webp_demo_dim * k_webp_demo_bpp ,
  k_webp_demo_fb_bytes = k_webp_demo_dim * k_webp_demo_stride ,
  k_webp_demo_scratch = 256U * 1024U ,
  k_webp_demo_probe_r = 32U ,
  k_webp_demo_probe_a = 255U
}
 Fixed geometry + buffer sizes for the baked 8x8 fixture. More...

Functions

static void webp_demo_panic_halt (void)
 Park the CPU forever after a fatal init failure.
static void webp_demo_setup_or_halt (void)
 Bring CGC + module-stop + SysTick + console up, or panic-halt.
static bool webp_demo_decode_ok (void)
 Decode the baked fixture and confirm a known pixel round-trips.
void main (void)
 Application entry point.

Variables

static const uint8_t k_webp_lossless []
 8x8 VP8L (lossless, -exact) fixture – see tests/fixtures/webp/README.md.
static const uint8_t k_webp_demo_pass [] = "webp: PASS 8x8\r\n"
 PASS banner (HIL scrape target).
static const uint8_t k_webp_demo_fail [] = "webp: FAIL\r\n"
 FAIL banner (HIL scrape target).
static uint8_t s_webp_demo_scratch [k_webp_demo_scratch]
 Decode arena backing store (static SRAM, NASA P10 Rule 3).
static uint8_t s_webp_demo_fb [k_webp_demo_fb_bytes]
 Decoded RGBA8888 output framebuffer.

Detailed Description

On-target WebP decode smoke test (ra8_webp over vendored libwebp).

Tag
[Ring 6 / APP] {World: S}

Stand-alone EK-RA8D2 application that proves the vendored libwebp decoder (apps/shared_libs/third_party/libwebp) and the ra8_webp facade cross-compile, link, and run on the Cortex-M85 – decoding with zero heap through the ra8_webp bump arena (_sbrk traps after init).

A tiny 8x8 lossless (VP8L) WebP is baked into the image (k_webp_lossless, the same fixture as tests/fixtures/webp/fixture_lossless.webp). Because it is lossless with -exact, its RGB is preserved bit-exact, so a known pixel can be checked after decode.

Flow:

  1. ra8_cgc_init / ra8_mstp_init / ra8_time_init bring the clocks and SysTick up.
  2. ra8_board_uart_console_init opens the J-Link OB VCOM console (SCI8).
  3. Bind a static SRAM arena, decode the baked WebP into a static RGBA8888 framebuffer, and verify pixel (1,1) == (32, 32, 32, 255).
  4. Print "webp: PASS 8x8\r\n" on success (banner line for the HIL scrape) or "webp: FAIL\r\n" on any mismatch, then park.

NOTE(#289): this decodes a whole WebP into one RGBA buffer. The band-tile normalisation + reflow raster dispatch land with #289.

Since
0.1.0

Definition in file main.c.

Enumeration Type Documentation

◆ webp_demo_consts_t

enum webp_demo_consts_t : uint32_t

Fixed geometry + buffer sizes for the baked 8x8 fixture.

Enumerator
k_webp_demo_baud 

Console baud rate.

k_webp_demo_dim 

Fixture width and height.

k_webp_demo_bpp 

RGBA8888 bytes per pixel.

k_webp_demo_stride 

Row stride.

k_webp_demo_fb_bytes 

8x8 RGBA.

k_webp_demo_scratch 

Decode arena, bytes.

k_webp_demo_probe_r 

Expected R at pixel (1,1).

k_webp_demo_probe_a 

Expected A at pixel (1,1).

Definition at line 51 of file main.c.

Function Documentation

◆ main()

void main ( void )

Application entry point.

The application entry point Reset_Handler hands control to.

Since
0.1.0

Definition at line 155 of file main.c.

References k_webp_demo_fail, k_webp_demo_pass, ra8_board_uart_console_write(), webp_demo_decode_ok(), webp_demo_panic_halt(), and webp_demo_setup_or_halt().

◆ webp_demo_decode_ok()

bool webp_demo_decode_ok ( void )
static

Decode the baked fixture and confirm a known pixel round-trips.

Returns
true if the decode succeeded and pixel (1,1) matches the source.
Precondition
The console + clocks are up (webp_demo_setup_or_halt ran).
Postcondition
s_webp_demo_fb holds the decoded canvas on success.
Since
0.1.0

Definition at line 126 of file main.c.

References k_ra8_ok, k_webp_demo_bpp, k_webp_demo_dim, k_webp_demo_probe_a, k_webp_demo_probe_r, k_webp_demo_stride, k_webp_lossless, ra8_webp_decode_rgba(), s_webp_demo_fb, and s_webp_demo_scratch.

Referenced by main().

◆ webp_demo_panic_halt()

void webp_demo_panic_halt ( void )
static

Park the CPU forever after a fatal init failure.

Precondition
Called only after an unrecoverable setup error.
Postcondition
CPU is parked; only a debugger or reset wakes it.
Since
0.1.0

Definition at line 86 of file main.c.

Referenced by main(), and webp_demo_setup_or_halt().

◆ webp_demo_setup_or_halt()

void webp_demo_setup_or_halt ( void )
static

Bring CGC + module-stop + SysTick + console up, or panic-halt.

Precondition
Reset default clock tree; MSTP gating cleared for nothing yet.
Postcondition
CGC live, SysTick running, and the console is ready for writes.
Since
0.1.0

Definition at line 99 of file main.c.

References k_ra8_clock_id_cpuclk0, k_ra8_ok, k_webp_demo_baud, ra8_board_uart_console_init(), ra8_cgc_get_clock_hz(), ra8_cgc_init(), ra8_mstp_init(), ra8_time_init(), and webp_demo_panic_halt().

Referenced by main().

Variable Documentation

◆ k_webp_demo_fail

const uint8_t k_webp_demo_fail[] = "webp: FAIL\r\n"
static

FAIL banner (HIL scrape target).

Definition at line 73 of file main.c.

Referenced by main().

◆ k_webp_demo_pass

const uint8_t k_webp_demo_pass[] = "webp: PASS 8x8\r\n"
static

PASS banner (HIL scrape target).

Definition at line 71 of file main.c.

Referenced by main().

◆ k_webp_lossless

const uint8_t k_webp_lossless[]
static
Initial value:
= {
0x52, 0x49, 0x46, 0x46, 0x2C, 0x00, 0x00, 0x00, 0x57, 0x45, 0x42, 0x50, 0x56,
0x50, 0x38, 0x4C, 0x1F, 0x00, 0x00, 0x00, 0x2F, 0x07, 0xC0, 0x01, 0x00, 0xCD,
0x65, 0x44, 0xFF, 0x63, 0x17, 0x85, 0x28, 0x78, 0xFF, 0x03, 0x42, 0x02, 0xC2,
0x14, 0xFF, 0x77, 0x6A, 0x0E, 0x0C, 0x48, 0xC4, 0x04, 0x80, 0xAD, 0x0D, 0x00,
}

8x8 VP8L (lossless, -exact) fixture – see tests/fixtures/webp/README.md.

Definition at line 63 of file main.c.

Referenced by webp_demo_decode_ok().

◆ s_webp_demo_fb

uint8_t s_webp_demo_fb[k_webp_demo_fb_bytes]
static

Decoded RGBA8888 output framebuffer.

Definition at line 78 of file main.c.

Referenced by webp_demo_decode_ok().

◆ s_webp_demo_scratch

uint8_t s_webp_demo_scratch[k_webp_demo_scratch]
static

Decode arena backing store (static SRAM, NASA P10 Rule 3).

Definition at line 76 of file main.c.

Referenced by webp_demo_decode_ok().