69typedef enum : uint32_t {
75 "staged parity .epub must fit the shared input buffer");
85typedef enum : uint8_t {
178 .clear_status =
true,
234 __asm
volatile(
"dsb" :::
"memory");
247 __asm
volatile(
"dsb" :::
"memory");
249 __asm
volatile(
"dsb" :::
"memory");
308 if (mb->
done == 1U) {
318 __asm
volatile(
"wfi" :::
"memory");
364 const void* base = (
const void*)(uintptr_t)mb->
blob_base;
403 __asm
volatile(
"nop");
426 ra8_log_info(
"M85",
"==== RA8D2 compile_on_m33 demo (#149b emitter offload) ====");
428 ra8_log_info(
"M85",
"shared mailbox + output blob in SRAM at 0x22100000");
438 ra8_log_info(
"M85",
"IPC wake arm failed -- falling back to bounded poll");
440 ra8_log_info(
"M85",
"IPC0 receive IRQ armed -- M85 will WFI-idle for the M33");
443 ra8_log_info(
"M85",
"releasing Cortex-M33 to run the RABOOK1 emitter ...");
454 ra8_log_info(
"M85",
"M33 signature not seen -- did it boot?");
457 ra8_log_info(
"M85",
"M85 yielding -- M33 is compiling the book ...");
459 ra8_log_info(
"M85",
"M33 done flag not seen -- timed out");
465 __asm
volatile(
"dmb" :::
"memory");
481 __asm
volatile(
"bkpt #0");
void main(void)
Secure fallback main entry point.
Flat, execute-in-place container for a build-time "compiled" e-book.
static const book_header_t * book_header(const void *base)
View the blob base as its header.
ra8_err_t book_validate(const void *base, size_t size)
Validate that a byte buffer is a well-formed, intact .rabook blob.
Shared-SRAM contract for the "RABOOK1 emitter on the M33" demo (#149b).
static volatile com33_mailbox_t * com33_mailbox(void)
Typed pointer to the fixed-address shared mailbox.
@ k_com33_blob_addr
Output blob base, carved from the shared window.
@ k_com33_epub_addr
Staged input base, carved from the shared window.
@ k_com33_status_running
status: M33 is still building the blob.
@ k_com33_magic
"COM3" – M85 stamps it when ready.
@ k_com33_req_magic
"REQ0" – M85 stamps it once the job (the
@ k_com33_status_ok
status: compile finalized a valid blob.
@ k_com33_m33_sig
"M33 CODE" boot sentinel written by M33.
@ k_com33_epub_cap
Shared staged-input .epub buffer capacity (32 KiB).
@ k_com33_blob_cap
Shared output-blob buffer capacity in bytes.
static uint8_t * com33_epub(void)
Typed pointer to the fixed-address shared staged-input .epub buffer.
uint32_t g_ra8_ls_cpu1_mram_start
static void park_forever(void)
Park the M85 forever after an unrecoverable startup failure.
static volatile bool s_m33_woke
Set by the IPC0 receive callback when the M33 signals compile-done.
m85_ipc_t
IPC channel the M85 watches for the M33's compile-done wake.
@ k_ipc_wake_channel
IPC0 channel 0 (CPU1 -> CPU0 receive side).
static bool wait_for_m33_sig(const volatile com33_mailbox_t *mb)
Poll the mailbox until the M33 stamps its boot signature.
static bool arm_ipc_wake(void)
Arm the IPC0 receive interrupt so the M85 can WFI-idle for the M33.
static void prep_mailbox(volatile com33_mailbox_t *mb)
Publish the mailbox, stage the source .epub, and post the compile job.
static bool verify_blob(volatile com33_mailbox_t *mb)
Validate the M33-emitted blob and cross-check the mailbox report.
static void ipc_wake_handler(void *ctx, uint8_t channel, ra8_ipc_irq_event_id_t event_id)
IPC0 receive event callback: record that the M33's wake poke arrived.
m85_poll_t
Bounded iteration limits for the M85 polling loops.
@ k_m85_done_poll_budget
Max iters waiting for M33 done flag.
@ k_m85_sig_poll_budget
Max iters waiting for M33 signature.
static void ipc0_receive_isr(void *ctx)
IPC0 receive ISR trampoline: decode the channel's pending events.
static bool wait_for_done(const volatile com33_mailbox_t *mb)
Idle in WFI until the M33's IPC poke signals the done flag.
uint32_t g_ra8_ls_cpu1_stack_top
Baked parity .epub + golden blob for the M33 compile (#149).
static const uint8_t s_m33_parity_epub[]
Fixture .epub bytes compiled on the M33 (text/CSS/SVG).
static const uint8_t s_m33_parity_golden[]
Golden RABOOK1 blob the M33 output must equal byte-for-byte.
@ k_m33_parity_golden_len
Length of s_m33_parity_golden in bytes.
@ k_m33_parity_epub_len
Length of s_m33_parity_epub in bytes.
Annotation-attribute framework macros for ra8-firmware.
#define RA8_LOOP_BOUND(ceiling)
NASA Power-of-10 Rule 2: bind ONE loop to a compile-time ceiling.
Boot entry points shared between a vector table and its startup code.
Dual-core (CPU0 / CPU1) lifecycle helper – public API.
ra8_err_t ra8_cpu1_release(void *entry, void *sp)
Release CPU1 (Cortex-M33) from reset and start it executing.
ra8_elc_event_t
Partial list of ELC events (populate as drivers need them).
Error Code Definitions for ra8-firmware.
@ k_ra8_ok
Success – operation completed with all postconditions satisfied.
ra8_err_codes_t ra8_err_t
Canonical error-return type used by every ra8-firmware API.
int memcmp(const void *a, const void *b, size_t n)
Compare bytes in two memory areas.
void * memcpy(void *dst, const void *src, size_t n)
Copy memory area between non-overlapping regions.
Inter-Processor Communication (IPC) HAL driver – public API.
@ k_ra8_ipc_elc_event_irq0
Receiving-side IRQ for IPC0_*.
void ra8_ipc_dispatch(uint8_t channel)
Drive the event callback for one channel.
ra8_err_t ra8_ipc_attach_event_handler(uint8_t channel, ra8_ipc_irq_event_id_t event_id, ra8_ipc_irq_fn_t fn, void *ctx)
Attach a callback for a single IRQ event line on a channel.
ra8_ipc_irq_event_id_t
Index of an IRQ event line within a channel (0..7).
@ k_ra8_ipc_irq_event_0
RA8 ipc IRQ event 0.
@ k_ra8_ipc_event_irq0
Maskable IRQ event line 0.
ra8_err_t ra8_ipc_init(const ra8_ipc_config_t *cfg)
Initialise one IPC channel.
NVIC + ICU IELSR allocator.
@ k_ra8_isr_prio_default
Middle priority.
ra8_err_t ra8_isr_init(void)
Initialise the ra8_isr table.
void ra8_isr_globals_enable(void)
Globally enable maskable interrupts (PRIMASK = 0).
ra8_err_t ra8_isr_register(ra8_elc_event_t event, ra8_isr_handler_t handler, void *ctx, uint8_t priority, uint16_t *out_slot)
Allocate an IELSR slot for an ELC event + handler.
Lightweight Logging Interface for ra8-firmware.
void ra8_log_init(void)
Initialise the logging backend.
#define ra8_log_info_val(tag, message, value)
RA8 log info val.
#define ra8_log_info(tag, message)
RA8 log info.
Cross-core handoff block backed by a fixed shared-SRAM address.
volatile uint32_t blob_base
Address of the finalized blob (= out_base).
volatile uint32_t chapter_count
Chapters the M33 emitted into the blob.
volatile uint32_t blob_len
Finalized RABOOK1 blob length, bytes.
volatile uint32_t m33_sig
M33 stamps k_com33_m33_sig on boot.
volatile uint32_t req_magic
M85 stamps k_com33_req_magic when the job is.
volatile uint32_t blob_crc
Blob header body CRC-32, echoed for cross-check.
volatile uint32_t out_cap
M85: capacity of the output buffer, bytes.
volatile uint32_t epub_len
M85: length of the staged .epub, bytes.
volatile uint32_t magic
M85 stamps k_com33_magic when ready.
volatile uint32_t out_base
M85: address the M33 writes the finalized blob.
volatile uint32_t done
Set to 1 by the M33 once the blob is published.
volatile uint32_t epub_base
M85: address of the staged source .epub bytes.
volatile uint32_t status
Compile outcome (com33_const_t status codes).
Per-channel configuration descriptor passed to ra8_ipc_init.