|
ra8-firmware 0.1.0
Bare-metal firmware for the Renesas RA8 family (RA8D2 / RA8P1)
|
Copy-to-run HIL demo: launch one embedded image at the SRAM run base. More...
#include <stdint.h>#include <string.h>#include "payload_image.h"#include "ra8_attributes.h"#include "ra8_boot_entry.h"#include "ra8_dfu.h"Go to the source code of this file.
Enumerations | |
| enum | dcr_vt_t : uint32_t { k_dcr_sram_mask = 0xFF000000U , k_dcr_sram_base = 0x22000000U , k_dcr_thumb_bit = 0x00000001U } |
| Sanity-check masks for the embedded image's vector table. More... | |
| enum | dcr_probe_t : uintptr_t { k_dcr_probe_sentinel_addr = 0x22010000U , k_dcr_probe_counter_addr = 0x22010004U } |
| Fixed SRAM probe-word addresses the copied-to-run payload writes. More... | |
Functions | |
| static void | internal_dcr_panic_halt (void) |
| Park forever in WFI – copy-to-run did not happen (alive gate fails). | |
| void | main (void) |
| Entry: launch the embedded copy-to-run image; never returns on success. | |
Variables | |
| volatile uint32_t | g_dcr_run_sentinel |
| Memprobe anchor for the payload's proof-of-run sentinel (0x22010000). | |
| volatile uint32_t | g_dcr_run_heartbeat |
| Memprobe liveness counter the copied-to-run payload advances (0x22010004). | |
Copy-to-run HIL demo: launch one embedded image at the SRAM run base.
The unattended, self-contained proof of the dfu_bootloader's copy-to-run scheme (issue #97): an image linked ONCE at the SRAM run base (k_ra8_dfu_run_base) runs from wherever it is staged, with no per-slot build.
This app embeds that image (payload_image.h, generated from payload.c by examples/ek_ra8d2/hw_validated/hil/dfu_copy_to_run/scripts/build_payload.sh) and hands it to the shared ra8_dfu_launch – the exact launcher the bootloader uses for a validated slot. ra8_dfu_launch copies the image to k_ra8_dfu_run_base and branches there; the payload then spins in the SRAM run window forever (writing a sentinel + heartbeat at a fixed probe word).
hil.conf is HIL_MODE=alive. After the hand-off the PC lives in the SRAM copy-to-run window (0x22020000+) – a region only reachable BY copying-to-run and branching there, since this app's own code is in MRAM. So "PC in the SRAM run window, CycleCnt advancing, CFSR/HFSR clean, not in a fault spinner" is a specific proof that copy-to-run executed. If the launch's run-target check fails (it never should: a fixed run base + a valid length), control returns and parks in internal_dcr_panic_halt, which the alive gate flags as a fault spinner.
Unlike the bootloader's alive gate (which can also pass via the DFU-device fallback when no slot is valid), this app ALWAYS copies-to-run, so its alive pass is unambiguous.
Definition in file main.c.
| enum dcr_probe_t : uintptr_t |
Fixed SRAM probe-word addresses the copied-to-run payload writes.
Mirror of payload.c's k_payload_probe_sentinel / k_payload_probe_counter. Once ra8_dfu_launch branches into it, the payload (running from the SRAM run window) writes a proof-of-run sentinel and a free-running heartbeat at these two fixed words. They sit above this app's low-SRAM .bss/.data and below the run base (0x22020000), so neither this app nor the payload image overwrites them. linker_script.ld pins g_dcr_run_sentinel / g_dcr_run_heartbeat here so the J-Link memprobe gate (HIL_MODE=jlink_memprobe) can resolve the heartbeat by name.
| Enumerator | |
|---|---|
| k_dcr_probe_sentinel_addr | Sentinel word address. |
| k_dcr_probe_counter_addr | Heartbeat word address. |
| enum dcr_vt_t : uint32_t |
|
static |
Park forever in WFI – copy-to-run did not happen (alive gate fails).
Definition at line 113 of file main.c.
References RA8_INTERNAL.
Referenced by main().
| void main | ( | void | ) |
Entry: launch the embedded copy-to-run image; never returns on success.
The application entry point Reset_Handler hands control to.
Definition at line 130 of file main.c.
References g_dcr_run_heartbeat, g_dcr_run_sentinel, internal_dcr_panic_halt(), k_dcr_probe_counter_addr, k_dcr_probe_sentinel_addr, k_dcr_sram_base, k_dcr_sram_mask, k_dcr_thumb_bit, k_ra8_dfu_run_base, memcpy(), ra8_dfu_launch(), and s_payload_image.
| volatile uint32_t g_dcr_run_heartbeat |
Memprobe liveness counter the copied-to-run payload advances (0x22010004).
A reserved 4-byte word pinned by linker_script.ld to k_dcr_probe_counter_addr. The payload increments the word at this address forever once copy-to-run branches into it, so hil_jlink_memprobe.sh sees it advance – proof the image ran via copy-to-run (the only writer of this word). This app reserves the word but never writes it.
Definition at line 101 of file main.c.
Referenced by main().
| volatile uint32_t g_dcr_run_sentinel |
Memprobe anchor for the payload's proof-of-run sentinel (0x22010000).
A reserved 4-byte word pinned by linker_script.ld to k_dcr_probe_sentinel_addr. This app never touches it – the copied-to-run payload writes k_payload_sentinel_value here. It exists only so nm can resolve a named symbol at the sentinel word.
Definition at line 87 of file main.c.
Referenced by main().