@h2loop/autosar 0.1.2 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -0
- package/agents/autosar-integrator.md +34 -2
- package/package.json +4 -1
- package/plugins/index.js +53 -23
- package/python/ecuc_engine/__init__.py +1 -1
- package/python/ecuc_engine/add_signal.py +351 -0
- package/python/ecuc_engine/arxml_edit.py +387 -0
- package/python/ecuc_engine/audit.py +372 -69
- package/python/ecuc_engine/cli.py +119 -10
- package/python/ecuc_engine/codegen/__init__.py +185 -0
- package/python/ecuc_engine/codegen/binding.py +210 -0
- package/python/ecuc_engine/codegen/bindings/sip_standin.json +111 -0
- package/python/ecuc_engine/codegen/cdiff.py +395 -0
- package/python/ecuc_engine/codegen/cwriter.py +150 -0
- package/python/ecuc_engine/codegen/emit.py +395 -0
- package/python/ecuc_engine/codegen/handles.py +89 -0
- package/python/ecuc_engine/codegen/mcal/tc4d.json +60 -0
- package/python/ecuc_engine/codegen/model.py +259 -0
- package/python/ecuc_engine/codegen/modules/__init__.py +7 -0
- package/python/ecuc_engine/codegen/modules/comstack.py +14 -0
- package/python/ecuc_engine/codegen/modules/dem.py +22 -0
- package/python/ecuc_engine/codegen/modules/mcal.py +170 -0
- package/python/ecuc_engine/codegen/modules/memstack.py +24 -0
- package/python/ecuc_engine/codegen/registry.py +133 -0
- package/python/ecuc_engine/codegen/schm_memmap.py +159 -0
- package/python/ecuc_engine/context.py +481 -0
- package/python/ecuc_engine/csrc.py +189 -0
- package/python/ecuc_engine/defs.py +30 -0
- package/python/ecuc_engine/diff.py +13 -5
- package/python/ecuc_engine/find.py +162 -0
- package/python/ecuc_engine/gen.py +105 -0
- package/python/ecuc_engine/history.py +146 -0
- package/python/ecuc_engine/model.py +33 -29
- package/python/ecuc_engine/paths.py +221 -0
- package/python/ecuc_engine/probe.py +229 -0
- package/python/ecuc_engine/rte_api.py +935 -0
- package/python/ecuc_engine/rules/__init__.py +5 -3
- package/python/ecuc_engine/rules/mem.py +84 -0
- package/python/ecuc_engine/rules/nvm.py +131 -0
- package/python/ecuc_engine/rules/pdur.py +87 -0
- package/python/ecuc_engine/rules/system.py +162 -0
- package/python/ecuc_engine/sysmodel.py +152 -0
- package/python/ecuc_engine/validate.py +52 -3
- package/python/ecuc_engine/verify_rte.py +445 -0
- package/python/pyproject.toml +1 -1
- package/skills/autosar/SKILL.md +57 -1
- package/skills/autosar/references/codegen.md +30 -0
- package/skills/autosar/references/project-layout.md +11 -2
- package/skills/autosar/references/runnable-code.md +50 -0
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
# Deterministic config code generation (`autosar_codegen`, `autosar_codegen_diff`)
|
|
2
|
+
|
|
3
|
+
Generated C is never written by hand or by the model: run `autosar_codegen`, review with
|
|
4
|
+
`autosar_codegen_diff`, then `autosar_build`. Same ECUC + param defs -> byte-identical files.
|
|
5
|
+
|
|
6
|
+
## What is generated, from where
|
|
7
|
+
| Output | Source |
|
|
8
|
+
|---|---|
|
|
9
|
+
| `<Mip>_Cfg.h` | pre-compile params of singleton containers as `<MIP>_<PARAM>` (booleans STD_ON/STD_OFF), `<MIP>_CFG_AR_RELEASE_*` (from the schema: AUTOSAR_00054 = R4.11.0), every symbolicNameValue param as `<Mip>Conf_<ContainerDef>_<Name>` (TPS_ECUC_02108) |
|
|
10
|
+
| `<Mip>_Cfg.c` / `_Lcfg.c` / `_PBcfg.c` | one const table per multiplicity-n container def, placed by the most dynamic config class of its fields for the module's IMPLEMENTATION-CONFIG-VARIANT |
|
|
11
|
+
| binding tables (e.g. `NvM_BlockDescriptorTable`, `PduR_Config`) | `codegen/bindings/*.json` (or `.hydron/codegen/bindings/`): the static code's struct layout, selected when its `detect` header is in the project |
|
|
12
|
+
| `SchM_<Mip>.h` | exclusive areas the static code uses (`SchM_Enter_<Mip>_<EA>` found in non-generated C) + main functions |
|
|
13
|
+
| `<Mip>_MemMap.h` | SWS_MemMap_00032 keyword file; pragmas from `codegen.memmap.pragmas` |
|
|
14
|
+
|
|
15
|
+
Handle IDs: missing symbolic values are assigned (lowest free >= def MIN, existing values kept, duplicates
|
|
16
|
+
are errors) and written back into the ARXML in place (TPS_ECUC_02107); `write_back=false` keeps them in memory.
|
|
17
|
+
|
|
18
|
+
Output goes to `.hydron/codegen/out` unless `out_dir` is given (`project` = `codegen.outDir`, default `Output`).
|
|
19
|
+
|
|
20
|
+
## Reading a diff
|
|
21
|
+
- *missing*: in the reference only (e.g. a symbol whose ECUC container was deleted: stale Output, not a generator bug).
|
|
22
|
+
- *extra*: generated only (generic def-driven macros/tables the reference generator does not emit).
|
|
23
|
+
- *mismatch*: same name, different value. Typical causes: enum encoding (we use the def literal order unless the
|
|
24
|
+
binding maps it), the configured value verbatim (`&Ram` vs `Ram`).
|
|
25
|
+
|
|
26
|
+
## MCAL
|
|
27
|
+
Port/Dio come from the standard R25-11 defs. Register-level output needs a silicon mapping
|
|
28
|
+
(`codegen.mcal.silicon`, e.g. `tc4d`) plus a project pin map (`codegen.mcal.pinMap`). The bundled TC4Dx file
|
|
29
|
+
has public user-manual data only (status `skeleton`); its `needsVendorData` lists what Infineon's VSMD/BSWMD
|
|
30
|
+
and MCAL static code must supply. Never invent register values.
|
|
@@ -9,7 +9,10 @@
|
|
|
9
9
|
| `Build/` | makefiles/CMake, linker scripts, compiler options | build owner |
|
|
10
10
|
| `SIP/` (or `BSW/`, `ThirdParty/`) | the vendor's Software Integration Package: static BSW code, BSWMD with vendor param defs (VSMD), generators | vendor; read-only |
|
|
11
11
|
|
|
12
|
-
Names vary; the tools classify `.arxml` files
|
|
12
|
+
Names vary; the tools classify `.arxml` files (any extension case, e.g. `.ecuc.arxml`, `.ARXML`) by
|
|
13
|
+
content, not by folder, at any depth. Tooling dirs (`.git`, `.hydron`, `node_modules`, …) are skipped; other
|
|
14
|
+
hidden dirs are scanned and reported; symlinked dirs are followed once. For C, generator output is
|
|
15
|
+
recognised by its banner or `*_Cfg.*`/`*_PBcfg.c`/`Rte*.c` names, not by the `Output/` folder.
|
|
13
16
|
|
|
14
17
|
## `.hydron/autosar.json`
|
|
15
18
|
Optional; pins what the tools load and how to generate/build:
|
|
@@ -20,10 +23,16 @@ Optional; pins what the tools load and how to generate/build:
|
|
|
20
23
|
"config": ["Config/**/*.arxml"],
|
|
21
24
|
"input": ["Input/**/*.arxml"],
|
|
22
25
|
"generate": {"command": "<vendor-cli> -p Config/Ecu.dpa --generate {module}", "cwd": ".", "timeoutSec": 3600},
|
|
23
|
-
"build": {"command": "make -C Build -j8 all", "timeoutSec": 3600}
|
|
26
|
+
"build": {"command": "make -C Build -j8 all", "timeoutSec": 3600},
|
|
27
|
+
"probe": {"cc": "tricore-elf-gcc", "flags": ["-I", "SIP/include", "-DCPU=TC4D"]},
|
|
28
|
+
"checkGenerated": false
|
|
24
29
|
}
|
|
25
30
|
```
|
|
26
31
|
Without it: param defs = every `.arxml` holding `ECUC-MODULE-DEF` (else `$AUTOSAR_PARAMDEFS`, a
|
|
27
32
|
path list), config = every file holding `ECUC-MODULE-CONFIGURATION-VALUES`, input = all other
|
|
28
33
|
`.arxml`. Use the param defs of the release and vendor the project actually targets; the vendor
|
|
29
34
|
BSWMD defs take precedence for vendor-specific parameters.
|
|
35
|
+
|
|
36
|
+
`probe` sets the compiler/flags for the compile-only sizeof probe (H2L-NVM-001; default: the Makefile's CC/CFLAGS,
|
|
37
|
+
else host `cc` with the discovered header dirs). `checkGenerated` turns the stale-Output check (H2L-GEN-001, run in a
|
|
38
|
+
scratch copy) on/off; by default it is on when a `generate` command exists and the configuration is under 5 MB.
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
# Runnable code: allowed RTE API, verify, context
|
|
2
|
+
|
|
3
|
+
## Three tiers of an RTE API name (AUTOSAR CP R25-11 SWS_RTE 5.6)
|
|
4
|
+
- **allowed** for runnable R: R has the access point the API's *Existence* requirement names. Only these may be
|
|
5
|
+
called from R and the functions it calls (SWS_Rte_CONSTR_09017/09083/...: "may only be used by the runnable that
|
|
6
|
+
contains the corresponding ..."). Shown in `autosar_build_context` section 3.
|
|
7
|
+
- **generated**: some runnable of the SW-C is allowed it, so it is in `Rte_<Swc>.h`. Calling it from another runnable
|
|
8
|
+
compiles but is wrong (NOT-ALLOWED).
|
|
9
|
+
- **derivable**: the port/element/IRV exists, but no runnable has the access point, so the API is not generated yet.
|
|
10
|
+
|
|
11
|
+
| API | Access point (role) | Existence | Signature |
|
|
12
|
+
|---|---|---|---|
|
|
13
|
+
| `Rte_Write_<p>_<o>` / `Rte_Send_<p>_<o>` | dataSendPoint, data / queued element | SWS_Rte_01280 / 01281 | SWS_Rte_01071 / 01072 |
|
|
14
|
+
| `Rte_Read_<p>_<o>` / `Rte_Receive_<p>_<o>` | dataReceivePointByArgument | SWS_Rte_01289 / 01288 | SWS_Rte_01091 / 01092 |
|
|
15
|
+
| `Rte_DRead_<p>_<o>` | dataReceivePointByValue (primitive) | SWS_Rte_07395 | SWS_Rte_07394 |
|
|
16
|
+
| `Rte_IRead[Ref]_<re>_<p>_<o>`, `Rte_IStatus_...` | dataReadAccess | SWS_Rte_01301 / 04578 / 02600 | SWS_Rte_03741 / 04577 / 02599 |
|
|
17
|
+
| `Rte_IWrite[Ref]_<re>_<p>_<o>`, `Rte_IInvalidate_...` | dataWriteAccess | SWS_Rte_01302 / 05510 / 03801 | SWS_Rte_03744 / 05509 / 03800 |
|
|
18
|
+
| `Rte_Call_<p>_<o>` / `Rte_Result_<p>_<o>` | (a)synchronousServerCallPoint / ...ResultPoint | SWS_Rte_01293/01294 / 01296 | SWS_Rte_01102 / 01111 |
|
|
19
|
+
| `Rte_Mode_<p>_<o>` / `Rte_Switch_<p>_<o>` | modeAccessPoint / modeSwitchPoint | SWS_Rte_02629 / 02632 | SWS_Rte_02628 / 02631 |
|
|
20
|
+
| `Rte_Prm_<p>_<o>` / `Rte_CData_<name>` | parameterAccess (port / local) | SWS_Rte_03929 / 01300 | SWS_Rte_03928 / 01252 |
|
|
21
|
+
| `Rte_IrvRead/IrvWrite_<re>_<o>` | read/writtenLocalVariable, explicit IRV | SWS_Rte_01305 / 01306 | SWS_Rte_03560 / 03565 |
|
|
22
|
+
| `Rte_IrvIRead/IrvIWrite[Ref]_<re>_<o>` | read/writtenLocalVariable, implicit IRV | SWS_Rte_01303 / 01304 | SWS_Rte_03550 / 03553 |
|
|
23
|
+
| `Rte_Pim_<name>` | any runnable | SWS_Rte_01299 | SWS_Rte_01118 |
|
|
24
|
+
| `Rte_Enter/Exit_<ea>` | canEnterExclusiveArea | SWS_Rte_01307 / 01308 | SWS_Rte_01120 / 01123 |
|
|
25
|
+
|
|
26
|
+
Parameter passing: IN primitive by value (SWS_Rte_01017), IN struct/union by `const T*` (01018, 07086), IN array as
|
|
27
|
+
pointer to the base type (05107); OUT always by pointer (01019, 07082, 05108); a struct/array return is a const
|
|
28
|
+
pointer (07071, 07072). Multiple instantiation adds `Rte_Instance self` first. `Rte_IsUpdated`, `Rte_Invalidate`,
|
|
29
|
+
`Rte_Feedback`, `Rte_IStatus` exist only with their ComSpec / InvalidationPolicy settings.
|
|
30
|
+
|
|
31
|
+
## autosar_verify_rte
|
|
32
|
+
Each `Rte_*` call is mapped to its enclosing function and to every runnable whose SYMBOL reaches it through the call
|
|
33
|
+
graph (a static helper called from two runnables is checked for both). Statuses:
|
|
34
|
+
- **OK**.
|
|
35
|
+
- **NOT-ALLOWED**: rewrite with an allowed API, or add the access point to the runnable (ops given). For
|
|
36
|
+
`Rte_I*`/`Rte_Irv*` the runnable name is part of the API name: use the caller's.
|
|
37
|
+
- **INVENTED**: no such port/element/runnable, or the wrong API kind for the port's direction or the element's
|
|
38
|
+
data/event semantics (the hint names the right one). When new data is truly needed the ops add the data
|
|
39
|
+
element (to the port's interface — note other users of that interface) or a new port + interface, then the access
|
|
40
|
+
point. New element types default to the type of a same-named element elsewhere, else `uint8` (flagged).
|
|
41
|
+
After applying ops: `autosar_generate`, then verify again; then `autosar_build`. RTE lifecycle calls (`Rte_Start`, ...)
|
|
42
|
+
in integration code are listed as not checked.
|
|
43
|
+
|
|
44
|
+
## autosar_build_context
|
|
45
|
+
Sections, in fixed order: 1 task, 2 SW-C definition, 3 allowed RTE API (exact header text), 4 runnable code,
|
|
46
|
+
5 callees, 6 Com signals / NvM blocks behind its ports and calls, 7 FUZZY similar functions in other SW-Cs, 8 FUZZY
|
|
47
|
+
similar past git changes (ARXML semantic delta + C hunks, ranked by overlap with the task's ports/elements/words and
|
|
48
|
+
recency). Over budget (~4 chars/token): drop 8, drop 7, callees → prototypes, truncate code, truncate config,
|
|
49
|
+
callees → names, code → head, compact 2. Sections 1 and 3 are never reduced. Output is byte-identical for the same
|
|
50
|
+
inputs; the MANIFEST lists every source (file:line, sha1, included mode). Treat 7–8 as hints, never as truth.
|