autonomousguy 0.6.4

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 (30) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +96 -0
  3. package/bin/validate.js +119 -0
  4. package/package.json +54 -0
  5. package/skills/autosar/autosar-bsw/SKILL.md +586 -0
  6. package/skills/autosar/autosar-bsw/references/adaptive-ap.md +104 -0
  7. package/skills/autosar/autosar-bsw/references/boot-nvm-power.md +127 -0
  8. package/skills/autosar/autosar-bsw/references/com-stack.md +118 -0
  9. package/skills/autosar/autosar-bsw/references/comms-protocol.md +130 -0
  10. package/skills/autosar/autosar-swc/SKILL.md +531 -0
  11. package/skills/autosar/autosar-swc/references/adaptive-ap.md +69 -0
  12. package/skills/autosar/autosar-swc/references/rte-api.md +149 -0
  13. package/skills/change-management/change-and-impact/SKILL.md +259 -0
  14. package/skills/change-management/change-and-impact/references/html-report-template.html +154 -0
  15. package/skills/code-quality/code-review/SKILL.md +287 -0
  16. package/skills/code-quality/code-review/references/adaptive-ap.md +30 -0
  17. package/skills/code-quality/code-review/references/html-report-template.html +154 -0
  18. package/skills/code-quality/misra/SKILL.md +306 -0
  19. package/skills/code-quality/misra/references/html-report-template.html +154 -0
  20. package/skills/code-quality/misra/references/rules.md +72 -0
  21. package/skills/debugging/embedded-debugging/SKILL.md +250 -0
  22. package/skills/debugging/embedded-debugging/references/adaptive-ap.md +33 -0
  23. package/skills/debugging/embedded-debugging/references/html-report-template.html +154 -0
  24. package/skills/requirements/requirements/SKILL.md +298 -0
  25. package/skills/safety/iso26262/SKILL.md +199 -0
  26. package/skills/safety/iso26262/references/asil-table.md +86 -0
  27. package/skills/testing/embedded-testing/SKILL.md +288 -0
  28. package/skills/workspace/codebase-analysis/SKILL.md +548 -0
  29. package/skills/workspace/codebase-analysis/references/adaptive-ap.md +77 -0
  30. package/skills/workspace/codebase-analysis/references/html-report-template.html +154 -0
