ecu-tests/docs/07_flash_sequence.md
Hosam-Eldin Mostafa 582764d410 Mark legacy BabyLIN adapter as deprecated across code and docs
The MUM (Melexis Universal Master) adapter is the current default; the
BabyLIN SDK adapter is retained only for backward compatibility with
existing rigs.

Code:
- Emit DeprecationWarning when BabyLinInterface is instantiated and
  when tests/conftest.py routes interface.type=='babylin' to it.
- Update module/class docstrings in ecu_framework/{__init__,config,
  lin/__init__,lin/babylin}.py to label BabyLIN-specific fields and
  paths as deprecated.

Config / scripts / pytest:
- pytest.ini: relabel the babylin marker as deprecated.
- config/{babylin.example,examples,test_config}.yaml: add deprecation
  banners and field comments.
- scripts/99-babylin.rules and scripts/pi_install.sh: annotate the
  udev-rule install block as legacy-only.

Documentation:
- TESTING_FRAMEWORK_GUIDE.md, docs/08_babylin_internals.md, and
  vendor/README.md: prepend explicit "DEPRECATED" banners.
- docs/{README,01,02,04,05,07,09,10,12,13,14,15,18,DEVELOPER_COMMIT_
  GUIDE}.md: relabel "legacy" to "deprecated" where babylin is
  mentioned, present MUM as the primary path, and steer new work
  toward the MUM examples.

No tests, configs, or modules were deleted; existing BabyLIN setups
keep working but now produce a clear DeprecationWarning at runtime.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-07 17:32:24 +02:00

58 lines
1.7 KiB
Markdown

# Flashing Sequence (ECU Programming)
This document outlines the expected flashing workflow using the `HexFlasher` scaffold over the LIN interface and where you can plug in your production flasher (UDS).
## Overview
- Flashing is controlled by configuration (`flash.enabled`, `flash.hex_path`)
- The `flash_ecu` session fixture invokes the flasher before tests
- The flasher uses the same `LinInterface` as tests
## Mermaid sequence
```mermaid
sequenceDiagram
autonumber
participant P as pytest
participant F as flash_ecu fixture
participant H as HexFlasher
participant L as LinInterface (mock/mum/babylin — babylin deprecated)
participant E as ECU
P->>F: Evaluate flashing precondition
alt flash.enabled == true and hex_path provided
F->>H: HexFlasher(lin).flash_hex(hex_path)
H->>L: connect (ensure session ready)
H->>E: Enter programming session (UDS)
H->>E: Erase memory (as required)
loop For each block in HEX
H->>L: Transfer block via LIN frames
L-->>H: Acks / flow control
end
H->>E: Verify checksum / signature
H->>E: Exit programming, reset if needed
H-->>F: Return success/failure
else
F-->>P: Skip flashing
end
```
## Implementation notes
- `ecu_framework/flashing/hex_flasher.py` is a stub — replace with your protocol implementation (UDS)
- Validate timing requirements and chunk sizes per ECU
- Consider power-cycle/reset hooks via programmable poewr supply.
## Error handling
- On failure, the fixture calls `pytest.fail("ECU flashing failed")`
- Make flashing idempotent when possible (can retry or detect current version)
## Configuration example
```yaml
flash:
enabled: true
hex_path: "firmware/ecu_firmware.hex"
```