-
Notifications
You must be signed in to change notification settings - Fork 156
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
socktap: Adding the Autotalks link layer #151
Changes from 11 commits
4069bcb
bb6e3b1
2fb46e0
488b1ed
b4e9413
c19e64e
5646f7b
75d437a
c8a6092
9a6e438
4c1614c
1bd2489
cfd8642
a2cd662
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
if(NOT AUTOTALKS_CRATON) | ||
find_path( | ||
AUTOTALKS_ROOT | ||
NAMES "include/atlk/v2x_service.h" | ||
PATH_SUFFIXES "autotalks_secton_api" | ||
PATHS $ENV{HOME} | ||
CMAKE_FIND_ROOT_PATH_BOTH # Seems like this is not needed in newer CMake | ||
) | ||
|
||
set(AUTOTALKS_INCLUDE_DIRS "${AUTOTALKS_ROOT}/include" "${AUTOTALKS_ROOT}/ref_src/include" "${AUTOTALKS_ROOT}/depend/device/include" "${AUTOTALKS_ROOT}/src/include" "${AUTOTALKS_ROOT}/src/core/include") | ||
set(AUTOTALKS_LIBS_DIR ${AUTOTALKS_ROOT}/output.sec/x86/lib) | ||
set(AUTOTALKS_OBJ_DIR ${AUTOTALKS_ROOT}/output.sec/x86/obj) | ||
|
||
# Secton does not need ToMcrypt and ToMmath as Craton | ||
|
||
set(AUTOTALKS_OBJECTS ${AUTOTALKS_OBJ_DIR}/target_type/target_type_remote.o ${AUTOTALKS_OBJ_DIR}/platform_type/platform_type_linux_u.o ${AUTOTALKS_OBJ_DIR}/link_layer/linux_u/remote/link_layer_remote.o ${AUTOTALKS_OBJ_DIR}/link_layer/linux_u/ipc/link_layer_ipc.o ${AUTOTALKS_OBJ_DIR}/link_layer/linux_u/tee/link_layer_tee_stub.o ${AUTOTALKS_OBJ_DIR}/link_layer/link_layer_interface.o ${AUTOTALKS_OBJ_DIR}/flash_reader/linux_u/remote/flash_reader_remote.o ${AUTOTALKS_OBJ_DIR}/ref_sys/ref_sys.o ${AUTOTALKS_OBJ_DIR}/ref_sys/ref_sys_logger.o ${AUTOTALKS_OBJ_DIR}/log_reader/log_reader.o ${AUTOTALKS_OBJ_DIR}/secure_hdif_crypto_layer/crypto_layer_ref_sys.o ${AUTOTALKS_OBJ_DIR}/secure_hdif_crypto_layer/crypto_layer_interface.o ${AUTOTALKS_OBJ_DIR}/secure_hdif_crypto_layer/crypto_lib_wrapper.o ${AUTOTALKS_OBJ_DIR}/secure_storage/secure_storage.o ${AUTOTALKS_OBJ_DIR}/time_sync/time_sync.o ${AUTOTALKS_OBJ_DIR}/time_sync/time_sync_poti.o ${AUTOTALKS_OBJ_DIR}/poti_lib/gnss/gnss.o ${AUTOTALKS_OBJ_DIR}/poti_lib/nmea/nmea.o ${AUTOTALKS_OBJ_DIR}/poti_lib/nmea/nmea_io.o ${AUTOTALKS_OBJ_DIR}/poti_lib/nmea/nmea_io_check.o ${AUTOTALKS_OBJ_DIR}/poti_lib/nmea/nmea_nav.o ${AUTOTALKS_OBJ_DIR}/poti_lib/nmea/nmea_parse.o ${AUTOTALKS_OBJ_DIR}/poti_lib/gnss/teseo/teseo.o ${AUTOTALKS_OBJ_DIR}/poti_lib/gnss/teseo/teseo_commands.o ${AUTOTALKS_OBJ_DIR}/poti_lib/coord/coord.o ${AUTOTALKS_OBJ_DIR}/poti_lib/periodic_alarm/periodic_alarm.o ${AUTOTALKS_OBJ_DIR}/poti_lib/api/poti_api.o ${AUTOTALKS_OBJ_DIR}/poti_lib/ubx/serial_driver.o ${AUTOTALKS_OBJ_DIR}/poti_lib/ubx/ubx_driver.o ${AUTOTALKS_OBJ_DIR}/poti_lib/ubx/ubx_nav.o) | ||
|
||
if (NOT TARGET Autotalks::AtlkRemote) | ||
add_library(Autotalks::AtlkRemote UNKNOWN IMPORTED) | ||
set_target_properties(Autotalks::AtlkRemote PROPERTIES | ||
IMPORTED_LOCATION "${AUTOTALKS_LIBS_DIR}/libatlkremote_linux_u.so" | ||
INTERFACE_INCLUDE_DIRECTORIES "${AUTOTALKS_INCLUDE_DIRS}") | ||
set_property(TARGET Autotalks::AtlkRemote APPEND PROPERTY | ||
INTERFACE_LINK_LIBRARIES ${AUTOTALKS_OBJECTS} rt) | ||
# target_link_libraries not working properly in CMake v3.5.1 used in Ubuntu 16.04 | ||
endif() | ||
|
||
else() # Craton device | ||
find_path( | ||
AUTOTALKS_ROOT | ||
NAMES "include/atlk/v2x_service.h" | ||
PATHS $ENV{HOME} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. So you expect the API to be located at /home/your_user/autotalks_craton_api? Is this suggested by Autotalks? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I expect the user to create symbolic link from /home/your_user/autotalks_craton_api or /home/your_user/autotalks_secton_api to SDK root, I thought that it was simpler as there does not seem to be any consistent path defined by Autotalks. However, the SDK itself is found in There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Would you please add a note about this expectation to autotalks-sdk-build.md? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It was already there but I tried to make the explanation more clear |
||
PATH_SUFFIXES "autotalks_craton_api" | ||
CMAKE_FIND_ROOT_PATH_BOTH # Seems like this is not needed in newer CMake | ||
) | ||
|
||
set(AUTOTALKS_INCLUDE_DIRS "${AUTOTALKS_ROOT}/include" "${AUTOTALKS_ROOT}/ref_src/include" "${AUTOTALKS_ROOT}/depend/device/include" "${AUTOTALKS_ROOT}/src/include" "${AUTOTALKS_ROOT}/src/core/include") | ||
|
||
set(AUTOTALKS_LIBS_DIR ${AUTOTALKS_ROOT}/output.cr2_lnx/armv7-32/lib) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Here it is always arm7-32 because that is simply the Craton processor's architecture, isn't it? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, I think this will always stay the same as you say. |
||
set(AUTOTALKS_OBJ_DIR ${AUTOTALKS_ROOT}/output.cr2_lnx/armv7-32/obj) | ||
|
||
if (NOT TARGET Autotalks::ToMcrypt) | ||
add_library(Autotalks::ToMcrypt UNKNOWN IMPORTED) | ||
set_target_properties(Autotalks::ToMcrypt PROPERTIES | ||
IMPORTED_LOCATION "${AUTOTALKS_LIBS_DIR}/libtomcrypt.a" | ||
INTERFACE_INCLUDE_DIRECTORIES "${AUTOTALKS_INCLUDE_DIRS}") | ||
endif() | ||
|
||
if (NOT TARGET Autotalks::ToMmath) | ||
add_library(Autotalks::ToMmath UNKNOWN IMPORTED) | ||
set_target_properties(Autotalks::ToMmath PROPERTIES | ||
IMPORTED_LOCATION "${AUTOTALKS_LIBS_DIR}/libtommath.a" | ||
INTERFACE_INCLUDE_DIRECTORIES "${AUTOTALKS_INCLUDE_DIRS}") | ||
endif() | ||
|
||
if (NOT TARGET Autotalks::Optee) | ||
add_library(Autotalks::Optee UNKNOWN IMPORTED) | ||
set_target_properties(Autotalks::Optee PROPERTIES | ||
IMPORTED_LOCATION "${AUTOTALKS_ROOT}/depend/optee/lib/libteec.so" | ||
INTERFACE_INCLUDE_DIRECTORIES "${AUTOTALKS_INCLUDE_DIRS}") | ||
endif() | ||
|
||
set(AUTOTALKS_OBJECTS ${AUTOTALKS_OBJ_DIR}/target_type/target_type_local.o ${AUTOTALKS_OBJ_DIR}/platform_type/platform_type_linux_u.o ${AUTOTALKS_OBJ_DIR}/link_layer/linux_u/local/link_layer_local_shared_memory.o ${AUTOTALKS_OBJ_DIR}/link_layer/linux_u/ipc/link_layer_ipc.o ${AUTOTALKS_OBJ_DIR}/link_layer/linux_u/tee/static_list.o ${AUTOTALKS_OBJ_DIR}/link_layer/linux_u/tee/link_layer_tee.o ${AUTOTALKS_OBJ_DIR}/link_layer/link_layer_interface.o ${AUTOTALKS_OBJ_DIR}/flash_reader/linux_u/local/flash_reader_local.o ${AUTOTALKS_OBJ_DIR}/ref_sys/ref_sys.o ${AUTOTALKS_OBJ_DIR}/ref_sys/ref_sys_logger.o ${AUTOTALKS_OBJ_DIR}/log_reader/log_reader.o ${AUTOTALKS_OBJ_DIR}/secure_hdif_crypto_layer/crypto_layer_stubs.o ${AUTOTALKS_OBJ_DIR}/time_sync/time_sync.o ${AUTOTALKS_OBJ_DIR}/time_sync/time_sync_poti.o ${AUTOTALKS_OBJ_DIR}/poti_lib/gnss/gnss.o ${AUTOTALKS_OBJ_DIR}/poti_lib/nmea/nmea.o ${AUTOTALKS_OBJ_DIR}/poti_lib/nmea/nmea_io.o ${AUTOTALKS_OBJ_DIR}/poti_lib/nmea/nmea_io_check.o ${AUTOTALKS_OBJ_DIR}/poti_lib/nmea/nmea_nav.o ${AUTOTALKS_OBJ_DIR}/poti_lib/nmea/nmea_parse.o ${AUTOTALKS_OBJ_DIR}/poti_lib/gnss/teseo/teseo.o ${AUTOTALKS_OBJ_DIR}/poti_lib/gnss/teseo/teseo_commands.o ${AUTOTALKS_OBJ_DIR}/poti_lib/coord/coord.o ${AUTOTALKS_OBJ_DIR}/poti_lib/periodic_alarm/periodic_alarm.o ${AUTOTALKS_OBJ_DIR}/poti_lib/api/poti_api.o ${AUTOTALKS_OBJ_DIR}/poti_lib/ubx/serial_driver.o ${AUTOTALKS_OBJ_DIR}/poti_lib/ubx/ubx_driver.o ${AUTOTALKS_OBJ_DIR}/poti_lib/ubx/ubx_nav.o) | ||
khevessy marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
if (NOT TARGET Autotalks::AtlkLocal) | ||
add_library(Autotalks::AtlkLocal SHARED IMPORTED) | ||
set_target_properties(Autotalks::AtlkLocal PROPERTIES | ||
IMPORTED_LOCATION "${AUTOTALKS_LIBS_DIR}/libatlklocal_linux_u.so" | ||
INTERFACE_INCLUDE_DIRECTORIES "${AUTOTALKS_INCLUDE_DIRS}") | ||
set_property(TARGET Autotalks::AtlkLocal APPEND PROPERTY | ||
INTERFACE_LINK_LIBRARIES Autotalks::ToMcrypt Autotalks::ToMmath ${AUTOTALKS_OBJECTS} rt Autotalks::Optee) | ||
# target_link_libraries not working properly in CMake v3.5.1 used in Ubuntu 16.04 | ||
endif() | ||
|
||
endif() | ||
|
||
include(FindPackageHandleStandardArgs) | ||
find_package_handle_standard_args(Autotalks "Autotalks libraries not found" AUTOTALKS_ROOT) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
set(CMAKE_SYSTEM_NAME "Linux") | ||
set(CMAKE_SYSTEM_PROCESSOR "arm") | ||
set(POKY_CRATON2 "/opt/poky-craton2/4.0.1") | ||
set(CMAKE_C_COMPILER "${POKY_CRATON2}/sysroots/x86_64-pokysdk-linux/usr/bin/arm-poky-linux-gnueabi/arm-poky-linux-gnueabi-gcc") | ||
set(CMAKE_CXX_COMPILER "${POKY_CRATON2}/sysroots/x86_64-pokysdk-linux/usr/bin/arm-poky-linux-gnueabi/arm-poky-linux-gnueabi-g++") | ||
set(CMAKE_C_FLAGS "--sysroot=${POKY_CRATON2}/sysroots/cortexa7t2hf-neon-poky-linux-gnueabi -march=armv7ve -mthumb -mfpu=neon -mfloat-abi=hard -mcpu=cortex-a7" CACHE STRING "" FORCE) | ||
set(CMAKE_CXX_FLAGS "--sysroot=${POKY_CRATON2}/sysroots/cortexa7t2hf-neon-poky-linux-gnueabi -I${POKY_CRATON2}/sysroots/cortexa7t2hf-neon-poky-linux-gnueabi/usr/include -march=armv7ve -mthumb -mfpu=neon -mfloat-abi=hard -mcpu=cortex-a7" CACHE STRING "" FORCE) | ||
set(THREADS_PTHREAD_ARG "2" CACHE STRING "Forced by Autotalks toolchain" FORCE) | ||
# Cache string needed in cmake v3.5.1, in v3.16.3 not anymore | ||
# THREADS_PTHREAD_ARG needed for a bug that is also not present in v3.16.3 anymore | ||
|
||
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) | ||
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) | ||
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) | ||
set(AUTOTALKS_CRATON true) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
Title: Building for Autotalks devices | ||
|
||
# Building Vanetza for Autotalks Craton using Autotalks SDK | ||
|
||
This document describes building Vanetza for the Autotalks device. There is a difference between building for Craton and Secton. | ||
Steps for building Vanetza for Autotalks Craton are very similar to build for Cohda MK5 devices (you can see steps in the [building for Cohda MK5 document](vanetza-build-dependencies.md)). Difference is that there is no virtual machine provided from Autotalks. | ||
|
||
Autotalks SDK can used only in the `socktap` example, so you must always compile it when you want the SDK. | ||
|
||
## Autotalks SDK | ||
|
||
SDK is shipped with Autotalks devices, you should have obtained one. Until Release 18, it was recommended to build the SDK in Ubuntu 16.04, now Ubuntu 18.04 or 20.04 should be used; it was tested on the latter. For Secton, there is used gcc version 9.4.0, for Craton `arm-poky-linux-gnueabi-g++` version 11.2.0, that is installed with the poky container. | ||
|
||
### Code corrections | ||
|
||
With Autotalks SDK version <= 5.15.0, you will have to do a correction in file `autotalks_*_api/include/atlk/ddm_service.h` on line 615 and add there an explicit cast to `stats_tlv_t *`. Without this, you won't be able to build the project because of the `-fpermissive` flag. As of version 5.16.0, this problem is fixed. | ||
|
||
In version 5.17 (Release 18), there are another problems: | ||
* In autotalks_{craton,secton}_api/include/common/counters.h change line 110 from `uint8_t data[]` to `uint8_t* data` | ||
* In autotalks_{craton,secton}_api/include/atlk/generic_compensator.h, there is missing `}` for the `extern "C"` directive (this should be solved in newer SDK) | ||
|
||
Another thing you must note is in the initialization in the `socktap` example. The initialization code in `v2x_device_init()` was used directly from the example in the Autotalks SDK, therefore it should not be distributed with the library. You will have to write it yourself, but it really is almost the same as `main()` function in the basic example from the SDK. | ||
|
||
## Vanetza build dependencies | ||
|
||
Please see [this document](vanetza-build-dependencies.md), program was tested with precompiled libraries downloadable there. | ||
|
||
## Compile Vanetza | ||
|
||
### Compiling for Craton | ||
We assume you have copy of the Vanetza repository in your home directory at `$HOME`. | ||
Furthermore, there should be a symbolic link named `autotalks_craton_api` in your home directory, that links to the root of Craton SDK (the directory where the API is compiled). If you have Poky toolchain installed in other directory than /opt/poky-craton2/4.0.1 (e.g. /tools/gcc/arm/new_toolchain as suggested by Autotalks), change the path in cmake/Toolchain-Autotalks-Craton.cmake. | ||
Create a build directory and tell CMake to use the cross-compiler installed on your machine and to look up additional dependencies in `vanetza-deps`: | ||
|
||
:::shell | ||
mkdir vanetza/vanetza-build | ||
cd vanetza/vanetza-build | ||
cmake .. \ | ||
-DCMAKE_TOOLCHAIN_FILE=../cmake/Toolchain-Autotalks-Craton.cmake \ | ||
-DCMAKE_FIND_ROOT_PATH=$HOME/vanetza-deps \ | ||
-DCMAKE_INSTALL_RPATH=\$ORIGIN/../lib \ | ||
-DCMAKE_INSTALL_PREFIX=$HOME/vanetza-dist \ | ||
-DBUILD_SOCKTAP=ON \ | ||
-DSOCKTAP_WITH_AUTOTALKS=ON | ||
make | ||
|
||
This builds the Vanetza libraries and *socktap* example as well. When you do `make install`, binaries are copied to `$HOME/vanetza-dist`. You can copy the binary with libraries to the Craton now. You should start the binary in the same directory as you would be running code from Autotalks examples (it needs their configuration files). You must run the binary with parameter `-l autotalks` for correct choosing of the link layer. | ||
|
||
### Compiling for Secton | ||
We assume you have copy of the Vanetza repository in your home directory at `$HOME`. | ||
Furthermore, there should be a symbolic link named `autotalks_secton_api` in your home directory, that links to the root of Secton SDK (the directory where the API is compiled). The build steps are then identical with the ones described in [How to build](vanetza-build-dependencies.md). Just note that for using Autotalks SDK you should use enable compilation of socktap, e.g. like this: | ||
|
||
:::shell | ||
cmake .. \ | ||
-DBUILD_SOCKTAP=ON \ | ||
-DSOCKTAP_WITH_AUTOTALKS=ON | ||
make | ||
|
||
Binary then can be ran from the same directory you would be running the Autotalks example (it needs their configuration files). You must run the binary with parameter `-l autotalks` for correct choosing of the link layer. | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are there only x86 libraries? May we want to check
CMAKE_SYSTEM_PROCESSOR
to select the right directory?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
By
x86
, Autotalks code generation means that the system's native compiler is used (e.g. no cross-compilation) so in this case this will really be x86 on every platform (last year I tried SDK compilation on Raspberry PI and libraries were still in x86 folder). Autotalks documentation mentions that when Secton is controlled from Craton and we are cross-compiling for Craton, output folder is armv7-32. However, I did not try this possibility.