@h2loop/autosar
v1.54.2
Published
AUTOSAR Classic pack for Hydron: ECUC read/edit-in-place/validate/diff on ARXML, config-to-code trace, generator and build runners
Readme
@h2loop/autosar: AUTOSAR Classic pack for Hydron
This pack lets the Hydron agent work on AUTOSAR Classic projects (MCAL, BSW, System / SW-C ARXML) with deterministic tools instead of hand-written XML. Every value it reads comes with its file and line, and every number it computes comes from a calculator. Every edit is checked against the vendor's parameter definitions (BSWMD) and validated before it counts as done. It works on any project layout: files are recognised by their content, not by folder names.
What it does
- Reads the configuration. It reads ECUC values and their definitions (allowed parameters, ranges,
enum literals, multiplicity) as compact JSON, with
file:linefor every value. - Edits safely. It can set, add or remove a value by AUTOSAR path, or add something "like" an existing
element (a message, port, Dem event, NvM block...) across ECUC and System ARXML.
- Edits change only the bytes they touch, so comments, formatting and UUIDs stay as they were.
- Each edit applies completely or not at all.
- An edit that would break validation is rolled back.
- Checks the work. It validates multiplicity, mandatory values, ranges, types, references and duplicates. It cross-checks modules against each other (Com ↔ PduR ↔ CanIf, NvM sizes, capacity). It also checks the configuration against the request's own requirements, and asks an independent reviewer for a PASS before the task is finished.
- Grounds every change. It gathers the element's current values, its definition and what the ingested manuals and specs say about it before editing. It reads pinouts, clock plans and requirement exports (xlsx, csv, PDF, ReqIF, docx, DBC, LDF) as citable text.
- Computes, never estimates. Calculators cover CAN bit timing, clock dividers, timer ticks, watchdog timeouts and baud rates.
- Covers the code side. It generates C configuration from the ARXML and diffs it against the
vendor's output. It checks
Rte_*calls against the SW-C description, reviews BSW API use in C, and runs a quick host unit test. - Protects the project.
- Vendor BSWMD / AUTOSAR definition files are read-only.
- Demo workspaces and backups inside a SIP are kept out of the project instead of being merged into it.
- Hand-edits of ARXML are blocked, and the agent is pointed at the edit tools instead.
TC4Dx COM CAN hardware data
autosar_calcwithop=can_timingandargs.silicon="tc4dx-com"uses the AURIX MCMCAN register limits and datasheet clock limits. Pass the configured asynchronous clockf_clk(fMCAN) and, when available, the host clockf_host(fMCANH). Pass any tighter driver ranges from the BSWMD.autosar_calcwithop=can_pinsandargs={package:"BGA436_COM",node:"CAN10"}returns TX mux numbers, RX input letters, and datasheet page and table references. Usepadto look up a known board assignment. The same tool supportsBGA292_COM. Use the board design to choose an actual route and the driver documentation to map it to vendor ECUC literals.
The hardware tables record source URLs, revisions, and PDF checksums. Regenerate the route data with
python3 script/extract_tc4dx_can_pins.py DATASHEET.pdf python/ecuc_engine/codegen/mcal/tc4dx-can-pins.json.
Quick start
Install the pack from the Hydron plugin marketplace (AUTOSAR), or:
hydron plugin add @h2loop/autosar # or a local path / --projectIt needs uv (preferred: it adds the strict ARXML schema check) or Python ≥ 3.10 on PATH.
AUTOSAR_PYTHONpoints at a specific interpreter.Open Hydron in the ECU project folder, not your home directory or a folder holding many projects.
The project is set up once, automatically. The first
autosar_build_contextcall in a project without.hydron/autosar.jsonwrites it (and says so). Discovery runs in a loop until it settles and fills every key: configuration folders, the definitions in use (the vendor BSWMD in the SIP), demo / backup folders to ignore, AUTOSAR schemas, System / SW-C input, the build command, the generated-code folder, spec texts and the DaVinci project. An existing file is never replaced;autosar_project_setupproposes an update (replace=truewrites it), andAUTOSAR_AUTO_SETUP=0turns the automatic write off.Ask in plain words. For example:
- "Configure Gpt with 4 continuous channels at 1, 2, 5 and 10 MHz with notifications."
- "Add a CAN FD controller for the chassis bus at 500 kbit/s / 2 Mbit/s, 80 % sample point."
- "Why does Dem report DTC 0x1234 at startup? Check the Dem / NvM configuration."
- "Validate the configuration and fix the errors."
- "Is the generated code up to date with the ARXML?"
The agent follows the same loop every time: ground → compute → edit → validate → check the request → review → generate → build. It asks before running your generator or build.
How it finds your files
Files are classified by content:
| Holds | Treated as |
|---|---|
| ECUC-MODULE-CONFIGURATION-VALUES | configuration (what the tools read and edit) |
| ECUC-MODULE-DEF | definitions (vendor BSWMD, AUTOSAR MOD), read-only |
| anything else (System extract, SW-C, BSW descriptions) | input, used to resolve references |
- Definitions. These come from, in order:
paramDefsin.hydron/autosar.json→ any definition file in the project (the variant matching the configured chip wins) →$AUTOSAR_PARAMDEFS→~/.config/hydron-cli/autosar/paramdefs/. Definitions aren't bundled; without them, values can be read but not validated, and new elements cannot be added. - Duplicate definitions. If a module is defined differently in several files, the project's own
file wins over a demo copy, and a warning says which file is in use.
ecuc_read schema=trueshows it as@defsFrom. - Copies. A folder named like a copy (demo / example / sample / template / backup / old /
archive...) that repeats the project's containers is set aside automatically. Pin it under
ignoreto make that permanent. A copy folder with an ordinary name is not caught, so pin it.
Project configuration: .hydron/autosar.json
Optional. autosar_project_setup writes the first version, and you can edit it by hand.
{
"config": ["Config/ECUC/"],
"paramDefs": ["sip/**/bswmd/*.arxml"],
"input": ["System/**/*.arxml"],
"ignore": ["sip/ThirdParty/MC-ISAR/TC4Dx/DemoWorkspace/", "**/Backup*/", "*.bak"],
"readOnly": ["sip/"],
"generate": {"command": "<vendor-cli> --project Config/Ecu.dpa --generate {module}", "timeoutSec": 3600},
"build": "make -C Build all",
"specDocs": ["~/autosar/R25-11/txt/*.txt"],
"docs": ["~/vendor/Infineon/TC4Dx/"]
}| Key | Meaning |
|---|---|
| config | The project's configuration files. Without it, they are discovered by content. |
| paramDefs | Definition files (vendor BSWMD, AUTOSAR MOD). |
| input | Other ARXML used to resolve references (System extract, SW-C). |
| ignore | The tools behave as if these paths did not exist. They aren't loaded, searched or written, by the engine or by Hydron's read / grep / glob / list / edit / write (those refuse them and leave them out of results). ignore wins over the other keys. Don't ignore the folder that holds the BSWMD unless paramDefs points elsewhere. |
| readOnly | The tools read these files but never write them. |
| schemas | Files or folders holding the official AUTOSAR XML schemas (AUTOSAR_00054.xsd, AUTOSAR_4-2-2.xsd, ...). ecuc_validate checks every file against the schema it names. autosar_project_setup proposes the folders where it finds them. |
| generate / build | Your generator and build commands, used by autosar_generate / autosar_build (each run asks permission). {module} is replaced by the module name. |
| specDocs | Text exports of the AUTOSAR specifications you are licensed to use, for autosar_spec_id_check. The pack bundles no spec text. |
| codegen | outDir: the folder holding the generated configuration code (setup finds it). |
| davinci | DaVinci Configurator for davinci_validate / davinci_generate: cmd (DVCfgCmd), project (the .dpa), and optionally the validate / generate command templates and timeoutSec (see DaVinci Configurator). |
Patterns can be a file, a folder (trailing slash optional), a ** glob relative to the project, or a
bare name / glob with no slash, which matches a file or folder name at any depth.
Tools
| Area | Tool | What it does |
|---|---|---|
| Set up | autosar_project_setup | Proposes, then on confirmation writes, .hydron/autosar.json. |
| Read | ecuc_read | ECUC values as compact JSON (@at = file:line, @hex); schema=true for the definition. |
| | ecuc_find | Structured queries: conditions, references to and from an element. |
| | autosar_build_context | Grounding before any change: current values, definition, spec / manual constraints; SW-C context for C. |
| | autosar_search_docs | Ranked page search over the project's own documents (vendor PDFs such as the Infineon AURIX datasheet / user manual / errata, MCAL user manuals, board and HSI documents), with [p<page>:<line>] locations. Used before query_hydron_project; text is cached in .hydron/cache/docs/. |
| | autosar_read_doc | Documents as citable text: xlsx / csv / PDF / ReqIF / docx / DBC / LDF / ARXML. |
| | arxml_diff | Semantic diff by AUTOSAR path. Set strict_ecuc to compare ECUC metadata, reference types and repeated value order. |
| Compute | autosar_calc | CAN bit timing, dividers, timer ticks, watchdog, baud rates. |
| Edit | ecuc_edit | Set / add / remove by AUTOSAR path; byte-preserving, all-or-nothing, schema-checked. |
| | autosar_add_like | Adds X like an existing Y across ECUC + System ARXML (renamed, linked, handle IDs); validates or rolls back. |
| | autosar_add_signal | Adds a signal end to end (ECUC + extract chain + DBC). |
| | arxml_edit | Structured edits of System / SW-C ARXML, including new files. |
| Check | ecuc_validate | AUTOSAR XML-schema (XSD), metamodel and rule checks, as LSP-like diagnostics, with fixes. |
| | autosar_fix | Applies the fixes (solving actions) ecuc_validate lists, by id or all preferred; validated, all-or-nothing. |
| | autosar_ack | Accepts a warning on purpose (rule + path + reason): reported as info from then on. |
| | ecuc_crosscheck | Per-module cross-check table (gateway, NvM sizes, capacity, packing, handles). |
| | autosar_accept | Checks the configuration against the request's requirements. |
| | autosar_review | Independent read-only reviewer; the task isn't done before PASS. |
| | autosar_spec_id_check | Checks SWS_ / TPS_ / ECUC_ IDs against your specDocs. |
| Code | autosar_codegen / autosar_codegen_diff | Deterministic C configuration from the ARXML; diff against the vendor's output. |
| | autosar_stale_output | Generated code older than the ARXML, row by row. |
| | autosar_verify_rte | Rte_* calls checked against the SW-C description. |
| | autosar_audit | BSW API use in C: handles, direction, widths, NvM vs ECUC. |
| | autosar_unit_test | Builds and runs C against a quick host test (stub RTE for SW-Cs). |
| | autosar_generate / autosar_build | Runs your configured generator / build (asks permission). |
| DaVinci | davinci_validate | Runs DaVinci Configurator's own validation (DVCfgCmd + an Automation Interface script) and returns every result by module. |
| | davinci_generate | Runs DaVinci's generators for the modules you changed. |
| H2Loop backend | autosar_trace / autosar_config_lookup | Config ↔ generated C symbol ↔ callers, via the H2Loop code graph. Uses your Hydron login and selected H2Loop project. |
Also included:
- the
autosarskill (the ECUC model, the symbolic-name rule, config classes, and the workflow); - the
autosar-integrator,autosar-mcal-deriverandautosar-mcal-revieweragents; - the
/autosar-validateand/autosar-tracecommands.
XML schema check
ecuc_validate checks each configuration, extract and SW-C file against the official AUTOSAR XML schema
(XSD) it names in xsi:schemaLocation. That's what a configurator rejects first on import: an element in the wrong
place or order, a required element or attribute missing, too many of something, an unknown element or attribute,
or a value that breaks its type (a DEST that isn't a valid metaclass, a SHORT-NAME that isn't an identifier, a
malformed number). Edits that would make a valid file invalid are refused.
The check is pure Python, part of the engine (no lxml or other package). It gave the same verdict as libxml2
(xmllint --schema) on all of about 5,200 original and deliberately broken files: misplaced, missing,
duplicated and renamed elements, bad attributes, values and text, against the R4.0.3, R4.2.2, R4.3.1, R19-11,
R22-11 and R25-11 schemas.
The schemas aren't bundled: AUTOSAR's terms allow them only unmodified, for information. They're free from
autosar.org, in each release's "XML Schema" package (AUTOSAR_FO_MMOD_XMLSchema.zip, or
AUTOSAR_MMOD_XMLSchema.zip for older releases). SIPs and tool installs often include them too. Put them where
the engine looks: schemas in .hydron/autosar.json, AUTOSAR_XSD_DIR, ~/.config/hydron-cli/autosar/schemas,
or anywhere in the project. Only the exact schema a file names is used. Without it, ecuc_validate says "XML
schema (XSD): NOT checked" rather than passing silently.
What it doesn't cover: the schema says what is well formed, not what a particular tool accepts. Vendor-specific rules (for example parameters a configurator calculates itself) are outside it.
Specification constraints
Beyond what the definition files can express, ecuc_validate checks the configuration constraints the AUTOSAR
module specifications state in their parameter tables. Examples: a notify-status flag that needs its API switch,
callback names that are fixed when the upper layer is CanSM or EcuM, handle and event IDs that must be unique and
gap-free, a CAN XL data rate at least twice the nominal rate, an ADC pin that must be an input. Each finding is
SPEC-<Module>-<n> and cites the [ECUC_<Module>_<n>] requirement it implements.
The catalog (python/ecuc_engine/rules/spec_constraints.json) is data: each entry is a condition and a requirement
over parameter names, evaluated on every container of one kind. A constraint runs only when the loaded definitions
have every name it uses, so another release or a vendor's renamed definitions never produce findings from it.
A value that can't be resolved skips that container; nothing is reported from a guess.
The SWS chapters' own configuration rules ("the generator shall reject configurations where …") are in the same
catalog and cite [SWS_<Module>_<n>]: a NAND expression with two arguments, an OS object owned by exactly one
OS-Application, contained PDUs of one container not mixing collection semantics, an RTE event mapped once.
Coverage today (R25-11): 531 constraints citing 499 requirements over 73 modules (480 ECUC_…, 19 SWS_…).
Every name is checked against the R25-11 definitions and every cited ID against the specification text. Each
constraint is proven on a configuration generated from the definitions: it reports the planted violation and stays
quiet once it is fixed (constraints between several containers are proven by tests that build the references).
Not covered: parameter descriptions that state behaviour, depend on the hardware, or are "only relevant if …" for a
parameter R25-11 makes mandatory; SWS rules that need the SW-C model, the ECU extract or vendor data (most RTE rules).
Template constraints
ecuc_validate also checks the [constr_NNNN] constraints of the AUTOSAR template documents on the ARXML elements
themselves: ECU configuration values and definitions (TPS_ECUConfiguration), System and ECU extracts
(TPS_SystemTemplate), SW-C descriptions, BSW module descriptions, diagnostic extracts and timing descriptions. Each
finding is TPS-<DOC>-<n> (e.g. TPS-SYS-9255). 412 constraints today: 48 written by hand for ECU configuration,
364 generated from the documents' fixed phrasings ("for each X, the attribute y shall exist", "the value of X.y
shall be in the range a..b") with every class and role resolved against the R25-11 XML schema. Elements copied from
AUTOSAR's standard definitions (ORIGIN AUTOSAR_ECUC) are not reported. Required-attribute findings on extracts are
warnings. Not covered: constraints that relate several objects semantically (data type compatibility, mapping
consistency across the system) and those on abstract base classes, which have no element of their own.
Solving actions: fixes you apply in one step
Like a configurator's solving actions, a finding whose fix follows from the definitions and the configuration alone
carries it, as ops in exactly the ecuc_edit (or arxml_edit) format:
Config/Com_ecuc.arxml:120 ERROR ECUC-RANGE /ActiveEcuC/Com/ComConfig/Sig1 — ComSignal 'Sig1': ComBitSize=99 outside [0..64]
FIX f3a9c1 (preferred): set …/ComConfig/Sig1/ComBitSize = 64 (clamped to [0..64])autosar_fix ids=["f3a9c1"] applies it (or preferred_all=true, optionally with module / files). It runs
through the edit engine, all or nothing: it validates again and writes nothing if any new error appears; dry_run
shows the diff. A fix id is a hash of its ops, so it is the same in every validation run.
| Finding | Fix | Preferred |
|---|---|---|
| mandatory parameter missing (ECUC-MISSING-PARAM), empty value, a numerical value without VALUE (TPS-ECUC-3594) | the definition's default | yes |
| mandatory reference missing, dangling or wrong destination | the one container of the right definition, if exactly one exists | yes |
| mandatory single container missing | add it, when all its mandatory content has defaults | yes |
| value out of range (ECUC-RANGE) | clamp to the nearest bound (never to an open bound) | yes |
| enum literal invalid (ECUC-ENUM) | the literal that differs only in case, else the closest by edit distance | only if unique and close |
| wrong value element / DEST for the definition | re-write the same value correctly | yes |
| too many values / containers | keep the first ones, remove the rest | no |
| spec rule "X only if switch" (optional_param) | remove X, or enable the switch | no (two alternatives) |
| spec rule "X == true requires Y == true" | set Y, or unset X | only when the rule has no condition |
| spec unique / gap-free ids | the duplicate moves to the next free value / the instances are renumbered without gaps | yes |
| no IMPLEMENTATION-CONFIG-VARIANT (TPS-ECUC-3590) | arxml_edit set to the variant the definition supports | if it supports one |
No fix is offered when it would take a guess or domain knowledge: timing values, hardware, names, an enum value
with nothing close, a reference with several possible targets, an ECUC-DEF-EDITION.
A warning that is accepted on purpose is acknowledged with autosar_ack (rule, path, reason). It is stored in
.hydron/autosar-acks.json (commit it with the configuration) and reported as info with its reason from then on.
Errors can't be acknowledged; an error written into the file by hand stays an error.
Fault bench (eval_work/autosar/bench/faults/fault_bench.py --fix, one planted fault per copy of the sample ECU
with the R25-11 definitions): of 35 planted faults, 17 get at least one fix and 10 a
preferred one; applying every preferred fix removes 8 completely (duplicate handle / PDU / block / DTC / function ids,
a CAN controller id gap, a CAN object id duplicate, a reserved DTC range). The rest need a value only the requirement
gives (a period, a bit position, which reference target), or the alternatives are a choice (remove the parameter or
enable its switch); one preferred fix (a reserved NvM block id clamped onto an id already in use) was rolled back
because it introduced a new error.
Module scope
ecuc_validate module=Com validates one module: its files against the schema, its definition checks and constraints,
cross-module findings that name it, and with build=true only its generated code and the project C files that
include its headers. The ECU extract is skipped. Findings drop from the whole project's to the module's; the run is
not much faster, because loading the project dominates.
Build check
ecuc_edit stages generated ECUC ARXML and reports newly introduced errors before writing. Use one edit batch to
create a module and supply its required values.
ecuc_validate defaults to ARXML-only checks. It reports official XSD coverage and uses the installed AUTOSAR
metamodel for ECUC structure when the project schema is unavailable. ecuc_validate build=true also generates the configuration with
the engine's generators in a scratch copy and compiles the result with the system C compiler. The project is never
written. It reports:
| Rule | Meaning |
|---|---|
| H2L-BUILD-001 | The generator refuses the configuration (handle-ID conflicts, values the static code's tables can't hold). |
| H2L-BUILD-002 | Generated C doesn't compile, a value overflows its C type, or the project's own C no longer compiles against the regenerated configuration. Only errors that are new compared with the current generated folder count, so target-only code (intrinsics, inline assembly) doesn't show up. |
| H2L-BUILD-003 | The project's C uses a <Mip>Conf_* symbol the configuration no longer defines. |
| H2L-BUILD-004 | A configured callout is defined or declared in no C file of the project. BSW-to-BSW callbacks (CanSM_..., EcuM_...) are the vendor's and are not reported. |
It covers the modules the engine generates (Com, PduR, CanIf, Can, Dem, LinIf, Lin, NvM, Fee, Mem, MCAL). A header
found nowhere (the vendor's static code isn't in the project) is reported as "NOT compiled", never as a pass.
Standard platform headers (Std_Types.h, Platform_Types.h, Compiler.h) are supplied when the project has none.
Measured: of 31 realistic faults planted one at a time into clean dev-set projects (communication stack, memory, diagnostics, MCAL, network management, OS, schema), all 31 were reported. 15 of them were found only by the specification constraints or the build check.
Not covered: the vendor's own generators and their checks, parameters a configurator calculates itself, and vendor-specific rules. Those still need the vendor tool.
Standalone DaVinci checks
ecuc_validate and staged ecuc_edit run local checks reconstructed from DaVinci Classic 5.25 SP15.
Look for DVCFG-* findings for ECUC names and linker symbols, symbolic references, BSW implementation references and releases, ADC, DIO, GPT, ICU, MCU, Port, PWM, RamTst, SPI, NvM, Fee/Fls, and Eep.
These checks use the loaded ARXML and ECUC definitions. DaVinci execution remains a separate optional tool.
DaVinci Configurator
Where Vector DaVinci Configurator is installed, the agent can run DaVinci itself instead of relying only on
ecuc_validate:
davinci_validateruns DVCfgCmd on the project's.dpawith an Automation Interface script that the plugin writes to.hydron/davinci/scripts/. The script validates the project and writes every result (severity, message ID, message, affected elements) as JSON; without that file the console output is parsed. The agent gets the results grouped by module and treats each error as an open item.davinci_generate modules=[...]runs DaVinci's generators for just the modules that changed.- Set
AUTOSAR_DAVINCI=1to require DaVinci validation after a configuration change when the tool and project are available.
DVCfgCmd is found in davinci.cmd, $DAVINCI_CMD, PATH, or the Vector install folders; the project in
davinci.project or as the only .dpa in the tree. Both tools ask permission, and a run can take minutes.
The command line differs between DaVinci versions, so check the defaults once against your installation and
set them in .hydron/autosar.json if they differ:
{"davinci": {
"cmd": "C:/Vector/DaVinci_Configurator_Classic/Bin/DVCfgCmd.exe",
"project": "Config/Ecu.dpa",
"validate": "\"{cmd}\" -p \"{project}\" --scriptLocations \"{scripts}\" --scriptTask HydronValidate --out \"{out}\"",
"generate": "\"{cmd}\" -p \"{project}\" -g {modules}"
}}The script (HydronValidate.groovy) uses the Automation Interface's validation API; check its calls against
the Automation Interface documentation of the installed version on the first run.
Work sessions: scope and git
- Scope. The files and modules the first request names become the session's scope:
autosar_build_contextloads only those files, so grounding stays fast on large projects (a module outside the scope loads the whole project).AUTOSAR_FOCUS=0turns it off. - Git. Before its first project write in a git work tree with ECU configuration, a work session creates its branch
(
hydron/<date-time>-<task words>, uncommitted changes carried over), and its changes are committed there each time the session goes idle. Nothing is pushed, hooks are not bypassed, empty commits are skipped, and nothing is committed after you switch to another branch.AUTOSAR_GIT_SESSION=0turns it off.
Review (autosar_review)
An MCAL task with requirements ends with an independent review in read-only child sessions:
- Blind derivation, started early. The
autosar-mcal-deriveragent derives each requirement's expected values from the request and documents only, without looking at the configuration. It starts in the background as soon as a change request's requirements are known (not while the user's answers to open questions are still to come), and again when the requirements or the request text change (a follow-up that corrects a value; a bare "continue" or "ok" does not count).autosar_reviewwaits for its result instead of starting it; when the background run failed, the review starts it itself. Cost: it runs on the same model server as the main agent, also in sessions that never reach the review. - Reviewers in parallel. The requirement rows are split by module into at most
AUTOSAR_REVIEW_GROUPS(default 3) reviewers that run at the same time, each owning its rows. A review with fewer than 6 rows, or without two modules of 2+ rows, keeps one reviewer: each extra reviewer is a full agent with its own prompt and document reads. Reviewer 1 also does the scope check and the oneecuc_validaterun. The verdict is as strict as one reviewer's: PASS only when every reviewer says PASS, every requirement has a row, no row is "no" and no deterministic finding holds; requirement coverage counts only the owning reviewer's rows (a "no" from any reviewer is NOT MET). A reviewer that could not run is retried once; if it fails again the review is INCOMPLETE: never a PASS, no round used, and an earlier PASS no longer shows as the review state. - Change plan items: demanded, optional or waived. Before any reviewer runs, the review fails on its own
("change plan items missing") while an item of the change plan does not exist. The plan copies an existing
sibling's whole footprint, which can reach further than the request allows. Two exceptions:
- Optional: an item in an ECUC module the scope rule rejects for this session (an integration / upper module,
not an MCAL driver, that neither the request nor its requirement documents name) is not demanded. The plan text
marks it
[optional]("the sibling also has this in CanIf; add it only if a requirement needs it"). It is asked each time, so requirements that arrive later count. - Waived:
autosar_review {waive:[{item, argued}]}takes an item (as listed, or its path) off the deterministic check when the agent argues it cannot exist or is not needed (a parameter value planned as a container). Waivers are kept for the session; the reviewers get them with the instruction to fail the change if an item is needed after all. A waiver that names no plan item is reported. Scope-rule findings cannot be waived.
- Optional: an item in an ECUC module the scope rule rejects for this session (an integration / upper module,
not an MCAL driver, that neither the request nor its requirement documents name) is not demanded. The plan text
marks it
- Configured values in the brief. The values at the paths each requirement's acceptance checks name are read by
the engine from the files at the start of every review call (never carried over from an earlier round), with
file:line, without the check's expected value or result. They are a shortcut, not evidence: the reviewers verify each against their own read of the configuration (a check can point at the wrong container). - No verdict on a changed configuration. Every
.arxml/.epc/.epdfile of the project (outside hidden and tooling folders and theignorepaths of.hydron/autosar.json; a symlinked folder once) and.hydron/autosar.jsonis hashed before the review and again before its verdict is returned. If anything changed (an editor, another session), the verdict is discarded and the review runs again on the new files, once; a second change is reported as a FAIL ("configuration changed during the review") and an earlier PASS no longer shows as the review state. A discarded run does not count as a round. - A time limit on every subagent. Each deriver / reviewer prompt waits at most
AUTOSAR_REVIEW_PROMPT_TIMEOUT_S(default 600 s). While it waits, the plugin looks at the child's newest message every few seconds: when the child has finished its answer but the call has not come back, that answer is used. At the limit the child is cancelled and its rows stay NOT VERIFIED; when no reviewer answered, the review returnsNOT COMPLETED(never a PASS; it counts as a round; the agent calls it once more, then finishes and says the review did not complete). A deriver that runs out of time is started again by the next review. Stopping the session stops the waiting review at once. - No folders outside the project. The reviewer and deriver agents deny reads, globs and searches outside the
project instead of asking. In a headless run (
hydron run --auto) nobody answers a permission ask from a plugin-run child, so such a call would wait forever.
Settings (environment variables)
Set these in the shell before starting Hydron.
| Variable | Effect |
|---|---|
| AUTOSAR_PYTHON | Python interpreter for the engine (default: uv, then python3). |
| AUTOSAR_PARAMDEFS | Definition files / folders to use when the project has none (path list). |
| AUTOSAR_SPEC_DOCS | Spec text exports, when specDocs isn't set. |
| AUTOSAR_AUTO_SETUP=0 / AUTOSAR_FOCUS=0 / AUTOSAR_GIT_SESSION=0 | Turn off the automatic .hydron/autosar.json, the session's file scope, and the session branch and commits. |
| DAVINCI_CMD | Path of DaVinci's DVCfgCmd, when davinci.cmd isn't set. |
| AUTOSAR_WARM_ENGINE=0 | Turns the warm engine off: every tool call re-reads the project (see below). On by default since 1.41.0. |
| AUTOSAR_BUILD_TIMEOUT_S / AUTOSAR_BUILD_MAX_FILES | Build check: compiler time limit per file (default 120) and how many project C files to compile (default 600). CC picks the compiler. |
| AUTOSAR_XSD_DIR | Folders holding AUTOSAR XML schemas (path list), when schemas isn't set. ~/.config/hydron-cli/autosar/schemas is also searched. |
| AUTOSAR_MAX_FILES / AUTOSAR_MAX_SCAN | Caps on the file walk (defaults 200000 files / 60000 entries). |
| AUTOSAR_HOOK_TIMEOUT_MS | Time limit for the engine calls the plugin makes on its own before the model answers (default 20000). The automatic autosar_verify_rte after a C edit gets the same limit; when it is skipped, the tool result says so. 0 = no limit. |
| AUTOSAR_GROUND_TIMEOUT_S | Time limit of the automatic autosar_build_context the ground-first gate runs before a first edit (default 150). Project facts usually arrive well inside it; a document lookup still running is reported as NOT YET and keeps running, so the model's own call reuses its answer. |
| AUTOSAR_DOC_PREFETCH=0 | Stops starting document lookups in the background when a change request arrives. By default the plugin asks the ingested-documents index about each configured module the request names (at most 2), with the same question autosar_build_context target=<module> sends; that call then waits only for what is still running. Not for an exact assignment (set X to 5) or a "what is the current ..." question, which the local value and definition may answer. |
| AUTOSAR_PLAN_WAIT_MS / AUTOSAR_PLAN_TIMEOUT_S | The change plan (the checklist of every place a requested change must exist, from the new element's existing sibling) is computed in the background when a change request arrives. The message waits for it at most AUTOSAR_PLAN_WAIT_MS (default 1500; not at all once loading the project is known to take longer): a plan ready by then is in that turn's system prompt, a later one arrives with the live task state at the end of the next tool result. On the generated 50 MB project it takes about 10 s. AUTOSAR_PLAN_TIMEOUT_S (default 300) stops a plan that runs longer (counted from its start, after the project preload; the preload itself has AUTOSAR_PRELOAD_TIMEOUT_S, default 300); a newer message replaces a plan still running. The earlier message's plan is hidden while the new one runs and comes back when the new one has none ("please continue"), fails, or is dropped because the project was edited before the plan had read it (the live state then says so). autosar_review waits for a plan still running up to AUTOSAR_REVIEW_PLAN_WAIT_S (default 60) and answers PENDING, never PASS, without it. AUTOSAR_CHANGE_PLAN=0 turns the plan off. |
| AUTOSAR_WARM_WAIT_MS | How long a call waits for the busy warm engine before running one-shot (see Warm engine). Unset: the project's last measured load time + 300 ms (at most 60 s); before any load was measured, up to 30 s behind the project preload (the warm engine is then doing its first load), 2 s behind any other call. 0 = never wait. |
| AUTOSAR_REVIEW_GROUPS | Most reviewers autosar_review runs at the same time, one per requirement group (default 3; 1 = one reviewer for all rows). See Review. |
| AUTOSAR_REVIEW_PROMPT_TIMEOUT_S | Time limit of each deriver / reviewer prompt of autosar_review (default 600; 0 = no limit). A reviewer that does not answer in time leaves its rows NOT VERIFIED; none answering gives NOT COMPLETED, never a PASS. |
| AUTOSAR_DOC_CONCURRENCY | How many ingested-documents (retriever) requests run at the same time (default 3); the others wait in line. |
| AUTOSAR_PERF_LOG=0 | Turns the timing log off (see Timing log). |
| KILO_API_URL | H2Loop backend URL for the backend tools. |
| AUTOSAR_LOCAL_DOCS_FIRST=0 | Stops routing document questions to the project's own documents first: query_hydron_project and the document facts of autosar_build_context / ecuc_validate docs=true then go straight to the ingested-documents index. |
| AUTOSAR_FREEZE_SYSTEM=0 / AUTOSAR_LIVE_STATE=0 | The pack's system prompt is built once per user message and kept byte-identical through the turn, so the model server reuses its prompt cache on every step; plan progress, requirement checks, open items and the review verdict are appended to tool results when they change. These turn that off (rebuild every step) or stop the tool-result updates. |
The other AUTOSAR_* switches in src/ are evaluation toggles; leave them unset.
Warm engine (on by default)
One engine process stays alive and keeps the project loaded between tool calls, instead of every call starting a new process that re-reads and re-parses the whole project. To turn it off:
export AUTOSAR_WARM_ENGINE=0- Speed: replaying 10 recorded sessions (520 calls) took 144 s → 30 s with identical answers and files. On a 418-file project, a read took 0.9 s → 0.02 s. A repeated edit took about 0.1 s instead of 0.25–0.37 s.
- Memory: about 130 MB while a small project is open. The generated 50 MB project (~400 files): about 620 MB after the first load, 1.3 GB once both kinds of load (with and without the system extract) are held. The change plan runs in a second process for about 11 s after each change request (peak 1.2 GB on that project), and a one-shot call beside the warm engine (its wait ran out) takes about 0.65 GB: the worst case there, warm engine + plan + two one-shot calls at once, is about 3.8 GB for a few seconds (measured peak resident memory, macOS arm64).
- No extra disk use.
How it stays correct:
- The loaded project is reused by read-only calls (
ecuc_read,ecuc_find,ecuc_validate,ecuc_crosscheck, ...), by the checks the plugin runs after every edit (plan status, acceptance checks, generated-code staleness), by the review's scope check andautosar_build_context, and byecuc_edit. Each of these is tested to write nothing and to leave the loaded project unchanged. - Calls that load the project without the system extract (
ecuc_read, info) and calls that load it with the extract (ecuc_validate,ecuc_edit) share one parse: the second kind is built from the first, and an edit updates both, so a session loads the project once while no file changes outside the tools. ecuc_editvalidates the result of each change against the findings of the configuration it started from. In the warm engine those come from the previous edit (it validated exactly what is now on disk), so an edit validates the project once instead of twice. They are reused only while the project holds the same parsed files and the settings, acknowledgements,.hydron/autosar.json, rule catalogs, vendor rules and XML schema files are unchanged.- Before each reuse, every configuration file must still have exactly the bytes the project was loaded from
(compared byte for byte, not by timestamp). The folder contents (recorded before loading),
.hydron/autosar.jsonand the relevant settings must also be unchanged. Any change (from the tools, your editor, git or a shell) reloads. - After an edit, the project stays loaded only if the edit wrote exactly what it changed in memory. A dry run, a
refused edit or a failed edit drops it. Other writers (
arxml_edit,autosar_add_like, ...) always load fresh. - Definitions and input files are checked by timestamp and size. A project whose definitions or input changed
within 2 s of loading is not kept (
AUTOSAR_WARM_SETTLE_S).
If the warm process is busy (the model sent two reads in one step, or a hook check runs), a call waits its turn,
first come first served, but never longer than running it the normal way is expected to take: the project's last
measured load time + 300 ms (at most 60 s; before any load was measured up to 30 s, since the warm process is then
doing its first load and a second load beside it only competes for the CPU, except a call under the hook time limit,
which then runs the normal way at once; AUTOSAR_WARM_WAIT_MS sets a fixed bound, 0 =
never wait). Behind a short call that costs about 0.1 s instead of a full load (4-5 s on a 50 MB project); behind a
long one (an edit, a full validate) the wait runs out and the call runs the normal way in parallel, at worst twice
the normal time. A call made under the hook time limit waits only while running it the normal way would still fit in what is left of that limit, so it is never skipped in the line. An abort while waiting only takes the call out of the line. The change
plan never uses the warm process (it runs in its own process in the background, once the project is loaded). When
a change request arrives the plugin loads the project into the warm process in the background (via: preload in
the timing log), with its own limit (AUTOSAR_PRELOAD_TIMEOUT_S, default 300 s) rather than the hook time limit; the document prefetch and the plan wait for it. Any failure falls back to the
normal way, and three failures turn it off for the session. It exits after 15 idle minutes
(AUTOSAR_WARM_IDLE_S) and keeps at most 4 projects (AUTOSAR_WARM_MAX_PROJECTS).
Timing log
Where a session's time goes, for a machine where no analysis script can run: ask Hydron to summarise the file.
.hydron/perf/autosar-perf.jsonl in the project gets one JSON line per event. The file stays on the machine (nothing is
sent anywhere), the folder's .gitignore keeps it out of the work session's commits, and it rotates to .1 past 20
MB. AUTOSAR_PERF_LOG=0 turns it off.
Every line has t (ISO time the event ended; it started at t - ms), sid (session), via (the hook or tool that caused it, e.g.
tool.execute.after:ecuc_edit, tool:ecuc_read), kind and ms:
| kind | One line per | Other fields |
|---|---|---|
| tool | tool call, plugin or host (query_hydron_project, read, ...): from the end of tool.execute.before to the start of tool.execute.after, so permission prompts inside the call count | name, chars (output size) |
| hook | hook run (event only when it took 50 ms or more) | name, tool; for a refused call gate (ground, intake, ledger, greeting, generate, arxml-check, local-docs = query_hydron_project answered from the project's own documents instead, other) and refused (first line), the call never ran; for a hook that threw anywhere else, error (first line) |
| engine | Python engine call | cmd, mode (warm, busy = one-shot because the warm process stayed busy longer than the wait bound, fallback = warm failed, oneshot = warm off or a background call that runs outside it, e.g. via: change-plan), queuedMs (time spent waiting for the busy warm process; with mode: warm it then got it), engineMs, loads / loadMs (full project loads and their time; 0 = the warm cache was reused), cache (warm: hit, miss, stale, cleared = cached projects this call dropped, checkMs = time spent checking the cached project still matches the disk), hookLimit (ran under the hook time limit), timedOut (hit that limit), aborted (cancelled by the user) |
| docs | document lookup (autosar_build_context, ecuc_validate docs=true, runnable context, via: prefetch for the background lookups started by a change request) | src: local (the project's own documents), cache (answered before in this turn of the session), joined (waited on a lookup already running, usually the prefetch), retriever (started a request), unavailable (failed, or the caller stopped waiting) |
| backend | H2Loop backend request (retriever, trace, config lookup) | path, status (HTTP status, when a response came back), error (HTTP <status>, never the response body; the message's first line when no response came back) |
| review | autosar_review phase | phase: deriver (the blind derivation; bg: true = started from the change request), deriver-wait (what the review waited for it; ready: true = already done), deterministic (a FAIL from the open items, no reviewer; gaps, and planOptional / planWaived: missing change-plan items not counted as gaps because they are optional or waived), reviewer / followup (one per reviewer group: group, groups, rows), retry (a reviewer group that failed to run, run once more: group, error), plan-wait (the review waited for a change plan still running), hash (configuration hash: run, files, changed), total (the whole call: runs, verdict, stale); round |
| plan | change plan computed for a change request (in the background, via its message) | delivered: system (ready before the turn's system prompt was built: in it), live (later: appended to the next tool result), replaced (a newer message came first: dropped), empty (nothing to plan), failed (engine error or AUTOSAR_PLAN_TIMEOUT_S); ms from the message |
| build | automatic build after a change | exit |
How to read it:
- A tool call's full cost is its
toolline plus thehooklines with the sametool(tool.execute.beforebefore it,tool.execute.afterafter it). Hydron's own session record counts hook time as tool time; this log splits it. - Engine calls inside a hook carry
via= that hook and tool, e.g.tool.execute.after:ecuc_edit: the after-hook's plan / acceptance checks for that edit. - An LLM step starts at each
experimental.chat.system.transformline (once per step, before the model is called). The interval to the next one holds the model's answer, the tool calls and their hooks. - Time in Hydron itself between steps (outside this plugin and the model): the start of a step's transform line
minus the end (
t) of the previous step's lasttool.execute.afterhook line. - Split everything by
sid: review subagents run in their own sessions. - Every line goes to the file of the project Hydron was started in, also for tool calls that name another
project_dir. When one Hydron process serves several projects (desktop app, IDE), each project gets its own file. - Document lookups on the critical path: the
docslines withvia: tool:...are what the model waited for;via: prefetchran in the background.src: joinedwith a smallmsmeans the prefetch had already done the work.
script/bench-grounding.ts replays the start of a configuration task against a local fake retriever (--delay ms per
answer) and prints the grounding calls' wall time and these log lines; it uses only the plugin's entry point, so the
same script measures an older checkout for a before/after comparison.
Troubleshooting
| Symptom | Cause / fix |
|---|---|
| "has 40 values" on a single-value parameter; a multiplicity count far too high | Copies of the configuration are being merged. Run autosar_project_setup, or pin config / ignore. |
| "No ECUC param definitions found" | No BSWMD found. Set paramDefs (or AUTOSAR_PARAMDEFS) to the vendor BSWMD / AUTOSAR MOD. |
| "X is defined differently in N files" | Duplicate definitions; the file named is the one in use. Pin paramDefs if it's the wrong one. |
| "XML schema (XSD): NOT checked" | The schema the files name isn't installed. See XML schema check. |
| "refused to write read-only file(s)" | The target is a definition, vendor, demo or readOnly file. Write into the project's own configuration instead. |
| Very slow first call, or "very large for an ECU project" | Hydron is open in a folder that is too broad. Open it in the project folder, or pin the globs. |
DaVinci-compatible command line
bin/h2l-cfgcmd (also python -m ecuc_engine dvcfg, and h2l-cfgcmd when the npm or Python package is installed)
takes the options of DaVinci Configurator's DVCfgCmd that build scripts use, so a CI job can run the engine where
it ran DaVinci:
h2l-cfgcmd -p Config/Ecu.dpa -v --reportFile Log/Validation.xml
h2l-cfgcmd -p Config/Ecu.dpa -g -m "Can,CanIf,/ActiveEcuC/PduR" --genDataDir Appl/GenData \
--reportFile Log/Report.xml --reportArgs CreateXmlFile,CreateHtmlReport -l Log/run.log
h2l-cfgcmd -p Config/Ecuc -p Bswmd/ -g # ECUC ARXML files / folders instead of a .dpa| Option | Meaning |
| --- | --- |
| -p/--project F | a DaVinci project (.dpa), or ECUC .arxml files / folders (repeatable; definition and system files among them are recognised by content) |
| -v/--validate | validate (the default) |
| -g/--generate | validate, then generate when validation has no FatalError / Error |
| -m/--modulesToGenerate "A,B" | short names, definition paths or AUTOSAR paths; default: every module the engine has a generator for |
| -x/--modulesToExclude "A,B" | the same, left out |
| --reportFile F | execution report; --reportArgs CreateXmlFile,CreateHtmlReport picks XML and/or HTML (default XML). With --reportArgs and no file: <Logs folder>/<Project>_ExecutionReport.xml |
| --genDataDir D | generation output (default: the .dpa's GenData folder, else codegen.outDir, else Output/) |
| --saveProject | write values computed during generation (handle IDs) back into the ECUC files; without it the configuration is never changed |
| -l/--logfile F, --verbose | console copy; print infos and generator notes too |
| --defs P | (h2l) parameter definitions (BSWMD) file / folder / glob, when the .dpa's SIP is not on this machine |
| -h, --version | |
Other DaVinci options (--scriptTask, --scriptLocations, ...) are accepted, reported as ignored, and skipped
together with their value.
What runs. The full ecuc_validate: AUTOSAR XML schema, the parameter definitions, the specification constraint
catalog, template constraints, the semantic rules, the system / SWC extract's references; with -g also the build
check (generate in a scratch folder and compile) for the selected modules. Generation then writes into the GenData
folder with the engine's generators.
From a .dpa (XML; paths relative to it, Windows separators and letter case tolerated): ECUC/Active and the
EcucSplitter files (or every ECUC file in Folders/ECUC but the ECUC/Derived initial copy) are the
configuration; the ECUC-MODULE-DEF files under Folders/SIP are the definitions; Input/ECUEX, the flat extract /
map, service and application component folders are the system input; Folders/GenData and Folders/Logs are the
output folders. An entry that does not exist on this machine (a C:\ SIP) is a warning in the report; give
--defs then. A .hydron/autosar.json next to the .dpa still supplies everything else (schemas, ignore, codegen).
Report. DaVinciExecutionReport XML that validates against DaVinci's published DaVinciExecutionReport.xsd:
ValidationResultscounts per severity; oneValidationResultIdper rule withoriginand a 5-digitid: reconstructed DaVinci checks emit the original Vector origin and number (DVCFG-CFG-28→Cfg/00028). Other numbered rule ids keep their numbers (SPEC-Can-00316→ originSPEC-Can, id00316= ECUC_Can_00316;TPS-ECUC-3217→TPS-ECUC/03217= constr_3217;H2L-COM-003→H2L-COM/00003);ECUC-*,XSD-*andH2L-ARXML-*have fixed numbers (ECUC-REF-DANGLING→ECUC/00015, seeFIXED_IDSinecuc_engine/dvcfg.py, never renumbered); anything else → origin = the rule id, id00000. The engine's rule id is the first word of everymessageandDescription.- severity: error →
Error, warning →Warning, info →Info, hint →Improvement; a file that is not XML or a project that cannot be opened →FatalError. ErroneousCEs/CE:Object= the AUTOSAR path,Definition= the definition path; file:line is in theDescription. Every report ends with one Info (H2L-SCOPE) saying what was checked and what was not (for example a missing AUTOSAR schema).GenerationProcessResult(SUCCESSFUL/WARNING/ERROR/FATAL_ERROR): oneGenerationResultper module with itsVALIDATIONandGENERATIONphases,GeneratedFiles(FILE_CREATED/FILE_UPDATED/FILE_IS_UP_TO_DATE), generator and module configuration (AUTOSAR path, variant); shared files (MemMap.h) under aCommongeneration step; for a validation-only run a singleValidationstep.
Exit codes: 0 ok (warnings allowed), 1 validation FatalError / Error (nothing generated), 2 command line error, 3 generation failed, 4 project could not be opened, 5 internal error.
Remaining gaps include MICROSAR generator coverage, calculated values beyond assigned handle IDs, and post-build selectable variants.
Engine CLI
The same engine the tools use, from a shell:
cd python && uv run --no-project --with autosar-data==0.17.0 python -m ecuc_engine --root <project> \
<info|setup [--write]|read [path] [--depth N] [--schema]|edit --ops '<json>' [--dry-run]|validate [--module M] [--file F]|fix (--id ID ...|--preferred-all) [--dry-run]|ack --rule R --path P --reason TEXT|diff A B> --json
python -m ecuc_engine dvcfg -p <Project.dpa | ecuc.arxml ...> [-v | -g] [-m "A,B"] [--reportFile F] # DaVinci-style, see aboveDevelop
bun install && bun run build && bun run typecheck
bun test # plugin tests (bun run test = plugin + engine)
bun run test:py # engine tests; R25-11 integration tests run when AUTOSAR_R25_DEFS (or the eval_work copy) exists
hydron plugin validate .Speed checks on a project of customer size (about 400 configuration files, 50 MB), without the customer's files:
python3 script/gen_large_project.py /tmp/big --git # deterministic: same seed, same bytes (and the same commit)
AUTOSAR_PYTHON=<python with autosar-data> python3 script/bench_edits.py run before.json --project /tmp/big --hooks \
--engine <older checkout>/python
AUTOSAR_PYTHON=<python with autosar-data> python3 script/bench_edits.py run after.json --project /tmp/big --hooks
python3 script/bench_edits.py compare before.json after.json # exit 1 if any edit decides or writes differentlybench_edits.py replays 21 ecuc_edit calls (set, add, remove, refused, forced, dry run) through the warm engine,
each followed with --hooks by what the plugin runs after an edit, and records per call the time, project loads and
cache outcome; compare checks that every edit's decision, introduced findings, diff and written files (UUIDs of
new elements masked) are identical. Smaller project for quick checks: --modules 10 --files-per-module 5
--channels 6.
Merging to main publishes to npm automatically, with the version taken from Conventional Commit
messages (feat: → minor, feat!: / BREAKING CHANGE → major, anything else → patch). Users get a new version once the plugin catalog points at it.
