|
ra8-firmware 0.1.0
Bare-metal firmware for the Renesas RA8 family (RA8D2 / RA8P1)
|
Cortex-M85 / RA8D2 core bring-up – MPU map via the ra8_mpu HAL (#576). More...
#include <stdint.h>#include "ra8_boot_entry.h"#include "ra8_boot_intrinsics.h"#include "ra8_cache.h"#include "ra8_err.h"#include "ra8_mpu.h"#include "trustzone_init.h"Go to the source code of this file.
Enumerations | |
| enum | ra8_core_addr_t : uintptr_t { k_ra8_scb_vtor_addr = 0xE000ED08UL , k_ra8_scb_ccr_addr = 0xE000ED14UL , k_ra8_scb_shcsr_addr = 0xE000ED24UL , k_ra8_scb_cpacr_addr = 0xE000ED88UL , k_ra8_scb_nsacr_addr = 0xE000ED8CUL , k_ra8_scb_iciallu = 0xE000EF50UL , k_ra8_scb_dciallu = 0xE000EF58UL , k_ra8_scb_csselr = 0xE000ED84UL , k_ra8_scb_ccsidr = 0xE000ED80UL , k_ra8_scb_dcisw = 0xE000EF60UL , k_ra8_fpu_fpccr_addr = 0xE000EF34UL , k_ra8_nvic_aircr = 0xE000ED0CUL } |
Functions | |
| static void | internal_set_vtor (void) |
| Point VTOR at the physical vector table base. | |
| static void | internal_enable_fpu (void) |
| Grant full access to CP10 / CP11 (the FPU coprocessors). | |
| static void | internal_enable_fpu_lazy_stack (void) |
| Turn on FPU lazy stacking (FPCCR.LSPEN = 1, ASPEN = 1). | |
| static void | internal_enable_icache (void) |
| Invalidate and enable the Cortex-M85 I-cache. | |
| static void | internal_enable_dcache (void) |
| Invalidate and enable the Cortex-M85 D-cache. | |
| static void | internal_enable_branch_predictor (void) |
| Enable branch-target prediction (CCR.BP on Cortex-M85). | |
| static void | internal_enable_fault_handlers (void) |
| Enable the configurable-fault handlers so faults decode by class. | |
| static void | internal_enable_div0_trap (void) |
| Make integer divide-by-zero trap as a decoded UsageFault. | |
| static void | internal_set_priority_grouping (void) |
| Set NVIC priority grouping to 4 preempt bits / 0 sub-priority. | |
| void | SystemInit (void) |
| Earliest C code the image runs: bring the core up before RAM init. | |
Variables | |
| const uint32_t | g_ra8_vector_table_start [] |
| uint32_t | g_ra8_ls_stack_top |
Cortex-M85 / RA8D2 core bring-up – MPU map via the ra8_mpu HAL (#576).
Per-app override of the shared board SystemInit() that installs the boot MPU memory-attribute map through the ra8_mpu HAL (ra8_mpu_apply_boot_map()) instead of hand-rolling the MAIR / RBAR / RLAR / CTRL register pokes. It is kept ALONGSIDE the raw-poke reference (libs/ra8_board_ek_ra8d2/src/boot/system_init.c, used by e.g. cache_mpu_hil): every other bring-up step here is byte-identical, so a diff of the two files shows exactly the raw-pokes-vs-HAL boot difference, and the two apps can be compared on HIL.
SystemInit() follows the CMSIS naming convention and runs as the first C function out of reset, before Reset_Handler copies .data or zeroes .bss. ra8_mpu_apply_boot_map() is safe in that window: it reads only the driver-owned const region table (in .rodata) and MMIO, writes no .data/.bss, and never logs – exactly as this same function already calls ra8_cache_dcache_invalidate_all() from boot.
Definition in file system_init.c.
| enum ra8_core_addr_t : uintptr_t |
Definition at line 57 of file system_init.c.
|
static |
Enable branch-target prediction (CCR.BP on Cortex-M85).
Sets CCR.BP so the branch predictor is active with the caches.
< RA8 ccr bp.
Definition at line 211 of file system_init.c.
References k_ra8_scb_ccr_addr, ra8_boot_dsb(), ra8_boot_isb(), ra8_boot_read32(), and ra8_boot_write32().
|
static |
Invalidate and enable the Cortex-M85 D-cache.
Runs the full CCSIDR-driven invalidate-by-set/way pass (ra8_cache_dcache_invalidate_all()) BEFORE setting CCR.DC, so no random power-on line content is ever treated as valid once the cache is enabled.
< RA8 ccr dc.
Definition at line 188 of file system_init.c.
References k_ra8_scb_ccr_addr, ra8_boot_dsb(), ra8_boot_isb(), ra8_boot_read32(), ra8_boot_write32(), and ra8_cache_dcache_invalidate_all().
|
static |
Make integer divide-by-zero trap as a decoded UsageFault.
Out of reset CCR.DIV_0_TRP is 0 and an SDIV/UDIV by zero silently returns
< RA8 ccr div 0 trp.
Definition at line 276 of file system_init.c.
References k_ra8_scb_ccr_addr, ra8_boot_dsb(), ra8_boot_isb(), ra8_boot_read32(), and ra8_boot_write32().
Referenced by SystemInit().
|
static |
Enable the configurable-fault handlers so faults decode by class.
Out of reset SHCSR.{MEM,BUS,USG,SECURE}FAULTENA are 0, so MemManage, BusFault, UsageFault and SecureFault all escalate to HardFault and the per-class exception trampolines never fire. Set the four enables so each configurable fault is taken by its own handler and reported with its true class. Always-on diagnostics, independent of the cache / MPU build flag.
< RA8 shcsr memfaultena.
< RA8 shcsr busfaultena.
< RA8 shcsr usgfaultena.
< RA8 shcsr securefaultena.
Definition at line 238 of file system_init.c.
References k_ra8_scb_shcsr_addr, ra8_boot_dsb(), ra8_boot_isb(), ra8_boot_read32(), and ra8_boot_write32().
Referenced by SystemInit().
|
static |
Grant full access to CP10 / CP11 (the FPU coprocessors).
Sets the CPACR access bits then barriers so the FPU is usable before any floating-point instruction executes.
< RA8 cpacr cp10 cp11 full access.
Definition at line 109 of file system_init.c.
References k_ra8_scb_cpacr_addr, ra8_boot_dsb(), ra8_boot_isb(), ra8_boot_read32(), and ra8_boot_write32().
|
static |
Turn on FPU lazy stacking (FPCCR.LSPEN = 1, ASPEN = 1).
Lets ISRs skip the full FP-state save unless they touch the FPU, reducing worst-case interrupt latency.
< RA8 fpccr lspen.
< RA8 fpccr aspen.
Definition at line 132 of file system_init.c.
References k_ra8_fpu_fpccr_addr, ra8_boot_read32(), and ra8_boot_write32().
|
static |
Invalidate and enable the Cortex-M85 I-cache.
Invalidates the whole I-cache (ICIALLU) with the surrounding barriers, then sets CCR.IC. Gated with the D-cache and MPU behind the cache+MPU build flag.
< RA8 ccr ic.
Definition at line 156 of file system_init.c.
References k_ra8_scb_ccr_addr, k_ra8_scb_iciallu, ra8_boot_dsb(), ra8_boot_isb(), ra8_boot_read32(), and ra8_boot_write32().
|
static |
Set NVIC priority grouping to 4 preempt bits / 0 sub-priority.
Writes AIRCR with the VECTKEY and PRIGROUP=3, the standard embedded split (all priority bits are preempt, none sub-priority).
< Required write key.
< PRIGROUP = 3 -> 4 bits.
Definition at line 301 of file system_init.c.
References k_ra8_nvic_aircr, and ra8_boot_write32().
|
static |
Point VTOR at the physical vector table base.
Writes the absolute vector-table address into SCB->VTOR so exceptions dispatch through the linker-pinned table in MRAM.
Definition at line 90 of file system_init.c.
References g_ra8_vector_table_start, k_ra8_scb_vtor_addr, and ra8_boot_write32().
| void SystemInit | ( | void | ) |
Earliest C code the image runs: bring the core up before RAM init.
Called by Reset_Handler before .data is copied and .bss is zeroed, so it must not touch initialised or zero-initialised statics. Each image supplies its own definition – the shared board one under the board boot directories, or an application-local system_init.c where the clock tree or memory map diverges.
The name is the CMSIS convention; the startup code reaches it by that name, which is why it has external linkage.
Definition at line 320 of file system_init.c.
References internal_enable_branch_predictor(), internal_enable_dcache(), internal_enable_div0_trap(), internal_enable_fault_handlers(), internal_enable_fpu(), internal_enable_fpu_lazy_stack(), internal_enable_icache(), internal_set_priority_grouping(), internal_set_vtor(), k_ra8_ok, ra8_boot_disable_irq(), ra8_mpu_apply_boot_map(), and ra8_trustzone_init().
|
extern |
|
extern |
Definition at line 294 of file vector_table.c.