67#error "npu_smoke must be built with cmake/toolchain-ra8p1.cmake (RA8_DEVICE_RA8P1)."
74typedef enum : uint32_t {
87typedef enum : uint8_t {
98typedef enum : uint8_t {
109typedef enum : uint32_t {
205 __asm__
volatile(
"wfi");
229 __asm__
volatile(
"wfi");
359 const uint8_t expected =
377 static const uint8_t k_hex[] =
"0123456789ABCDEF";
380 const uint8_t shift =
389 const uint8_t* text = ok ? (
const uint8_t*)
"OK" : (
const uint8_t*)
"FAIL";
390 const size_t len = ok ? 2U : 4U;
396 const uint8_t* text = pass ? (
const uint8_t*)
"PASS" : (
const uint8_t*)
"FAIL";
464 pass = run_ok && matched && (
id != 0U);
void main(void)
Secure fallback main entry point.
static uint8_t s_npu_input[k_npu_infer_arena_bytes]
Region 1 UINT8 input tensor (quantized s_infer_input_f).
static uint8_t s_npu_output[k_npu_infer_arena_bytes]
Region 2 UINT8 output tensor: zeroed pre-run, holds the NPU result.
static uint32_t s_npu_cmd_stream[k_npu_infer_cmd_words]
Stand-in command stream in SRAM (ra8_npu_fake_cmd.h layout; add-constant op).
static uint8_t s_npu_weights[k_npu_infer_arena_bytes]
Region 0 weight arena (present by Vela convention; unused by this op).
npu_smoke_region_t
Tensor-region indices the smoke job programs into BASEPn.
@ k_npu_smoke_region_count
Regions programmed (BASEP0..2).
@ k_npu_smoke_region_weights
Region 0: Vela weight arena (unused by op).
@ k_npu_smoke_region_output
Region 2: op destination (output tensor).
@ k_npu_smoke_region_input
Region 1: op source (input tensor).
npu_smoke_fnv_t
FNV-1a 32-bit constants for the displayed output checkword.
@ k_npu_smoke_fnv_prime
FNV-1a 32-bit prime.
@ k_npu_smoke_fnv_offset
FNV-1a 32-bit offset basis.
volatile uint32_t g_npu_smoke_check
Output checkword captured after verify, for external inspection.
static bool internal_npu_smoke_verify(uint32_t *out_check)
Verify the output arena equals input+K and fold it into a checkword.
npu_smoke_size_t
Command-stream / tensor-arena sizes and the console baud.
@ k_npu_smoke_hex_shift
Bits per hex nibble.
@ k_npu_smoke_hex_mask
Mask for one hex nibble.
@ k_npu_smoke_arena_bytes
Tensor-arena length (bytes).
@ k_npu_smoke_hex_digits
Fixed-width hex word digits.
@ k_npu_smoke_baud
SCI8 J-Link OB console baud.
@ k_npu_smoke_cmd_words
Command-stream word count.
static void internal_npu_smoke_build_stream(void)
Fill the command stream (add-constant op) per the stand-in convention.
static void internal_npu_smoke_write_hex32(uint32_t value)
npu_smoke_seed_t
Deterministic input pattern + the add-constant the job applies.
@ k_npu_smoke_addk
Constant added to every input byte.
@ k_npu_smoke_byte_mask
8-bit element wrap (matches the op).
@ k_npu_smoke_seed_add
Input pattern additive offset.
@ k_npu_smoke_seed_mul
input[i] = (i * mul + add) & mask.
static void internal_npu_smoke_write(const uint8_t *data, size_t len)
static ra8_err_t internal_npu_smoke_run_job(void)
Submit + run + wait for the NPU job.
static void internal_npu_smoke_setup_or_halt(void)
Bring up CGC + the SCI8 console.
static void internal_npu_smoke_emit(uint32_t id, bool run_ok, uint32_t check, bool pass)
Print the one-line verdict banner over the SCI8 console.
static void internal_npu_smoke_write_verdict(bool pass)
volatile uint32_t g_npu_smoke_id
NPU_ID captured after init, for external (J-Link) inspection.
volatile uint32_t g_npu_smoke_pass
Final verdict (1 = PASS, 0 = FAIL), for external inspection.
static void internal_npu_smoke_panic_halt(void)
Park the CPU forever in WFI after a fatal init error (a real panic).
static void internal_npu_smoke_write_status(bool ok)
volatile uint32_t g_npu_smoke_status
Raw NPU_STATUS captured after the run, for external inspection.
static void internal_npu_smoke_seed_arenas(void)
Seed the input arena with a deterministic pattern and zero the output.
static void internal_npu_smoke_park(void)
Park the CPU forever in WFI after the verdict banner (a clean stop).
Annotation-attribute framework macros for ra8-firmware.
#define RA8_INTERNAL
Marker that a function is intended to be static (file-local).
ra8_err_t ra8_board_uart_console_write(const uint8_t *data, size_t len)
Polled blocking write to the J-Link OB VCOM console.
ra8_err_t ra8_board_uart_console_init(uint32_t baud)
Configure SCI8 + PD02/PD03 as the debug-console UART.
ra8_err_t ra8_board_uart_console_flush(void)
Block until every byte queued on the J-Link OB VCOM console has finished clocking out on the wire.
Board-support layer for the Renesas RA8P1 (R7KA8P1KFLCAC) target board.
Boot entry points shared between a vector table and its startup code.
High-level Clock Generation Circuit driver.
ra8_err_t ra8_cgc_init(void)
Configure the clock tree to a safe default.
Compile-time device selection for the RA8 multi-chip build (RA8D2 / RA8P1).
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.
Arm Ethos-U55 NPU command/queue driver foundation (RA8P1-only).
ra8_err_t ra8_npu_read_status(ra8_npu_status_t *out)
Read and decode the NPU_STATUS register.
ra8_err_t ra8_npu_submit(const ra8_npu_job_t *job)
Program the command queue and tensor region base pointers for a job.
ra8_err_t ra8_npu_run(void)
Kick the currently-submitted job (transition the NPU to running).
ra8_err_t ra8_npu_read_id(uint32_t *out_id)
Read the Ethos-U55 NPU_ID (architecture / product revision) register.
ra8_err_t ra8_npu_init(void)
Bring the NPU out of module-stop and soft-reset it.
ra8_err_t ra8_npu_wait(void)
Bounded busy-wait until the running job completes or faults.
ra8_emulator / host-test command-stream convention for the Ethos-U55 model
@ k_ra8_npu_fake_op_addk
dst[i] = (src[i] + constant) & 0xFF.
@ k_ra8_npu_fake_word_dst
Destination region index (0 .
@ k_ra8_npu_fake_word_count
Byte count to process.
@ k_ra8_npu_fake_word_num
Header word count (populated words).
@ k_ra8_npu_fake_word_src
Source region index (0 .
@ k_ra8_npu_fake_word_op
magic | opcode.
@ k_ra8_npu_fake_word_const
Constant addend (add-constant op).
@ k_ra8_npu_fake_magic
Emu-Ethos-U55 marker in bits [31:16].
Arm Ethos-U55 NPU register window on the Renesas RA8P1 (RA8P1-only).
One Ethos-U55 inference job: a command stream plus its tensor arenas.
uint8_t region_count
Number of region_base[] entries in use.
uint32_t cmd_stream_bytes
Command stream length in bytes (> 0).
uint64_t region_base[k_ra8_npu_region_count]
AXI base of each BASEPn arena.
const void * cmd_stream
Vela command stream base in SRAM.
Decoded snapshot of the NPU_STATUS register.
uint32_t raw
Verbatim NPU_STATUS register value.