s32ct-generate-code
Triggers headless code generation in S32 Configuration Tools for a single specific tool (Pins, Clocks, Peripherals, DCD, IVT, eFUSE, GTM, QuadSPI, or FFC) of an existing .mex project and exports the r
SKILL.mdskills/s32ct/s32ct-generate-code/SKILL.md
GitHubS32CT Generate Code (single tool)
Regenerates driver / init code for one S32CT tool of an existing
.mex project and exports the result to a target folder. Drives the
official S32CT command-line interface via
-HeadlessTool <Tool> plus an export verb
(-ExportAll / -ExportSrc / -ExportHTML / ...), which regenerates
before exporting. Portable across the desktop and integrated_s32ds
distributions; the MCP picks the right launcher prefix transparently
(see s32ct-distributions).
When to use
Use this skill when:
- The user asks to regenerate, update, refresh, or export the
code/report of a single configuration tool after editing the
.mex. - Only one tool has changed and you want a scoped, predictable run.
- Integrating S32CT code generation into an MCP-driven pipeline.
Do not use this skill for:
- Bootstrapping a brand-new GTM configuration from a use-case template -
use
s32ct-gtm-create-from-usecase. - Editing values inside a
.mex(-SetValue/-GetValue) - use the GTMeditsub-mode or a dedicated facade. - Full multi-tool regeneration in one shot - call this skill per tool.
Available Capabilities
| Type | Name | Invocation |
|---|---|---|
| MCP tool | nxp_s32ct_execute_action |
action_name="s32ct.generate_code", params={"project_path": ..., "tool_name": ..., "output_dir": ...} |
| Resource | skill://nxp_s32ct/s32ct-generate-code |
Auto-loaded on trigger |
Canonical call shape
nxp_s32ct_execute_action(
action_name="s32ct.generate_code",
params={
"project_path": "...", # required, absolute path to a .mex
"tool_name": "Pins", # required, see enum below
"output_dir": "...", # required, created if missing
"export_kind": "ExportAll",
"enable_if_disabled": True,
"sdk_version": "...", # optional, e.g. "s32sdk_s32k3_rtm_402"
},
)
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
project_path |
string | yes | Absolute path to a .mex file |
tool_name |
string | yes | Exact-case name - see enum below |
output_dir |
string | yes | Target folder for exported artifacts |
export_kind |
string | no | See enum below (default ExportAll) |
enable_if_disabled |
boolean | no | Adds -Enable (default true) |
sdk_version |
string | no | Value for -SDKVersion |
s32ct_launcher |
string | no | Override launcher path |
launcher_ini |
string | no | Override .ini path |
tool_name enum (case-sensitive on the CLI)
Pins, Clocks, Peripherals, DCD, IVT, eFUSE, GTM,
QuadSPI, FFC.
export_kind enum
| Value | Effect |
|---|---|
ExportAll |
Union of source + reports + tool-specific dumps (default) |
ExportSrc |
Regenerated *.c / *.h only |
ExportHTML |
HTML report of the tool configuration |
ExportCSV |
CSV dump (Pins) |
ExportRegisters |
Register dump (Clocks) |
ExportMEX |
Writes a .mex to output_dir (original .mex untouched) |
Quickstart
1. Confirm S32CT is discovered
nxp_s32ct_execute_action(action_name="s32ct.env_status", params={})
2. Regenerate the Pins source code
nxp_s32ct_execute_action(
action_name="s32ct.generate_code",
params={
"project_path": r"C:/projects/motor/motor.mex",
"tool_name": "Pins",
"output_dir": r"C:/projects/motor/board/generated/pins",
"export_kind": "ExportSrc",
},
)
3. Verify
Confirm the return status starts with "Code generation succeeded" and
that expected files exist under output_dir. See
references/examples.md for more scenarios and full resolved CLI
command lines.
Behavior
Validate inputs:
project_pathexists and ends with.mex;tool_nameis in the allowed set;export_kindis in the allowed set.Resolve the launcher and prefix per active distribution (see
s32ct-distributions).Build the tail (single chain, no
;):-Load "<project_path>" [-SDKVersion <sdk_version>] -HeadlessTool <tool_name> [-Enable] # if enable_if_disabled = true -<export_kind> "<output_dir>"Spawn the process, wait for completion, capture stdout / stderr / exit code.
Map exit code + stderr signals to a human-readable status string including the resolved CLI and the output directory.
Do not modify the source
.mex. Only write underoutput_dir(exceptExportMEX, which writes a new.mexthere).
Guardrails
Scope
- Reads the input
.mex; writes only underoutput_dir. - Regenerates exactly the tool named in
tool_name- no others.
Destructive actions
- Overwrites previously generated files under
output_dir(*.c,*.h,*.html,*.csv, register dumps, or a.mex). - May create
output_dir. - Launches an external OS process (the S32CT launcher).
Refuse-and-escalate
- Launcher binary or
.inimissing -> return the searched paths and stop. project_pathmissing or not a.mex-> stop.tool_name/export_kindoutside the enum -> return accepted values and stop.- Non-zero exit code -> surface exit code + truncated stderr/stdout tail; do not retry silently.
IllegalStateException: The instance data location has not been specifiedin stderr -> hint that-data {workspace}is needed (the MCP handles this automatically forintegrated_s32ds).- User is actively editing the target
.mex-> confirm before running (this skill can overwrite hand-modified generated files).
Validation loop
- Return payload starts with
"Code generation succeeded". Pass if true. - Process exit code is
0. Pass if true. output_direxists on disk after the call. Pass if true.- Expected artifacts for the chosen
export_kindare present and non-empty underoutput_dir(e.g. at least one*.c/*.hfile withsize > 0forExportSrc, at least one*.htmlfile withsize > 0forExportHTML). Pass if the file-count and size checks both hold; zero-byte files count as a failure.
If any step fails, follow the Refuse-and-escalate rules above.
Out of scope
- Compiling the generated code. Chain with a build skill to verify.
- Regenerating multiple tools in a single call. Loop over tools instead.
- Editing
.mexvalues (-SetValue) - separate skill. - Interacting with a live target.
See Also
references/examples.md- worked scenarios (Pins/ExportSrc, Clocks/ExportAll, Peripherals/ExportHTML) with the full resolved desktop CLI.- Related skills:
s32ct-distributions(launcher prefixes and-data <workspace>handling),s32ct-gtm-create-from-usecase(GTM-specific bootstrap from a use-case template).