@h2loop/autosar 1.0.1 → 1.2.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.
Files changed (53) hide show
  1. package/README.md +11 -1
  2. package/agents/autosar-integrator.md +45 -2
  3. package/commands/autosar-trace.md +2 -2
  4. package/package.json +4 -1
  5. package/plugins/index.js +55 -23
  6. package/python/ecuc_engine/__init__.py +1 -1
  7. package/python/ecuc_engine/add_signal.py +351 -0
  8. package/python/ecuc_engine/arxml_edit.py +387 -0
  9. package/python/ecuc_engine/audit.py +352 -50
  10. package/python/ecuc_engine/cli.py +125 -5
  11. package/python/ecuc_engine/codegen/__init__.py +233 -0
  12. package/python/ecuc_engine/codegen/binding.py +305 -0
  13. package/python/ecuc_engine/codegen/bindings/sip_standin.json +378 -0
  14. package/python/ecuc_engine/codegen/cdiff.py +395 -0
  15. package/python/ecuc_engine/codegen/cwriter.py +150 -0
  16. package/python/ecuc_engine/codegen/emit.py +463 -0
  17. package/python/ecuc_engine/codegen/handles.py +176 -0
  18. package/python/ecuc_engine/codegen/mcal/tc4d.json +60 -0
  19. package/python/ecuc_engine/codegen/model.py +264 -0
  20. package/python/ecuc_engine/codegen/modules/__init__.py +7 -0
  21. package/python/ecuc_engine/codegen/modules/com.py +145 -0
  22. package/python/ecuc_engine/codegen/modules/comstack.py +14 -0
  23. package/python/ecuc_engine/codegen/modules/dem.py +22 -0
  24. package/python/ecuc_engine/codegen/modules/mcal.py +170 -0
  25. package/python/ecuc_engine/codegen/modules/memstack.py +24 -0
  26. package/python/ecuc_engine/codegen/registry.py +208 -0
  27. package/python/ecuc_engine/codegen/schm_memmap.py +159 -0
  28. package/python/ecuc_engine/context.py +481 -0
  29. package/python/ecuc_engine/csrc.py +189 -0
  30. package/python/ecuc_engine/defs.py +30 -0
  31. package/python/ecuc_engine/ecucjson.py +75 -22
  32. package/python/ecuc_engine/find.py +164 -0
  33. package/python/ecuc_engine/gen.py +105 -0
  34. package/python/ecuc_engine/history.py +146 -0
  35. package/python/ecuc_engine/model.py +4 -1
  36. package/python/ecuc_engine/probe.py +229 -0
  37. package/python/ecuc_engine/rte_api.py +935 -0
  38. package/python/ecuc_engine/rules/__init__.py +5 -3
  39. package/python/ecuc_engine/rules/mem.py +84 -0
  40. package/python/ecuc_engine/rules/nvm.py +131 -0
  41. package/python/ecuc_engine/rules/pdur.py +87 -0
  42. package/python/ecuc_engine/rules/system.py +162 -0
  43. package/python/ecuc_engine/specids.py +163 -0
  44. package/python/ecuc_engine/sysmodel.py +152 -0
  45. package/python/ecuc_engine/validate.py +15 -2
  46. package/python/ecuc_engine/values.py +26 -0
  47. package/python/ecuc_engine/verify_rte.py +445 -0
  48. package/python/pyproject.toml +1 -1
  49. package/skills/autosar/SKILL.md +78 -6
  50. package/skills/autosar/references/codegen.md +58 -0
  51. package/skills/autosar/references/ecuc-model.md +4 -1
  52. package/skills/autosar/references/project-layout.md +10 -1
  53. package/skills/autosar/references/runnable-code.md +50 -0
