|
ra8-firmware 0.1.0
Bare-metal firmware for the Renesas RA8 family (RA8D2 / RA8P1)
|
Single-core TrustZone bring-up for a RAM-resident NS image (#60). More...
#include "trustzone_init.h"#include <stdint.h>#include "ra8_board_ek_ra8d2.h"#include "ra8_cgc.h"#include "ra8_err.h"#include "ra8_gpio_constants.h"#include "ra8_pin_validator.h"#include "ra8_port_constants.h"#include "ra8_port_utils.h"#include "ra8_tz_secure_boot.h"Go to the source code of this file.
Enumerations | |
| enum | tz_ns_image_t : uintptr_t { k_tz_ns_load_base = 0x02080000U , k_tz_ns_run_base = 0x32100000U , k_tz_ns_copy_size = 0x00030000U } |
| Fixed NS-image addresses (two-project build, #96). More... | |
Functions | |
| void | ra8_trustzone_init (void) |
| Programme + enable the SAU per the partition. | |
Variables | |
| uint32_t | g_ra8_ls_sgstubs_start |
| Veneer-region start (NSC). | |
| uint32_t | g_ra8_ls_sgstubs_end |
| Veneer-region end (NSC). | |
Single-core TrustZone bring-up for a RAM-resident NS image (#60).
The RA8 IDAU is FIXED by address bit[28] (HUM section 51.3.3.1, p3265): bit[28]=0 is Secure/NSC and the SAU cannot downgrade it, so an "NS" image at the 0x02.. / 0x22.. (bit[28]=0) aliases always executes Secure. Real NS lives at the bit[28]=1 aliases (0x12.. code, 0x32.. SRAM, 0x5.. peripherals).
Code MRAM's secure/NS split needs persistent (brick-risky) option bytes, but SRAM's split is the RUNTIME SRAMSABARn register, so the NS image is RAM-resident: flashed into Secure MRAM (the LMA) and copied by this code into the SRAM Non-secure alias 0x3210_0000 (physical SRAM2) after SRAMSABAR2 marks SRAM2 Non-secure. No option bytes, no brick.
Boot sequence (this file, all in Secure state):
This file does NOT use ra8_tz_secure_boot_sau_init – that function's region table is tuned for cpu1_pingpong_ipc (CPU1 is the NS core) and is shared; the bit[28] model here is app-local so that validated app is untouched. Only the generic ra8_tz_secure_boot_jump_ns primitive is reused.
On a host build (RA8_OFF_TARGET) this function is a no-op.
Definition in file trustzone_init.c.
| enum tz_ns_image_t : uintptr_t |
Fixed NS-image addresses (two-project build, #96).
The NS image is a SEPARATE ELF (tz_nsc_cgc_usb_ns.elf), so the Secure side has none of its linker symbols. Its load (MRAM) and run (SRAM2 NS alias) bases are fixed by ns_image.ld; the Secure boot copies a fixed window large enough for the NS image (ThreadX + USBX
| Enumerator | |
|---|---|
| k_tz_ns_load_base | NS image LMA (Secure MRAM). |
| k_tz_ns_run_base | NS image VMA (SRAM2 NS alias). |
| k_tz_ns_copy_size | Bytes copied LMA->VMA (192 KB). |
Definition at line 86 of file trustzone_init.c.
| void ra8_trustzone_init | ( | void | ) |
Programme + enable the SAU per the partition.
No-op TrustZone init for the secure-only USB experiment.
Programme the SAU + SRAM NS boundary and copy the NS image (no BLXNS).
Called from SystemInit after the cache + MPU are up but before any application code runs. When the firmware is built without RA8_TRUSTZONE_ENABLE defined this function is a no-op so the single-world build is unaffected.
Definition at line 611 of file trustzone_init.c.
References g_tz_jump_ns_err, internal_sau_set_region(), k_ra8_ok, k_tz_ns_run_base, ra8_boot_dsb(), ra8_boot_isb(), ra8_boot_read32(), ra8_boot_write32(), and ra8_tz_secure_boot_jump_ns().
Referenced by SystemInit().
|
extern |
Veneer-region end (NSC).
|
extern |
Veneer-region start (NSC).