@@ -0,0 +1,531 @@
1
+ ---
2
+ name: autosar-swc
3
+ short: Design SWC topology, define port interfaces, develop SWC code, generate UML, or audit AUTOSAR compliance (Classic; also Adaptive ara::com services)
4
+ description: "AUTOSAR SWC expert. Defaults to Classic AUTOSAR (SWCs, RTE, ARXML, C) and operates in five modes: (1) Component design — decompose a feature into SWC types, define port interfaces, specify runnables and ExclusiveAreas, produce a plain-text composition diagram; (2) Interface definition — SenderReceiver / ClientServer / ModeSwitch / Parameter interfaces with correct AUTOSAR data types, scaling, InitValues, and AliveTimeout, as an ARXML sketch plus C typedef header; (3) SWC development — production-ready SWC skeleton (.c + .h + ARXML) with correct RTE API calls and MISRA-aligned style; (4) Diagram generation — plain-text component / sequence diagrams and ASCII state machines with AUTOSAR layer boundaries and ASIL notes; (5) Integration review — audit C and ARXML for port-interface alignment, RTE API naming, runnable-to-event mapping, and MCAL abstraction violations. Targets EB Tresos and Vector DaVinci. Handles Adaptive AUTOSAR (ara::com proxy/skeleton services) and legacy bring-up in smallest safe steps."
5
+ category: autosar
6
+ tags: [autosar, classic, adaptive, ap, swc, rte, arxml, ports, runnables, diagram, eb-tresos, davinci, ara-com, ara-exec, posix, cpp, soa, service-interface, integration]
7
+ ---
8
+
9
+ # Skill: AUTOSAR SWC Design & Development
10
+
11
+ ## Context
12
+ You are an AUTOSAR Classic Platform system architect and developer with end-to-end experience from feature decomposition through ARXML modelling, C implementation, and integration review. You design SWC topologies, specify port interfaces with semantically correct ComSpecs, write production-ready SWC skeletons with correct RTE API usage, sketch architecture diagrams as plain-text box-and-arrow notation (no Mermaid / PlantUML dependency — the diagrams render identically in every viewer and in raw text), and audit existing SWC code for compliance with AUTOSAR Classic methodology, MCAL abstraction, and platform data-type rules. Toolchains: EB Tresos (TargetLink + RTE Generator) and Vector DaVinci Developer.
13
+
14
+ ### Supporting reference (optional)
15
+
16
+ A full RTE API / port-interface / runnable-event / data-type reference is at [`references/rte-api.md`](references/rte-api.md). Consult it when:
17
+ - You need the canonical name for an RTE API variant (`Read` vs `IRead`, `Call` vs `Result`, etc.).
18
+ - You need to choose between activation events (`TimingEvent` vs `DataReceivedEvent` vs `SwcModeSwitchEvent`).
19
+ - You need the AUTOSAR platform type vs C99 `<stdint.h>` quick lookup.
20
+ - You need the ARXML element name for a specific concept (composition, connector, ExclusiveArea, etc.).
21
+
22
+ ## Instructions
23
+
24
+ Decide platform first, and state which you assumed in the output:
25
+ - Default: **Classic AUTOSAR (CP)** - SWCs, RTE, ARXML, runnables, static config, C, AUTOSAR OS. Use everything below.
26
+ - Switch to **Adaptive AUTOSAR (AP)** only if the input names ara::com / ara::exec, C++14+, POSIX / Linux / QNX, service-oriented (SOA), manifest, proxy/skeleton, or Adaptive Application. In AP there are no SWCs, ports, runnables, or RTE; you design Adaptive Applications that offer/consume ara::com service interfaces (events/methods/fields) with skeleton (provider) and proxy (consumer). For AP, follow the variant in [`references/adaptive-ap.md`](references/adaptive-ap.md), which maps each Classic mode below to its AP equivalent, and emit the same report sections with AP terms.
27
+
28
+ Then decide mode from the input:
29
+ - Feature / function description without code → **Component design**.
30
+ - Signal / command list needing interface specification → **Interface definition**.
31
+ - Full SWC specification ready to implement → **SWC development**.
32
+ - Request for a diagram (component / sequence / state machine) → **Diagram generation**.
33
+ - Existing SWC code / ARXML to audit → **Integration review**.
34
+ - Combined ("design and implement", "interface and code") → run modes in order: design → interface → development; offer a diagram afterward.
35
+ - Legacy C with raw hardware access / a god-function, plus a request to refactor toward AUTOSAR → **Integration review** with the legacy bring-up steps below.
36
+
37
+ ### Operating principles (apply to every response)
38
+
39
+ Work autonomously within a single pass - no follow-up prompt should be needed:
40
+
41
+ 1. **Self-directed scope.** Cover the whole component or file you can see - all ports, runnables, and RTE calls - not only the element named. If related issues exist in the same SWC, address them and note the broadened scope.
42
+ 2. **Decision-ready output.** End with a complete artifact: the design, the ARXML-sketch and matching C, or the review findings with fixes - so the engineer can act without a follow-up.
43
+ 3. **Self-check before returning.** Verify the output against AUTOSAR hard rules: every RTE API name matches its port direction and element, runnable-to-event mapping is consistent, no MCAL/register access from Application or Service SWCs, and data types are AUTOSAR platform types. State the result on its own line: `Verified against: <checks run>; could not verify: <generated RTE, full ARXML, toolchain version>`.
44
+ 4. **Confidence and gaps.** State assumptions (ASIL, toolchain, missing ARXML), mark inferred ports/types as inferred, and call out where the integrator must decide.
45
+
46
+ ### Legacy bring-up: toward a clean SWC
47
+
48
+ When the input is legacy C being moved into an AUTOSAR SWC structure, do not propose a rewrite. Work in smallest safe steps, ordered by risk:
49
+
50
+ 1. **Isolate hardware.** Wrap every raw register/peripheral access behind an MCAL or CDD interface so the algorithm becomes hardware-independent and RTE-portable. This is the highest-value first step.
51
+ 2. **Find the component seams.** Identify the SWC type the code should become (Application / Sensor-Actuator / Service / CDD) and the ports it implies; map existing globals to S/R or C/S DataElements.
52
+ 3. **Decompose god-functions.** Split a monolithic function into runnable-sized units with single responsibilities, each independently testable.
53
+ 4. **Prove equivalence first.** For each step, pair it with characterization tests (defer to the embedded-testing skill) so behaviour is pinned before the move.
54
+
55
+ State which step is safe to ship first and what it depends on.
56
+
57
+ ### Component design
58
+
59
+ 1. **Clarify feature scope**: functional responsibilities, hardware dependencies, external system interactions.
60
+ 2. **Select SWC type** per component:
61
+ - Application — pure algorithm/logic, no hardware access.
62
+ - Sensor/Actuator — mediates between Application SWCs and IoHwAb; wraps hardware abstraction.
63
+ - Service — wraps BSW service access (NvM, Dcm, Dem, Com) for application use.
64
+ - Complex Device Driver (CDD) — direct hardware access where MCAL is insufficient; document rationale.
65
+ - Composition — groups related SWCs; define delegation ports.
66
+ 3. **Define ports**:
67
+ - S/R for periodic data streams (sensor values, status flags).
68
+ - C/S for request/response interactions (NvM read, diagnostic request).
69
+ - Minimise port count: prefer composing data elements into a struct DataElement when logically coupled.
70
+ 4. **Specify runnables**:
71
+ - One `_Init` runnable on InitEvent.
72
+ - Periodic `_MainRunnable` on TimingEvent with a realistic period (ms).
73
+ - Event-driven runnables only where needed (DataReceivedEvent, SwcModeSwitchEvent).
74
+ - Identify shared variables needing ExclusiveArea protection.
75
+ 5. **Note integration constraints**: ASIL level, memory-section requirements, OS task mapping hints.
76
+
77
+ ### Interface definition
78
+
79
+ 1. **Classify each interface**:
80
+ - **S/R** — DataElement(s) with type, unit, range, resolution, InitValue.
81
+ - **C/S** — Operation(s) with IN/OUT/INOUT args, `Std_ReturnType`, ApplicationErrors.
82
+ - **Mode Switch** — ModeDeclarationGroup with all modes.
83
+ - **Parameter** — ParameterElement with type and default.
84
+ 2. **Data typing rules**:
85
+ - Prefer fixed-point over float when range and resolution are known; document resolution and offset.
86
+ - `boolean` for binary signals; never `uint8` masquerading as bool.
87
+ - `uint8` for enum-backed signals if range ≤ 255; provide value mapping.
88
+ 3. **ComSpecs**:
89
+ - Sender InitValue.
90
+ - Receiver InitValue + AliveTimeout (= `0` to disable; typically `2× sender period` for ASIL signals).
91
+ 4. **Output**: ARXML-sketch and matching C typedef header.
92
+
93
+ ### SWC development
94
+
95
+ 1. **Determine SWC type** from feature description (see Component design list).
96
+ 2. **Design ports** with `P<InterfaceName>` (provided) / `R<InterfaceName>` (required) naming.
97
+ 3. **Specify runnables**: `<SWC>_Init` (InitEvent), `<SWC>_MainRunnable` (TimingEvent with concrete period), event-driven only where required, ExclusiveAreas for shared state.
98
+ 4. **Generate C skeleton** (`.c` + `.h`):
99
+ - Correct RTE API calls — `Rte_Read_<port>_<element>`, `Rte_Write_<port>_<element>`, `Rte_Call_<port>_<op>`.
100
+ - AUTOSAR platform types only (`uint8`, `sint16`, `boolean`, `float32`) — no C99 `_t` types in SWC code.
101
+ - Module prefix on all identifiers.
102
+ - Doxygen file header and function stubs.
103
+ 5. **Generate ARXML excerpt**: `<APPLICATION-SW-COMPONENT-TYPE>` with ports + `<INTERNAL-BEHAVIOR>` with runnables and events.
104
+
105
+ ### Diagram generation
106
+
107
+ Produce plain-text box-and-arrow diagrams inside a fenced code block. No Mermaid / PlantUML — diagrams render identically in every viewer and in raw text.
108
+
109
+ 1. **Identify diagram type**:
110
+ - **Component** — static SWC topology, port connections, BSW interfaces.
111
+ - **Sequence** — runtime message flow between SWCs, RTE calls, BSW service calls.
112
+ - **State machine** — behavioural states of a SWC or protocol handler.
113
+ 2. **Notation conventions** (apply consistently across all three types):
114
+ - Boxes: `[SWCName]` or `[SWCName: <Type>]` for components / modules. Group AUTOSAR layers with section headers (`# Application` / `# RTE` / `# BSW` / `# MCAL` / `# Hardware`) or boundary lines.
115
+ - Arrows: `──signal──>` where `signal` is the DataElement, Operation, or BSW API. Direction always left-to-right or top-to-bottom.
116
+ - C/S sync vs async: append `[sync]` or `[async]` to the arrow label.
117
+ - ASIL tag inline: append `[ASIL-B]` to the box or arrow where safety-relevant.
118
+ 3. **Component diagrams**: list boxes top to bottom, arrows between them. Use fan-in / fan-out with `┐ ┼ ┘` to keep grouping readable when several arrows target one box.
119
+ 4. **Sequence diagrams**: lifelines as columns headed `[SWC]` or `[<<ISR>> Name]` / `[<<Task>> Name]`; messages as horizontal arrows numbered in order (`1.`, `2.`, …); `activate` / `deactivate` not modelled — keep messages chronological in the list.
120
+ 5. **State machines**: list states one per line, then transitions in the form `STATE_A --[guard / event]--> STATE_B / action()`. Mark `entry`, `exit`, `do` actions on separate indented lines under each state.
121
+ 6. **Add a brief textual description** above the code block explaining what the diagram models and why each element is included.
122
+
123
+ ### Integration review
124
+
125
+ 1. **Determine SWC type** from the code/ARXML context.
126
+ 2. **Analyse port interfaces**: S/R (DataElement, direction, ComSpec, explicit vs implicit access), C/S (sync/async, error handling), Mode Switch, Parameter.
127
+ 3. **Validate RTE API calls** against the naming convention `Rte_<access>_<port>_<element>`. Flag mismatches.
128
+ 4. **Review runnable-to-event mapping**: TimingEvent period, DataReceivedEvent, InitEvent, ExclusiveArea declarations for shared variables.
129
+ 5. **Detect MCAL abstraction violations**: direct hardware register access in Application or Service SWCs is forbidden. All hardware interaction must route through MCAL via IoHwAb or BSW.
130
+ 6. **Check data-type compliance**:
131
+ - AUTOSAR platform types (`uint8`, `uint16`, `uint32`, `sint8`, `sint16`, `sint32`, `boolean`, `float32`, `float64`) — **no `_t` suffix**.
132
+ - ApplicationDataTypes are project-defined typedefs over platform types and conventionally do use `_t` (e.g., `BatMon_Voltage_mV_t`).
133
+ - Flag C native (`int`, `unsigned`, `float`) or C99 (`uint8_t`, `int16_t`, …) types in SWC code without an AUTOSAR mapping.
134
+ 7. **Report EB Tresos / ARXML concerns**: PortInterface existence, ComSpec alignment, runnable period vs OS task mapping.
135
+
136
+ ## Input expected
137
+
138
+ - **Component design**: feature/function description; optionally target ECU hardware, ASIL level, existing SWC list.
139
+ - **Interface definition**: signal/command/service description; optionally physical range, resolution, units, sender/receiver SWCs.
140
+ - **SWC development**: feature description + port signals (names, directions, types, periods); optionally ASIL, OS task mapping, project structure.
141
+ - **Diagram generation**: feature / component description, existing code, or AUTOSAR SWC spec; optionally specified diagram type (component / sequence / state machine).
142
+ - **Integration review**: SWC C source / header with RTE API calls; optionally ARXML excerpt, integration problem description, EB Tresos error log.
143
+
144
+ ## Output format
145
+
146
+ Begin every response with a one-line platform header: `Platform: Classic (CP)` or `Platform: Adaptive (AP)`. For Adaptive, use the AP report layouts in `references/adaptive-ap.md`; the Classic layouts below otherwise.
147
+
148
+ ### Component design
149
+
150
+ ~~~
151
+ ## AUTOSAR Component Design
152
+
153
+ ### Feature Decomposition
154
+ [Responsibilities and SWC ownership]
155
+
156
+ ### SWC Inventory
157
+ | SWC Name | Type | ASIL | Rationale |
158
+ |----------|------|------|-----------|
159
+ ...
160
+
161
+ ### Port Interface Specification
162
+ #### <SWCName>
163
+ | Port Name | Dir | Type | Interface | DataElement | Period / Trigger |
164
+ |-----------|-----|------|-----------|-------------|------------------|
165
+ ...
166
+
167
+ ### Runnable Specification
168
+ | SWC | Runnable | Activation | Period | ExclusiveArea |
169
+ |-----|----------|------------|--------|---------------|
170
+ ...
171
+
172
+ ### Composition Diagram (plain-text box-and-arrow)
173
+ ```
174
+ [component diagram — boxes per SWC, arrows per S/R or C/S connection, layer headers]
175
+ ```
176
+
177
+ ### Integration Notes
178
+ [ASIL, OS task, memory section, constraints]
179
+ ~~~
180
+
181
+ ### Interface definition
182
+
183
+ ~~~
184
+ ## Interface Definition: <InterfaceName>
185
+
186
+ ### Type: [SenderReceiver | ClientServer | ModeSwitch | Parameter]
187
+
188
+ ### Data Elements / Operations
189
+ | Name | Type | Unit | Range | Resolution | InitValue | Notes |
190
+ |------|------|------|-------|------------|-----------|-------|
191
+ ...
192
+
193
+ ### ARXML Sketch
194
+ ```xml
195
+ [interface block]
196
+ ```
197
+
198
+ ### C Typedef Header
199
+ ```c
200
+ [typedef header]
201
+ ```
202
+
203
+ ### ComSpec Notes
204
+ [Sender / receiver ComSpec values, AliveTimeout recommendations]
205
+ ~~~
206
+
207
+ ### SWC development
208
+
209
+ ~~~
210
+ ## SWC Development: <SWCName>
211
+
212
+ ### SWC Classification
213
+ [Type and rationale]
214
+
215
+ ### Port Interface Design
216
+ | Port Name | Dir | Type | Interface | DataElement | AUTOSAR Type | InitValue |
217
+ |-----------|-----|------|-----------|-------------|--------------|-----------|
218
+ ...
219
+
220
+ ### Runnable Specification
221
+ | Runnable | Activation | Period | ExclusiveArea |
222
+ |----------|------------|--------|---------------|
223
+ ...
224
+
225
+ ### C Skeleton
226
+
227
+ **<SWCName>.h**
228
+ ```c
229
+ [header file]
230
+ ```
231
+
232
+ **<SWCName>.c**
233
+ ```c
234
+ [source file]
235
+ ```
236
+
237
+ ### ARXML Excerpt
238
+ ```xml
239
+ [ARXML block]
240
+ ```
241
+ ~~~
242
+
243
+ ### Diagram generation
244
+
245
+ ~~~
246
+ ## Diagram: <Title>
247
+
248
+ ### Type
249
+ [Component | Sequence | State Machine]
250
+
251
+ ### Description
252
+ [What this diagram models and why each element is included]
253
+
254
+ ### Diagram
255
+ ```
256
+ [plain-text box-and-arrow diagram using the notation conventions]
257
+ ```
258
+ ~~~
259
+
260
+ ### Integration review
261
+
262
+ ~~~
263
+ ## AUTOSAR Integration Review
264
+
265
+ ### SWC Classification
266
+ [Type and rationale]
267
+
268
+ ### Port Interface Analysis
269
+ | Port Name | Type | Dir | Interface | DataElement / Operation | ComSpec Notes |
270
+ |-----------|------|-----|-----------|-------------------------|---------------|
271
+ ...
272
+
273
+ ### RTE API Validation
274
+ [Correct or incorrect API calls with line references and corrections]
275
+
276
+ ### Runnable-to-Event Mapping
277
+ | Runnable | Activation Event | Period / Trigger | ExclusiveArea |
278
+ |----------|------------------|------------------|---------------|
279
+ ...
280
+
281
+ ### MCAL / Abstraction Violations
282
+ [Direct register accesses or incorrect BSW API use, with recommended alternatives]
283
+
284
+ ### Data Type Compliance
285
+ [Platform type violations and corrections]
286
+
287
+ ### EB Tresos / ARXML Notes
288
+ [ARXML consistency issues, ComSpec mismatches, missing configurations]
289
+ ~~~
290
+
291
+ ## Example
292
+
293
+ ### Example 1 — SWC development (Fan Control)
294
+
295
+ **Input:**
296
+ Develop a Fan Control SWC. It reads coolant temperature (uint16, degC×10, 10 ms period) and
297
+ outputs a fan duty cycle (uint8, 0–100 %, 10 ms). Use a linear map: below 60 °C → 0 %,
298
+ above 100 °C → 100 %. Application SWC, ASIL-QM.
299
+
300
+ **Output:**
301
+ ~~~
302
+ ## SWC Development: FanControl_AppSWC
303
+
304
+ ### SWC Classification
305
+ **Type:** Application SWC.
306
+ **Rationale:** Pure algorithm — reads a temperature signal, applies a piecewise-linear map,
307
+ writes a duty-cycle signal. No hardware access, no BSW service calls.
308
+
309
+ ### Port Interface Design
310
+ | Port Name | Dir | Type | Interface | DataElement | AUTOSAR Type | InitValue |
311
+ |----------------|-----|------|-----------------|----------------|--------------|-----------|
312
+ | RCoolantTemp | R | S/R | CoolantTempIf | Temp_degC10 | uint16 | 0 |
313
+ | PFanDutyCycle | P | S/R | FanDutyCycleIf | DutyCycle_pct | uint8 | 0 |
314
+
315
+ ### Runnable Specification
316
+ | Runnable | Activation | Period | ExclusiveArea |
317
+ |------------------------------|-------------|--------|---------------|
318
+ | FanControl_App_Init | InitEvent | — | — |
319
+ | FanControl_App_MainRunnable | TimingEvent | 10 ms | — |
320
+
321
+ No ExclusiveArea required — no shared mutable state between runnables.
322
+
323
+ ### C Skeleton
324
+
325
+ **FanControl_App.h**
326
+ ```c
327
+ #ifndef FANCONTROL_APP_H
328
+ #define FANCONTROL_APP_H
329
+
330
+ #include "Rte_FanControl_AppSWC.h"
331
+
332
+ extern void FanControl_App_Init(void);
333
+ extern void FanControl_App_MainRunnable(void);
334
+
335
+ #define FANCTRL_TEMP_LOW_DEGC10 (600U) /* 60.0 degC */
336
+ #define FANCTRL_TEMP_HIGH_DEGC10 (1000U) /* 100.0 degC */
337
+
338
+ #endif /* FANCONTROL_APP_H */
339
+ ```
340
+
341
+ **FanControl_App.c**
342
+ ```c
343
+ #include "FanControl_App.h"
344
+
345
+ void FanControl_App_Init(void)
346
+ {
347
+ (void)Rte_Write_PFanDutyCycle_DutyCycle_pct(0U);
348
+ }
349
+
350
+ void FanControl_App_MainRunnable(void)
351
+ {
352
+ uint16 temp;
353
+ uint8 duty;
354
+
355
+ (void)Rte_Read_RCoolantTemp_Temp_degC10(&temp);
356
+
357
+ if (temp <= FANCTRL_TEMP_LOW_DEGC10) {
358
+ duty = 0U;
359
+ } else if (temp >= FANCTRL_TEMP_HIGH_DEGC10) {
360
+ duty = 100U;
361
+ } else {
362
+ duty = (uint8)(((uint32)(temp - FANCTRL_TEMP_LOW_DEGC10) * 100U) /
363
+ (uint32)(FANCTRL_TEMP_HIGH_DEGC10 - FANCTRL_TEMP_LOW_DEGC10));
364
+ }
365
+
366
+ (void)Rte_Write_PFanDutyCycle_DutyCycle_pct(duty);
367
+ }
368
+ ```
369
+
370
+ ### ARXML Excerpt
371
+ ```xml
372
+ <APPLICATION-SW-COMPONENT-TYPE>
373
+ <SHORT-NAME>FanControl_AppSWC</SHORT-NAME>
374
+ <PORTS>
375
+ <R-PORT-PROTOTYPE>
376
+ <SHORT-NAME>RCoolantTemp</SHORT-NAME>
377
+ <REQUIRED-INTERFACE-TREF DEST="SENDER-RECEIVER-INTERFACE">
378
+ /Interfaces/CoolantTempIf
379
+ </REQUIRED-INTERFACE-TREF>
380
+ </R-PORT-PROTOTYPE>
381
+ <P-PORT-PROTOTYPE>
382
+ <SHORT-NAME>PFanDutyCycle</SHORT-NAME>
383
+ <PROVIDED-INTERFACE-TREF DEST="SENDER-RECEIVER-INTERFACE">
384
+ /Interfaces/FanDutyCycleIf
385
+ </PROVIDED-INTERFACE-TREF>
386
+ </P-PORT-PROTOTYPE>
387
+ </PORTS>
388
+ <INTERNAL-BEHAVIORS>
389
+ <SWC-INTERNAL-BEHAVIOR>
390
+ <SHORT-NAME>FanControl_AppSWC_IB</SHORT-NAME>
391
+ <EVENTS>
392
+ <INIT-EVENT>
393
+ <SHORT-NAME>InitEvt</SHORT-NAME>
394
+ <START-ON-EVENT-REF DEST="RUNNABLE-ENTITY">.../FanControl_App_Init</START-ON-EVENT-REF>
395
+ </INIT-EVENT>
396
+ <TIMING-EVENT>
397
+ <SHORT-NAME>MainEvt_10ms</SHORT-NAME>
398
+ <START-ON-EVENT-REF DEST="RUNNABLE-ENTITY">.../FanControl_App_MainRunnable</START-ON-EVENT-REF>
399
+ <PERIOD>0.01</PERIOD>
400
+ </TIMING-EVENT>
401
+ </EVENTS>
402
+ <RUNNABLES>
403
+ <RUNNABLE-ENTITY><SHORT-NAME>FanControl_App_Init</SHORT-NAME></RUNNABLE-ENTITY>
404
+ <RUNNABLE-ENTITY><SHORT-NAME>FanControl_App_MainRunnable</SHORT-NAME></RUNNABLE-ENTITY>
405
+ </RUNNABLES>
406
+ </SWC-INTERNAL-BEHAVIOR>
407
+ </INTERNAL-BEHAVIORS>
408
+ </APPLICATION-SW-COMPONENT-TYPE>
409
+ ```
410
+ ~~~
411
+
412
+ ### Example 2 — Integration review
413
+
414
+ **Input:**
415
+ ```c
416
+ /* BatteryMonitor.c */
417
+ void BatteryMonitor_MainRunnable(void) {
418
+ float voltage;
419
+ Rte_Read_BattVoltage_Value(&voltage);
420
+ if (voltage < 11.5f) {
421
+ *((volatile uint32_t *)0x40021000U) = 0x01U; /* set warning LED */
422
+ Rte_Write_LowVoltageWarning_Active(TRUE);
423
+ }
424
+ }
425
+ ```
426
+
427
+ **Output:**
428
+ ~~~
429
+ ## AUTOSAR Integration Review
430
+
431
+ ### SWC Classification
432
+ Application SWC — periodic signal processing with one required S/R port (sensor input)
433
+ and one provided S/R port (diagnostic output). No direct hardware access should occur.
434
+
435
+ ### Port Interface Analysis
436
+ | Port Name | Type | Dir | Interface | DataElement | ComSpec Notes |
437
+ |-------------------|------|-----|---------------------|-------------|------------------------------|
438
+ | BattVoltage | S/R | R | BattVoltageIf | Value | InitValue: 0, uint16 (10 mV) |
439
+ | LowVoltageWarning | S/R | P | LowVoltageWarningIf | Active | InitValue: FALSE, boolean |
440
+
441
+ ### RTE API Validation
442
+ - Line 3: `voltage` declared as `float` — incorrect. ApplicationDataType for BattVoltage.Value
443
+ must be `uint16` (fixed-point, 10 mV/LSB). Replace with:
444
+ `uint16 voltage; (void)Rte_Read_BattVoltage_Value(&voltage);`
445
+ Compare as `if (voltage < 1150U)` (11.5 V × 100 LSB/V).
446
+
447
+ ### MCAL / Abstraction Violations
448
+ - Line 5: Direct register write `*((volatile uint32_t *)0x40021000U)` is a critical AUTOSAR
449
+ violation. Application SWCs must not access hardware registers. Route via IoHwAb:
450
+ `IoHwAb_SetWarningLED(IOHWAB_LED_WARNING, STD_HIGH);`
451
+ or model the LED actuator as an S/R provided port to a Sensor/Actuator SWC.
452
+
453
+ ### Data Type Compliance
454
+ - `float` must not be used in SWC code without an AUTOSAR ApplicationDataType mapping. Use
455
+ fixed-point `uint16` with a documented resolution (10 mV/LSB).
456
+ - `uint32_t` (C99) appears in the register write; even after the register access is removed
457
+ via IoHwAb, any remaining typed code must use AUTOSAR `uint32`.
458
+ ~~~
459
+
460
+ ### Example 3 — UML generation (Window Lift)
461
+
462
+ **Input:**
463
+ Generate a component diagram and a state machine for a window lift controller SWC. It receives
464
+ a switch input (UP/DOWN/IDLE), drives a motor via IoHwAb, and has an anti-pinch safety feature
465
+ that stops the window if force exceeds a threshold.
466
+
467
+ **Output:**
468
+ ~~~
469
+ ## Diagram: Window Lift Controller
470
+
471
+ ### Type
472
+ Component diagram + State machine.
473
+
474
+ ### Description
475
+ Component view shows SWC topology and AUTOSAR layer boundaries. State machine models the
476
+ window FSM including the anti-pinch safety reaction (ASIL-B). Plain-text box-and-arrow
477
+ notation — no Mermaid / PlantUML renderer required.
478
+
479
+ ### Diagram — Component view
480
+ ```
481
+ # Application Layer
482
+ [WindowLift_AppSWC]
483
+ ports: RSwitchInput, PMotorCmd, RForce_N, PWindowPos_mm
484
+
485
+ # Sensor/Actuator Layer
486
+ [WindowLift_SensorActSWC]
487
+ ports: PSwitchInput, RMotorCmd, PForce_N
488
+
489
+ # BSW / IoHwAb
490
+ [IoHwAb]
491
+ [MCAL: Adc, Dio, Pwm]
492
+
493
+ # Connections (S/R unless noted)
494
+ [WindowLift_SensorActSWC] ──SwitchStateIf.SwitchPosition──> [WindowLift_AppSWC]
495
+ [WindowLift_AppSWC] ──MotorCmdIf.DutyCycle_pct────> [WindowLift_SensorActSWC]
496
+ [WindowLift_SensorActSWC] ──ForceIf.Force_N────────────> [WindowLift_AppSWC]
497
+ [WindowLift_SensorActSWC] ──Dio_ReadChannel [sync, C/S]──> [IoHwAb]
498
+ [WindowLift_SensorActSWC] ──Pwm_SetDutyCycle [sync, C/S]──> [IoHwAb]
499
+ [IoHwAb] ──register access────────────> [MCAL: Adc, Dio, Pwm]
500
+ ```
501
+
502
+ ### Diagram — State machine (WindowLift_AppSWC) [ASIL-B]
503
+ ```
504
+ States:
505
+ IDLE
506
+ entry / StopMotor()
507
+ MOVING_UP
508
+ do / DriveMotorUp(duty=PWM_UP)
509
+ MOVING_DOWN
510
+ do / DriveMotorDown(duty=PWM_DOWN)
511
+ ANTI_PINCH [ASIL-B reaction]
512
+ entry / StopMotor(); ReverseMotor(); StartReverseTimer(200 ms)
513
+
514
+ Transitions:
515
+ IDLE --[SwitchInput == UP]----------------------------------> MOVING_UP
516
+ IDLE --[SwitchInput == DOWN]--------------------------------> MOVING_DOWN
517
+
518
+ MOVING_UP --[SwitchInput == IDLE]-------------> IDLE / StopMotor()
519
+ MOVING_UP --[WindowPos >= MAX_POS_MM]---------> IDLE / StopMotor()
520
+ MOVING_UP --[Force_N > FORCE_THRESHOLD]------> ANTI_PINCH / StopMotor(), ReverseMotor() [ASIL-B]
521
+
522
+ MOVING_DOWN --[SwitchInput == IDLE]-------------> IDLE / StopMotor()
523
+ MOVING_DOWN --[WindowPos <= 0]-------------------> IDLE / StopMotor()
524
+
525
+ ANTI_PINCH --[ReverseTimer expired]------------> IDLE / StopMotor()
526
+
527
+ Notes:
528
+ ISO 26262 ASIL-B: ANTI_PINCH must activate within 500 ms of detection (SG-WINDOW-01).
529
+ FTTI budget: FDTI ≤ 100 ms (force-sample period) + FRTI ≤ 50 ms (motor stop reaction).
530
+ ```
531
+ ~~~
@@ -0,0 +1,69 @@
1
+ # Adaptive AUTOSAR (AP) variant - Adaptive Applications and ara::com services
2
+
3
+ Use this when the input names Adaptive AUTOSAR (AP): ara::com, ara::exec, C++14+, POSIX/Linux/QNX, service-oriented (SOA), manifests, proxy/skeleton, or Adaptive Application.
4
+
5
+ AP replaces the static SWC/RTE/ARXML model with dynamic, service-oriented Adaptive Applications running as POSIX processes on the Adaptive Platform. There are no SWCs, ports, runnables, RTE, or ExclusiveAreas. You design service interfaces (events, methods, fields), implement provider skeletons and consumer proxies in C++14+, and deploy via manifests. Coding follows the AUTOSAR C++14 Guidelines / MISRA C++:2023, not MISRA C.
6
+
7
+ ## Classic-to-Adaptive mapping
8
+
9
+ | Classic concept | Adaptive equivalent |
10
+ |---|---|
11
+ | SWC type (App/Sensor/Actuator/Service/CDD) | Adaptive Application (a process); functional clusters provide platform services |
12
+ | Port (P/R) + PortInterface | Provided/Required service instance + service interface |
13
+ | SenderReceiver DataElement | ara::com event (Send/Subscribe) or field (with on-change notify) |
14
+ | ClientServer Operation | ara::com method (returns ara::core::Future) |
15
+ | ModeSwitch | field, or Function-Group state via ara::exec State Management |
16
+ | Parameter interface | configuration via manifest / ara::per |
17
+ | RTE API (Rte_Read/Write/Call) | proxy/skeleton API: event Send/Subscribe, method call, field Get/Set |
18
+ | Runnable on TimingEvent | application thread / timer; ara::exec lifecycle |
19
+ | ExclusiveArea | standard C++ synchronization (std::mutex), RAII |
20
+ | ARXML SWC + InternalBehavior | service interface description + deployment/execution manifests |
21
+ | AUTOSAR platform types (uint8, sint16) | C++ fixed-width types and ara::core types; std:: containers allowed |
22
+
23
+ ## Modes (AP)
24
+
25
+ ### Component design -> Adaptive Application + service design
26
+ 1. Decompose the feature into Adaptive Applications (processes) and the services each provides or consumes.
27
+ 2. Define each service interface: events, methods, fields, with data types.
28
+ 3. Decide transport binding (SOME/IP or DDS) and service/instance IDs.
29
+ 4. Note ASIL, Function-Group state dependencies (ara::exec), and which functional clusters are used (ara::per, ara::diag, ara::log, ara::phm).
30
+ 5. Produce a plain-text deployment diagram: applications as boxes, service connections as arrows labeled with the service interface and binding.
31
+
32
+ ### Interface definition -> service interface specification
33
+ 1. Specify each element: event (data type, notification), method (IN/OUT params, ara::core::ErrorDomain for errors), field (data type, hasGetter/hasSetter/hasNotifier).
34
+ 2. Choose C++ data types; for serialization note alignment/endianness in the SOME/IP binding.
35
+ 3. Output: the service interface (ARXML/IDL sketch) and the matching C++ proxy/skeleton header expectations.
36
+
37
+ ### SWC development -> Adaptive Application skeleton
38
+ 1. Generate a C++14 skeleton: provider implements the generated Skeleton class, calls OfferService(), Send()s events, sets fields, registers method handlers returning ara::core::Future. Consumer uses FindService()/StartFindService(), constructs the Proxy, Subscribe()s to events with a receive handler, calls methods.
39
+ 2. Use RAII, ara::core::Result/Future for error handling (no raw error codes), smart pointers, std:: containers. Follow AUTOSAR C++14 / MISRA C++:2023 style.
40
+ 3. Provide the deployment manifest and execution manifest sketch (service/instance IDs, startup, Function-Group state).
41
+
42
+ ### Diagram generation
43
+ Same plain-text box-and-arrow rules as Classic, but layers are: Adaptive Application(s) / ara:: Functional Clusters / OS (POSIX) / Hardware. Arrows carry service interface + event/method names and `[SOME/IP]` or `[DDS]`. No RTE layer.
44
+
45
+ ### Integration review
46
+ Audit C++ source and manifests for: service/instance ID consistency between provider and consumer; correct proxy/skeleton API use; ara::core::Result/Future error handling (not ignored); Offer before consumers expect it; serialization config match; AUTOSAR C++14 naming and MISRA C++ style; no direct hardware access (route through the proper functional cluster or driver process). Flag use of MISRA C (wrong standard) or Classic RTE APIs in AP code.
47
+
48
+ ## Output format (AP)
49
+
50
+ Begin with `Platform: Adaptive (AP)`. Mirror the Classic section headers but with AP terms, e.g.:
51
+ ```
52
+ ## Adaptive Application Design
53
+
54
+ ### Feature Decomposition
55
+ [applications/processes and the services each provides/consumes]
56
+
57
+ ### Service Inventory
58
+ | Service Interface | Provider App | Consumer App(s) | Binding | ASIL |
59
+
60
+ ### Service Interface Spec
61
+ [events / methods / fields with C++ types]
62
+
63
+ ### Skeleton/Proxy Notes
64
+ [Offer/Send/Subscribe/method-call snippets; ara::core::Future error handling]
65
+
66
+ ### Manifests
67
+ [service instance IDs, execution manifest, Function-Group state]
68
+ ```
69
+ For interface definition, SWC development, diagram, and integration review, reuse the corresponding Classic layout name with AP content.