Skip to content
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

[WIP]: uavcannode (v1) testing branch #14518

Closed
wants to merge 7 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@
path = src/drivers/gps/devices
url = https://github.com/PX4/GpsDrivers.git
branch = master
[submodule "src/drivers/uavcannode_v1/libcanard"]
path = src/drivers/uavcannode_v1/libcanard
url = https://github.com/UAVCAN/libcanard.git
[submodule "src/modules/micrortps_bridge/micro-CDR"]
path = src/modules/micrortps_bridge/micro-CDR
url = https://github.com/PX4/micro-CDR.git
Expand Down
1 change: 1 addition & 0 deletions Tools/astyle/files_to_check_code_style.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ exec find boards msg src platforms test \
-path platforms/nuttx/NuttX -prune -o \
-path platforms/qurt/dspal -prune -o \
-path src/drivers/uavcan/libuavcan -prune -o \
-path src/drivers/uavcannode_v1/libcanard -prune -o \
-path src/drivers/uavcan/uavcan_drivers/kinetis/driver/include/uavcan_kinetis -prune -o \
-path src/lib/ecl -prune -o \
-path src/lib/matrix -prune -o \
Expand Down
2 changes: 1 addition & 1 deletion boards/nxp/fmuk66-v3/socketcan.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ px4_add_board(
telemetry # all available telemetry drivers
#test_ppm # NOT Portable YET
tone_alarm
#uavcannode_v1
uavcannode_v1
MODULES
airspeed_selector
attitude_estimator_q
Expand Down
2 changes: 1 addition & 1 deletion boards/nxp/rddrone-uavcan146/default.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ px4_add_board(
#pwm_out
#safety_button
#tone_alarm
#uavcannode # TODO: CAN driver needed
uavcannode_v1
MODULES
#ekf2
#load_mon
Expand Down
9 changes: 9 additions & 0 deletions boards/nxp/rddrone-uavcan146/nuttx-config/scripts/script.ld
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,15 @@ SECTIONS
*(.init_array .init_array.*)
_einit = ABSOLUTE(.);
} > dflash

/*
* Construction data for parameters.
*/
__param ALIGN(4): {
__param_start = ABSOLUTE(.);
KEEP(*(__param*))
__param_end = ABSOLUTE(.);
} > dflash

/*
* Construction data for parameters.
Expand Down
2 changes: 1 addition & 1 deletion boards/px4/fmu-v4/cannode.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ px4_add_board(
#pwm_out
#safety_button
#tone_alarm
uavcannode
uavcannode_v0
MODULES
#ekf2
#load_mon
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,8 @@ add_custom_command(OUTPUT px4_uavcan_dsdlc_run.stamp
add_custom_target(px4_uavcan_dsdlc DEPENDS px4_uavcan_dsdlc_run.stamp)

px4_add_module(
MODULE drivers__uavcannode
MAIN uavcannode
MODULE drivers__uavcannode_v0
MAIN uavcannode_v0
INCLUDES
${DSDLC_OUTPUT}
${LIBUAVCAN_DIR}/libuavcan/include
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -582,7 +582,7 @@ extern "C" int uavcannode_start(int argc, char *argv[])
return rv;
}

extern "C" __EXPORT int uavcannode_main(int argc, char *argv[])
extern "C" __EXPORT int uavcannode_v0_main(int argc, char *argv[])
{
if (argc < 2) {
print_usage();
Expand Down
71 changes: 71 additions & 0 deletions src/drivers/uavcannode_v1/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
############################################################################
#
# Copyright (c) 2020 PX4 Development Team. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in
# the documentation and/or other materials provided with the
# distribution.
# 3. Neither the name PX4 nor the names of its contributors may be
# used to endorse or promote products derived from this software
# without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
#
############################################################################

set(LIBCANARD_DIR ${CMAKE_CURRENT_SOURCE_DIR}/libcanard)

px4_add_git_submodule(TARGET git_libcanard PATH ${LIBCANARD_DIR})

add_definitions(
-DCONFIG_EXAMPLES_LIBCANARDV1_DEV="can0"
-DCONFIG_EXAMPLES_LIBCANARDV1_NODE_ID=2
-DCONFIG_EXAMPLES_LIBCANARDV1_APP_NODE_NAME="org.uavcan.libcanardv1.nuttx.demo"
-DCONFIG_EXAMPLES_LIBCANARDV1_NODE_MEM_POOL_SIZE=4096
-DCONFIG_EXAMPLES_LIBCANARDV1_DAEMON_STACK_SIZE=5000
-DCONFIG_EXAMPLES_LIBCANARDV1_DAEMON_PRIORITY=100
-DCANARD_DSDL_CONFIG_LITTLE_ENDIAN=1
)

px4_add_module(
MODULE drivers__uavcannode-v1
MAIN uavcannode_v1
COMPILE_FLAGS
-Wno-error
-DUINT32_C\(x\)=__UINT32_C\(x\)
INCLUDES
${LIBCANARD_DIR}/libcanard/
SRCS
canard_main.c
socketcan.c
socketcan.h
uorb_converter.c
uorb_converter.h
o1heap.c
o1heap.h
${LIBCANARD_DIR}/libcanard/canard_dsdl.c
${LIBCANARD_DIR}/libcanard/canard_dsdl.h
${LIBCANARD_DIR}/libcanard/canard.c
${LIBCANARD_DIR}/libcanard/canard.h
DEPENDS
git_libcanard
version
)
Loading