|
ra8-firmware 0.1.0
Bare-metal firmware for the Renesas RA8 family (RA8D2 / RA8P1)
|
Non-Secure image: liveness beacon proving the BLXNS RoT gate passed (#172). More...
#include <stdint.h>Go to the source code of this file.
Typedefs | |
| typedef void(* | ns_exc_handler_t) (void) |
Functions | |
| static void | ns_nmi_halt (void) |
| NMI / fault halt vector for the NS table. | |
| static void | ns_reset_handler (void) |
| NS-world reset handler – entered via BLXNS from the Secure side. | |
Variables | |
| volatile uint32_t | g_sbns_ns_alive |
| Liveness counter: advances forever once the NS reset handler runs. | |
| uint32_t | g_ra8_ls_ns_stack_top |
| Linker symbol: top of NS stack. | |
| uint32_t | g_ra8_ls_ns_bss_start |
| Linker symbol: start of .ns_bss. | |
| uint32_t | g_ra8_ls_ns_bss_end |
| Linker symbol: end of .ns_bss. | |
| const ns_exc_handler_t | g_ra8_ns_vector_table [16] |
Non-Secure image: liveness beacon proving the BLXNS RoT gate passed (#172).
The Non-Secure half of the secure_boot_ns_hil two-project TrustZone build. The Secure side copies this image into the SRAM Non-secure alias (0x3210_0000), programmes the SAU, and – only if ra8_rot_verify_image authenticates the image's ECDSA-P256 signature – BLXNS-es to ns_reset_handler here.
This image is deliberately minimal: it makes NO NS->Secure calls (no CMSE import library, no veneers). After zeroing .ns_bss it advances a single liveness counter, g_sbns_ns_alive, forever. A J-Link memprobe that samples the counter twice and sees it ADVANCE proves the whole chain worked:
A TAMPERED NS image never reaches this code: the Secure gate default-denies, ra8_tz_secure_boot_jump_ns returns an error, and the counter stays 0.
| Symbol | Section | Address (VMA) |
|---|---|---|
| g_ra8_ns_vector_table | .ns_vectors | 0x32100000 |
| .ns_rot_header | .ns_rot_header | 0x32100040 |
| ns_reset_handler | .ns_text | 0x32100048+ |
| g_sbns_ns_alive | .ns_bss | 0x321000xx |
(Run-time VMA in the SRAM NS alias; the image is flashed in Secure MRAM at the LMA 0x02080000 and copied here by the Secure trustzone_init.)
Definition in file ns_main.c.
|
static |
NMI / fault halt vector for the NS table.
Any unmasked NS fault lands here and parks, so a J-Link halt plus a g_sbns_ns_alive read shows whether the NS code was making progress when the fault hit.
|
static |
NS-world reset handler – entered via BLXNS from the Secure side.
Zeros .ns_bss via uintptr_t arithmetic (cppcheck flags a pointer comparison between two distinct externs as ISO C UB even though the linker fixes them to a contiguous range), then advances g_sbns_ns_alive forever so a J-Link memprobe observes NS liveness.
Definition at line 120 of file ns_main.c.
References g_ra8_ls_ns_bss_end, g_ra8_ls_ns_bss_start, and g_sbns_ns_alive.
|
extern |
Linker symbol: end of .ns_bss.
|
extern |
Linker symbol: start of .ns_bss.
|
extern |
Linker symbol: top of NS stack.
| const ns_exc_handler_t g_ra8_ns_vector_table[16] |
| volatile uint32_t g_sbns_ns_alive |
Liveness counter: advances forever once the NS reset handler runs.
Zeroed by ns_reset_handler on entry, then incremented in a tight loop. The HIL gate probes this symbol: a genuine signed NS image makes it advance; a tampered image is rejected before BLXNS so it stays 0. Lives in .ns_bss (SRAM NS alias 0x32100000+), squarely inside the SAU NS region.
Definition at line 63 of file ns_main.c.
Referenced by ns_reset_handler().