feat: update CAN integration and T2G seat firmware

This commit is contained in:
vee
2026-08-01 15:55:21 +08:00
parent 8cda026ac2
commit 4aded5c21d
1443 changed files with 1007122 additions and 4978 deletions
+35 -28
View File
@@ -1,37 +1,44 @@
# T2G seat-controller firmware
# Self-contained T2G seat-controller firmware
`Seat_Controller_demo/` is the repository-owned IAR interface project for the
physical seat bench. It combines the verified heater, fan and four-motor demos
and is the only firmware accepted by the hardware executor.
`Seat_Controller_demo/` is the repository-owned IAR project used by the real
seat-bench executor. It contains the 2026-07-30 heater, ventilation, four-axis
motion, SMV8 position memory, Hall feedback and ADC current-diagnostic code.
The Infineon/T2G vendor library is intentionally not duplicated here. The IAR
project keeps its original relative `common/` and `tviibh8m/` references;
`tools/build_seat_firmware.ps1` stages the repository project beside junctions
to `COGNITIVE_AGENT_T2G_SDK_ROOT`, builds it, and copies only the resulting
`Seat_Controller_demo.hex` and `Seat_Controller_demo.out` back into the
repository.
The matching Cypress 7.9.0 build dependencies are vendored beside it:
```powershell
powershell -ExecutionPolicy Bypass -File .\tools\build_seat_firmware.ps1 -Profile combined
```text
firmware/t2g/
├── common/
├── tviibh8m/
└── Seat_Controller_demo/
```
The build script never opens a debug probe or flashes a target. Physical
programming is performed only by an authorized `execution_mode=hardware`
request when `COGNITIVE_AGENT_SEAT_AUTO_FLASH_ENABLED=true` and the CAN
identity handshake does not match the repository firmware.
This preserves the IAR project's `../../common` and `../../tviibh8m` paths and
removes any dependency on the original Desktop SDK directory. The applicable
vendor terms are retained in `CYPRESS_SDK_LICENSE.txt`. An IAR installation is
still a toolchain prerequisite, just as the ZLG driver remains a CAN-adapter
prerequisite; neither is project source data.
Automatic programming uses `IAR/Seat_Controller_program.mac`, not the
interactive-debug `Seat_Controller_demo.mac`. The automatic-programming macro
forces motor, fan and heater outputs low before download, clears the retained
debug-session marker, and uses a bounded Download-and-Debug handoff with
`--leave_target_running`. `--download_only` is intentionally not used because
it leaves the CM0+ stopped after programming.
Build without flashing:
Firmware identity protocol:
```powershell
powershell -ExecutionPolicy Bypass -File .\tools\build_seat_firmware.ps1
```
- request: `0x304`, `53 45 41 54 01 00 00 00`
- expected response: `0x305`, `53 45 41 54 01 01 00 3F`
Set `COGNITIVE_AGENT_IAR_BUILD` or pass `-IarBuild` when `iarbuild.exe` is not
at a standard location. The script stages the project beside repository-local
vendor junctions, copies the resulting HEX/OUT back, removes build products,
and never opens a debug probe.
The response identifies protocol 1, firmware 1.1.0 and the combined capability
mask. It is a non-actuating readiness probe and is checked before any seat
control frame is sent.
The latest firmware uses periodic CAN `0x304`/`0x305` for motor and thermal
current diagnostics. The backend therefore verifies it passively by observing
`0x301` through `0x305`, `0x4FA`, all four motor IDs and MaxHall
`480/374/917/647`; it sends no identity request and no actuator frame during
verification.
When real hardware execution is enabled, automatic programming defaults to
enabled and uses `IAR/Seat_Controller_program.mac` to force outputs safe before
download. A missing protocol signature triggers programming, a boot wait and
passive re-verification before the original request continues. Set
`COGNITIVE_AGENT_SEAT_AUTO_FLASH_ENABLED=false` to opt out explicitly; dry-run
execution never programs hardware.