vanetza icon indicating copy to clipboard operation
vanetza copied to clipboard

Adding a new ASN1 file to Vanetza

Open inesbj opened this issue 2 years ago • 5 comments

Hello all,

Here is my problem, I recently tried to add a new ASN1 file to the vanetza/asn1 folder and to compile it. The new asn1 file imports containers from other existing asn1 files in the same directory. I added the following line to the CMakeLists.txt in vanetza/vanetza/asn1:

${PROJECT_SOURCE_DIR}/asn1/file.asn

and changed the following line from OFF to ON

option(VANETZA_ASN1_WITH_ASN1C "Enable asn1c targets" ON)

When I recompiled Vanetza, I realized that the required asn1c version is the 0.9.29 (find_package(ASN1C 0.9.29 REQUIRED MODULE)). The asn1c that we can download on ubuntu is the 0.9.28. Even changing the version on the CMakeLists.txt of ASN1C to ASN1C 0.9.28 did not resolve the problem and I have errors when running cmake ..

Did I miss something here ? Do we need to install the asn1c compiler on linux when adding a new asn1 file to vanetza or we can do it differently? Your help is appreciated. Ines

inesbj avatar Apr 19 '22 12:04 inesbj

Hi Ines,

Unfortunately, the asn1c version numbers are not really useful (anymore). I track a patched version of asn1c at https://github.com/riebl/asn1c, which is also the version used to generate the ASN.1 code bundled with Vanetza. If you can still not process your ASN.1 file, please submit the exact error messages here.

riebl avatar Apr 20 '22 19:04 riebl

Hi, I tried to follow the process to add new asn files. Unfortunately when I run the cmake passing the arguments -DVANETZA_ASN1_WITH_ASN1C=ON I have the following error:

CMake Error at /usr/share/cmake-3.10/Modules/FindPackageHandleStandardArgs.cmake:137 (message): Could NOT find ASN1C (missing: ASN1C_SKELETON_DIR) (found suitable version "0.9.29", minimum required is "0.9.29")

Any suggestion?

Regards

liviolima80 avatar Apr 21 '22 07:04 liviolima80

Vanetza uses three CMake variables regarding asn1c: ASN1C_EXECUTABLE, ASN1C_FLAGS, and ASN1C_SKELETON_DIR. The skeleton directory comes with asn1c itself and contains files such as asn_application.c and uper_decoder.c. Usually, this directory is located at <some_dir>/share/ if the asn1c executable is located at <some_dir>/bin/asn1c and then found automatically. You may need to set the variable manually if your layout differs.

riebl avatar Apr 23 '22 07:04 riebl

Hi Raphael,

Thank you very much for your help ! I recompiled the new ASN1 file using your ASN1C version in https://github.com/riebl/asn1c. It is working. I just added the new additional generated files and keep the existing ones (due to the inter-dependency between the other ASN1 files such as the one of CAM or CPM). I noticed that there is a small difference between the already existing .c generated files in vanetza (here I show the example of the CAM.c) and the .c that I generated using your ASN1C. To illustrate this I attached a file where I generated the output of the diff command for the the generated CAM.c between the regenerated.c and the existing.c : diff CAMOriginalVanetza.c CAM_ReCompiledWithASN1C.c > ResultDiff ResultDiff.odt

Could you tell me if this is OK or if I missed something in the compilation please ? Thanks in advance. Ines

inesbj avatar Apr 29 '22 08:04 inesbj

Your posted diff does not look severe to me. However, I think it is strange that the generated code is not identical. If I remember correctly, I have been using the integer_uper branch from my asn1c repository.

riebl avatar May 15 '22 20:05 riebl