modules: canopennode: move glue code to modules directory

Move the Zephyr-specific interface and support code for CANopenNode into
the modules directory. Consolidate the CMakeLists.txt files into one.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
This commit is contained in:
Henrik Brix Andersen 2021-06-12 17:25:20 +02:00 committed by Anas Nashif
parent aab30dad6f
commit d679037643
16 changed files with 72 additions and 38 deletions

View file

@ -9,7 +9,6 @@ comment "Optional modules. Make sure they're installed, via the project manifest
source "modules/Kconfig.altera"
source "modules/Kconfig.atmel"
source "modules/Kconfig.canopennode"
source "modules/Kconfig.civetweb"
source "modules/Kconfig.cmsis"
source "modules/Kconfig.cypress"
@ -64,6 +63,9 @@ comment "Lz4 module not available."
comment "loramac-node module not available."
depends on !ZEPHYR_LORAMAC_NODE_MODULE
comment "CANopenNode module not available."
depends on !ZEPHYR_CANOPENNODE_MODULE
# This ensures that symbols are available in Kconfig for dependency checking
# and referencing, while keeping the settings themselves unavailable when the
# modules are not present in the workspace

View file

@ -1,9 +0,0 @@
# CANopenNode CANopen protocol stack
# Copyright (c) 2019 Vestas Wind System A/S
# SPDX-License-Identifier: Apache-2.0
config CANOPENNODE
bool "CANopenNode Support"
help
This option enables the CANopenNode library.

View file

@ -0,0 +1,36 @@
# SPDX-License-Identifier: Apache-2.0
if(CONFIG_CANOPENNODE)
set(CANOPENNODE_DIR ${ZEPHYR_CURRENT_MODULE_DIR})
zephyr_library()
zephyr_include_directories(
${CANOPENNODE_DIR}
${CANOPENNODE_DIR}/stack
.
)
zephyr_library_sources(
${CANOPENNODE_DIR}/CANopen.c
${CANOPENNODE_DIR}/stack/CO_Emergency.c
${CANOPENNODE_DIR}/stack/CO_HBconsumer.c
${CANOPENNODE_DIR}/stack/CO_LSSmaster.c
${CANOPENNODE_DIR}/stack/CO_LSSslave.c
${CANOPENNODE_DIR}/stack/CO_NMT_Heartbeat.c
${CANOPENNODE_DIR}/stack/CO_PDO.c
${CANOPENNODE_DIR}/stack/CO_SDO.c
${CANOPENNODE_DIR}/stack/CO_SDOmaster.c
${CANOPENNODE_DIR}/stack/CO_SYNC.c
${CANOPENNODE_DIR}/stack/CO_TIME.c
${CANOPENNODE_DIR}/stack/CO_trace.c
CO_driver.c
)
zephyr_library_sources_ifdef(CONFIG_CANOPEN_SYNC_THREAD canopen_sync.c)
zephyr_library_sources_ifdef(CONFIG_CANOPEN_STORAGE canopen_storage.c)
zephyr_library_sources_ifdef(CONFIG_CANOPEN_LEDS canopen_leds.c)
zephyr_library_sources_ifdef(CONFIG_CANOPEN_PROGRAM_DOWNLOAD canopen_program.c)
endif()

View file

@ -4,8 +4,8 @@
* SPDX-License-Identifier: Apache-2.0
*/
#ifndef ZEPHYR_SUBSYS_CANBUS_CANOPEN_CO_DRIVER_H
#define ZEPHYR_SUBSYS_CANBUS_CANOPEN_CO_DRIVER_H
#ifndef ZEPHYR_MODULES_CANOPENNODE_CO_DRIVER_H
#define ZEPHYR_MODULES_CANOPENNODE_CO_DRIVER_H
/*
* Zephyr RTOS CAN driver interface and configuration for CANopenNode
@ -120,4 +120,4 @@ void canopen_od_unlock(void);
}
#endif
#endif /* ZEPHYR_SUBSYS_CANBUS_CANOPEN_CO_DRIVER_H */
#endif /* ZEPHYR_MODULES_CANOPENNODE_CO_DRIVER_H */

View file

@ -1,22 +1,18 @@
# CANopen configuration options
# CANopenNode CANopen protocol stack configuration options
# Copyright (c) 2019 Vestas Wind Systems A/S
# SPDX-License-Identifier: Apache-2.0
menuconfig CANOPEN
bool "CANopen protocol support"
config ZEPHYR_CANOPENNODE_MODULE
bool
config CANOPENNODE
bool "CANopenNode support"
depends on CAN
select CANOPENNODE
help
Enable CANopen (EN 50325-4) (CiA 301) protocol
support. Support is provided by the 3rd party CANopenNode
protocol stack.
This option enables the CANopenNode library.
if CANOPEN
module = CANOPEN
module-str = CANOPEN
source "subsys/logging/Kconfig.template.log_config"
if CANOPENNODE
config CANOPEN_SDO_BUFFER_SIZE
int "CANopen SDO buffer size"
@ -113,4 +109,4 @@ config CANOPEN_PROGRAM_DOWNLOAD
Enable support for program download over CANopen according
to the CiA 302-3 (draft) specification.
endif # CANOPEN
endif # CANOPENNODE

View file

@ -1,4 +1,3 @@
# SPDX-License-Identifier: Apache-2.0
add_subdirectory_ifdef(CONFIG_CANOPEN canopen)
add_subdirectory_ifdef(CONFIG_ISOTP isotp)

View file

@ -5,7 +5,7 @@
menu "Controller Area Network (CAN) bus subsystem"
source "subsys/canbus/canopen/Kconfig"
source "subsys/canbus/Kconfig.canopen"
source "subsys/canbus/isotp/Kconfig"
endmenu

View file

@ -0,0 +1,19 @@
# Copyright (c) 2019 - 2021 Vestas Wind Systems A/S
# SPDX-License-Identifier: Apache-2.0
menuconfig CANOPEN
bool "CANopen protocol support"
depends on CAN
select CANOPENNODE
help
Enable CANopen (EN 50325-4) (CiA 301) protocol
support. Support is provided by the 3rd party CANopenNode
protocol stack.
if CANOPEN
module = CANOPEN
module-str = CANopen
source "subsys/logging/Kconfig.template.log_config"
endif # CANOPEN

View file

@ -1,9 +0,0 @@
# SPDX-License-Identifier: Apache-2.0
zephyr_library()
zephyr_library_sources_ifdef(CONFIG_CANOPEN CO_driver.c)
zephyr_library_sources_ifdef(CONFIG_CANOPEN_SYNC_THREAD canopen_sync.c)
zephyr_library_sources_ifdef(CONFIG_CANOPEN_STORAGE canopen_storage.c)
zephyr_library_sources_ifdef(CONFIG_CANOPEN_LEDS canopen_leds.c)
zephyr_library_sources_ifdef(CONFIG_CANOPEN_PROGRAM_DOWNLOAD canopen_program.c)
zephyr_include_directories(.)

View file

@ -26,7 +26,7 @@ manifest:
# Please add items below based on alphabetical order
projects:
- name: canopennode
revision: 468d350028a975b96563e58344de48281a0ab371
revision: f167efe85c8c7de886f1bc47f9173cfb8a346bb5
path: modules/lib/canopennode
- name: civetweb
revision: 094aeb41bb93e9199d24d665ee43e9e05d6d7b1c