diff options
author | Romain Forlot <romain.forlot@iot.bzh> | 2017-04-11 12:55:23 +0200 |
---|---|---|
committer | Romain Forlot <romain.forlot@iot.bzh> | 2017-04-11 12:55:23 +0200 |
commit | 9e444ade872bc436cf12bc12d03c3a5d51ac0b9e (patch) | |
tree | d828311d50f1c02a91c8254b1e8e3a18843fe8be | |
parent | 8eaebc2cdfcab4b2f7cd5381241bb0e8bc39701c (diff) |
Handle project new architecture using new CMakeFile
Change-Id: I672a9b49d9d5a3953ba6dccaafbbd738839f64a6
Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
# Conflicts:
# low-can-binding/libs/bitfield-c
# low-can-binding/libs/isotp-c
# low-can-binding/libs/openxc-message-format
-rw-r--r-- | .gitmodules | 24 | ||||
-rw-r--r-- | CMakeLists.txt | 177 | ||||
-rw-r--r-- | etc/config.cmake | 75 | ||||
-rw-r--r-- | etc/export.map (renamed from src/export.map) | 0 | ||||
-rw-r--r-- | low-can-binding/CMakeLists.txt | 81 | ||||
-rw-r--r-- | low-can-binding/can/can-bus-dev.cpp (renamed from src/can/can-bus-dev.cpp) | 0 | ||||
-rw-r--r-- | low-can-binding/can/can-bus-dev.hpp (renamed from src/can/can-bus-dev.hpp) | 0 | ||||
-rw-r--r-- | low-can-binding/can/can-bus.cpp (renamed from src/can/can-bus.cpp) | 0 | ||||
-rw-r--r-- | low-can-binding/can/can-bus.hpp (renamed from src/can/can-bus.hpp) | 0 | ||||
-rw-r--r-- | low-can-binding/can/can-command.hpp (renamed from src/can/can-command.hpp) | 0 | ||||
-rw-r--r-- | low-can-binding/can/can-decoder.cpp (renamed from src/can/can-decoder.cpp) | 0 | ||||
-rw-r--r-- | low-can-binding/can/can-decoder.hpp (renamed from src/can/can-decoder.hpp) | 0 | ||||
-rw-r--r-- | low-can-binding/can/can-message-definition.cpp (renamed from src/can/can-message-definition.cpp) | 0 | ||||
-rw-r--r-- | low-can-binding/can/can-message-definition.hpp (renamed from src/can/can-message-definition.hpp) | 0 | ||||
-rw-r--r-- | low-can-binding/can/can-message-set.cpp (renamed from src/can/can-message-set.cpp) | 0 | ||||
-rw-r--r-- | low-can-binding/can/can-message-set.hpp (renamed from src/can/can-message-set.hpp) | 0 | ||||
-rw-r--r-- | low-can-binding/can/can-message.cpp (renamed from src/can/can-message.cpp) | 0 | ||||
-rw-r--r-- | low-can-binding/can/can-message.hpp (renamed from src/can/can-message.hpp) | 0 | ||||
-rw-r--r-- | low-can-binding/can/can-signals.cpp (renamed from src/can/can-signals.cpp) | 0 | ||||
-rw-r--r-- | low-can-binding/can/can-signals.hpp (renamed from src/can/can-signals.hpp) | 0 | ||||
-rw-r--r-- | low-can-binding/configuration-generated.cpp | 350 | ||||
-rw-r--r-- | low-can-binding/configuration.cpp (renamed from src/configuration.cpp) | 0 | ||||
-rw-r--r-- | low-can-binding/configuration.hpp (renamed from src/configuration.hpp) | 0 | ||||
-rw-r--r-- | low-can-binding/diagnostic/active-diagnostic-request.cpp (renamed from src/diagnostic/active-diagnostic-request.cpp) | 0 | ||||
-rw-r--r-- | low-can-binding/diagnostic/active-diagnostic-request.hpp (renamed from src/diagnostic/active-diagnostic-request.hpp) | 0 | ||||
-rw-r--r-- | low-can-binding/diagnostic/diagnostic-manager.cpp (renamed from src/diagnostic/diagnostic-manager.cpp) | 0 | ||||
-rw-r--r-- | low-can-binding/diagnostic/diagnostic-manager.hpp (renamed from src/diagnostic/diagnostic-manager.hpp) | 0 | ||||
-rw-r--r-- | low-can-binding/diagnostic/diagnostic-message.cpp (renamed from src/diagnostic/diagnostic-message.cpp) | 0 | ||||
-rw-r--r-- | low-can-binding/diagnostic/diagnostic-message.hpp (renamed from src/diagnostic/diagnostic-message.hpp) | 0 | ||||
m--------- | low-can-binding/libs/bitfield-c (renamed from src/libs/bitfield-c) | 0 | ||||
m--------- | low-can-binding/libs/isotp-c (renamed from src/libs/isotp-c) | 0 | ||||
m--------- | low-can-binding/libs/nanopb | 7 | ||||
m--------- | low-can-binding/libs/openxc-message-format (renamed from src/libs/openxc-message-format) | 0 | ||||
m--------- | low-can-binding/libs/uds-c | 9 | ||||
-rw-r--r-- | low-can-binding/low-can-binding.cpp (renamed from src/low-can-binding.cpp) | 0 | ||||
-rw-r--r-- | low-can-binding/low-can-binding.hpp (renamed from src/low-can-binding.hpp) | 0 | ||||
-rw-r--r-- | low-can-binding/packaging/wgt/config.xml (renamed from src/config.xml.in) | 0 | ||||
-rw-r--r-- | low-can-binding/packaging/wgt/etc/can_buses.json (renamed from src/can_buses.json.in) | 0 | ||||
-rw-r--r-- | low-can-binding/packaging/wgt/icon.png (renamed from src/icon.png) | bin | 4035 -> 4035 bytes | |||
-rw-r--r-- | low-can-binding/subCMakeLists.txt (renamed from src/CMakeLists.txt) | 22 | ||||
-rw-r--r-- | low-can-binding/utils/config-parser.cpp (renamed from src/utils/config-parser.cpp) | 0 | ||||
-rw-r--r-- | low-can-binding/utils/config-parser.hpp (renamed from src/utils/config-parser.hpp) | 0 | ||||
-rw-r--r-- | low-can-binding/utils/openxc-utils.cpp (renamed from src/utils/openxc-utils.cpp) | 0 | ||||
-rw-r--r-- | low-can-binding/utils/openxc-utils.hpp (renamed from src/utils/openxc-utils.hpp) | 0 | ||||
-rw-r--r-- | low-can-binding/utils/signals.cpp (renamed from src/utils/signals.cpp) | 0 | ||||
-rw-r--r-- | low-can-binding/utils/signals.hpp (renamed from src/utils/signals.hpp) | 0 | ||||
-rw-r--r-- | low-can-binding/utils/socket.cpp (renamed from src/utils/socket.cpp) | 0 | ||||
-rw-r--r-- | low-can-binding/utils/socket.hpp (renamed from src/utils/socket.hpp) | 0 | ||||
-rw-r--r-- | low-can-binding/utils/timer.cpp (renamed from src/utils/timer.cpp) | 0 | ||||
-rw-r--r-- | low-can-binding/utils/timer.hpp (renamed from src/utils/timer.hpp) | 0 | ||||
m--------- | src/libs/nanopb | 9 | ||||
m--------- | src/libs/uds-c | 10 |
52 files changed, 722 insertions, 42 deletions
diff --git a/.gitmodules b/.gitmodules index de99e87d..74a13e89 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,15 +1,15 @@ -[submodule "src/libs/openxc-message-format"] - path = src/libs/openxc-message-format - url = https://github.com/openxc/openxc-message-format.git -[submodule "src/libs/nanopb"] - path = src/libs/nanopb +[submodule "low-can-binding/libs/openxc-message-format"] + path = low-can-binding/libs/openxc-message-format + url = https://github.com/openxc/openxc-message-format +[submodule "low-can-binding/libs/nanopb"] + path = low-can-binding/libs/nanopb url = https://github.com/nanopb/nanopb.git -[submodule "src/libs/uds-c"] - path = src/libs/uds-c +[submodule "low-can-binding/libs/uds-c"] + path = low-can-binding/libs/uds-c url = https://github.com/openxc/uds-c.git -[submodule "src/libs/bitfield-c"] - path = src/libs/bitfield-c +[submodule "low-can-binding/libs/bitfield-c"] + path = low-can-binding/libs/bitfield-c url = https://github.com/openxc/bitfield-c.git -[submodule "src/libs/isotp-c"] - path = src/libs/isotp-c - url = https://github.com/openxc/isotp-c.git +[submodule "low-can-binding/libs/isotp-c"] + path = low-can-binding/libs/isotp-c + url = https://github.com/openxc/isotp-c diff --git a/CMakeLists.txt b/CMakeLists.txt index 233ee695..4ba6136f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,8 +1,7 @@ ########################################################################### -# Copyright 2016 IoT.bzh +# Copyright 2015, 2016, 2017 IoT.bzh # -# author: José Bollo <jose.bollo@iot.bzh> -# author: Stéphane Desneux <stephane.desneux@iot.bzh> +# author: Fulup Ar Foll <fulup@iot.bzh> # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -17,6 +16,172 @@ # limitations under the License. ########################################################################### -cmake_minimum_required(VERSION 3.3) -project(low-can-binding) -add_subdirectory(src) + +#-------------------------------------------------------------------------- +# WARNING: +# Do not change this cmake template +# Customise your preferences in "./etc/config.cmake" +#-------------------------------------------------------------------------- + + +# Generic useful macro +# ----------------------- +macro(PROJECT_TARGET_ADD TARGET_NAME) + set(PROJECT_TARGETS ${PROJECT_TARGETS} ${TARGET_NAME} CACHE INTERNAL PROJECT_TARGETS) +endmacro(PROJECT_TARGET_ADD) + +macro(defstr name value) + add_definitions(-D${name}=${value}) +endmacro(defstr) + +macro(setc name value) + if(NOT DEFINED ${name}) + set(${name} ${value}) + endif(NOT DEFINED ${name}) +endmacro(setc) + +macro(fill_include_dir path) + file(GLOB_RECURSE dirlist LIST_DIRECTORIES true "${path}/*") + foreach(filename ${dirlist}) + if(IS_DIRECTORY ${filename}) + include_directories(${filename}) + endif(IS_DIRECTORY ${filename}) + endforeach() +endmacro(fill_include_dir) + +function(find_source_files path) + file(GLOB_RECURSE filelist "${path}/*.[cpx]") + foreach(filename ${filelist}) + if(NOT ${filename} MATCHES ".*(test|example|sample).*") + string(APPEND sources "${filename};") + endif(NOT ${filename} MATCHES ".*(test|example|sample).*") + endforeach() + set(sources_files ${sources} PARENT_SCOPE) +endfunction(find_source_files) + +CMAKE_MINIMUM_REQUIRED(VERSION 3.3) +setc(CMAKE_BUILD_TYPE Debug) +set(CMAKE_POSITION_INDEPENDENT_CODE ON) +set(CMP0048 1) + +# Compiler selection should append before project definition +# ----------------------------------------------------------- +foreach (GCC_VERSION "6" "5") + execute_process(COMMAND gcc-${GCC_VERSION} -dumpversion RESULT_VARIABLE GCCRC OUTPUT_QUIET ERROR_QUIET) + if(GCCRC EQUAL 0) + set(CMAKE_C_COMPILER "gcc-${GCC_VERSION}") + set(CMAKE_CXX_COMPILER "g++-${GCC_VERSION}") + set(CMAKE_C_VERSION ${GCC_VERSION}) + break() + endif(GCCRC EQUAL 0) +endforeach(GCC_VERSION) + +# Include project configuration +# ------------------------------ +include(${CMAKE_CURRENT_SOURCE_DIR}/etc/config.cmake) +project(${NAME} VERSION ${VERSION}) +setc(PROJECT_PRETTY_NAME "${PRETTY_NAME}") +setc(PROJECT_DESCRIPTION "${DESCRIPTION}") +setc(PROJECT_WGT_DIR "packaging/wgt") +setc(PROJECT_LIBDIR "libs") +setc(PROJECT_RESOURCES "data") + +message(STATUS "") +message(STATUS "Project=${PROJECT_NAME}/${VERSION}[${PRETTY_NAME} ${DESCRIPTION}]") +message(STATUS "") +message(STATUS "gcc/g++ version-${CMAKE_C_VERSION}.x selected") + +INCLUDE(FindPkgConfig) +INCLUDE(CheckIncludeFiles) +INCLUDE(CheckLibraryExists) +INCLUDE(GNUInstallDirs) + +# Default compilation options +############################################################################ +link_libraries(-Wl,--as-needed -Wl,--gc-sections) +add_compile_options(-Wall -Wextra -Wconversion) +add_compile_options(-Wno-unused-parameter) # frankly not using a parameter does it care? +add_compile_options(-Wno-sign-compare -Wno-sign-conversion) +add_compile_options(-Werror=maybe-uninitialized) +add_compile_options(-Werror=implicit-function-declaration) +add_compile_options(-ffunction-sections -fdata-sections) +add_compile_options(-fPIC) +add_compile_options(-g) + +setc(CMAKE_C_FLAGS_PROFILING "-g -O2 -pg -Wp,-U_FORTIFY_SOURCE") +setc(CMAKE_C_FLAGS_DEBUG "-g -O2 -ggdb -Wp,-U_FORTIFY_SOURCE") +setc(CMAKE_C_FLAGS_RELEASE "-O2") +setc(CMAKE_C_FLAGS_CCOV "-g -O2 --coverage") +setc(CMAKE_INSTALL_PREFIX "${CMAKE_SOURCE_DIR}/Install") + +# (BUG!!!) as PKG_CONFIG_PATH does not work [should be en env variable] +setc(PKG_CONFIG_USE_CMAKE_PREFIX_PATH 1) + +# Loop on required package and add options +foreach (PKG_CONFIG ${PKG_REQUIRED_LIST}) + PKG_CHECK_MODULES(${PKG_CONFIG} REQUIRED ${PKG_CONFIG}) + + INCLUDE_DIRECTORIES(${${PKG_CONFIG}_INCLUDE_DIRS}) + list (APPEND link_libraries ${${PKG_CONFIG}_LIBRARIES}) + add_compile_options (${${PKG_CONFIG}_CFLAGS}) +endforeach(PKG_CONFIG) + +# Optional LibEfence Malloc debug library +IF(CMAKE_BUILD_TYPE MATCHES DEBUG) +CHECK_LIBRARY_EXISTS(efence malloc "" HAVE_LIBEFENCE) +IF(HAVE_LIBEFENCE) + MESSAGE(STATUS "Linking with ElectricFence for debugging purposes...") + SET(libefence_LIBRARIES "-lefence") + list (APPEND link_libraries libefence_LIBRARIES}) +ENDIF(HAVE_LIBEFENCE) +ENDIF(CMAKE_BUILD_TYPE MATCHES DEBUG) + +# set default include directories +INCLUDE_DIRECTORIES(${EXTRA_INCLUDE_DIRS}) + +# If no install dir try to guest some smart default +if(BINDINGS_INSTALL_PREFIX) + set(BINDINGS_INSTALL_DIR ${BINDINGS_INSTALL_PREFIX}/${PROJECT_NAME}) +else() + set(BINDINGS_INSTALL_DIR ${CMAKE_INSTALL_FULL_LIBDIR}/${PROJECT_NAME}) +endif() + +# Default Linkflag +if(NOT BINDINGS_LINK_FLAG) + set(BINDINGS_LINK_FLAG "-Wl,--version-script=${CMAKE_SOURCE_DIR}/etc/export.map") +endif() + +# Bindings to compile +# -------------------- +file(GLOB filelist "[A-z]*") +foreach(filename ${filelist}) +if(EXISTS "${filename}/CMakeLists.txt") + add_subdirectory(${filename}) +endif(EXISTS "${filename}/CMakeLists.txt") +endforeach() + +# Add a dummy target to enable global dependency order +# ----------------------------------------------------- +if(EXTRA_DEPENDENCIES_ORDER) + set(DEPENDENCIES_TARGET ${PROJECT_NAME}_extra_dependencies) + add_custom_target(${DEPENDENCIES_TARGET} ALL + DEPENDS ${EXTRA_DEPENDENCY_ORDER} + ) +endif() + +# Cmake does not maintain targets list before 3.7 +# ------------------------------------------------- +if(${CMAKE_VERSION} VERSION_LESS 3.7) + set(GLOBAL_TARGET_LIST ${PROJECT_TARGETS}) +else() + get_property(GLOBAL_TARGET_LIST GLOBAL PROPERTY GlobalTargetList) +endif() + +# Print developer helper message when everything is done +# ------------------------------------------------------- +if(CLOSING_MESSAGE AND GLOBAL_TARGET_LIST) + add_custom_target(${PROJECT_NAME}_done ALL + DEPENDS ${DEPENDENCIES_TARGET} ${GLOBAL_TARGET_LIST} + COMMAND ${CMAKE_COMMAND} -E cmake_echo_color --cyan "++ ${CLOSING_MESSAGE}" + ) +endif() diff --git a/etc/config.cmake b/etc/config.cmake new file mode 100644 index 00000000..dc695b44 --- /dev/null +++ b/etc/config.cmake @@ -0,0 +1,75 @@ +########################################################################### +# Copyright 2015, 2016, 2017 IoT.bzh +# +# author: Fulup Ar Foll <fulup@iot.bzh> +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +########################################################################### + +# Project Info +# ------------------ +set(NAME low-can-binding) +set(VERSION "1.0") +set(PRETTY_NAME "Low level CAN binding") +set(DESCRIPTION "Expose CAN Low Level APIs through AGL Framework") +set(URL "https://github.com/iotbzh/CAN_signaling") +set(PROJECT_ICON "icon.png") + +# Compilation Mode (DEBUG, RELEASE) +# ---------------------------------- +setc(CMAKE_BUILD_TYPE "DEBUG") + +# PKG_CONFIG required packages +# ----------------------------- +set (PKG_REQUIRED_LIST + json-c + libsystemd + afb-daemon +) + +# Static constante definition +# ----------------------------- +add_compile_options(-D_REENTRANT) +add_compile_options(-DPB_FIELD_16BIT) + +# Print a helper message when every thing is finished +setc(CLOSING_MESSAGE "Test with: afb-daemon --ldpaths=\$\$(pwd)/package/lib --port=1234 --roothttp=\$\$(pwd)/package/htdocs --tracereq=common --token=\"\" --verbose") +# ---------------------------------------------------- + +# (BUG!!!) as PKG_CONFIG_PATH does not work [should be an env variable] +# --------------------------------------------------------------------- +setc(CMAKE_INSTALL_PREFIX ${HOME}/opt) +setc(CMAKE_PREFIX_PATH ${CMAKE_INSTALL_PREFIX}/lib64/pkgconfig ${CMAKE_INSTALL_PREFIX}/lib/pkgconfig) +setc(LD_LIBRARY_PATH ${CMAKE_INSTALL_PREFIX}/lib64 ${CMAKE_INSTALL_PREFIX}/lib) + +# Optional dependencies order +# --------------------------- +#set(EXTRA_DEPENDENCIES_ORDER target1 target2 ...) + +# Optional Extra global include path +# ----------------------------------- +#set(EXTRA_INCLUDE_DIRS incdir1 incdir2 ...) + +# Optional extra libraries +# ------------------------- +set(EXTRA_LINK_LIBRARIES nanopb bitfield-c isotp-c uds-c openxc-message-format) + +# Optional force binding installation +# ------------------------------------ +# set(BINDINGS_INSTALL_PREFIX DestinationPath ) + +# Optional force binding Linking flag +# ------------------------------------ +# set(BINDINGS_LINK_FLAG LinkOptions ) + + diff --git a/src/export.map b/etc/export.map index 52c1b4aa..52c1b4aa 100644 --- a/src/export.map +++ b/etc/export.map diff --git a/low-can-binding/CMakeLists.txt b/low-can-binding/CMakeLists.txt new file mode 100644 index 00000000..ae035c91 --- /dev/null +++ b/low-can-binding/CMakeLists.txt @@ -0,0 +1,81 @@ +########################################################################### +# Copyright 2015, 2016, 2017 IoT.bzh +# +# author: Fulup Ar Foll <fulup@iot.bzh> +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +########################################################################### + +# Add target to project dependency list +PROJECT_TARGET_ADD(low-can-binding) + + # Define project Targets + fill_include_dir(${PROJECT_LIBDIR}) + file(GLOB filelist "${PROJECT_LIBDIR}/*") + foreach(filename ${filelist}) + if(IS_DIRECTORY ${filename}) + include_directories(${filename}) + STRING(REGEX REPLACE "^.*\/(.*)$" "\\1" shortname ${filename}) + find_source_files(${PROJECT_LIBDIR}) + add_library(${shortname} STATIC ${sources_files}) + endif(IS_DIRECTORY ${filename}) + endforeach() + + add_library(${PROJECT_NAME} MODULE ${PROJECT_NAME}.cpp configuration.cpp configuration-generated.cpp + can/can-bus.cpp can/can-bus-dev.cpp can/can-message-set.cpp can/can-message-definition.cpp can/can-message.cpp can/can-signals.cpp can/can-decoder.cpp + diagnostic/diagnostic-message.cpp diagnostic/diagnostic-manager.cpp diagnostic/active-diagnostic-request.cpp + utils/signals.cpp utils/openxc-utils.cpp utils/timer.cpp utils/socket.cpp) + + # Binder exposes a unique public entry point + SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES + PREFIX "" + LINK_FLAGS ${BINDINGS_LINK_FLAG} + OUTPUT_NAME ${PROJECT_NAME} + ) + + # Library dependencies (include updates automatically) + TARGET_LINK_LIBRARIES(${PROJECT_NAME} + ${EXTRA_LINK_LIBRARIES} + ${link_libraries} + ) + + # installation directory + INSTALL(TARGETS ${PROJECT_NAME} + LIBRARY DESTINATION ${BINDINGS_INSTALL_DIR}) + + # WGT packaging + message(STATUS "Creation of ${PROJECT_NAME}.wgt package for AppFW") + + configure_file(${PROJECT_WGT_DIR}/config.xml config.xml) + + if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${PROJECT_WGT_DIR}/etc") + file(GLOB conf_files "${PROJECT_WGT_DIR}/etc/*") + foreach(filename ${conf_files}) + STRING(REGEX REPLACE "^.*\/(.*)$" "\\1" shortname ${filename}) + message(STATUS "Copying config file ${shortname}") + configure_file(${filename} ${shortname}) + endforeach() + endif(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${PROJECT_WGT_DIR}/etc") + + add_custom_command( + OUTPUT ${PROJECT_NAME}.wgt + DEPENDS ${PROJECT_NAME} ${EXTRA_LINK_LIBRARIES} ${conf_files} ${PROJECT_WGT_DIR}/config.xml + COMMAND rm -rf package + COMMAND mkdir -p package/lib package/htdocs package/etc + COMMAND cp config.xml package/ + COMMAND cp ${conf_files} package/etc + COMMAND cp ${CMAKE_CURRENT_SOURCE_DIR}/packaging/wgt/${PROJECT_ICON} package/icon.png + COMMAND cp ${PROJECT_NAME}.so package/lib + COMMAND wgtpkg-pack -f -o ${PROJECT_NAME}.wgt package + ) + add_custom_target(widget ALL DEPENDS ${PROJECT_NAME}.wgt)
\ No newline at end of file diff --git a/src/can/can-bus-dev.cpp b/low-can-binding/can/can-bus-dev.cpp index fb76498f..fb76498f 100644 --- a/src/can/can-bus-dev.cpp +++ b/low-can-binding/can/can-bus-dev.cpp diff --git a/src/can/can-bus-dev.hpp b/low-can-binding/can/can-bus-dev.hpp index a612e7d8..a612e7d8 100644 --- a/src/can/can-bus-dev.hpp +++ b/low-can-binding/can/can-bus-dev.hpp diff --git a/src/can/can-bus.cpp b/low-can-binding/can/can-bus.cpp index 33f58fd9..33f58fd9 100644 --- a/src/can/can-bus.cpp +++ b/low-can-binding/can/can-bus.cpp diff --git a/src/can/can-bus.hpp b/low-can-binding/can/can-bus.hpp index eb474769..eb474769 100644 --- a/src/can/can-bus.hpp +++ b/low-can-binding/can/can-bus.hpp diff --git a/src/can/can-command.hpp b/low-can-binding/can/can-command.hpp index 4cf20cb5..4cf20cb5 100644 --- a/src/can/can-command.hpp +++ b/low-can-binding/can/can-command.hpp diff --git a/src/can/can-decoder.cpp b/low-can-binding/can/can-decoder.cpp index 8843059d..8843059d 100644 --- a/src/can/can-decoder.cpp +++ b/low-can-binding/can/can-decoder.cpp diff --git a/src/can/can-decoder.hpp b/low-can-binding/can/can-decoder.hpp index ebe1de20..ebe1de20 100644 --- a/src/can/can-decoder.hpp +++ b/low-can-binding/can/can-decoder.hpp diff --git a/src/can/can-message-definition.cpp b/low-can-binding/can/can-message-definition.cpp index 206d0b0c..206d0b0c 100644 --- a/src/can/can-message-definition.cpp +++ b/low-can-binding/can/can-message-definition.cpp diff --git a/src/can/can-message-definition.hpp b/low-can-binding/can/can-message-definition.hpp index 98cb2c5d..98cb2c5d 100644 --- a/src/can/can-message-definition.hpp +++ b/low-can-binding/can/can-message-definition.hpp diff --git a/src/can/can-message-set.cpp b/low-can-binding/can/can-message-set.cpp index a9f8cf23..a9f8cf23 100644 --- a/src/can/can-message-set.cpp +++ b/low-can-binding/can/can-message-set.cpp diff --git a/src/can/can-message-set.hpp b/low-can-binding/can/can-message-set.hpp index 94e2d8d5..94e2d8d5 100644 --- a/src/can/can-message-set.hpp +++ b/low-can-binding/can/can-message-set.hpp diff --git a/src/can/can-message.cpp b/low-can-binding/can/can-message.cpp index f61de67e..f61de67e 100644 --- a/src/can/can-message.cpp +++ b/low-can-binding/can/can-message.cpp diff --git a/src/can/can-message.hpp b/low-can-binding/can/can-message.hpp index 6fe03172..6fe03172 100644 --- a/src/can/can-message.hpp +++ b/low-can-binding/can/can-message.hpp diff --git a/src/can/can-signals.cpp b/low-can-binding/can/can-signals.cpp index 6211fa1d..6211fa1d 100644 --- a/src/can/can-signals.cpp +++ b/low-can-binding/can/can-signals.cpp diff --git a/src/can/can-signals.hpp b/low-can-binding/can/can-signals.hpp index 34ebeebd..34ebeebd 100644 --- a/src/can/can-signals.hpp +++ b/low-can-binding/can/can-signals.hpp diff --git a/low-can-binding/configuration-generated.cpp b/low-can-binding/configuration-generated.cpp new file mode 100644 index 00000000..2e965703 --- /dev/null +++ b/low-can-binding/configuration-generated.cpp @@ -0,0 +1,350 @@ +#include "configuration.hpp" +#include "can/can-decoder.hpp" + +configuration_t::configuration_t() + : can_message_set_{{0, "example", 0, 1, 5, 0, 20}} + , can_message_definition_ + { + { + can_message_definition_t(0, "can0", 0x620, can_message_format_t::STANDARD, frequency_clock_t(0.00000f), true) + } + } + , can_signals_ + { + { + { + 0, + 0, + "doors.coffer.open", + 88, + 1, + 0.00000f, + 0, + 0, + 0, + frequency_clock_t(0.00000f), + true, + false, + { + }, + false, + decoder_t::booleanDecoder, + nullptr, + false + }, + { + 0, + 0, + "doors.driver.open", + 78, + 1, + 0.00000f, + 0, + 0, + 0, + frequency_clock_t(0.00000f), + true, + false, + { + }, + false, + decoder_t::booleanDecoder, + nullptr, + false + }, + { + 0, + 0, + "doors.passenger.open", + 79, + 1, + 0.00000f, + 0, + 0, + 0, + frequency_clock_t(0.00000f), + true, + false, + { + }, + false, + decoder_t::booleanDecoder, + nullptr, + false + }, + { + 0, + 0, + "doors.rearleft.open", + 86, + 1, + 0.00000f, + 0, + 0, + 0, + frequency_clock_t(0.00000f), + true, + false, + { + }, + false, + decoder_t::booleanDecoder, + nullptr, + false + }, + { + 0, + 0, + "doors.rearright.open", + 85, + 4, + 0.00000f, + 0, + 0, + 0, + frequency_clock_t(0.00000f), + true, + false, + { + }, + false, + decoder_t::booleanDecoder, + nullptr, + false + } + } + } + , diagnostic_messages_ + { + { + { + 4, + "engine.load", + 0, + 0, + UNIT::INVALID, + 5.00000f, + decoder_t::decode_obd2_response, + nullptr, + true + }, + { + 5, + "engine.coolant.temperature", + 0, + 0, + UNIT::INVALID, + 1.00000f, + decoder_t::decode_obd2_response, + nullptr, + true + }, + { + 10, + "fuel.pressure", + 0, + 0, + UNIT::INVALID, + 1.00000f, + decoder_t::decode_obd2_response, + nullptr, + true + }, + { + 11, + "intake.manifold.pressure", + 0, + 0, + UNIT::INVALID, + 1.00000f, + decoder_t::decode_obd2_response, + nullptr, + true + }, + { + 12, + "engine.speed", + 0, + 0, + UNIT::INVALID, + 5.00000f, + decoder_t::decode_obd2_response, + nullptr, + true + }, + { + 13, + "vehicle.speed", + 0, + 0, + UNIT::INVALID, + 5.00000f, + decoder_t::decode_obd2_response, + nullptr, + true + }, + { + 15, + "intake.air.temperature", + 0, + 0, + UNIT::INVALID, + 1.00000f, + decoder_t::decode_obd2_response, + nullptr, + true + }, + { + 16, + "mass.airflow", + 0, + 0, + UNIT::INVALID, + 5.00000f, + decoder_t::decode_obd2_response, + nullptr, + true + }, + { + 17, + "throttle.position", + 0, + 0, + UNIT::INVALID, + 5.00000f, + decoder_t::decode_obd2_response, + nullptr, + true + }, + { + 31, + "running.time", + 0, + 0, + UNIT::INVALID, + 1.00000f, + decoder_t::decode_obd2_response, + nullptr, + true + }, + { + 45, + "EGR.error", + 0, + 0, + UNIT::INVALID, + 0.00000f, + decoder_t::decode_obd2_response, + nullptr, + true + }, + { + 47, + "fuel.level", + 0, + 0, + UNIT::INVALID, + 1.00000f, + decoder_t::decode_obd2_response, + nullptr, + true + }, + { + 51, + "barometric.pressure", + 0, + 0, + UNIT::INVALID, + 1.00000f, + decoder_t::decode_obd2_response, + nullptr, + true + }, + { + 76, + "commanded.throttle.position", + 0, + 0, + UNIT::INVALID, + 1.00000f, + decoder_t::decode_obd2_response, + nullptr, + true + }, + { + 82, + "ethanol.fuel.percentage", + 0, + 0, + UNIT::INVALID, + 1.00000f, + decoder_t::decode_obd2_response, + nullptr, + true + }, + { + 90, + "accelerator.pedal.position", + 0, + 0, + UNIT::INVALID, + 5.00000f, + decoder_t::decode_obd2_response, + nullptr, + true + }, + { + 91, + "hybrid.battery-pack.remaining.life", + 0, + 0, + UNIT::INVALID, + 5.00000f, + decoder_t::decode_obd2_response, + nullptr, + true + }, + { + 92, + "engine.oil.temperature", + 0, + 0, + UNIT::INVALID, + 1.00000f, + decoder_t::decode_obd2_response, + nullptr, + true + }, + { + 94, + "engine.fuel.rate", + 0, + 0, + UNIT::INVALID, + 1.00000f, + decoder_t::decode_obd2_response, + nullptr, + true + }, + { + 99, + "engine.torque", + 0, + 0, + UNIT::INVALID, + 1.00000f, + decoder_t::decode_obd2_response, + nullptr, + true + } + } + } +{ +} + +const std::string configuration_t::get_diagnostic_bus() const +{ + return "can0"; +} + + diff --git a/src/configuration.cpp b/low-can-binding/configuration.cpp index 8a50cbc4..8a50cbc4 100644 --- a/src/configuration.cpp +++ b/low-can-binding/configuration.cpp diff --git a/src/configuration.hpp b/low-can-binding/configuration.hpp index 017b148d..017b148d 100644 --- a/src/configuration.hpp +++ b/low-can-binding/configuration.hpp diff --git a/src/diagnostic/active-diagnostic-request.cpp b/low-can-binding/diagnostic/active-diagnostic-request.cpp index 7ddf1d51..7ddf1d51 100644 --- a/src/diagnostic/active-diagnostic-request.cpp +++ b/low-can-binding/diagnostic/active-diagnostic-request.cpp diff --git a/src/diagnostic/active-diagnostic-request.hpp b/low-can-binding/diagnostic/active-diagnostic-request.hpp index 247eeb17..247eeb17 100644 --- a/src/diagnostic/active-diagnostic-request.hpp +++ b/low-can-binding/diagnostic/active-diagnostic-request.hpp diff --git a/src/diagnostic/diagnostic-manager.cpp b/low-can-binding/diagnostic/diagnostic-manager.cpp index e3a78d0f..e3a78d0f 100644 --- a/src/diagnostic/diagnostic-manager.cpp +++ b/low-can-binding/diagnostic/diagnostic-manager.cpp diff --git a/src/diagnostic/diagnostic-manager.hpp b/low-can-binding/diagnostic/diagnostic-manager.hpp index 3edb2b12..3edb2b12 100644 --- a/src/diagnostic/diagnostic-manager.hpp +++ b/low-can-binding/diagnostic/diagnostic-manager.hpp diff --git a/src/diagnostic/diagnostic-message.cpp b/low-can-binding/diagnostic/diagnostic-message.cpp index 6f615574..6f615574 100644 --- a/src/diagnostic/diagnostic-message.cpp +++ b/low-can-binding/diagnostic/diagnostic-message.cpp diff --git a/src/diagnostic/diagnostic-message.hpp b/low-can-binding/diagnostic/diagnostic-message.hpp index 064904d2..064904d2 100644 --- a/src/diagnostic/diagnostic-message.hpp +++ b/low-can-binding/diagnostic/diagnostic-message.hpp diff --git a/src/libs/bitfield-c b/low-can-binding/libs/bitfield-c -Subproject a34745ec93ae0a1d4f1b640dba8fb6702331a8e +Subproject a34745ec93ae0a1d4f1b640dba8fb6702331a8e diff --git a/src/libs/isotp-c b/low-can-binding/libs/isotp-c -Subproject ee24440b7c123ab1b0317e57be33e837a1cb51f +Subproject ee24440b7c123ab1b0317e57be33e837a1cb51f diff --git a/low-can-binding/libs/nanopb b/low-can-binding/libs/nanopb new file mode 160000 +Subproject 651bdc45f2180b17c132470ff1a3a515dbffaa7 diff --git a/src/libs/openxc-message-format b/low-can-binding/libs/openxc-message-format -Subproject d9f54f97578429773421abce98d5f6579717afc +Subproject d9f54f97578429773421abce98d5f6579717afc diff --git a/low-can-binding/libs/uds-c b/low-can-binding/libs/uds-c new file mode 160000 +Subproject ca20db3dd978871bbb9f01f3c862b510c03d1dc diff --git a/src/low-can-binding.cpp b/low-can-binding/low-can-binding.cpp index 07b3f1ea..07b3f1ea 100644 --- a/src/low-can-binding.cpp +++ b/low-can-binding/low-can-binding.cpp diff --git a/src/low-can-binding.hpp b/low-can-binding/low-can-binding.hpp index ed5741d8..ed5741d8 100644 --- a/src/low-can-binding.hpp +++ b/low-can-binding/low-can-binding.hpp diff --git a/src/config.xml.in b/low-can-binding/packaging/wgt/config.xml index d735ce2b..d735ce2b 100644 --- a/src/config.xml.in +++ b/low-can-binding/packaging/wgt/config.xml diff --git a/src/can_buses.json.in b/low-can-binding/packaging/wgt/etc/can_buses.json index c4292df2..c4292df2 100644 --- a/src/can_buses.json.in +++ b/low-can-binding/packaging/wgt/etc/can_buses.json diff --git a/src/icon.png b/low-can-binding/packaging/wgt/icon.png Binary files differindex 9bd6a6e4..9bd6a6e4 100644 --- a/src/icon.png +++ b/low-can-binding/packaging/wgt/icon.png diff --git a/src/CMakeLists.txt b/low-can-binding/subCMakeLists.txt index 4c4132b9..23869eff 100644 --- a/src/CMakeLists.txt +++ b/low-can-binding/subCMakeLists.txt @@ -70,10 +70,22 @@ link_libraries(${EXTRAS_LIBRARIES}) ########################################################################### # the library used by the binding : openxc, bitfield, uds, isotp -add_library(bitfield STATIC ${PROJECT_LIBDIR}/bitfield-c/src/bitfield/8byte.c ${PROJECT_LIBDIR}/bitfield-c/src/bitfield/bitarray.c ${PROJECT_LIBDIR}/bitfield-c/src/bitfield/bitfield.c ${PROJECT_LIBDIR}/bitfield-c/src/canutil/read.c ${PROJECT_LIBDIR}/bitfield-c/src/canutil/write.c) -add_library(isotp STATIC ${PROJECT_LIBDIR}/isotp-c/src/isotp/isotp.c ${PROJECT_LIBDIR}/isotp-c/src/isotp/receive.c ${PROJECT_LIBDIR}/isotp-c/src/isotp/send.c) -add_library(uds STATIC ${PROJECT_LIBDIR}/uds-c/src/uds/extras.c ${PROJECT_LIBDIR}/uds-c/src/uds/uds.c) -add_library(openxc STATIC ${PROJECT_LIBDIR}/openxc-message-format/gen/cpp/openxc.pb.c ${PROJECT_LIBDIR}/nanopb/pb_encode.c ${PROJECT_LIBDIR}/nanopb/pb_decode.c ${PROJECT_LIBDIR}/nanopb/pb_common.c) +# Bindings to compile +# -------------------- +file(GLOB filelist "${PROJECT_LIBDIR}/*") +foreach(filename ${filelist}) + if(IS_DIRECTORY ${filename}) + message(STATUS "${filename}") + file(GLOB_RECURSE c_list "*.[chpx]") + string(REGEX REPLACE "^.*\/(.*)$" "\\1" LIB_NAME ${filename}) + add_library(${LIB_NAME} STATIC ${c_list}) + endif(IS_DIRECTORY ${filename}) +endforeach() + +#add_library(bitfield STATIC ${PROJECT_LIBDIR}/bitfield-c/src/bitfield/8byte.c ${PROJECT_LIBDIR}/bitfield-c/src/bitfield/bitarray.c ${PROJECT_LIBDIR}/bitfield-c/src/bitfield/bitfield.c ${PROJECT_LIBDIR}/bitfield-c/src/canutil/read.c ${PROJECT_LIBDIR}/bitfield-c/src/canutil/write.c) +#add_library(isotp STATIC ${PROJECT_LIBDIR}/isotp-c/src/isotp/isotp.c ${PROJECT_LIBDIR}/isotp-c/src/isotp/receive.c ${PROJECT_LIBDIR}/isotp-c/src/isotp/send.c) +#add_library(uds STATIC ${PROJECT_LIBDIR}/uds-c/src/uds/extras.c ${PROJECT_LIBDIR}/uds-c/src/uds/uds.c) +#add_library(openxc STATIC ${PROJECT_LIBDIR}/openxc-message-format/gen/cpp/openxc.pb.c ${PROJECT_LIBDIR}/nanopb/pb_encode.c ${PROJECT_LIBDIR}/nanopb/pb_decode.c ${PROJECT_LIBDIR}/nanopb/pb_common.c) ########################################################################### # the binding for afb @@ -83,7 +95,7 @@ add_library(${PROJECT_NAME} MODULE ${PROJECT_NAME}.cpp configuration.cpp configu can/can-bus.cpp can/can-bus-dev.cpp can/can-message-set.cpp can/can-message-definition.cpp can/can-message.cpp can/can-signals.cpp can/can-decoder.cpp diagnostic/diagnostic-message.cpp diagnostic/diagnostic-manager.cpp diagnostic/active-diagnostic-request.cpp utils/signals.cpp utils/openxc-utils.cpp utils/timer.cpp utils/socket.cpp) -target_link_libraries(${PROJECT_NAME} pthread bitfield uds isotp openxc) +target_link_libraries(${PROJECT_NAME} pthread bitfield-c uds-c isotp-c openxc-message-format) set_target_properties(${PROJECT_NAME} PROPERTIES PREFIX "" diff --git a/src/utils/config-parser.cpp b/low-can-binding/utils/config-parser.cpp index e73b0f94..e73b0f94 100644 --- a/src/utils/config-parser.cpp +++ b/low-can-binding/utils/config-parser.cpp diff --git a/src/utils/config-parser.hpp b/low-can-binding/utils/config-parser.hpp index e6bd9d22..e6bd9d22 100644 --- a/src/utils/config-parser.hpp +++ b/low-can-binding/utils/config-parser.hpp diff --git a/src/utils/openxc-utils.cpp b/low-can-binding/utils/openxc-utils.cpp index 52b49d29..52b49d29 100644 --- a/src/utils/openxc-utils.cpp +++ b/low-can-binding/utils/openxc-utils.cpp diff --git a/src/utils/openxc-utils.hpp b/low-can-binding/utils/openxc-utils.hpp index d36b359b..d36b359b 100644 --- a/src/utils/openxc-utils.hpp +++ b/low-can-binding/utils/openxc-utils.hpp diff --git a/src/utils/signals.cpp b/low-can-binding/utils/signals.cpp index 2e14a98f..2e14a98f 100644 --- a/src/utils/signals.cpp +++ b/low-can-binding/utils/signals.cpp diff --git a/src/utils/signals.hpp b/low-can-binding/utils/signals.hpp index e9417569..e9417569 100644 --- a/src/utils/signals.hpp +++ b/low-can-binding/utils/signals.hpp diff --git a/src/utils/socket.cpp b/low-can-binding/utils/socket.cpp index e75e27f2..e75e27f2 100644 --- a/src/utils/socket.cpp +++ b/low-can-binding/utils/socket.cpp diff --git a/src/utils/socket.hpp b/low-can-binding/utils/socket.hpp index b42eee6a..b42eee6a 100644 --- a/src/utils/socket.hpp +++ b/low-can-binding/utils/socket.hpp diff --git a/src/utils/timer.cpp b/low-can-binding/utils/timer.cpp index a35a3e9f..a35a3e9f 100644 --- a/src/utils/timer.cpp +++ b/low-can-binding/utils/timer.cpp diff --git a/src/utils/timer.hpp b/low-can-binding/utils/timer.hpp index f5659044..f5659044 100644 --- a/src/utils/timer.hpp +++ b/low-can-binding/utils/timer.hpp diff --git a/src/libs/nanopb b/src/libs/nanopb deleted file mode 160000 -Subproject ffe4aff87cc3a15863c09aa808adf2381c8f2fb diff --git a/src/libs/uds-c b/src/libs/uds-c deleted file mode 160000 -Subproject e506334e270d77b20c0bc259ac6c7d8c9b702b7 |