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:
+18
-41
@@ -1,64 +1,41 @@
|
||||
cmake_minimum_required(VERSION 3.22)
|
||||
# obu-firmware: the ESP32-C5 half of the MicrOBU station, on the vanetza-idf C-ITS stack.
|
||||
#
|
||||
# Since 2026-09-23 this is a port of the colleague's standalone VRU station
|
||||
# (microbu-esp32c5/firmware, in their own repository, not part of this one). From it:
|
||||
# BTP/GeoNetworking and the TS 103 097 security entity (vanetza-idf), the station-link message
|
||||
# layer over native USB Serial/JTAG and BLE GATT, the NVS credential store, and the C5 radio adapter.
|
||||
# Added here for this project: the raw receive path of the previous firmware (gn_unwrap.c, forwarded
|
||||
# as link opcode V2X_RX) so unsigned and non-demo-signed traffic still reaches the phone, the
|
||||
# unsigned transmit path of the previous firmware (geonet.c), and BLE pausing while USB is in use.
|
||||
# See NOTES.md.
|
||||
#
|
||||
# ESP-IDF 6.0.2 exactly: the C5 radio's private Wi-Fi driver ABI (otm_tx_custom.c) is pinned to it
|
||||
# by vanetza-idf's radio_c5.cmake and has only been validated there. The previous C firmware was
|
||||
# built with IDF 6.1; see FLASHING.md for the export script of each.
|
||||
#
|
||||
# vanetza-idf lives in external/vanetza-idf, copied from the colleague's repository (their
|
||||
# external/vanetza-idf at commit cf4b99f, unchanged; see its PROVENANCE.md). Override with
|
||||
# -DVANETZA_IDF_DIR=... to build against another checkout.
|
||||
if(NOT VANETZA_IDF_DIR)
|
||||
set(VANETZA_IDF_DIR "${CMAKE_CURRENT_LIST_DIR}/external/vanetza-idf")
|
||||
endif()
|
||||
if(NOT EXISTS "${VANETZA_IDF_DIR}/idf_component.yml")
|
||||
message(FATAL_ERROR "vanetza-idf not found at ${VANETZA_IDF_DIR}: obu-firmware/external/vanetza-idf "
|
||||
"is part of this repository; check it is complete, or pass "
|
||||
"-DVANETZA_IDF_DIR=<path to a vanetza-idf checkout>")
|
||||
endif()
|
||||
|
||||
# Provenance guard for main/otm_tx_custom.c, copied unchanged from microbu-esp32c5/firmware/CMakeLists.txt:
|
||||
# this checked-in copy is what microbu::C5Radio::request() links against for every transmission.
|
||||
# Fail configure if either the pinned upstream or this file drifts from the reviewed revision.
|
||||
set(_otm_upstream "${VANETZA_IDF_DIR}/ports/esp_idf/third_party/otm/main/tx_custom.c")
|
||||
# ESP32-C5 station on the microbu_v2x and Vanetza components.
|
||||
# Verify the vendored radio source before configuration.
|
||||
set(_otm_upstream "${CMAKE_CURRENT_LIST_DIR}/components/microbu_v2x/third_party/otm/main/tx_custom.c")
|
||||
if(EXISTS "${_otm_upstream}")
|
||||
file(READ "${_otm_upstream}" _otm_upstream_text)
|
||||
string(REPLACE "\r\n" "\n" _otm_upstream_text "${_otm_upstream_text}")
|
||||
string(SHA256 _otm_upstream_hash "${_otm_upstream_text}")
|
||||
if(NOT _otm_upstream_hash STREQUAL "cb1dccfef96912ca59275e8a9102f41f56925b94a19d4a4629082aaeb779be1b")
|
||||
message(FATAL_ERROR "OpenTrafficMap upstream tx_custom.c differs from the reviewed source revision (674e3412) -- review before updating main/otm_tx_custom.c and this hash")
|
||||
message(FATAL_ERROR "The vendored OpenTrafficMap radio source differs from its pinned SHA256")
|
||||
endif()
|
||||
endif()
|
||||
set(_otm_checked_in "${CMAKE_CURRENT_LIST_DIR}/main/otm_tx_custom.c")
|
||||
file(READ "${_otm_checked_in}" _otm_checked_in_text)
|
||||
string(REPLACE "\r\n" "\n" _otm_checked_in_text "${_otm_checked_in_text}")
|
||||
string(SHA256 _otm_checked_in_hash "${_otm_checked_in_text}")
|
||||
if(NOT _otm_checked_in_hash STREQUAL "114693af99ce3866cfc767066d484e45822eaf15335d94a03626b60ac5777277")
|
||||
message(FATAL_ERROR "main/otm_tx_custom.c differs from the reviewed copy -- review the change, then update this hash")
|
||||
if(NOT _otm_checked_in_hash STREQUAL "db32dd6e2a50decf7add4fc09ea14ee1f060bf07a047c5c7bd3cdc2b1190b019")
|
||||
message(FATAL_ERROR "The application radio source differs from its pinned SHA256")
|
||||
endif()
|
||||
|
||||
list(APPEND EXTRA_COMPONENT_DIRS "${VANETZA_IDF_DIR}")
|
||||
set(SDKCONFIG_DEFAULTS "${CMAKE_CURRENT_LIST_DIR}/sdkconfig.defaults")
|
||||
set(COMPONENTS main)
|
||||
set(MICROBU_CRYPTO_ADAPTER_COMPONENT "" CACHE STRING
|
||||
"Optional ESP IDF component implementing the selected external Vanetza crypto backend")
|
||||
include($ENV{IDF_PATH}/tools/cmake/project.cmake)
|
||||
project(obu_firmware)
|
||||
project(microbu_firmware)
|
||||
include("${CMAKE_CURRENT_LIST_DIR}/cmake/no_efuse_writes.cmake")
|
||||
add_compile_options(-Wno-error -Wno-cpp -Wno-error=implicit-function-declaration)
|
||||
idf_component_get_property(vanetza_lib vanetza-idf COMPONENT_LIB)
|
||||
if(vanetza_lib)
|
||||
target_compile_options(${vanetza_lib} PRIVATE -Wno-error=implicit-function-declaration -Wno-error=cpp)
|
||||
endif()
|
||||
foreach(_stack vanetza microbu_v2x)
|
||||
idf_component_get_property(_stack_lib ${_stack} COMPONENT_LIB)
|
||||
if(_stack_lib)
|
||||
target_compile_options(${_stack_lib} PRIVATE -Wno-error=implicit-function-declaration -Wno-error=cpp)
|
||||
endif()
|
||||
endforeach()
|
||||
# GCC 15's stricter -Warray-bounds false-positives on NimBLE's fixed-size bond-store arrays
|
||||
# (upstream Apache Mynewt code); demote to a warning so the component still builds.
|
||||
# (upstream Apache Mynewt code, not ours); demote to a warning so the component still builds.
|
||||
idf_component_get_property(bt_lib bt COMPONENT_LIB)
|
||||
if(bt_lib)
|
||||
target_compile_options(${bt_lib} PRIVATE -Wno-error=array-bounds)
|
||||
endif()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user