Keep vanetza-idf in obu-firmware, so a plain clone builds the firmware
obu-firmware builds against the vanetza-idf C-ITS library, which until now came from the colleague's microbu-esp32c5 tree beside the repository and was not tracked here, so a clone of this repository could not build the firmware it ships. The library alone is now part of obu-firmware, as obu-firmware/external/vanetza-idf: their external/vanetza-idf at commit cf4b99f, unchanged (9775 files; see its PROVENANCE.md). CMake takes it from there by default; -DVANETZA_IDF_DIR still points the build elsewhere. The rest of the colleague's tree (their own VAM firmware, PKI tooling, station-link Python tools, the V2X2MAP bridge) stays out of this repository and gitignored; nothing is pushed to their repository. NOTES.md, docs/06, TODO.md and the pcap verifier's usage line point at the new location.
This commit is contained in:
@@ -0,0 +1,47 @@
|
||||
Title: Generate code from ASN.1
|
||||
|
||||
# How to generate code from ASN.1 definitions
|
||||
|
||||
Generating new ASN.1 structs based on ASN.1 definitions can be a daunting task requiring the appropriate ASN.1 compiler.
|
||||
In particular, we use the **asn1c** fork maintained by [mouse07410](https://github.com/mouse07410/asn1c).
|
||||
|
||||
Though the Vanetza repository comes with various pre-generated ASN.1 messages, you may want to add further or revised versions of these messages.
|
||||
In this case, the following steps guide you how to generate code from ASN.1 definitions on your own.
|
||||
|
||||
## Prerequisites
|
||||
|
||||
We have streamlined the process of installing and using **asn1c** by relying on a Docker container.
|
||||
|
||||
1. Install Docker on your system
|
||||
2. Build the Docker container from the `vanetza/asn1/Dockerfile` as `vanetza-asn1c:latest`
|
||||
|
||||
```bash
|
||||
docker build --tag vanetza-asn1c:latest vanetza/asn1
|
||||
```
|
||||
|
||||
## Generate ASN.1 code
|
||||
|
||||
Our CMake build environment comes with a `generate_asn1c` code generation target.
|
||||
This target is available if the the `VANETZA_ASN1_WITH_ASN1C` CMake option is enabled.
|
||||
When you invoke this target, CMake will run the Docker container for you with suitable arguments.
|
||||
You can specify a custom image by modifying the `VANETZA_ASN1C_CONTAINER` CMake cache variable.
|
||||
By default, CMake will use the `vanetza-asn1c:latest` image.
|
||||
|
||||
1. Update your copy of Vanetza with the new or updated ASN.1 definitions
|
||||
2. Update the **CMakeLists.txt** file at **vanetza/asn1** accordingly
|
||||
3. Create a fresh build directory and configure CMake with enabled ASN.1 targets
|
||||
4. Invoke **asn1c** and compile Vanetza with newly generated code
|
||||
|
||||
```bash
|
||||
# Create a new build directory at the project's root
|
||||
mkdir build.asn1 && cd build.asn1
|
||||
|
||||
# Configure the build with enabled ASN.1 targets and retrieval of ISO ASN.1 files
|
||||
cmake -DVANETZA_ASN1_WITH_ASN1C=ON -DVANETZA_ASN1_WITH_ISO=ON ..
|
||||
|
||||
# Invoke the target calling asn1c
|
||||
make generate_asn1c
|
||||
|
||||
# Compile Vanetza with newly generated ASN.1 code
|
||||
cmake --build .
|
||||
```
|
||||
Reference in New Issue
Block a user