s32ct-peripherals-author-mex
Authors a fully-validated S32 Configuration Tools Peripherals-tool block on top of an existing Pins-tool routing for any S32 MCU (S32K1/K3, S32G2/G3, S32Z2, S32M, S32N, S32R, S32V, S32E, ...) and any
Files12
View on GitHubSKILL.mdskills/s32ct/s32ct-peripherals-author-mex/SKILL.md
GitHubS32CT Peripherals - Author .mex (from scratch)
Board-level driver <instance> authoring for the Peripherals tool of
S32 Configuration Tools. Composes driver blocks (Spi / Uart / Can /
Lin / Adc / Pwm / Wdg / ...) with per-controller configuration
containers on top of a Pins-populated .mex. Encodes the trap that
toolsc.exe exits 0 on 25 real validation errors.
When to use
- Use for: composing a Peripherals-tool block on top of a
Pins-populated
.mex; authoring drivers where no RTD example ships on disk; fine-grained per-setting control; recovering from a suspicious "validation passed" report from a lower-level wrapper. - Do not use this skill for: drivers where an RTD example is available - prefer
the faster sibling
s32ct-peripherals-graft-mex(3-6 rounds instead of 25+); Pins / Clocks / DCD / IVT / eFUSE / GTM / QuadSPI / FFC tools (each has its own skill); generating driver C sources (uses32ct-generate-codeafter validation is clean); application-level containers (SpiChannel/Job/Sequence,CanHwFiltermasks,AdcGroupDefinition) - project-specific; sees32ct-peripherals-info.
Available Capabilities
| Capability | Notes |
|---|---|
| 5-source authoring | Compose <instance> blocks from .component schema, resource tables, <quick_selection> defaults, RTD example .mex, and the target .mex. See references/authoring-procedure.md. |
| Per-driver programmatic emitters | scripts/build_peripherals.py - reference emitter for the six standard drivers with CommonPublishedInformation and correct enum casing. |
Splice into target .mex |
scripts/splice_peripherals.py - replaces any prior peripherals block. |
| Structural diagnostics | scripts/dump_resources.py, scripts/inspect_required.py, scripts/compare_children.py, scripts/find_bad_names.py. |
| Honest validation gate | scripts/check_problems.bat (Windows) / scripts/check_problems.sh (Linux/macOS) - runs the launcher with -Load ... -HeadlessTool Peripherals -Enable -ShowProblems, captures stderr to a file for the noise filter to consume. |
| Optional code generation | Run s32ct-generate-code Peripherals ExportSrc after validation is clean; verify each named controller appears in its .ecvd. |
Quickstart
- Confirm the
.mexalready has the Pins entries for the peripherals to configure (uses32ct-pins-author-mexfirst if not). - Resolve MCU / package / platform-SDK / RTD version; auto-discovery
is available at MCP startup. See
s32ct-distributions. - Follow the 7-step recipe:
- Inventory routed peripherals from the existing Pins entries.
- Per driver: look up schema (
.component), enums (resource_tables/[RTD/]<Driver>.xml), defaults (<quick_selection>), shape (RTD example.mex). - Programmatically emit one
<instance>per driver intoperipherals_block.xml(usescripts/build_peripherals.pyas the template). - Splice into the target
.mex(scripts/splice_peripherals.py). - Validate - stage the
.mex, then runscripts/check_problems.bat <mex> Peripherals(Windows) orsh scripts/check_problems.sh <mex> Peripherals(Linux/macOS), and filter the noise. - Iterate until the filtered stderr is empty (3-5 rounds is typical the first time).
- Optional: run
s32ct-generate-codePeripheralsExportSrc.
- Emit the Markdown report: driver instance table, validation result,
code-generation result, known caveats. Full input/output schema and
verification-scope caveats in
references/authoring-procedure.md.
Full driver-specific edits (XML shapes, ModuleIds, enum casings, the
10 critical pitfalls) live in references/per-driver-reference.md.
Read that file before writing the first <setting> for any driver you
have not previously hand-authored.
Configuration
Placeholders resolved from the active MCP install:
<MCU>- e.g.S32K312,S32G274A,S32M276.<PACKAGE>- e.g.S32K312_172HDQFP,S32G2_BGA257.<PLATFORM_SDK>- e.g.PlatformSDK_S32K3,PlatformSDK_S32G2.<RTD_VERSION>- e.g.TS_T40D34M70I1R0,TS_T40D11M40I0R0.<S32DS_INSTALL>/<S32CT_INSTALL>- auto-discovered by the MCP at startup (bothdesktopandintegrated_s32dsdistributions supported). Sees32ct-distributions.
Data reachable on disk:
<S32DS_INSTALL>/eclipse/mcu_data/components/<PLATFORM_SDK>/<driver_folder>/<driver_folder>.component<S32DS_INSTALL>/eclipse/mcu_data/processors/<MCU>/<PLATFORM_SDK>/<PACKAGE>/resource_tables/[RTD/]<Driver>.xml<S32DS_INSTALL>/S32DS/software/<PLATFORM_SDK>/RTD/<Driver>_<RTD_VERSION>/examples/S32DS/<MCU_FAMILY>/<Example>/<Example>.mex
Guardrails
- Scope. Read-only:
signal_configuration.xml,.componentfiles,resource_tables/*.xml, RTD example.mex, the<MCU>_default.mextemplate. Read-write: the user's.mexand any output folders named by the user. No network, no telemetry, no hardware, no registers. - Destructive actions. Splice replaces any prior peripherals
block in the target
.mex- the user should have chosen anoutput_pathdeliberately. Freshly generate a UUID v4 for every new<instance>; the example's UUID collides otherwise. - Refuse and escalate. If the requested driver has a shipped RTD
example, prefer
s32ct-peripherals-graft-mexand stop. If the Pins-tool entries are missing, hand off tos32ct-pins-author-mexfirst. Never report "validated" without having parsed the filtered stderr; the exit code lies.
Validation loop
-ShowProblems returns exit_code = 0 even when the Problems View
contains 25 errors. The MCP wrapper's stderr_tail field is also
truncated at ~3 KB. Trust the captured text, not the exit code, and
not stderr_tail.
Windows only: copy the
.mexto a no-space path.cmd's redirection parser fails on paths containing spaces inside quoted exe paths. POSIX shells quote correctly, socheck_problems.shaccepts any path and stages under$PROBE_DIR(default${TMPDIR:-/tmp}/s32ct_probe_out).Run the launcher with explicit stderr capture via
scripts/check_problems.bat(Windows) orscripts/check_problems.sh(Linux/macOS). See either script for the canonical invocation; both take the same arguments and write the same capture files.<LAUNCHER>istoolsc[.exe]ondesktopands32dsc[.exe]onintegrated_s32ds- sees32ct-distributions.Filter framework noise. A catalog of the ~7 SEVERE lines that appear on any clean project (
Cannot get container for IPath ...,SerDes Config Toolscript warning,derefAsrTypeErrors,Siul2_Port InfoSettingmessages,Port_GetNumOfPinConfig/getTotalNumOfChans/getTotalNumOfGroupsgetChildren/getChildByIderrors) lives inreferences/error-decision-tree.md. Drop those before interpreting the output.Pass criterion. After filtering, the remaining
SEVERE: [TOOL]andSEVERE: [Generationlines must be empty. Real problems look like:SEVERE: [TOOL] The resource "Can_43_FLEXCAN" from functional group "BOARD_InitPeripherals" has the following error: <human-readable text>.Never report "validated" without executing step 4. When a real line survives, pattern-match against
references/error-decision-tree.mdbefore changing anything else.
Out of scope
- Pins, Clocks, DCD, IVT, eFUSE, GTM, QuadSPI, FFC tool authoring.
- Application-level containers (SpiChannel/Job/Sequence,
CanHardwareObject filters, UartDma refs, LinClockRef alternates,
AdcGroupDefinition cross-refs) - see
s32ct-peripherals-info. - Driver C-source generation -
s32ct-generate-codePeripheralsExportSrc. - Adding
McuClockReferencePoint_*entries soLinClockRef/CanCpuClockRefrefs resolve at runtime - hand off tos32ct-clocks-info. - Using the MCP
s32ct-peripherals-facadewrapper for-ShowProblems(itsstderr_tailis truncated and hides errors).
See Also
references/per-driver-reference.md- verified XML shapes for Spi, Uart, Can_43_FLEXCAN, Lin_43_LPUART_FLEXIO, Adc, Pwm; surprise enum strings; ModuleIds; the 10 critical pitfalls.references/error-decision-tree.md-SEVERE: [TOOL]/SEVERE: [Generationpatterns mapped to fixes, plus the framework-noise catalog (Appendix) listing the ~7 SEVERE lines that appear on any clean project and must be filtered before interpreting output.references/authoring-procedure.md- the 5-source rule, 7-step recipe, inputs, outputs, verification scope, safety classification.s32ct-peripherals-graft-mex- faster sibling when an RTD example exists; prefer it whenever available.s32ct-peripherals-info- application-level container authoring.s32ct-pins-author-mex,s32ct-pins-info- Pins-tool skills.s32ct-clocks-info- clock reference points.s32ct-generate-mex-config- generic clone-and-patch operator.s32ct-generate-code- code generation after green validation.s32ct-cli- generic CLI wrapper.s32ct-distributions- launcher and prefix selection.