The doIt.sh
script will copy the generated C code for the specified year into the asn1c_combined
directory. It will also compile the example converter program.
This script expects the necessary files to have already been generated by the generate-files.sh
script.
The necessary files can be generated using the generate-files.sh
script. This script will reference the necessary ASN.1 files from the j2735-asn-files
directory from the specified year and generate the C code in the generated-files
directory.
For a WSL Ubuntu environment, install the asn1c
prerequisites as follows:
sudo apt install build-essential automake autoconf libtool-bin bison flex
The generate-files.sh
script requires the asn1c
compiler to be installed. The asn1c
compiler can be installed in WSL using the following commands:
cd ./usdot-asn1c
aclocal
test -f configure || autoreconf -iv
./configure
make
sudo make install
The 'j2735-asn-files' subdirectory should contain the ASN.1 files for the J2735 standard. These are organized by year.
Place the ASN files in the appropriate subdirectory for the year. For example, for 2024, place the ASN files in the j2735-asn-files/2024
subdirectory.
The generate-files.sh
script will reference the necessary files from the j2735-asn-files/$year
directory when generating the C code.
Redistribution of the ASN files is not permitted, so they are not included in this repository. You must obtain them from SAE and place them in the j2735-asn-files
directory under the appropriate year subdirectory.
A table of the ASN files for each year is provided below.
Year | Source |
---|---|
2016 | https://www.sae.org/standards/content/j2735set_201603/ |
2020 | https://www.sae.org/standards/content/j2735set_202007/ |
2024 | https://www.sae.org/standards/content/j2735set_202409/ |
In the 2024 set of ASN files there are a couple changes that need to be made for them to compile with the current version of asn1c. These changes are shown in the form of .patch
files in the j2735-asn-files/2024/asn-edits
directory. The .patch
files contain only the spcific lines in the specific files that need to be changed, due to the aforementioned prohibition on redistributing the ASN files. The patches were created with the diff
command line utility, and are applied automatically by the generate-files.sh
script before it runs asn1c to compile the ASN files. The patch
command line in that script includes the --forward
option, which prevents the patch from being reversed if the script is run more than once.
The doIt.sh
and generate-files.sh
scripts uses the following environment variables:
J2735_YEAR
- The year of the J2735 standard to use. For example,2020
.
The following compile flags must be set for the converter-example.c to compile (whether you need this or not is another story).
- -DPDU= // this allows the #ifndef statements in the above c file to work correctly.
- -DASN_PDU_COLLECTION // if you have several message types you want to use.