\documentclass[10pt,a4paper]{article} \usepackage[T1]{fontenc} \usepackage{lmodern} \usepackage{helvet} \renewcommand{\familydefault}{\sfdefault} \usepackage[a4paper,left=18mm,right=18mm,top=18mm,bottom=18mm,headheight=13pt]{geometry} \usepackage{xcolor} \usepackage{array,longtable,booktabs} \usepackage{fancyhdr,lastpage,needspace} \usepackage[hidelinks]{hyperref} \definecolor{ink}{HTML}{193447} \setlength{\parindent}{0pt} \setlength{\parskip}{4pt} \setlength{\tabcolsep}{1.5mm} \renewcommand{\arraystretch}{1.12} \setlength{\emergencystretch}{3em} \newcolumntype{P}[1]{>{\raggedright\arraybackslash}p{#1}} \pagestyle{fancy} \fancyhf{} \fancyfoot[L]{\footnotesize Overnight bench test of the micrOBU firmware} \fancyfoot[R]{\footnotesize\thepage\ / \pageref{LastPage}} \renewcommand{\headrulewidth}{0pt} \hypersetup{pdftitle={Overnight bench test of the micrOBU firmware}} \newcommand{\cmd}[1]{\texttt{\small #1}} \begin{document} {\Large\bfseries\color{ink} Overnight bench test of the micrOBU firmware}\par \smallskip Revision 2, status 2026-11-27. Scripts: \cmd{obu-firmware/test/bench}.\newline Companion documents: \cmd{obu-firmware/test/bench/README.md}, \cmd{obu-firmware/test/host/README.md},\newline\cmd{obu-firmware/FLASHING.md}.\par \section*{1\quad Purpose} The test checks the integrity and function of \cmd{obu-firmware} on a real board over many hours, without a phone. A PC plays the phone over the USB station link, drives every kind of request, resets and reconfigures the board, listens to the air, and watches the board's own counters and heap. A second, board-free part runs the PC-side C tests and a long fuzz of the receive parser. \section*{2\quad Boards} \begin{longtable}{@{}P{22mm}P{32mm}P{108mm}@{}} \toprule\textbf{Port (lab)} & \textbf{Board} & \textbf{Role}\\\midrule\endhead COM10 & XIAO ESP32-C5 with cell & production OBU. Never used for this test.\\ \textbf{COM6} & XIAO ESP32-C5, no cell & \textbf{spare board: the board under test}, also taken home.\\ COM4 & ESP32-C5 & V2X node (a second station on the air).\\ COM8 & CH343 board & simulated car (CAM beacon).\\\bottomrule \end{longtable} The spare's single USB-C port is the chip's native USB Serial/JTAG (VID 303A, PID 1001). \textbf{Opening the port resets the board}, so nothing else may hold it (phone app, \cmd{station\_status\_watch.py}, serial monitor). A board without a cell still reports about 4000\,mV in \cmd{battery\_mv} (the USB charger node), so the battery value cannot tell the spare from the production board: plug in only the spare. The run writes the demo ticket to the board's NVS. \section*{3\quad What a run does} Every run starts and ends with the conformance stage, so drift shows as a different result. In between, cycles of about 45 minutes repeat until the time is up. \begin{longtable}{@{}P{30mm}P{132mm}@{}} \toprule\textbf{Stage} & \textbf{What it checks}\\\midrule\endhead conformance & about 100 checks of the link protocol against the specification and the firmware source: opcodes, malformed lengths, fragment reassembly (1536-octet requests, gaps, 2\,s timeout, 8 pending), CRC and resynchronisation, configure and POTI, BTP requests, stale requests, counter wrap.\\ soak-unsigned & BTP requests at 4\,Hz, payload 24 to 1480 octets in turn (494 and 495 are the V2X\_RX edge). Every accepted request must reach the radio driver byte for byte, with the MAC the phone named. 40 refusals (\cmd{resource\_limit}) in a row end the phase as ``transmit path wedged'', and a repeated configure is tried.\\ soak-signed & the same at 3\,Hz up to 1200 octets, signed with the demo chain; \cmd{sign\_failed} must stay 0.\\ raw-toggle & \cmd{RAW\_CAPTURE} modes 0x00, 0x01, 0x03, 0x05, 0x07 in turn: copies of the station's own frames must appear exactly in the modes with the own-TX bit.\\ reconfigure & \cmd{STATION\_CONFIGURE} every second or two with a new MAC, security on or off, radio TX+RX or RX only; the next frame must carry the new MAC and security.\\ fuzz & the board is reset, then seeded random frames are sent while it is unconfigured, so nothing reaches the radio. Heap afterwards must be within 8\,KB.\\ resets & the port is reopened five times; each time the board must boot, come back unconfigured, configure and transmit.\\ idle-listen & radio receive-only, STATUS once a second; counts what else is on the air and checks the receive queue never overflows.\\\bottomrule \end{longtable} \textbf{How a transmitted frame is checked.} One board has no second receiver, so the test uses \cmd{RAW\_CAPTURE} mode 0x05: every frame the station submits to the radio is copied back over the link. The copy is unwrapped by a Python port of \cmd{gn\_unwrap.c} written separately from the firmware, and its ITS payload is compared with what was sent. The payload carries its own size and CRC-32. The copy is made when the radio driver \emph{accepts} the frame, not when it reports the transmission complete, so it proves neither that the frame went on the air nor that another station can hear it (section 7). The driver's completion count is in \cmd{device.log} (\cmd{TX observation: submitted= completed=}); the test does not check it yet. \textbf{On the air.} Transmit phases send at most 4 frames per second at 5\,dBm on channel 180. The payload is a made-up ItsPduHeader with messageID \cmd{0xF1}, which is not an assigned ETSI message, so receivers refuse it. MACs are locally administered, \cmd{02:b3:0a:ce:xx:xx}. \cmd{--no-tx} keeps the radio silent. \textbf{PC-side tests} (\cmd{run\_host\_tests\_overnight.ps1}, no board): \cmd{make check} of \cmd{test/host} (chain test, replay of recorded captures, fuzz, battery policy, firmware unit tests, fragments), then the \cmd{gn\_unwrap} fuzzer with new seeds until the time is up. A \cmd{CRASH} line or a non-zero exit is a failure. The script's search for that line currently also matches ``no crash'' (section 7). \section*{4\quad Running it} Close everything that holds the port, run \cmd{git pull}, then from the repository root: \begin{center}\small\texttt{powershell -ExecutionPolicy Bypass -File obu-firmware\textbackslash test\textbackslash bench\textbackslash start\_overnight.ps1 -Flash -Hours 8}\end{center} \begin{longtable}{@{}P{34mm}P{128mm}@{}} \toprule\textbf{Option} & \textbf{Effect}\\\midrule\endhead \cmd{-Flash} & builds this checkout with ESP-IDF 6.0.2 and writes it to the board first (first build about 20 minutes: components are downloaded).\\ \cmd{-Quick} & about 8 minutes on the board, no host fuzz: does it all work?\\ \cmd{-Port COMx} & names the board; the default finds the one Espressif USB board plugged in and refuses if there are several.\\ \cmd{-NoTx} & the radio stays silent: protocol, fuzz, resets and idle only.\\ \cmd{-NoHostTests} & skips the PC-side C tests.\\\bottomrule \end{longtable} The script keeps Windows awake while it runs. \cmd{run\_overnight.py} refuses a board whose firmware is not this checkout's HEAD (\cmd{--allow-stale-firmware} overrides), because the results would then describe another build. Exit status: 0 if no check failed, 1 otherwise, 2 if the board does not speak the station link. \section*{5\quad Setting up the workstation} \cmd{setup\_workstation.ps1 -CheckOnly} reports what is missing; without \cmd{-CheckOnly} it installs it (about 3\,GB, 20 to 40 minutes, internet needed). It can be run again after a failure. \begin{longtable}{@{}P{44mm}P{62mm}P{56mm}@{}} \toprule\textbf{Needed} & \textbf{Why} & \textbf{Installed as}\\\midrule\endhead Git, \cmd{core.longpaths true} & \cmd{git pull}; ESP-IDF paths exceed 260 characters & winget \cmd{Git.Git}\\ Python 3.11 (\cmd{py -3.11}) & board tests, \cmd{check\_replay.py} & winget \cmd{Python.Python.3.11}\\ \cmd{pyserial} & the station link & \cmd{pip install --user}\\ \cmd{asn1tools} & host replay check only & \cmd{pip install --user}\\ MSYS2 UCRT64 \cmd{gcc}, \cmd{make} & PC-side C tests & winget \cmd{MSYS2.MSYS2}, then pacman\\ \textbf{ESP-IDF 6.0.2}, esp32c5, in \cmd{C:\textbackslash Espressif} & build and flash; exactly this version, because \cmd{components/microbu\_v2x} pins the radio driver ABI to it & \cmd{git clone --branch v6.0.2 --recursive}, then \cmd{install.ps1 esp32c5}\\\bottomrule \end{longtable} Nothing to install for the board itself: the native USB port uses the Windows built-in driver. Internet is needed on the first build (\cmd{espressif/esp-boost}, about 125\,MB, into \cmd{managed\_components/}). \cmd{setup\_workstation.ps1 -PreventSleep} turns off sleep, hibernate, display-off and USB selective suspend on mains power; a suspended USB port drops the board. Pause Windows Update and use mains power. Not in git, so absent on a fresh checkout: \cmd{its-g5-receiver-firmware/recordings/*.pcap} (the host replay test then skips itself), \cmd{vanetza/} (\cmd{check\_replay.py} then does not decode the 1609.2 envelopes independently) and \cmd{firmware-backups/}. \textbf{Flashing trouble.} If the flash reports ``No serial data received'': unplug the board, hold BOOT, plug in, release, flash again, then unplug and replug without BOOT. If the flasher stub does not start, use the \cmd{--no-stub} recipe in \cmd{FLASHING.md}. \section*{6\quad Reading the result} Results go to \cmd{obu-firmware/test/results/overnight-