Files
MicrOBU/microbu-esp32c5/external/vanetza-idf/vanetza/asn1/fetch_ieee_asn1_files.cmake
T
Ashin Walpola 0e9525162d Keep the colleague's microbu-esp32c5 tree in this repository
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).
2026-09-23 17:46:40 +02:00

64 lines
2.7 KiB
CMake

if(NOT OUTPUT_DIRECTORY)
message(FATAL_ERROR "OUTPUT_DIRECTORY variable is undefined")
endif()
file(MAKE_DIRECTORY "${OUTPUT_DIRECTORY}")
if(NOT PATCH_DIRECTORY)
message(FATAL_ERROR "PATH_DIRECTORY variable is undefined")
endif()
macro(download URL OUTPUT_FILE)
file(DOWNLOAD "${URL}" "${OUTPUT_FILE}"
STATUS _status)
list(GET _status 0 _result)
if(NOT _result EQUAL 0)
list(GET _status 1 _log)
message(FATAL_ERROR "Download of ${URL} failed: ${_log}")
endif()
endmacro()
macro(download_ieee1609dot2 ASN1_FILE)
download(
"https://forge.etsi.org/rep/ITS/asn1/ieee1609.2/-/raw/2022-published/${ASN1_FILE}"
"${OUTPUT_DIRECTORY}/${ASN1_FILE}")
endmacro()
macro(download_ieee1609dot2dot1 ASN1_FILE)
download(
"https://forge.etsi.org/rep/ITS/asn1/ieee1609.2.1/-/raw/2022-published/${ASN1_FILE}"
"${OUTPUT_DIRECTORY}/${ASN1_FILE}")
endmacro()
download_ieee1609dot2("Ieee1609Dot2.asn")
download_ieee1609dot2("Ieee1609Dot2BaseTypes.asn")
download_ieee1609dot2("Ieee1609Dot2Crl.asn")
download_ieee1609dot2("Ieee1609Dot2CrlBaseTypes.asn")
download_ieee1609dot2dot1("Ieee1609Dot2Dot1AcaEeInterface.asn")
download_ieee1609dot2dot1("Ieee1609Dot2Dot1AcaLaInterface.asn")
download_ieee1609dot2dot1("Ieee1609Dot2Dot1AcaMaInterface.asn")
download_ieee1609dot2dot1("Ieee1609Dot2Dot1AcaRaInterface.asn")
download_ieee1609dot2dot1("Ieee1609Dot2Dot1Acpc.asn")
download_ieee1609dot2dot1("Ieee1609Dot2Dot1CamRaInterface.asn")
download_ieee1609dot2dot1("Ieee1609Dot2Dot1CertManagement.asn")
download_ieee1609dot2dot1("Ieee1609Dot2Dot1EcaEeInterface.asn")
download_ieee1609dot2dot1("Ieee1609Dot2Dot1EeMaInterface.asn")
download_ieee1609dot2dot1("Ieee1609Dot2Dot1EeRaInterface.asn")
download_ieee1609dot2dot1("Ieee1609Dot2Dot1LaMaInterface.asn")
download_ieee1609dot2dot1("Ieee1609Dot2Dot1LaRaInterface.asn")
download_ieee1609dot2dot1("Ieee1609Dot2Dot1MaRaInterface.asn")
download_ieee1609dot2dot1("Ieee1609Dot2Dot1Protocol.asn")
file(READ "${OUTPUT_DIRECTORY}/Ieee1609Dot2.asn" _content)
string(REGEX REPLACE " Extension" " IeeeExtension" _content "${_content}")
file(WRITE "${OUTPUT_DIRECTORY}/Ieee1609Dot2.asn" "${_content}")
file(READ "${OUTPUT_DIRECTORY}/Ieee1609Dot2BaseTypes.asn" _content)
string(REGEX REPLACE "([\r\n])Extension" "\\1IeeeExtension" _content "${_content}")
file(WRITE "${OUTPUT_DIRECTORY}/Ieee1609Dot2BaseTypes.asn" "${_content}")
execute_process(COMMAND patch -p1 -i "${PATCH_DIRECTORY}/scoped-certificate-request.patch"
WORKING_DIRECTORY "${OUTPUT_DIRECTORY}"
RESULT_VARIABLE PATCH_RESULT)
if(NOT PATCH_RESULT EQUAL 0)
message(SEND_ERROR "Applying patch on IEEE 1609.2.1 ScopedCertificateRequest failed!")
endif()