Files
MicrOBU/obu-firmware/CMakeLists.txt
T
Ashin Walpola 50bbf6552d 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.
2026-11-11 00:13:57 +01:00

42 lines
2.2 KiB
CMake

cmake_minimum_required(VERSION 3.22)
# 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 "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 "db32dd6e2a50decf7add4fc09ea14ee1f060bf07a047c5c7bd3cdc2b1190b019")
message(FATAL_ERROR "The application radio source differs from its pinned SHA256")
endif()
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(microbu_firmware)
include("${CMAKE_CURRENT_LIST_DIR}/cmake/no_efuse_writes.cmake")
add_compile_options(-Wno-error -Wno-cpp -Wno-error=implicit-function-declaration)
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, 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()