@@ -0,0 +1,378 @@
1
+ {
2
+ "name": "sip-standin",
3
+ "description": "Struct layout of the fixture's SIP stand-in static code (fixtures/*/SIP/include). Every type, field and macro below is taken from those headers; the values come from the ECUC via the path language (see codegen/binding.py). Enumeration fields without an 'enum' map use the def literal order.",
4
+ "modules": {
5
+ "NvM": {
6
+ "detect": {"header": "NvM.h", "contains": "NvM_BlockDescriptorType"},
7
+ "sourceIncludes": ["NvM.h"],
8
+ "macros": [{"name": "NVM_TOTAL_NUM_OF_NVRAM_BLOCKS", "value": "max:NvMBlockDescriptor/NvMNvramBlockIdentifier+1"}],
9
+ "tables": [
10
+ {
11
+ "name": "NvM_BlockDescriptorTable",
12
+ "type": "NvM_BlockDescriptorType",
13
+ "qualifier": "NVM_CONST",
14
+ "rows": "NvMBlockDescriptor",
15
+ "size": "NVM_TOTAL_NUM_OF_NVRAM_BLOCKS",
16
+ "designated": true,
17
+ "doc": "indexed by NvMNvramBlockIdentifier (0 and 1 are reserved block IDs)",
18
+ "fields": [
19
+ {
20
+ "name": "RamBlockDataAddress",
21
+ "path": "param:NvMRamBlockDataAddress",
22
+ "default": "NULL_PTR",
23
+ "extern": "VAR(uint8, NVM_APPL_DATA) {}[]"
24
+ },
25
+ {"name": "NvBlockLength", "path": "param:NvMNvBlockLength"},
26
+ {
27
+ "name": "FeeBlockNumber",
28
+ "path": [
29
+ ["sub:NvMTargetBlockReference", "sub:NvMFeeRef", "ref:NvMNameOfFeeBlock", "param:FeeBlockNumber"],
30
+ ["sub:NvMTargetBlockReference", "sub:NvMEaRef", "ref:NvMNameOfEaBlock", "param:EaBlockNumber"]
31
+ ]
32
+ },
33
+ {
34
+ "name": "ManagementType",
35
+ "path": "param:NvMBlockManagementType",
36
+ "enum": {"NVM_BLOCK_NATIVE": 0, "NVM_BLOCK_REDUNDANT": 1, "NVM_BLOCK_DATASET": 2},
37
+ "doc": "NvM.h types the field as uint8 without literal values; the SWS defines no C encoding either (ECUC_NvM_00062 is an ECUC enum). Encoded in the SWS_NvM_00137 listing order, not the def's alphabetical literal order."
38
+ },
39
+ {"name": "UseCrc", "path": "param:NvMBlockUseCrc"},
40
+ {
41
+ "name": "SingleBlockCallback",
42
+ "path": ["sub:NvMSingleBlockCallback", "param:NvMSingleBlockCallbackFnc"],
43
+ "default": "NULL_PTR",
44
+ "extern": "FUNC(Std_ReturnType, NVM_APPL_CODE) {}(NvM_BlockRequestType BlockRequest, NvM_RequestResultType JobResult)"
45
+ }
46
+ ]
47
+ }
48
+ ]
49
+ },
50
+ "Dem": {
51
+ "detect": {"header": "Dem.h", "contains": "Dem_EventIdType"},
52
+ "genericTables": true,
53
+ "macros": [{"name": "DEM_NUMBER_OF_EVENTS", "value": "max:DemEventParameter/DemEventId"}]
54
+ },
55
+ "PduR": {
56
+ "detect": {"header": "PduR.h", "contains": "PduR_RoutingPathType"},
57
+ "sourceIncludes": ["PduR.h"],
58
+ "macros": [
59
+ {"name": "PDUR_NUMBER_OF_SRC_PDUS", "value": "count:PduRSrcPdu"},
60
+ {"name": "PDUR_NUMBER_OF_DEST_PDUS", "value": "count:PduRDestPdu"}
61
+ ],
62
+ "tables": [
63
+ {
64
+ "name": "PduR_RoutingPaths",
65
+ "type": "PduR_RoutingPathType",
66
+ "qualifier": "PDUR_CONST",
67
+ "static": true,
68
+ "rows": "PduRSrcPdu",
69
+ "size": "PDUR_NUMBER_OF_SRC_PDUS",
70
+ "doc": "indexed by PduRSourcePduHandleId",
71
+ "comment": "name",
72
+ "fields": [
73
+ {
74
+ "name": "DestModule",
75
+ "path": ["back:PduRRoutingPath/PduRSrcPduRRef", "ref:PduRDestPduRRef", "peer:PduRDestPduRef", "module"],
76
+ "fmt": "PDUR_DEST_{MIP}"
77
+ },
78
+ {
79
+ "name": "DestLowerPduId",
80
+ "path": ["back:PduRRoutingPath/PduRSrcPduRRef", "ref:PduRDestPduRRef", "peer:PduRDestPduRef", "sym"]
81
+ },
82
+ {"name": "DestPduRPduId", "path": ["back:PduRRoutingPath/PduRSrcPduRRef", "ref:PduRDestPduRRef", "sym"]}
83
+ ]
84
+ },
85
+ {
86
+ "name": "PduR_TxConfUpperPduId",
87
+ "type": "PduIdType",
88
+ "qualifier": "PDUR_CONST",
89
+ "static": true,
90
+ "scalar": true,
91
+ "rows": "PduRDestPdu",
92
+ "size": "PDUR_NUMBER_OF_DEST_PDUS",
93
+ "doc": "indexed by PduRDestPduHandleId: the upper (Com) I-PDU to confirm when the source PDU asks for it (PduRSrcPduUpTxConf)",
94
+ "fields": [
95
+ {
96
+ "name": "UpperPduId",
97
+ "path": ["back:PduRRoutingPath/PduRDestPduRRef", "ref:PduRSrcPduRRef", "peer:PduRSrcPduRef@Com", "sym"],
98
+ "when": ["back:PduRRoutingPath/PduRDestPduRRef", "ref:PduRSrcPduRRef", "param:PduRSrcPduUpTxConf"],
99
+ "default": "COMSTACK_INVALID_PDUID"
100
+ }
101
+ ]
102
+ }
103
+ ],
104
+ "objects": [
105
+ {
106
+ "name": "PduR_Config",
107
+ "type": "PduR_PBConfigType",
108
+ "qualifier": "PDUR_CONST",
109
+ "init": ["PduR_RoutingPaths", "PduR_TxConfUpperPduId", "PDUR_NUMBER_OF_SRC_PDUS", "PDUR_NUMBER_OF_DEST_PDUS"]
110
+ }
111
+ ]
112
+ },
113
+ "CanIf": {
114
+ "detect": {"header": "CanIf.h", "contains": "CanIf_TxPduConfigType"},
115
+ "sourceIncludes": ["CanIf.h"],
116
+ "macros": [
117
+ {"name": "CANIF_NUMBER_OF_TX_PDUS", "value": "count:CanIfTxPduCfg"},
118
+ {"name": "CANIF_NUMBER_OF_RX_PDUS", "value": "count:CanIfRxPduCfg"}
119
+ ],
120
+ "tables": [
121
+ {
122
+ "name": "CanIf_TxPduConfig",
123
+ "type": "CanIf_TxPduConfigType",
124
+ "qualifier": "CANIF_CONST",
125
+ "static": true,
126
+ "rows": "CanIfTxPduCfg",
127
+ "size": "CANIF_NUMBER_OF_TX_PDUS",
128
+ "comment": "sym",
129
+ "doc": "indexed by CanIfTxPduId",
130
+ "fields": [
131
+ {"name": "CanId", "path": "param:CanIfTxPduCanId", "fmt": "hex"},
132
+ {"name": "Dlc", "path": ["ref:CanIfTxPduRef", "param:PduLength"]},
133
+ {
134
+ "name": "Hth",
135
+ "path": ["ref:CanIfTxPduBufferRef", "ref:CanIfBufferHthRef", "ref:CanIfHthIdSymRef", "sym"]
136
+ },
137
+ {"name": "UpperPduId", "path": ["peer:CanIfTxPduRef@PduR", "sym"]}
138
+ ]
139
+ },
140
+ {
141
+ "name": "CanIf_RxPduConfig",
142
+ "type": "CanIf_RxPduConfigType",
143
+ "qualifier": "CANIF_CONST",
144
+ "static": true,
145
+ "rows": "CanIfRxPduCfg",
146
+ "size": "CANIF_NUMBER_OF_RX_PDUS",
147
+ "comment": "sym",
148
+ "doc": "indexed by CanIfRxPduId",
149
+ "fields": [
150
+ {"name": "CanId", "path": "param:CanIfRxPduCanId", "fmt": "hex"},
151
+ {"name": "CanIdMask", "path": "param:CanIfRxPduCanIdMask", "fmt": "hex"},
152
+ {"name": "Dlc", "path": "param:CanIfRxPduDataLength"},
153
+ {"name": "Hrh", "path": ["ref:CanIfRxPduHrhIdRef", "ref:CanIfHrhIdSymRef", "sym"]},
154
+ {"name": "UpperPduId", "path": ["peer:CanIfRxPduRef@PduR", "sym"]}
155
+ ]
156
+ }
157
+ ],
158
+ "objects": [
159
+ {
160
+ "name": "CanIf_Config",
161
+ "type": "CanIf_ConfigType",
162
+ "qualifier": "CANIF_CONST",
163
+ "init": ["CanIf_TxPduConfig", "CanIf_RxPduConfig", "CANIF_NUMBER_OF_TX_PDUS", "CANIF_NUMBER_OF_RX_PDUS"]
164
+ }
165
+ ]
166
+ },
167
+ "Com": {
168
+ "detect": {"header": "Com.h", "contains": "Com_SignalInfoType"},
169
+ "sourceIncludes": ["Com.h"],
170
+ "sets": {
171
+ "TxSignals": {
172
+ "rows": "ComSignal",
173
+ "where": [{"path": ["back:ComIPdu/ComIPduSignalRef", "param:ComIPduDirection"], "in": ["SEND"]}]
174
+ },
175
+ "RxSignals": {
176
+ "rows": "ComSignal",
177
+ "where": [{"path": ["back:ComIPdu/ComIPduSignalRef", "param:ComIPduDirection"], "in": ["RECEIVE"]}]
178
+ },
179
+ "TxIPdus": {"rows": "ComIPdu", "where": [{"path": "param:ComIPduDirection", "in": ["SEND"]}]},
180
+ "RxIPdus": {"rows": "ComIPdu", "where": [{"path": "param:ComIPduDirection", "in": ["RECEIVE"]}]}
181
+ },
182
+ "handleLayout": [
183
+ {"param": "ComHandleId", "sets": ["TxSignals", "RxSignals"]},
184
+ {"param": "ComIPduHandleId", "sets": ["TxIPdus", "RxIPdus"]}
185
+ ],
186
+ "require": [
187
+ {
188
+ "rows": "ComSignal",
189
+ "path": "param:ComSignalEndianness",
190
+ "in": ["LITTLE_ENDIAN"],
191
+ "why": "Com_PackBits/Com_UnpackBits pack LSB-first from ComBitPosition (Com_SignalInfoType has no endianness field)"
192
+ },
193
+ {"rows": "ComIPdu", "path": "param:ComIPduType", "in": ["NORMAL"], "why": "Com.c has no TP (large data) path"},
194
+ {
195
+ "rows": "ComSignal",
196
+ "path": "param:ComUpdateBitPosition",
197
+ "in": [null],
198
+ "why": "Com_SignalInfoType has no update bit"
199
+ }
200
+ ],
201
+ "unsupported": [
202
+ {"rows": "ComSignalGroup", "why": "Com.h has no signal-group table (Com_SignalGroupIdType only)"},
203
+ {"rows": "ComGwMapping", "why": "Com.c has no signal gateway"},
204
+ {"rows": "ComFilter", "why": "Com.c has no transmission mode selection (ComFilter / TMS)"},
205
+ {"rows": "ComTxModeFalse", "why": "Com.c has no transmission mode selection (ComTxModeFalse)"}
206
+ ],
207
+ "macros": [
208
+ {"name": "COM_NUMBER_OF_TX_SIGNALS", "value": "count:@TxSignals"},
209
+ {"name": "COM_NUMBER_OF_RX_SIGNALS", "value": "count:@RxSignals"},
210
+ {"name": "COM_NUMBER_OF_TX_IPDUS", "value": "count:@TxIPdus"},
211
+ {"name": "COM_NUMBER_OF_RX_IPDUS", "value": "count:@RxIPdus"},
212
+ {"name": "COM_NUMBER_OF_IPDUS", "value": "count:ComIPdu"}
213
+ ],
214
+ "vars": [
215
+ {
216
+ "name": "Com_IPduBuffer_{}",
217
+ "rows": "ComIPdu",
218
+ "type": "uint8",
219
+ "qualifier": "COM_VAR",
220
+ "static": true,
221
+ "size": ["ref:ComPduIdRef", "param:PduLength"],
222
+ "section": "VAR_NOINIT_UNSPECIFIED"
223
+ }
224
+ ],
225
+ "tables": [
226
+ {
227
+ "name": "Com_TxSignalInfo",
228
+ "type": "Com_SignalInfoType",
229
+ "qualifier": "COM_CONST",
230
+ "static": true,
231
+ "rows": "@TxSignals",
232
+ "size": "COM_NUMBER_OF_TX_SIGNALS",
233
+ "designated": true,
234
+ "comment": "sym",
235
+ "doc": "Tx signals, indexed by ComHandleId (Com_SendSignal: TxSignals[SignalId])",
236
+ "fields": [
237
+ {"name": "BitPosition", "path": "param:ComBitPosition"},
238
+ {"name": "BitSize", "path": "param:ComBitSize"},
239
+ {
240
+ "name": "Type",
241
+ "path": "param:ComSignalType",
242
+ "enum": {
243
+ "BOOLEAN": "COM_SIGTYPE_BOOLEAN",
244
+ "UINT8": "COM_SIGTYPE_UINT8",
245
+ "UINT16": "COM_SIGTYPE_UINT16",
246
+ "UINT32": "COM_SIGTYPE_UINT32",
247
+ "SINT8": "COM_SIGTYPE_SINT8",
248
+ "SINT16": "COM_SIGTYPE_SINT16",
249
+ "SINT32": "COM_SIGTYPE_SINT32"
250
+ }
251
+ },
252
+ {"name": "IPduRef", "path": ["back:ComIPdu/ComIPduSignalRef", "sym"]},
253
+ {"name": "InitValue", "path": "param:ComSignalInitValue", "fmt": "int", "default": "0u"},
254
+ {
255
+ "name": "TransferProperty",
256
+ "path": "param:ComTransferProperty",
257
+ "enum": {
258
+ "PENDING": "COM_XFER_PENDING",
259
+ "TRIGGERED": "COM_XFER_TRIGGERED",
260
+ "TRIGGERED_ON_CHANGE": "COM_XFER_TRIGGERED_ON_CHANGE"
261
+ },
262
+ "default": "COM_XFER_PENDING"
263
+ },
264
+ {"name": "Notification", "path": "call:rteSignalCallback", "default": "NULL_PTR"}
265
+ ]
266
+ },
267
+ {
268
+ "name": "Com_RxSignalInfo",
269
+ "type": "Com_SignalInfoType",
270
+ "qualifier": "COM_CONST",
271
+ "static": true,
272
+ "rows": "@RxSignals",
273
+ "size": "COM_NUMBER_OF_RX_SIGNALS",
274
+ "designated": "{sym} - COM_NUMBER_OF_TX_SIGNALS",
275
+ "comment": "sym",
276
+ "doc": "Rx signals, indexed by ComHandleId - COM_NUMBER_OF_TX_SIGNALS (Com_ReceiveSignal)",
277
+ "fields": [
278
+ {"name": "BitPosition", "path": "param:ComBitPosition"},
279
+ {"name": "BitSize", "path": "param:ComBitSize"},
280
+ {
281
+ "name": "Type",
282
+ "path": "param:ComSignalType",
283
+ "enum": {
284
+ "BOOLEAN": "COM_SIGTYPE_BOOLEAN",
285
+ "UINT8": "COM_SIGTYPE_UINT8",
286
+ "UINT16": "COM_SIGTYPE_UINT16",
287
+ "UINT32": "COM_SIGTYPE_UINT32",
288
+ "SINT8": "COM_SIGTYPE_SINT8",
289
+ "SINT16": "COM_SIGTYPE_SINT16",
290
+ "SINT32": "COM_SIGTYPE_SINT32"
291
+ }
292
+ },
293
+ {"name": "IPduRef", "path": ["back:ComIPdu/ComIPduSignalRef", "sym"]},
294
+ {"name": "InitValue", "path": "param:ComSignalInitValue", "fmt": "int", "default": "0u"},
295
+ {
296
+ "name": "TransferProperty",
297
+ "path": "param:ComTransferProperty",
298
+ "enum": {
299
+ "PENDING": "COM_XFER_PENDING",
300
+ "TRIGGERED": "COM_XFER_TRIGGERED",
301
+ "TRIGGERED_ON_CHANGE": "COM_XFER_TRIGGERED_ON_CHANGE"
302
+ },
303
+ "default": "COM_XFER_PENDING"
304
+ },
305
+ {"name": "Notification", "path": "call:rteSignalCallback", "default": "NULL_PTR"}
306
+ ]
307
+ },
308
+ {
309
+ "name": "Com_TxIPduInfo",
310
+ "type": "Com_TxIPduInfoType",
311
+ "qualifier": "COM_CONST",
312
+ "static": true,
313
+ "rows": "@TxIPdus",
314
+ "size": "COM_NUMBER_OF_TX_IPDUS",
315
+ "designated": true,
316
+ "comment": "sym",
317
+ "doc": "Tx I-PDUs, indexed by ComIPduHandleId; CycleTicks = ComTxModeTimePeriod / ComMainTxTimeBase of the I-PDU's ComMainFunctionTx",
318
+ "fields": [
319
+ {"name": "PduRSrcPduId", "path": ["peer:ComPduIdRef@PduR/PduRSrcPdu", "sym"]},
320
+ {"name": "Length", "path": ["ref:ComPduIdRef", "param:PduLength"]},
321
+ {
322
+ "name": "TxMode",
323
+ "path": ["sub:ComTxIPdu", "sub:ComTxModeTrue", "sub:ComTxMode", "param:ComTxModeMode"],
324
+ "enum": {
325
+ "NONE": "COM_TXMODE_NONE",
326
+ "DIRECT": "COM_TXMODE_DIRECT",
327
+ "PERIODIC": "COM_TXMODE_PERIODIC",
328
+ "MIXED": "COM_TXMODE_MIXED"
329
+ },
330
+ "default": "COM_TXMODE_NONE"
331
+ },
332
+ {
333
+ "name": "CycleTicks",
334
+ "path": ["sub:ComTxIPdu", "sub:ComTxModeTrue", "sub:ComTxMode", "param:ComTxModeTimePeriod"],
335
+ "divide": ["ref:ComIPduMainFunctionRef", "param:ComMainTxTimeBase"],
336
+ "default": "0u"
337
+ },
338
+ {"name": "Buffer", "path": "name", "fmt": "Com_IPduBuffer_{}"}
339
+ ]
340
+ },
341
+ {
342
+ "name": "Com_RxIPduInfo",
343
+ "type": "Com_RxIPduInfoType",
344
+ "qualifier": "COM_CONST",
345
+ "static": true,
346
+ "rows": "@RxIPdus",
347
+ "size": "COM_NUMBER_OF_RX_IPDUS",
348
+ "designated": "{sym} - COM_NUMBER_OF_TX_IPDUS",
349
+ "comment": "sym",
350
+ "doc": "Rx I-PDUs, indexed by ComIPduHandleId - COM_NUMBER_OF_TX_IPDUS; TimeoutTicks = smallest non-zero ComFirstTimeout/ComTimeout of the I-PDU's signals without update bit (SWS_Com_00291) / ComMainRxTimeBase",
351
+ "fields": [
352
+ {"name": "Length", "path": ["ref:ComPduIdRef", "param:PduLength"]},
353
+ {
354
+ "name": "TimeoutTicks",
355
+ "agg": {
356
+ "over": "ComIPduSignalRef",
357
+ "params": ["ComFirstTimeout", "ComTimeout"],
358
+ "op": "min_nonzero",
359
+ "skipIf": "ComUpdateBitPosition"
360
+ },
361
+ "divide": ["ref:ComIPduMainFunctionRef", "param:ComMainRxTimeBase"],
362
+ "default": "0u"
363
+ },
364
+ {"name": "Buffer", "path": "name", "fmt": "Com_IPduBuffer_{}"}
365
+ ]
366
+ }
367
+ ],
368
+ "objects": [
369
+ {
370
+ "name": "Com_Config",
371
+ "type": "Com_ConfigType",
372
+ "qualifier": "COM_CONST",
373
+ "init": ["Com_TxSignalInfo", "Com_RxSignalInfo", "Com_TxIPduInfo", "Com_RxIPduInfo"]
374
+ }
375
+ ]
376
+ }
377
+ }
378
+ }