Skip to content

module_handler

Classes

ModuleHandler

ModuleHandler(context: CodeGenContext)

Responsible for generating the module source code.

Functions

compute_values
compute_values() -> dict[str, str]

Computes the values needed for generating the module source code.

Returns:

  • dict ( dict[str, str] ) –

    A dictionary containing the computed values for code generation.

generate_common_files
generate_common_files(save_path: Path)

Generates common files for the module.

Parameters:

  • save_path
    (Path) –

    Path to save the generated files.

generate_neuralspot_module
generate_neuralspot_module(save_path: Path)

Generates the NeuralSpot module files.

This method creates the module.mk file for the NeuralSpot module.

generate_zephyr_module
generate_zephyr_module(save_path: Path)

Generates the Zephyr module files.

This method creates the module.yml and CMakeLists.txt files for the Zephyr module.

generate_cmake_module
generate_cmake_module(save_path: Path)

Generates the CMake module files.

This method creates the CMakeLists.txt files for the CMake module.

generate_nsx_module
generate_nsx_module(save_path: Path)

Generates the NSX (neuralspotx) module files.

Creates both the nsx-module.yaml manifest and a CMakeLists.txt that follows NSX conventions (nsx:: alias, board flags linkage, CMSIS-NN dependency, and an optional attributes-header override hook).

generate_cmsis_pack_module
generate_cmsis_pack_module(save_path: Path)

Generates the CMSIS-Pack .pdsc manifest.

Emits a single Open-CMSIS-Pack .pdsc describing the AOT-compiled model as a component that depends on the HeliaCORE / ns-cmsis-nn pack. The .pdsc lives next to the existing src/ and includes-api/ directories so a downstream gen-pack / packchk step can zip the directory verbatim into <vendor>.<pack-name>.<version>.pack.

The pack vendor is fixed to Ambiq and the pack name defaults to the module name; the HeliaCORE dependency is declared against Ambiq.NS-CMSIS-NN with a minimum version pinned to :data:CMSIS_NN_VERSION (the same floor AOT-emitted code already #errors on at compile time).

A copy of the heliaAOT LICENSE file is placed alongside the .pdsc by :class:DocHandler (it already stages LICENSE for every module type from templates/docs/license.md.j2) so the manifest's <license> reference resolves during packchk.

Pack archiving is handled by :class:AotConverter when module.path ends in .pack. packchk CI integration is tracked in issue #192.

Raises:

  • ValueError

    if module.name contains characters not permitted in a CMSIS-Pack pack identifier ([A-Za-z0-9_-]).

Functions