|
ra8-firmware 0.1.0
Bare-metal firmware for the Renesas RA8 family (RA8D2 / RA8P1)
|
Second-core (cpu1, Cortex-M33) engine: release watch, boot, stepping. More...
#include <stdint.h>#include <unicorn/unicorn.h>#include "emu_elf.h"#include "emu_memmap.h"#include "ra8_attributes.h"Go to the source code of this file.
Functions | |
| void | emu_cpu1_notify_mmio_write (uint64_t mmio_abs, uint64_t value) |
| Watch a peripheral MMIO write for the cpu1 release sequence. | |
| void | emu_cpu1_init (const emu_elf_source_t *elf, emu_memmap_workspace_t *memory) |
| Create the second emulator engine for cpu1, if the image carries one. | |
| void | emu_cpu1_close (emu_memmap_workspace_t *memory) |
| Detach and close the optional cpu1 engine. | |
| void | emu_cpu1_step (void) |
| Boot cpu1 on a pending release, then step it one interleave chunk. | |
Second-core (cpu1, Cortex-M33) engine: release watch, boot, stepping.
The RA8D2 boots cpu0 (Cortex-M85); the application releases cpu1 (Cortex-M33) by writing CPU1INITVTOR (its vector table) then CPU1ACTCSR.ACTREQ. ra8_emulator emulates cpu1 in a second Unicorn engine that shares the on-chip SRAM with cpu0 (host-backed), so cross-core IPC over shared SRAM actually runs. The MMIO model notifies this module of every peripheral write so the release sequence is captured; the run loop boots and steps the second engine between cpu0 chunks. Inert unless the firmware carries a cpu1 image and asserts ACTREQ.
Split out of the ra8_emulator main translation unit; behaviour unchanged.
Definition in file emu_cpu1.h.
| void emu_cpu1_close | ( | emu_memmap_workspace_t * | memory | ) |
Detach and close the optional cpu1 engine.
| [in,out] | memory | Backing supplied to emu_cpu1_init. |
Detach and close the optional cpu1 engine; this step is contained within the emu cpu1 model and uses bounded caller or module-owned storage.
Definition at line 183 of file emu_cpu1.c.
References emu_memmap_detach(), s_cpu1_active, s_cpu1_release_req, and s_cpu1_uc.
Referenced by priv_run_cleanup().
| void emu_cpu1_init | ( | const emu_elf_source_t * | elf, |
| emu_memmap_workspace_t * | memory ) |
Create the second emulator engine for cpu1, if the image carries one.
Only dual-core firmware (a PT_LOAD segment in the MRAM_CPU1 window) gets a cpu1 engine, so single-core apps pay nothing. The engine maps the same regions as cpu0 but binds the on-chip SRAM (and its NS alias) to the shared authoritative sparse backing so cross-core IPC over shared SRAM is coherent, maps the peripheral windows through the same MMIO model, and loads the full ELF so cpu1 can boot from its own vector table when released. The engine is left idle – emu_cpu1_step() boots it on the CPU1ACTCSR release.
| [in] | elf | Open firmware source carrying cpu0 and optional cpu1 segments. |
| [in,out] | memory | Open caller-owned backing shared with cpu0. |
elf is valid and remains open for cpu1 detection and loading. Create the second emulator engine for cpu1, if the image carries one.
Definition at line 178 of file emu_cpu1.c.
References internal_cpu1_engine_init(), and s_cpu1_uc.
Referenced by internal_main_install_run_seams().
| void emu_cpu1_notify_mmio_write | ( | uint64_t | mmio_abs, |
| uint64_t | value ) |
Watch a peripheral MMIO write for the cpu1 release sequence.
Captures CPU1INITVTOR (cpu1's vector-table base) and, on a correctly-keyed CPU1ACTCSR write (HUM Ch 2.9.1.9 "CPU1ACTCSR" p 130: KEY=0xA5 in bits [15:8] plus ACTREQ), latches the release request the run loop consumes. Called by the MMIO write model for every peripheral write; anything but the two CPU_CTRL words is ignored.
| [in] | mmio_abs | Absolute peripheral address being written. |
| [in] | value | Value being written. |
Watch a peripheral MMIO write for the cpu1 release sequence.
Definition at line 68 of file emu_cpu1.c.
References k_cpu1_actcsr_actreq, k_cpu1_actcsr_addr, k_cpu1_actcsr_key, k_cpu1_actcsr_key_mask, k_cpu1_actcsr_key_shift, k_cpu1_initvtor_addr, s_cpu1_initvtor, and s_cpu1_release_req.
Referenced by mmio_write().
| void emu_cpu1_step | ( | void | ) |
Boot cpu1 on a pending release, then step it one interleave chunk.
The run loop calls this once per outer chunk. On the latched CPU1ACTCSR release it reads cpu1's SP/PC from the captured CPU1INITVTOR and marks the core active; while active it runs one bounded instruction chunk. cpu1 is a tight poll loop (no interrupts), so a plain stepped run suffices; a cpu1 fault just halts cpu1 (cpu0 keeps running). A no-op without a cpu1 engine.
Boot cpu1 on a pending release, then step it one interleave chunk.
Definition at line 196 of file emu_cpu1.c.
References k_cpu1_chunk_insns, rd32(), s_cpu1_active, s_cpu1_initvtor, s_cpu1_pc, s_cpu1_release_req, and s_cpu1_uc.
Referenced by internal_run_loop_record().