-
Notifications
You must be signed in to change notification settings - Fork 654
DroneCAN add socketcan support, rename to DroneCAN #1558
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| /libcanard | ||
| /*.zip |
| 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 |
|---|---|---|
| @@ -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) | ||
| 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) | ||
|
Contributor
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. use DOWNLOAD macro
Contributor
Author
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 may have missed something, but where's this new DOWNLOAD macro documented?
Contributor
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. 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) | ||
|
Contributor
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. 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 | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| /libcanard | ||
| /o1heap | ||
| /*.zip |
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.
why need $(WD)