3.1.15. waf_tools.config_codegen_task
Code Generator for foxBMS configuration C/H source and CSV files.
This waf tool implements the build tasks and task generators that transform
JSON configuration files (e.g. battery_cell_cfg.json,
battery_system_cfg.json, diag_array_cfg.json) into generated C
source/header files and documentation CSV files. It uses template files
located in conf/bms/templates/ and resolves define values, CSV lookup
tables, and diagnostic array initializers at build time.
- The tool provides two waf features:
codegen_config - Generates C/H files from JSON configuration. For each file entry in the JSON, a
CreateCfgFiletask is created that resolves typed values (bool, int, uint, float), CSV data, and diagnostic arrays, then renders them into the corresponding template. An optionalvalidatorcallback is invoked to validate the JSON before code generation.codegen_csv - Generates documentation CSV files summarizing the configuration defines for use in Sphinx documentation.
3.1.15.1. Usage
Declare task generators in a waf build script:
bld(
features="codegen_config",
json=bld.srcnode.find_node("conf/bms/battery_cell_cfg.json"),
validator=battery_cell_config_validate.validate_battery_cell_configuration,
target=f"{cp}battery_cell_cfg",
)
bld(
features="codegen_csv",
json=bld.srcnode.find_node(f"conf/bms/battery_cell_cfg.json"),
)
3.1.15.2. Dependencies
waf_tools.c_codegen_template- Template rendering engine.waf_tools.diag_array_config_validate- Diagnostic array rendering.waf_tools.vcs- Version information for file headers.
Functions
|
Process the |
|
Create the C/H code from a JSON configuration and template. |
|
Process the |
|
Resolve all values in a file configuration. |
Classes
|
Waf task that generates a C/H file from a JSON configuration. |
|
Waf task that generates a documentation CSV file from a JSON configuration. |
|
Min/max limits for numeric types. |