embassy-stm32

Crates

git

Versions

stm32n647z0

Flavors

Skip to main content

Module ecloader

Module ecloader 

Source
Expand description

Loader for ST Edge AI Epoch Controller binaries.

When a network is compiled with --enable-epoch-controller, ST Edge AI emits one or more EC binaries (the _ec_blob_<network>_<n> arrays in <network>_ecblobs.h). An EC binary is a container holding:

  • the blob: the command stream executed by the NPU’s epoch controller,
  • an optional relocation table: named lists of blob words to which a base address must be added (used e.g. to point the blob at the user’s input/output buffers),
  • an optional patch table: named lists of blob words in which a masked/shifted value must be substituted.

This module is a no_std port of ST’s ecloader.c. Typical use mirrors the generated LL_ATON_EC_Network_Init_* / LL_ATON_EC_Inference_Init_* functions:

// The EC binary as emitted by ST Edge AI (u64 words, 8-byte aligned).
static EC_BIN_1: &[u64] = &[ /* ..._ec_blob_network_1 contents... */ ];

// Writable copy of the blob, in NPU-visible RAM.
static BLOB_1: StaticCell<[u64; 3800]> = StaticCell::new();

let bin = EcBinary::new(EC_BIN_1)?;
let blob = BLOB_1.init([0; 3800]);
bin.load_blob(blob)?;                       // once, at network init
let mut prev = 0;
bin.reloc(blob, 0, input.as_ptr() as u32, &mut prev)?; // before inference

Blobs that need no relocation (fully linked at generation time) can be executed straight from flash without copying.

Structs§

EcBinary
A parsed, read-only view of an Epoch Controller binary container.

Enums§

EcError
Errors returned by EcBinary operations.

Constants§

BINARY_MAGIC
Magic number at the start of an Epoch Controller binary container.
BLOB_MAGIC
Magic number at the start of an Epoch Controller blob.