Rebuild obu-firmware on Niklas Dathe's microbu-firmware
Replace the vanetza-idf port with his current station firmware (microbu-firmware e4e4bd8: main/, components/microbu_v2x, components/vanetza, external/vanetza) and re-apply the MicrOBU additions, each marked "MicrOBU:" in the sources: - V2X_RX (opcode 0x90): every received ITS message, signed or not, through gn_unwrap.c, because the stack drops unsigned and foreign-root traffic. 0x85 is the spec's RAW_FRAME and 0x86 is reserved. The body is built in v2x_rx.hpp. - Unsigned transmission (geonet.c) for security profile 1 or station security 0, from a random MAC per configuration. - Radio polled from STATION_CONFIGURE on; manual country policy, TX power read-back, static RX buffer, short frames ignored. - Battery guard (battery_policy.hpp): deep sleep below 3.30 V with no phone on USB. - No USB writes without a host; last_frame_ms() for the guard. - 80 KB NVS with the app at 0x20000, 8 MB flash, XIAO ESP32-C5 board, 20 dBm. Remove the old C firmware, the bench listener and the old vanetza-idf copy. Add docs/station-link.tex as revision 2 of the interface reference (V2X_RX, unsigned sending, battery rule, revision history). Add 39 host unit tests (make firmware in test/host) next to the existing chain, replay, fuzz and battery tests, and point tools/station_status_watch.py at the new CONFIRM-based status.
This commit is contained in:
@@ -4,6 +4,13 @@
|
||||
results under "Running". Toolchain: MSYS2 UCRT64 gcc, Option B below (chosen and
|
||||
installed 2026-09-11).
|
||||
|
||||
**Firmware unit tests (`make firmware`, `test_firmware.cpp`, 39 tests):** the station-link codec byte-exact against
|
||||
the app's `StationLinkTest` hex, the 131-octet STATUS offsets, request reassembly, the V2X_RX extension
|
||||
(`main/v2x_rx.hpp`; the 494-octet limit, the 14-octet prefix, TX code -> air frame -> RX path), radio operating
|
||||
points, the BLE TX guard, the ITS clock, CCA counters, BLE security and the battery policy. It prints PASS or FAIL
|
||||
per test and a `RESULT:` line, and exits non-zero on a failure. It cannot test the radio, BLE, NVS or USB: those are
|
||||
on the bench list in `TODO.md`.
|
||||
|
||||
`geonet.c`, `dot11p.c` and `gn_unwrap.c` include nothing but standard C headers, so they compile
|
||||
unmodified on a PC. That makes three things possible without a board: a TX -> RX round trip
|
||||
through our own code, replaying real captures through the RX parser, and fuzzing the parser that
|
||||
@@ -19,7 +26,7 @@ obu-firmware/
|
||||
├── pcap_gn_tally.py GN header fields per station over .pcap captures (Python only)
|
||||
└── host/
|
||||
├── README.md this file
|
||||
├── Makefile `make`: builds ../../main/{geonet,dot11p,gn_unwrap}.c + tests, runs them
|
||||
├── Makefile `make`: builds ../../main/{geonet,gn_unwrap}.c and ./dot11p.c + tests, runs them
|
||||
├── test_chain.c geonet_wrap_shb -> dot11p_build_frame -> gn_unwrap_its, byte-checked
|
||||
├── test_util.c/.h shared: guard page, crash report, pcap read/write
|
||||
├── test_replay.c every recorded frame through gn_unwrap_its, results to a TSV
|
||||
@@ -72,7 +79,7 @@ make
|
||||
iterations (about 2 s); `make fuzz FUZZ_ITER=50000000 FUZZ_SEED=7` for a longer run.
|
||||
2026-09-11: 50 000 000 iterations, no crash.
|
||||
|
||||
Not covered: `main.c` (serial prefix parsing, queues) and `serial_link.c`, which need ESP-IDF;
|
||||
Not covered: the station, link and serial code in `main/`, which need ESP-IDF;
|
||||
and the phone's encoder, whose bytes are opaque here (asn1tools and the app's golden test cover
|
||||
it).
|
||||
|
||||
@@ -104,7 +111,7 @@ Kept as the fallback if AddressSanitizer or libFuzzer are ever needed; Option B
|
||||
|
||||
```bash
|
||||
cd /mnt/c/Users/Ashin/AndroidStudioProjects/MicrOBU/obu-firmware/test/host
|
||||
cc -std=c11 -Wall -Wextra -fsyntax-only ../../main/geonet.c ../../main/dot11p.c ../../main/gn_unwrap.c
|
||||
cc -std=c11 -Wall -Wextra -fsyntax-only ../../main/geonet.c dot11p.c ../../main/gn_unwrap.c
|
||||
```
|
||||
|
||||
## Option B (chosen): native Windows gcc via MSYS2
|
||||
@@ -138,7 +145,7 @@ AddressSanitizer with MinGW gcc, which is why the fuzzer uses a guard page inste
|
||||
|
||||
```powershell
|
||||
cd C:\Users\Ashin\AndroidStudioProjects\MicrOBU\obu-firmware\test\host
|
||||
gcc -std=c11 -Wall -Wextra -fsyntax-only ../../main/geonet.c ../../main/dot11p.c ../../main/gn_unwrap.c
|
||||
gcc -std=c11 -Wall -Wextra -fsyntax-only ../../main/geonet.c dot11p.c ../../main/gn_unwrap.c
|
||||
```
|
||||
|
||||
Installed on this PC 2026-09-11: MSYS2 20260611, gcc 16.2.0 (UCRT64), GNU Make 4.4.1. All three
|
||||
|
||||
Reference in New Issue
Block a user