|
ra8-firmware 0.1.0
Bare-metal firmware for the Renesas RA8 family (RA8D2 / RA8P1)
|
Shared-SRAM contract for the "RABOOK1 emitter on the M33" demo (#149b). More...
Go to the source code of this file.
Data Structures | |
| struct | com33_mailbox_t |
| Cross-core handoff block backed by a fixed shared-SRAM address. More... | |
Enumerations | |
| enum | com33_addr_t : uintptr_t { k_com33_epub_offset = 0x100U , k_com33_blob_offset = 0x8100U , k_com33_mailbox_addr = (uintptr_t)k_ra8_board_shared_ram_base , k_com33_epub_addr = (uintptr_t)k_ra8_board_shared_ram_base + (uintptr_t)k_com33_epub_offset , k_com33_blob_addr = (uintptr_t)k_ra8_board_shared_ram_base + (uintptr_t)k_com33_blob_offset } |
| Fixed shared-SRAM addresses for the mailbox and the output blob. More... | |
| enum | com33_const_t : uint32_t { k_com33_magic = 0x434F4D33U , k_com33_req_magic = 0x52455130U , k_com33_m33_sig = 0x4D33C0DEU , k_com33_status_running = 0U , k_com33_status_ok = 1U , k_com33_status_build_fail = 2U , k_com33_status_open_fail = 3U , k_com33_status_no_request = 4U , k_com33_status_fault = 5U } |
| Magics, the boot signature, and the build-status codes shared by both core images. More... | |
| enum | com33_blob_cap_t : uint32_t { k_com33_epub_cap = 0x8000U , k_com33_blob_cap = 8192U } |
| Capacities, in bytes, of the shared staged-input and output buffers. More... | |
Functions | |
| static volatile com33_mailbox_t * | com33_mailbox (void) |
| Typed pointer to the fixed-address shared mailbox. | |
| static uint8_t * | com33_blob (void) |
| Typed pointer to the fixed-address shared output-blob buffer. | |
| static uint8_t * | com33_epub (void) |
| Typed pointer to the fixed-address shared staged-input .epub buffer. | |
Shared-SRAM contract for the "RABOOK1 emitter on the M33" demo (#149b).
This header pins the cross-core JOB mailbox and the shared input/output buffers for the #149 compiler offload: running the full text/CSS/SVG EPUB->.rabook compile (apps/shared_libs/rabook_compile + epub) on the RA8D2's Cortex-M33 secondary core. The Cortex-M85 (primary, "CPU0") STAGES a source .epub into shared SRAM, posts the job, releases the M33, then PARKS while the slow core compiles the staged book and lays a complete RABOOK1 blob into the shared output buffer. The M85 then validates that blob with book_validate AND byte-compares it to the desktop/M85 golden – proving the secondary core produced the identical compiled book the primary core would have.
Why a fixed address: each core is a separate compiled image with its own linker script, so a static global in one image is invisible to the other. The one name both images resolve identically is a hard-coded address.
Memory budget (all in the shared upper SRAM window, see the address enum):
Coherency: this app's system_init.c leaves the M85 data cache OFF, so a store from one core is visible to the other once a dsb has drained the write buffer; no cache clean / invalidate dance is needed. The mailbox fields are volatile so the compiler emits a real load / store on every access.
Protocol (the compile job handoff):
Definition in file compile_on_m33.h.
| enum com33_addr_t : uintptr_t |
Fixed shared-SRAM addresses for the mailbox and the output blob.
All three slices are carved from the CPU0 <-> CPU1 window at fixed offsets: the mailbox occupies the first 32 bytes, the staged input starts 256 bytes in so the mailbox keeps its own cache line and some growth room, and the output blob follows 32 KiB after that. The window itself is a board fact, declared once in ra8_board_ek_ra8d2_dualcore.h along with why both linker scripts leave it free; this app only names its own slice of it.
Definition at line 91 of file compile_on_m33.h.
| enum com33_blob_cap_t : uint32_t |
Capacities, in bytes, of the shared staged-input and output buffers.
The M85 stages the source .epub into k_com33_epub_addr (up to k_com33_epub_cap bytes) before posting the job; the M33 lays the finalized RABOOK1 blob into k_com33_blob_addr (the buffer's out_cap = k_com33_blob_cap). 32 KiB of input dwarfs the parity fixture .epub (~1 KiB) and 8 KiB of output dwarfs its blob (~700 B), so neither buffer overflows for this demo.
| Enumerator | |
|---|---|
| k_com33_epub_cap | Shared staged-input .epub buffer capacity (32 KiB). |
| k_com33_blob_cap | Shared output-blob buffer capacity in bytes. |
Definition at line 141 of file compile_on_m33.h.
| enum com33_const_t : uint32_t |
Magics, the boot signature, and the build-status codes shared by both core images.
k_com33_magic ("COM3") lets the M33 confirm the mailbox is live before trusting it; k_com33_m33_sig is the boot sentinel the M33 stamps so the M85 can prove the second core left reset and is executing user code. The status codes report the outcome of the emitter run the M33 performed.
Definition at line 117 of file compile_on_m33.h.
|
inlinestatic |
Typed pointer to the fixed-address shared output-blob buffer.
The emitter's out arena and the M85's validation target are the same physical SRAM bytes at k_com33_blob_addr; this inline returns that base identically on both images so no shared translation unit is needed.
| non-NULL | Always; the address is a compile-time constant. |
Definition at line 233 of file compile_on_m33.h.
References k_com33_blob_addr.
Referenced by bind_compile().
|
inlinestatic |
Typed pointer to the fixed-address shared staged-input .epub buffer.
The M85 copies the source .epub bytes here before posting the job; the M33 reads them via epub_mem_media_t at the same physical SRAM base, so no shared translation unit is needed.
| non-NULL | Always; the address is a compile-time constant. |
Definition at line 257 of file compile_on_m33.h.
References k_com33_epub_addr.
Referenced by prep_mailbox().
|
inlinestatic |
Typed pointer to the fixed-address shared mailbox.
Inlined so both core images compute the identical address with no shared translation unit. Returns the same physical SRAM location on the M85 and the M33.
| non-NULL | Always; the address is a compile-time constant. |
Definition at line 209 of file compile_on_m33.h.
References k_com33_mailbox_addr.
Referenced by compile_fixture(), cpu1_fault_handler(), cpu1_run_compile(), and main().