Skip to main content

Module codegen

Module codegen 

Source
Expand description

HAL code generation.

Turns a validated Config into two C files:

  • nucleus_config.h — a typed config struct per peripheral plus extern HAL handle declarations and the Nucleus_Init() prototype.
  • nucleus_init.c — the resolved config struct instances, the handle definitions, and a single Nucleus_Init() that enables GPIO clocks, configures the alternate-function muxing (using AF numbers resolved from nucleus_db), and calls the stock ST HAL HAL_*_Init functions.

Architectural rule (README): the generated code never reimplements the HAL. It only calls Init functions with resolved parameters, so a HAL point-release that changes internals does not break Nucleus output. The tested HAL family is STM32F4 (stm32f4xx_hal.h).

Codegen assumes the config already passed crate::solver::solve; it skips unmodelled peripheral kinds and pins it cannot resolve rather than failing.

Structs§

Generated
The generated C sources for a project.

Functions§

generate
Generate nucleus_config.h and nucleus_init.c for config.