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).
4.1 KiB
Title: Building for Cohda MK5
Building Vanetza for Cohda MK5 using Cohda SDK
This document describes step-by-step how to build Vanetza using the Cohda SDK. At the end, we have Vanetza libraries and its socktap tool cross-compiled for Cohda MK5 devices.
Cohda SDK
Cohda SDK is provided by Cohda Wireless along with their MK5 units. Since you are reading this build how-to you most likely already possess one of these units. This how-to has been created for the Release 16 of the SDK. The following instructions are expected to be done within the virtual machine (VM) provided by Cohda.
Please make sure that a recent GCC version for the arm-linux-gnueabihf target is installed in this VM.
I recommend to deinstall g++-4.8-arm-linux-gnueabihf entirely as this version supports C++11 only poorly.
g++-5-arm-linux-gnueabihf is known to work well.
Vanetza build dependencies
Compilation of Vanetza depends on several third-party libraries, e.g. Boost, GeographicLib and Crypto++ as mentioned in Vanetza's README. Steps to compile those dependencies are described in our cross-compile dependencies document. For the sake of simplicity, we provide the pre-compiled dependencies for Cohda MK5 as compressed archives.
| Archive | Content | MD5 checksum |
|---|---|---|
| vanetza-deps-20171129.tar.bz2 | Boost 1.65.1, GeographicLib 1.49, Crypto++ 5.6.5 | 853a2833fde0266674d4a4dbe22fe7ef |
| vanetza-deps-20191126.tar.bz2 | Boost 1.71.0, GeographicLib 1.50, Crypto++ 8.2.0 | 1d8832949673e3935f72aac6c00a132d |
At the moment, these archives are hosted on box.com.
We recommend to download the most recent archive in general.
Before the next step, extract the archive's content into /home/duser/vanetza-deps.
Compile Vanetza
We assume you have copy of the Vanetza repository in your home directory at /home/duser/vanetza.
Create a build directory and tell CMake to use the cross-compiler installed in the Cohda VM and to look up additional dependencies in vanetza-deps:
:::shell
mkdir vanetza-build
cd vanetza-build
cmake $HOME/vanetza \
-DCMAKE_TOOLCHAIN_FILE=$HOME/vanetza/cmake/Toolchain-Cohda-MK5.cmake \
-DCMAKE_FIND_ROOT_PATH=$HOME/vanetza-deps \
-DCMAKE_INSTALL_RPATH=\$ORIGIN/../lib \
-DCMAKE_INSTALL_PREFIX=$HOME/vanetza-dist
make
This builds the Vanetza libraries only. Enable the BUILD_SOCKTAP CMake option if you want to try socktap as well. Additionally, enable the SOCKTAP_WITH_COHDA_LLC CMake option if you want socktap to use 802.11p via Cohda's LLC network interface on your MK5.
Fortunately, socktap's additional gpsd dependency is already shipped with the Cohda SDK itself.
You only need to specify its location by setting GPS_LIBRARY to /home/duser/mk5/stack/v2x-lib/lib/mk5/libgps_static.a and GPS_INCLUDE_DIR to /home/duser/mk5/stack/v2x-lib/include.
Please note, that socktap does not make use of Cohda's socket API currently.
We might provide a modified socktap application in the future.
Deployment
make install
Compile and link socktap with correct RPATH, binaries are copied to $HOME/vanetza-dist.
- copy runtime dependencies
Copy the shared object files (*.so) from $HOME/vanetza-deps/libs onto the MK5, e.g. to /home/user/vanetza/lib.
- copy socktap onto MK5
Copy the files from $HOME/vanetza-dist to /home/user/vanetza on the MK5, i.e. Vanetza libraries and its dependency libraries are located in the same directory.
You can execute socktap located at /home/user/vanetza/bin/socktap and it will look up its shared objects in the sibling lib directory. If you have enabled the SOCKTAP_WITH_COHDA_LLC CMake option, make sure to give socktap the name of a Cohda LLC network interface via the command line option --interface/-i (e.g. cw-llc0).