Skip to content

Commit 28980b3

Browse files
Rename canardv1 to OpenCyphal
1 parent d6d243c commit 28980b3

File tree

16 files changed

+104
-100
lines changed

16 files changed

+104
-100
lines changed

canutils/libcanardv1/.gitignore

Lines changed: 0 additions & 2 deletions
This file was deleted.

canutils/libdronecan/.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1-
/libcanard-*
1+
/libcanard
2+
/*.zip

canutils/libdronecan/Make.defs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,6 @@
2121
ifneq ($(CONFIG_CANUTILS_LIBDRONECAN),)
2222
CONFIGURED_APPS += $(APPDIR)/canutils/libdronecan
2323

24-
CFLAGS += ${INCDIR_PREFIX}$(APPDIR)/canutils/libdronecan/libcanard
25-
CXXFLAGS += ${INCDIR_PREFIX}$(APPDIR)/canutils/libdronecan/libcanard
26-
2724

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

canutils/libdronecan/Makefile

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,16 +36,13 @@ LIBDRONECAN_SRCDIR = $(WD)/$(LIBDRONECAN_SRCNAME)
3636
LIBDRONECAN_DRVDIR = $(LIBDRONECAN_SRCDIR)$(DELIM)drivers$(DELIM)nuttx
3737
LIBDRONECAN_SOCKETCANDIR = $(LIBDRONECAN_SRCDIR)$(DELIM)drivers$(DELIM)socketcan
3838

39-
APPS_INCDIR = $(APPDIR)$(DELIM)include$(DELIM)canutils
40-
4139
# Conflict with Cyphal's libcanard
42-
ifeq ($(CONFIG_CANUTILS_LIBCANARDV1),y)
43-
APPS_INCDIR = $(APPDIR)$(DELIM)include$(DELIM)canutils$(DELIM)dronecan
44-
CFLAGS += -DcanardInit=dronecanardInit -I$(APPS_INCDIR)
40+
ifeq ($(CONFIG_CANUTILS_LIBOPENCYPHAL),y)
41+
CFLAGS += -DcanardInit=dronecanardInit
4542
endif
4643

4744
CFLAGS += -std=c99 -DCANARD_ASSERT=DEBUGASSERT
48-
CFLAGS += ${shell $(INCDIR) "$(CC)" $(APPS_INCDIR)}
45+
CFLAGS += ${INCDIR_PREFIX}$(APPDIR)/canutils/libdronecan/libcanard
4946

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

canutils/libopencyphal/.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
/libcanard
2+
/o1heap
3+
/*.zip

canutils/libcanardv1/Kconfig renamed to canutils/libopencyphal/Kconfig

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,22 +3,22 @@
33
# see the file kconfig-language.txt in the NuttX tools repository.
44
#
55

6-
config CANUTILS_LIBCANARDV1
7-
bool "libcanard UAVCAN v1 Library"
6+
config CANUTILS_LIBOPENCYPHAL
7+
bool "libcanard OpenCyphal Cyphal/CAN Library"
88
default n
99
depends on NET_CAN && ALLOW_MIT_COMPONENTS
1010
---help---
11-
Enable the libcanard UAVCAN v1 library.
11+
Enable the OpenCyphal Cyphal/CAN library.
1212

13-
if CANUTILS_LIBCANARDV1
13+
if CANUTILS_LIBOPENCYPHAL
1414

15-
config LIBCANARDV1_URL
15+
config LIBOPENCYPHAL_URL
1616
string "libcanard URL"
17-
default "https://github.com/UAVCAN/libcanard/archive"
17+
default "https://github.com/OpenCyphal/libcanard/archive"
1818
---help---
1919
libcanard URL.
2020

21-
config LIBCANARDV1_VERSION
21+
config LIBOPENCYPHAL_VERSION
2222
string "libcanard Version"
2323
default "cde670347425023480a1417fcd603b27c8eb06c1"
2424
---help---
@@ -28,12 +28,12 @@ config O1HEAP_URL
2828
string "O(1) heap URL"
2929
default "https://github.com/pavel-kirienko/o1heap/archive"
3030
---help---
31-
libcanard URL.
31+
O(1) heap allocator URL.
3232

3333
config O1HEAP_VERSION
3434
string "O(1) heap Version"
3535
default "b21b069e4b971d3016dd232784faca6f7d9fd724"
3636
---help---
37-
libcanard version.
37+
O(1) heap allocator version.
3838

3939
endif

canutils/libcanardv1/Make.defs renamed to canutils/libopencyphal/Make.defs

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
############################################################################
2-
# apps/canutils/libcanardv1/Make.defs
2+
# apps/canutils/libopencyphal/Make.defs
33
#
44
# Licensed to the Apache Software Foundation (ASF) under one or more
55
# contributor license agreements. See the NOTICE file distributed with
@@ -18,6 +18,11 @@
1818
#
1919
############################################################################
2020

21-
ifneq ($(CONFIG_CANUTILS_LIBCANARDV1),)
22-
CONFIGURED_APPS += $(APPDIR)/canutils/libcanardv1
21+
ifneq ($(CONFIG_CANUTILS_LIBOPENCYPHAL),)
22+
CONFIGURED_APPS += $(APPDIR)/canutils/libopencyphal
23+
24+
25+
CFLAGS += ${INCDIR_PREFIX}$(APPDIR)/canutils/libopencyphal/o1heap/o1heap
26+
CXXFLAGS += ${INCDIR_PREFIX}$(APPDIR)/canutils/libopencyphal/o1heap/o1heap
27+
2328
endif
Lines changed: 35 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
############################################################################
2-
# apps/canutils/libcanardv1/Makefile
2+
# apps/canutils/libopencyphal/Makefile
33
#
44
# Licensed to the Apache Software Foundation (ASF) under one or more
55
# contributor license agreements. See the NOTICE file distributed with
@@ -20,81 +20,75 @@
2020

2121
include $(APPDIR)/Make.defs
2222

23+
WD := ${shell echo $(CURDIR) | sed -e 's/ /\\ /g'}
24+
2325
UNPACK = unzip
2426
PACKEXT = .zip
2527

26-
LIBCANARDV1_URL = $(patsubst "%",%,$(strip $(CONFIG_LIBCANARDV1_URL)))
27-
LIBCANARDV1_VERSION = $(patsubst "%",%,$(strip $(CONFIG_LIBCANARDV1_VERSION)))
28-
LIBCANARDV1_UNPACKNAME = libcanard-$(LIBCANARDV1_VERSION)
29-
LIBCANARDV1_PACKNAME = $(LIBCANARDV1_UNPACKNAME)$(PACKEXT)
30-
LIBCANARDV1_SRCDIR = $(LIBCANARDV1_UNPACKNAME)
31-
LIBCANARDV1_DRVDIR = $(LIBCANARDV1_SRCDIR)$(DELIM)libcanard
28+
LIBOPENCYPHAL_URL = $(patsubst "%",%,$(strip $(CONFIG_LIBOPENCYPHAL_URL)))
29+
LIBOPENCYPHAL_VERSION = $(patsubst "%",%,$(strip $(CONFIG_LIBOPENCYPHAL_VERSION)))
30+
31+
LIBOPENCYPHAL_PACKNAME = $(LIBOPENCYPHAL_UNPACKNAME)$(PACKEXT)
32+
LIBOPENCYPHAL_UNPACKNAME = libcanard-$(LIBOPENCYPHAL_VERSION)
33+
LIBOPENCYPHAL_SRCNAME = libcanard
34+
35+
LIBOPENCYPHAL_SRCDIR = $(WD)/$(LIBOPENCYPHAL_SRCNAME)
36+
LIBOPENCYPHAL_DRVDIR = $(LIBOPENCYPHAL_SRCDIR)$(DELIM)libcanard
3237

3338
O1HEAP_URL = $(patsubst "%",%,$(strip $(CONFIG_O1HEAP_URL)))
3439
O1HEAP_VERSION = $(patsubst "%",%,$(strip $(CONFIG_O1HEAP_VERSION)))
35-
O1HEAP_UNPACKNAME = o1heap-$(O1HEAP_VERSION)
40+
3641
O1HEAP_PACKNAME = $(O1HEAP_UNPACKNAME)$(PACKEXT)
37-
O1HEAP_SRCDIR = $(O1HEAP_UNPACKNAME)
38-
O1HEAP_DRVDIR = $(O1HEAP_SRCDIR)$(DELIM)o1heap
42+
O1HEAP_UNPACKNAME = o1heap-$(O1HEAP_VERSION)
43+
O1HEAP_SRCNAME = o1heap
3944

40-
APPS_INCDIR = $(APPDIR)$(DELIM)include$(DELIM)canutils
45+
O1HEAP_SRCDIR = $(WD)/$(O1HEAP_SRCNAME)
46+
O1HEAP_DRVDIR = $(O1HEAP_SRCDIR)$(DELIM)o1heap
4147

4248
CFLAGS += -std=c11 -DCANARD_ASSERT=DEBUGASSERT -DCANARD_DSDL_CONFIG_LITTLE_ENDIAN=1
43-
CFLAGS += ${INCDIR_PREFIX}$(APPS_INCDIR)
4449

45-
CSRCS = $(LIBCANARDV1_DRVDIR)$(DELIM)canard.c $(LIBCANARDV1_DRVDIR)$(DELIM)canard_dsdl.c
50+
CSRCS = $(LIBOPENCYPHAL_DRVDIR)$(DELIM)canard.c $(LIBOPENCYPHAL_DRVDIR)$(DELIM)canard_dsdl.c
4651
CSRCS += $(O1HEAP_DRVDIR)$(DELIM)o1heap.c
4752

48-
49-
$(LIBCANARDV1_PACKNAME):
53+
ifeq ($(wildcard $(LIBOPENCYPHAL_SRCNAME)/.git),)
54+
$(LIBOPENCYPHAL_PACKNAME):
5055
@echo "Downloading: $@"
51-
$(Q) curl -o $@ -L $(LIBCANARDV1_URL)$(DELIM)$(LIBCANARDV1_VERSION)$(PACKEXT)
56+
$(Q) curl -o $@ -L $(LIBOPENCYPHAL_URL)$(DELIM)$(LIBOPENCYPHAL_VERSION)$(PACKEXT)
5257

53-
$(LIBCANARDV1_UNPACKNAME): $(LIBCANARDV1_PACKNAME)
58+
$(LIBOPENCYPHAL_SRCNAME): $(LIBOPENCYPHAL_PACKNAME)
5459
@echo "Unpacking: $< -> $@"
5560
$(call DELDIR, $@)
5661
$(Q) $(UNPACK) $<
62+
$(Q) mv $(LIBOPENCYPHAL_UNPACKNAME) $(LIBOPENCYPHAL_SRCNAME)
5763
$(Q) touch $@
64+
65+
$(LIBOPENCYPHAL_DRVDIR)$(DELIM)canard.c: $(LIBOPENCYPHAL_SRCNAME)
66+
endif
5867

68+
ifeq ($(wildcard $(O1HEAP_SRCNAME)/.git),)
5969
$(O1HEAP_PACKNAME):
6070
@echo "Downloading: $@"
6171
$(Q) curl -o $@ -L $(O1HEAP_URL)$(DELIM)$(O1HEAP_VERSION)$(PACKEXT)
6272

63-
$(O1HEAP_UNPACKNAME): $(O1HEAP_PACKNAME)
73+
$(O1HEAP_SRCNAME): $(O1HEAP_PACKNAME)
6474
@echo "Unpacking: $< -> $@"
6575
$(call DELDIR, $@)
6676
$(Q) $(UNPACK) $<
77+
$(Q) mv $(O1HEAP_UNPACKNAME) $(O1HEAP_SRCNAME)
6778
$(Q) touch $@
6879

69-
$(LIBCANARDV1_DRVDIR)$(DELIM)canard.h: $(LIBCANARDV1_UNPACKNAME)
70-
71-
$(LIBCANARDV1_DRVDIR)$(DELIM)canard_dsdl.h: $(LIBCANARDV1_UNPACKNAME)
72-
73-
$(O1HEAP_DRVDIR)$(DELIM)o1heap.h: $(O1HEAP_UNPACKNAME)
74-
75-
$(APPS_INCDIR)$(DELIM)canard.h: $(LIBCANARDV1_DRVDIR)$(DELIM)canard.h
76-
$(Q) cp $< $@
80+
$(O1HEAP_DRVDIR)$(DELIM)o1heap.c: $(O1HEAP_SRCNAME)
81+
endif
7782

78-
$(APPS_INCDIR)$(DELIM)canard_dsdl.h: $(LIBCANARDV1_DRVDIR)$(DELIM)canard_dsdl.h
79-
$(Q) cp $< $@
80-
81-
$(APPS_INCDIR)$(DELIM)o1heap.h: $(O1HEAP_DRVDIR)$(DELIM)o1heap.h
82-
$(Q) cp $< $@
83-
84-
context:: $(APPS_INCDIR)$(DELIM)canard.h $(APPS_INCDIR)$(DELIM)canard_dsdl.h $(APPS_INCDIR)$(DELIM)o1heap.h
83+
context:: $(LIBOPENCYPHAL_SRCNAME) $(O1HEAP_SRCNAME)
8584

8685
clean::
8786
$(foreach OBJ, $(OBJS), $(call DELFILE, $(OBJ)))
8887

8988
distclean::
90-
$(call DELFILE, $(APPS_INCDIR)$(DELIM)canard.h)
91-
$(call DELFILE, $(APPS_INCDIR)$(DELIM)canard_dsdl.h)
92-
$(call DELDIR, $(LIBCANARDV1_UNPACKNAME))
93-
$(call DELFILE, $(LIBCANARDV1_PACKNAME))
94-
$(call DELDIR, $(O1HEAP_UNPACKNAME))
95-
$(call DELFILE, $(O1HEAP_PACKNAME))
96-
$(call DELFILE, $(APPS_INCDIR)$(DELIM)o1heap.h)
97-
$(call DELDIR, $(O1HEAP_UNPACKNAME))
89+
$(call DELDIR, $(LIBOPENCYPHAL_SRCNAME))
90+
$(call DELFILE, $(LIBOPENCYPHAL_PACKNAME))
91+
$(call DELDIR, $(O1HEAP_SRCNAME))
9892
$(call DELFILE, $(O1HEAP_PACKNAME))
9993

10094
include $(APPDIR)/Application.mk

examples/dronecan/Makefile

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,13 @@ PRIORITY = SCHED_PRIORITY_DEFAULT
2525
STACKSIZE = $(CONFIG_EXAMPLES_DRONECAN_STACKSIZE)
2626
MODULE = $(CONFIG_EXAMPLES_DRONECAN)
2727

28-
CFLAGS += ${INCDIR_PREFIX}$(APPDIR)/include/canutils
28+
# Conflict with Cyphal's libcanard
29+
ifeq ($(CONFIG_CANUTILS_LIBOPENCYPHAL),y)
30+
CFLAGS += -DcanardInit=dronecanardInit
31+
endif
32+
33+
CFLAGS += ${INCDIR_PREFIX}$(APPDIR)/canutils/libdronecan/libcanard
34+
2935
MAINSRC = canard_main.c
3036

3137
include $(APPDIR)/Application.mk

examples/dronecan/canard_main.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -486,12 +486,12 @@ static int canard_daemon(int argc, char *argv[])
486486
static SocketCANInstance socketcan;
487487
#else
488488
static CanardNuttXInstance canardnuttx_instance;
489+
int ret;
489490
#endif
490491
#ifdef CONFIG_DEBUG_CAN
491492
struct canioc_bittiming_s bt;
492493
#endif
493494
int errval = 0;
494-
int ret;
495495

496496
/* Initialization of the CAN hardware is performed by external, board-
497497
* specific logic to running this test.
@@ -575,8 +575,8 @@ static int canard_daemon(int argc, char *argv[])
575575
}
576576
}
577577

578-
errout_with_dev:
579578
#ifdef CONFIG_CAN
579+
errout_with_dev:
580580
canardNuttXClose(&canardnuttx_instance);
581581
#endif
582582

0 commit comments

Comments
 (0)