Skip to content
Merged
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
1 change: 0 additions & 1 deletion canutils/libcanardv0/.gitignore

This file was deleted.

27 changes: 0 additions & 27 deletions canutils/libcanardv0/Kconfig

This file was deleted.

71 changes: 0 additions & 71 deletions canutils/libcanardv0/Makefile

This file was deleted.

2 changes: 0 additions & 2 deletions canutils/libcanardv1/.gitignore

This file was deleted.

2 changes: 2 additions & 0 deletions canutils/libdronecan/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/libcanard
/*.zip
37 changes: 37 additions & 0 deletions canutils/libdronecan/Kconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#
# For a description of the syntax of this configuration file,
# see the file kconfig-language.txt in the NuttX tools repository.
#

config CANUTILS_LIBDRONECAN
bool "libcanard DroneCAN Library"
default n
depends on (CAN && CAN_EXTID) || NET_CAN
---help---
Enable the libcanard DroneCAN library.

if CANUTILS_LIBDRONECAN

config LIBDRONECAN_URL
string "libcanard URL"
default "https://github.com/dronecan/libcanard/archive"
---help---
libcanard URL.

config LIBDRONECAN_VERSION
string "libcanard Version"
default "21f2a73df86886101e254d02cfc2277cd2a15717"
---help---
libcanard version.

config LIBDRONECAN_CANFD
bool "(Experimental) libcanard CAN FD Support"
default n
depends on NET_CAN_CANFD && EXPERIMENTAL
---help---
libcanard CAN FD support.
Adds support for CAN FD, this is still experimental
since libcanard doesn't support runtime switching
between CAN2.0B and CAN FD that well

endif
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
############################################################################
# apps/canutils/libcanardv0/Make.defs
# apps/canutils/libdronecan/Make.defs
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
Expand All @@ -18,6 +18,12 @@
#
############################################################################

ifneq ($(CONFIG_CANUTILS_LIBCANARDV0),)
CONFIGURED_APPS += $(APPDIR)/canutils/libcanardv0
ifneq ($(CONFIG_CANUTILS_LIBDRONECAN),)
CONFIGURED_APPS += $(APPDIR)/canutils/libdronecan

ifeq ($(CONFIG_NET_CAN),y)
CFLAGS += ${INCDIR_PREFIX}$(APPDIR)/canutils/libdronecan/libcanard/drivers/socketcan
CXXFLAGS += ${INCDIR_PREFIX}$(APPDIR)/canutils/libdronecan/libcanard/drivers/socketcan
endif

endif
83 changes: 83 additions & 0 deletions canutils/libdronecan/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
############################################################################
# apps/canutils/libdronecan/Makefile
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership. The
# ASF licenses this file to you 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.
#
############################################################################

include $(APPDIR)/Make.defs

WD := ${shell echo $(CURDIR) | sed -e 's/ /\\ /g'}

UNPACK = unzip
PACKEXT = .zip

LIBDRONECAN_URL = $(patsubst "%",%,$(strip $(CONFIG_LIBDRONECAN_URL)))
LIBDRONECAN_VERSION = $(patsubst "%",%,$(strip $(CONFIG_LIBDRONECAN_VERSION)))

LIBDRONECAN_PACKNAME = $(LIBDRONECAN_UNPACKNAME)$(PACKEXT)
LIBDRONECAN_UNPACKNAME = libcanard-$(LIBDRONECAN_VERSION)
LIBDRONECAN_SRCNAME = libcanard

LIBDRONECAN_SRCDIR = $(WD)/$(LIBDRONECAN_SRCNAME)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why need $(WD)

LIBDRONECAN_DRVDIR = $(LIBDRONECAN_SRCDIR)$(DELIM)drivers$(DELIM)nuttx
LIBDRONECAN_SOCKETCANDIR = $(LIBDRONECAN_SRCDIR)$(DELIM)drivers$(DELIM)socketcan

# Conflict with Cyphal's libcanard
ifeq ($(CONFIG_CANUTILS_LIBOPENCYPHAL),y)
CFLAGS += -DcanardInit=dronecanardInit
endif

CFLAGS += -std=c99 -DCANARD_ASSERT=DEBUGASSERT
CFLAGS += ${INCDIR_PREFIX}$(APPDIR)/canutils/libdronecan/libcanard

ifeq ($(CONFIG_LIBDRONECAN_CANFD),y)
CFLAGS += -DCANARD_ENABLE_CANFD=1
endif

CSRCS = $(LIBDRONECAN_SRCDIR)$(DELIM)canard.c

ifeq ($(CONFIG_NET_CAN),y)
CSRCS += $(LIBDRONECAN_SOCKETCANDIR)$(DELIM)socketcan.c
else
CSRCS += $(LIBDRONECAN_DRVDIR)$(DELIM)canard_nuttx.c
endif

# Download and unpack tarball if no git repo found
ifeq ($(wildcard $(LIBDRONECAN_SRCNAME)/.git),)
$(LIBDRONECAN_PACKNAME):
@echo "Downloading: $@"
$(Q) curl -o $@ -L $(LIBDRONECAN_URL)$(DELIM)$(LIBDRONECAN_VERSION)$(PACKEXT)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use DOWNLOAD macro

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I may have missed something, but where's this new DOWNLOAD macro documented?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please reference: apache/nuttx#8759


$(LIBDRONECAN_SRCNAME): $(LIBDRONECAN_PACKNAME)
@echo "Unpacking: $< -> $@"
$(call DELDIR, $@)
$(Q) $(UNPACK) $<
$(Q) mv $(LIBDRONECAN_UNPACKNAME) $(LIBDRONECAN_SRCNAME)
$(Q) touch $@

$(LIBDRONECAN_SRCDIR)$(DELIM)canard.c: $(LIBDRONECAN_SRCNAME)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why need this rule

endif

context:: $(LIBDRONECAN_SRCNAME)

distclean::
ifeq ($(wildcard $(LIBDRONECAN_SRCNAME)/.git),)
$(call DELDIR, $(LIBDRONECAN_SRCNAME))
$(call DELFILE, $(LIBDRONECAN_PACKNAME))
endif

include $(APPDIR)/Application.mk
3 changes: 3 additions & 0 deletions canutils/libopencyphal/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
/libcanard
/o1heap
/*.zip
18 changes: 9 additions & 9 deletions canutils/libcanardv1/Kconfig → canutils/libopencyphal/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,22 @@
# see the file kconfig-language.txt in the NuttX tools repository.
#

config CANUTILS_LIBCANARDV1
bool "libcanard UAVCAN v1 Library"
config CANUTILS_LIBOPENCYPHAL
bool "libcanard OpenCyphal Cyphal/CAN Library"
default n
depends on NET_CAN && ALLOW_MIT_COMPONENTS
---help---
Enable the libcanard UAVCAN v1 library.
Enable the OpenCyphal Cyphal/CAN library.

if CANUTILS_LIBCANARDV1
if CANUTILS_LIBOPENCYPHAL

config LIBCANARDV1_URL
config LIBOPENCYPHAL_URL
string "libcanard URL"
default "https://github.com/UAVCAN/libcanard/archive"
default "https://github.com/OpenCyphal/libcanard/archive"
---help---
libcanard URL.

config LIBCANARDV1_VERSION
config LIBOPENCYPHAL_VERSION
string "libcanard Version"
default "cde670347425023480a1417fcd603b27c8eb06c1"
---help---
Expand All @@ -28,12 +28,12 @@ config O1HEAP_URL
string "O(1) heap URL"
default "https://github.com/pavel-kirienko/o1heap/archive"
---help---
libcanard URL.
O(1) heap allocator URL.

config O1HEAP_VERSION
string "O(1) heap Version"
default "b21b069e4b971d3016dd232784faca6f7d9fd724"
---help---
libcanard version.
O(1) heap allocator version.

endif
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
############################################################################
# apps/canutils/libcanardv1/Make.defs
# apps/canutils/libopencyphal/Make.defs
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
Expand All @@ -18,6 +18,10 @@
#
############################################################################

ifneq ($(CONFIG_CANUTILS_LIBCANARDV1),)
CONFIGURED_APPS += $(APPDIR)/canutils/libcanardv1
ifneq ($(CONFIG_CANUTILS_LIBOPENCYPHAL),)
CONFIGURED_APPS += $(APPDIR)/canutils/libopencyphal

CFLAGS += ${INCDIR_PREFIX}$(APPDIR)/canutils/libopencyphal/o1heap/o1heap
CXXFLAGS += ${INCDIR_PREFIX}$(APPDIR)/canutils/libopencyphal/o1heap/o1heap

endif
Loading