|
ra8-firmware 0.1.0
Bare-metal firmware for the Renesas RA8 family (RA8D2 / RA8P1)
|
DRW 2D-engine framebuffer fill-rect + verify demo (EK-RA8D2). More...
#include <stdint.h>#include "ra8_board_ek_ra8d2.h"#include "ra8_boot_entry.h"#include "ra8_cgc.h"#include "ra8_check.h"#include "ra8_drw.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 | drw_demo_config_t : uint32_t { k_drw_demo_baud = 115200U , k_drw_demo_period_ms = 1000U , k_drw_demo_fill_argb = 0xFF00FF00U , k_drw_demo_idle_budget = 200000U } |
| Compile-time settings. More... | |
| enum | drw_demo_geom_t : uint16_t { k_drw_demo_fb_dim = 32U , k_drw_demo_rect_xy = 8U , k_drw_demo_rect_wh = 16U , k_drw_demo_center = 16U } |
| Framebuffer + rectangle geometry (pixels). More... | |
Functions | |
| static void | drw_demo_panic_halt (void) |
| Park forever after a fatal init failure. | |
| static uint32_t | drw_demo_px (uint16_t x, uint16_t y) |
| Index of pixel (x, y) within the framebuffer. | |
| static void | drw_demo_setup_or_halt (void) |
| Bring CGC + SysTick + SCI8 + LEDs + MSTP up. | |
| static ra8_err_t | drw_demo_configure (void) |
| Bring up the DRW engine pointed at g_drw_fb. | |
| static ra8_err_t | drw_demo_fill_and_check (uint8_t *out_ok) |
| Clear the framebuffer, fill the centre rectangle, and verify. | |
| void | main (void) |
| The application entry point Reset_Handler hands control to. | |
Variables | |
| static const char * | s_tag = "drw_demo" |
| Diagnostic / log tag. | |
| static const uint8_t | k_drw_demo_ok_msg [] = "drw: fill match=Y\r\n" |
| Output line tags. | |
| static const uint8_t | k_drw_demo_bad_msg [] = "drw: fill match=N\r\n" |
| static uint32_t | g_drw_fb [(uint32_t) k_drw_demo_fb_dim *(uint32_t) k_drw_demo_fb_dim] |
| 32 x 32 ARGB8888 framebuffer the DRW rasterizes into. | |
| volatile uint32_t | g_drw_match = 0U |
| 1 when the filled rectangle read back as expected. | |
| volatile uint32_t | g_drw_rev = 0U |
| DRW HWREVISION register snapshot (confirms the engine is present). | |
| volatile uint32_t | g_drw_fill_err = 0U |
| Non-zero if a DRW call returned an error. | |
| volatile uint32_t | g_drw_heartbeat = 0U |
| Bumps once per main-loop pass – liveness for headless probes. | |
DRW 2D-engine framebuffer fill-rect + verify demo (EK-RA8D2).
The DRW ("D/AVE 2D") engine is the RA8D2's hardware 2D rasterizer. This demo points it at a small 32x32 ARGB8888 framebuffer in SRAM, asks it to fill a 16x16 green rectangle in the centre, waits for the engine to go idle, and checks the framebuffer byte-exact: the centre pixel must be green and the corners must still be clear.
Bring-up: CGC + SysTick + SCI8 + LEDs + MSTP. Once a second the loop clears the framebuffer, issues the fill, and reports "drw: fill match=Y\r\n" (or match=N) on the J-Link OB CDC channel. LED1 toggles on a clean fill; LED2 toggles on a mismatch. On silicon the DRW paints exactly the requested rectangle once the graphics power domain is up (issue #247 resolved), so the banner reads match=Y.
Bare EK-RA8D2 only – no shields or external transceivers. The DRW FB cache is left off (enable_caches = false) so the CPU reads the freshly-rasterized pixels directly; with the FB cache on, call ra8_drw_cache_flush before the verify, and mind the Cortex-M85 D-cache (the framebuffer lives in cacheable SRAM) – see the bench plan.
Definition in file main.c.
| enum drw_demo_config_t : uint32_t |
| enum drw_demo_geom_t : uint16_t |
|
staticnodiscard |
Bring up the DRW engine pointed at g_drw_fb.
Definition at line 171 of file main.c.
References g_drw_fb, g_drw_rev, k_drw_demo_fb_dim, k_ra8_drw_writefmt_argb8888, k_ra8_ok, ra8_drw_get_hwrevision(), and ra8_drw_init().
Referenced by main().
|
staticnodiscard |
Clear the framebuffer, fill the centre rectangle, and verify.
| [out] | out_ok | 1 when the centre pixel is green and both checked corners are clear. |
| k_ra8_err_null_ptr | out_ok was NULL. |
Definition at line 204 of file main.c.
References drw_demo_px(), g_drw_fb, g_drw_fill_err, k_drw_demo_center, k_drw_demo_fb_dim, k_drw_demo_fill_argb, k_drw_demo_idle_budget, k_drw_demo_rect_wh, k_drw_demo_rect_xy, k_ra8_ok, RA8_CHECK_NULL_PTR, ra8_drw_fill_rect(), ra8_drw_wait_idle(), and s_tag.
Referenced by main().
|
static |
Park forever after a fatal init failure.
Definition at line 119 of file main.c.
Referenced by drw_demo_setup_or_halt(), and main().
|
static |
Index of pixel (x, y) within the framebuffer.
Definition at line 127 of file main.c.
References k_drw_demo_fb_dim.
Referenced by drw_demo_fill_and_check().
|
static |
Bring CGC + SysTick + SCI8 + LEDs + MSTP up.
Definition at line 133 of file main.c.
References drw_demo_panic_halt(), k_drw_demo_baud, k_ra8_board_led1, k_ra8_board_led2, k_ra8_clock_id_cpuclk0, k_ra8_ok, ra8_board_led_init(), 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 | ) |
The application entry point Reset_Handler hands control to.
Returns void, not int. This is a freestanding image: there is no hosted C environment, no process and nothing to report an exit status to. ISO C fixes main at int only for a hosted implementation; for a freestanding one (C23 5.1.2.1) the startup function's name and type are implementation-defined, and this is that definition. Reset_Handler discards no value because there is none to discard, and if main ever does return, startup halts the CPU rather than resuming anything.
The firmware lane is compiled -ffreestanding (see cmake/ra8_add_app.cmake) and the flag and this signature travel together: without it both GCC and clang reject a non-int main (-Wmain / -Wmain-return-type). Do not remove one without the other.
That coupling is why the declaration sits behind __STDC_HOSTED__ == 0, which -ffreestanding sets and a hosted build does not. The guard is not defensive dressing: this header is reachable from host builds (the unit tests compile ra8_core natively), and an unguarded void main(void); makes every hosted translation unit that includes it fail with conflicting types for 'main' against its own ISO int main. The declaration therefore exists exactly where its contract does.
Hosted first-party code – everything under tests/ and tools/ – uses the ISO int main(...) contract instead, because it genuinely does run under an OS that reads the exit status. scripts/checks/check_entry_points.py holds each domain to its own contract (#707).
Declared here, once, for the same reason SystemInit is: every vector_table.c used to restate it as a local extern int32_t main(void);, sixteen copies that no compiler ever compared against the definition – and roughly thirty of them had silently drifted out of agreement with the main they called.
The application entry point Reset_Handler hands control to.
Brings up CGC + BSP audio then plays blocks.
The application entry point Reset_Handler hands control to.
Brings up CGC + GPT triple, runs sweep.
The application entry point Reset_Handler hands control to.
Brings up clocks + UART + RMII pins, then ThreadX.
The application entry point Reset_Handler hands control to.
Brings up clocks + UART, then enters ThreadX.
The application entry point Reset_Handler hands control to.
Brings up LED, console, SDHI pins, then ThreadX.
The application entry point Reset_Handler hands control to.
Brings up CGC + USB-FS + UAC1, then enters the iso-IN feed loop forever.
The application entry point Reset_Handler hands control to.
The application entry point Reset_Handler hands control to.
See file header.
The application entry point Reset_Handler hands control to.
The application entry point Reset_Handler hands control to.
The application entry point Reset_Handler hands control to.
The application entry point Reset_Handler hands control to.
The application entry point Reset_Handler hands control to.
The application entry point Reset_Handler hands control to.
The application entry point Reset_Handler hands control to.
Profiles power modes once a second.
The application entry point Reset_Handler hands control to.
The application entry point Reset_Handler hands control to.
Brings up the clocks, console, SPI, and SD card, then runs the shared ra8_io VFS round-trip over the SD-over-SPI block device. On success it prints the exact PASS banner the HIL runner and ra8_emulator smoke gate scrape for; on any failure it prints FAIL and parks the core.
The application entry point Reset_Handler hands control to.
Initialises logging and the console, brings up the OSPI NOR volume, runs the erase-before-write round-trip, and prints a single PASS/FAIL verdict line over SCI8 before parking in an infinite loop.
The application entry point Reset_Handler hands control to.
The application entry point Reset_Handler hands control to.
The application entry point Reset_Handler hands control to.
The application entry point Reset_Handler hands control to.
Both USB controllers' clocks and pins come up before the kernel so the workers only deal with stack bring-up.
The application entry point Reset_Handler hands control to.
Brings up logging and the clock tree, releases the Cortex-M33 (which then blinks LED1 via ra8_pcntr_set_output()), and idles. See the file header.
The application entry point Reset_Handler hands control to.
The application entry point Reset_Handler hands control to.
Brings up logging, the clock tree, and the VCOM console, runs the cacheable-SRAM round-trip with the D-cache that SystemInit() enabled through ra8_cache_dcache_enable(), emits the matching PASS / FAIL banner over the console and ra8_log, then parks in WFI. Every byte the self-test touches runs with the L1 caches + MPU enabled by the shared boot (RA8_BOOT_ENABLE_CACHE_MPU + RA8_BOOT_CACHE_VIA_HAL).
The application entry point Reset_Handler hands control to.
Publishes the mailbox, releases the Cortex-M33 into the emitter, yields until it signals done, validates the blob the M33 built, then logs the PASS/FAIL verdict and the chapter count read back from the blob. See the file header for the offload narrative.
The application entry point Reset_Handler hands control to.
The application entry point Reset_Handler hands control to.
The application entry point Reset_Handler hands control to.
The application entry point Reset_Handler hands control to.
The application entry point Reset_Handler hands control to.
The application entry point Reset_Handler hands control to.
Publishes the mailbox, arms the IPC0 wake and configures the LPM block, releases the Cortex-M33 into the reader, waits for the first held page, logs the page-0 verdict, then runs the #150 mode-switch cycle – parking in low-power WFI and waking on the M33's page-turn pokes – before logging the handoff verdict and parking for good. See the file header for the narrative.
The application entry point Reset_Handler hands control to.
The application entry point Reset_Handler hands control to.
Brings up the timebase then measures forever.
The application entry point Reset_Handler hands control to.
Arms the RIIC1 target and polls the dispatcher.
The application entry point Reset_Handler hands control to.
The application entry point Reset_Handler hands control to.
The application entry point Reset_Handler hands control to.
Brings up the LIN commander then drives frames.
The application entry point Reset_Handler hands control to.
Brings up logging, "renders" page 0 into the shared mailbox, releases the Cortex-M33 into its hold loop, and parks the M85 in low-power WFI sleep. See the file header for the power-saving narrative.
The application entry point Reset_Handler hands control to.
The USB clock, pins, console, and the SD card all come up before the kernel so the worker only deals with USB stack bring-up.
The application entry point Reset_Handler hands control to.
The application entry point Reset_Handler hands control to.
The application entry point Reset_Handler hands control to.
The application entry point Reset_Handler hands control to.
Brings up logging, the clock tree, and the VCOM console, runs the three-step self-test (MPU enabled, canonical boot map, Device MMIO), emits the matching PASS / FAIL banner over the console and ra8_log, then parks in WFI.
The application entry point Reset_Handler hands control to.
The application entry point Reset_Handler hands control to.
Initialises logging + console, brings up the MRAM volume, runs the wear-levelling + power-cycle-survival flow, and prints a single PASS/FAIL verdict.
The application entry point Reset_Handler hands control to.
Initialises logging + console, brings up the MRAM volume, runs the program/erase round-trip, and prints a single PASS/FAIL verdict.
The application entry point Reset_Handler hands control to.
Brings up the clocks, console, and SDHI bus pins, runs the native SD card identification, fills the payload, then runs the full ra8_io VFS round-trip over the native-SDHI block device. On success it prints the exact PASS banner the HIL runner and ra8_emulator smoke gate scrape for; on any failure it prints FAIL and parks the core.
The application entry point Reset_Handler hands control to.
Brings up the console and both stdio sinks, retargets the engine's stdio to the in-RAM capture sink, runs the two-backend swap, replays the RAM capture out of the UART, and prints a single PASS/FAIL verdict per abstraction before parking in an infinite loop.
The application entry point Reset_Handler hands control to.
Brings up the clocks, console, and SDHI bus pins, runs the native SD card identification, fills the payload, then writes + reads + compares one raw 512-byte block straight against ra8_sdcard. On success it prints the exact PASS banner; on any failure it prints FAIL and parks the core.
The application entry point Reset_Handler hands control to.
The application entry point Reset_Handler hands control to.
Brings up clocks + UART + RMII + RSIP, then ThreadX.
The application entry point Reset_Handler hands control to.
The application entry point Reset_Handler hands control to.
The application entry point Reset_Handler hands control to.
The application entry point Reset_Handler hands control to.
The application entry point Reset_Handler hands control to.
The application entry point Reset_Handler hands control to.
Initializes and arms ADC_B, formats each successful channel sample without variadic I/O, emits the verdict, toggles LED1, and delays.
The application entry point Reset_Handler hands control to.
The application entry point Reset_Handler hands control to.
Brings up logging, releases the Cortex-M33 (which then blinks LED1), and idles. See the file header for the teaching narrative.
The application entry point Reset_Handler hands control to.
The application entry point Reset_Handler hands control to.
See the file header for the full behaviour summary.
The application entry point Reset_Handler hands control to.
Brings up logging, the clock tree, and the VCOM console, runs the three-step self-test (cacheable SRAM, RO MRAM const, Device MMIO), emits the matching PASS / FAIL banner over the console and ra8_log, then parks in WFI. Every byte the self-test touches runs with the L1 caches and MPU enabled by the shared boot (RA8_BOOT_ENABLE_CACHE_MPU).
The application entry point Reset_Handler hands control to.
The application entry point Reset_Handler hands control to.
Lights HOCO + PLL, then runs a 1 Hz blink.
The application entry point Reset_Handler hands control to.
See file header for behaviour summary.
The application entry point Reset_Handler hands control to.
The application entry point Reset_Handler hands control to.
The application entry point Reset_Handler hands control to.
The application entry point Reset_Handler hands control to.
The application entry point Reset_Handler hands control to.
Initializes the demo, executes one comparison per period, increments the exported match or mismatch counter, and toggles the matching LED.
Definition at line 235 of file main.c.
References drw_demo_configure(), drw_demo_fill_and_check(), drw_demo_panic_halt(), drw_demo_setup_or_halt(), g_drw_heartbeat, g_drw_match, k_drw_demo_bad_msg, k_drw_demo_ok_msg, k_drw_demo_period_ms, k_ra8_board_led1, k_ra8_board_led2, k_ra8_ok, ra8_board_led_toggle(), ra8_board_uart_console_write(), ra8_delay_ms(), and ra8_isr_globals_enable().
|
static |
32 x 32 ARGB8888 framebuffer the DRW rasterizes into.
Definition at line 84 of file main.c.
Referenced by drw_demo_configure(), and drw_demo_fill_and_check().
| volatile uint32_t g_drw_fill_err = 0U |
Non-zero if a DRW call returned an error.
Definition at line 108 of file main.c.
Referenced by drw_demo_fill_and_check().
| volatile uint32_t g_drw_heartbeat = 0U |
| volatile uint32_t g_drw_match = 0U |
| volatile uint32_t g_drw_rev = 0U |
DRW HWREVISION register snapshot (confirms the engine is present).
Definition at line 100 of file main.c.
Referenced by drw_demo_configure().
|
static |
|
static |