Skip to content

Latest commit

 

History

History
62 lines (43 loc) · 3.27 KB

README.md

File metadata and controls

62 lines (43 loc) · 3.27 KB

doIt.sh Script

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.

Generating the C Code

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.

Installing asn1c

Prerequisites

For a WSL Ubuntu environment, install the asn1c prerequisites as follows:

sudo apt install build-essential automake autoconf libtool-bin bison flex

Install

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

J2735 ASN Files

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.

Obtaining the J2735 ASN Files

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/

Patches to the J2735 ASN files

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.

Environment Variables

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.

Troubleshooting

Fix for Makefile

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.