obu-firmware builds against vanetza-idf from microbu-esp32c5/external, but that tree was gitignored, so a clone of this repository could not build the firmware it ships. It is now committed here as ordinary files in its own folder, microbu-esp32c5/: the colleague's commit cf4b99f plus the V2X2MAP bridge's signature verification (--trust) used on the bench. Nothing is fetched from or pushed to the colleague's repository; this repository and its remotes carry everything. The folder's own .gitignore keeps build output, downloaded components and private key material out, as it did there; the committed file set is identical to that repository's tracked files. The ESP32-C5 is still flashed from obu-firmware/, which only takes vanetza-idf from microbu-esp32c5/, so the two stay separate folders. FLASHING.md says how to take a newer version of the colleague's tree (copy it over the folder, rebuild, test, commit).
64 lines
3.8 KiB
CMake
64 lines
3.8 KiB
CMake
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; a copy of that repository is kept in microbu-esp32c5/). 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 is taken from the colleague's tree in microbu-esp32c5/ rather than a second copy here
|
|
# (it is ~70 MB). Override with -DVANETZA_IDF_DIR=... if it lives elsewhere.
|
|
if(NOT VANETZA_IDF_DIR)
|
|
set(VANETZA_IDF_DIR "${CMAKE_CURRENT_LIST_DIR}/../microbu-esp32c5/external/vanetza-idf")
|
|
endif()
|
|
if(NOT EXISTS "${VANETZA_IDF_DIR}/idf_component.yml")
|
|
message(FATAL_ERROR "vanetza-idf not found at ${VANETZA_IDF_DIR}: microbu-esp32c5/ is part of "
|
|
"this repository; check it is complete, or pass "
|
|
"-DVANETZA_IDF_DIR=<path to external/vanetza-idf>")
|
|
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")
|
|
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")
|
|
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")
|
|
endif()
|
|
|
|
list(APPEND EXTRA_COMPONENT_DIRS "${VANETZA_IDF_DIR}")
|
|
set(SDKCONFIG_DEFAULTS "${CMAKE_CURRENT_LIST_DIR}/sdkconfig.defaults")
|
|
set(COMPONENTS main)
|
|
include($ENV{IDF_PATH}/tools/cmake/project.cmake)
|
|
project(obu_firmware)
|
|
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()
|
|
# 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.
|
|
idf_component_get_property(bt_lib bt COMPONENT_LIB)
|
|
if(bt_lib)
|
|
target_compile_options(${bt_lib} PRIVATE -Wno-error=array-bounds)
|
|
endif()
|