Merged in paulpatience/nuttx-apps (pull request #15)
Changes to apps/examples/uavcan and apps/canutils/uavcan
This commit is contained in:
commit
3fc4039db1
@ -9,7 +9,7 @@ config CANUTILS_UAVCAN
|
|||||||
depends on STM32_HAVE_CAN1
|
depends on STM32_HAVE_CAN1
|
||||||
depends on !STM32_CAN1
|
depends on !STM32_CAN1
|
||||||
depends on !STM32_CAN2
|
depends on !STM32_CAN2
|
||||||
depends on (STM32_HAVE_TIM2 && !STM32_TIM2) || (STM32_HAVE_TIM3 && !STM32_TIM3) || (STM32_HAVE_TIM4 && !STM32_TIM4) || (STM32_HAVE_TIM5 && !STM32_TIM5) || (STM32_HAVE_TIM6 && !STM32_TIM6) || (STM32_HAVE_TIM7 && !STM32_TIM7)
|
depends on !STM32_TIM2 || (STM32_HAVE_TIM3 && !STM32_TIM3) || (STM32_HAVE_TIM4 && !STM32_TIM4) || (STM32_HAVE_TIM5 && !STM32_TIM5) || (STM32_HAVE_TIM6 && !STM32_TIM6) || (STM32_HAVE_TIM7 && !STM32_TIM7)
|
||||||
depends on C99_BOOL8
|
depends on C99_BOOL8
|
||||||
depends on HAVE_CXX
|
depends on HAVE_CXX
|
||||||
depends on !DISABLE_POLL
|
depends on !DISABLE_POLL
|
||||||
@ -62,7 +62,7 @@ config UAVCAN_STM32_NUM_IFACES
|
|||||||
|
|
||||||
choice
|
choice
|
||||||
prompt "Timer"
|
prompt "Timer"
|
||||||
default UAVCAN_STM32_TIM2 if STM32_HAVE_TIM2 && !STM32_TIM2
|
default UAVCAN_STM32_TIM2 if !STM32_TIM2
|
||||||
default UAVCAN_STM32_TIM3 if STM32_HAVE_TIM3 && !STM32_TIM3
|
default UAVCAN_STM32_TIM3 if STM32_HAVE_TIM3 && !STM32_TIM3
|
||||||
default UAVCAN_STM32_TIM4 if STM32_HAVE_TIM4 && !STM32_TIM4
|
default UAVCAN_STM32_TIM4 if STM32_HAVE_TIM4 && !STM32_TIM4
|
||||||
default UAVCAN_STM32_TIM5 if STM32_HAVE_TIM5 && !STM32_TIM5
|
default UAVCAN_STM32_TIM5 if STM32_HAVE_TIM5 && !STM32_TIM5
|
||||||
@ -71,7 +71,7 @@ choice
|
|||||||
|
|
||||||
config UAVCAN_STM32_TIM2
|
config UAVCAN_STM32_TIM2
|
||||||
bool "TIM2"
|
bool "TIM2"
|
||||||
depends on STM32_HAVE_TIM2 && !STM32_TIM2
|
depends on !STM32_TIM2
|
||||||
---help---
|
---help---
|
||||||
The library will use TIM2.
|
The library will use TIM2.
|
||||||
|
|
||||||
|
@ -64,7 +64,8 @@ PYUAVCAN_PACKNAME = $(PYUAVCAN_UNPACKNAME)$(PACKEXT)
|
|||||||
CXXSRCS = platform_stm32.cpp $(LIBUAVCAN_SRC) $(LIBUAVCAN_STM32_SRC)
|
CXXSRCS = platform_stm32.cpp $(LIBUAVCAN_SRC) $(LIBUAVCAN_STM32_SRC)
|
||||||
|
|
||||||
CXXFLAGS += -I$(LIBUAVCAN_INC) -I$(LIBUAVCAN_STM32_INC) -Idsdlc_generated
|
CXXFLAGS += -I$(LIBUAVCAN_INC) -I$(LIBUAVCAN_STM32_INC) -Idsdlc_generated
|
||||||
CXXFLAGS += -I$(TOPDIR)/arch/arm/src/common -I$(TOPDIR)/arch/arm/src/stm32
|
CXXFLAGS += -I$(TOPDIR)$(DELIM)arch$(DELIM)arm$(DELIM)src$(DELIM)common
|
||||||
|
CXXFLAGS += -I$(TOPDIR)$(DELIM)arch$(DELIM)arm$(DELIM)src$(DELIM)stm32
|
||||||
|
|
||||||
CXXFLAGS += -D__KERNEL__
|
CXXFLAGS += -D__KERNEL__
|
||||||
CXXFLAGS += -DUAVCAN_STM32_NUTTX=1
|
CXXFLAGS += -DUAVCAN_STM32_NUTTX=1
|
||||||
@ -176,7 +177,7 @@ all: .built
|
|||||||
|
|
||||||
$(LIBUAVCAN_PACKNAME):
|
$(LIBUAVCAN_PACKNAME):
|
||||||
@echo "Downloading: $(LIBUAVCAN_PACKNAME)"
|
@echo "Downloading: $(LIBUAVCAN_PACKNAME)"
|
||||||
$(Q) $(WGET) -O $(LIBUAVCAN_PACKNAME) $(LIBUAVCAN_URL)/$(LIBUAVCAN_VERSION)$(PACKEXT)
|
$(Q) $(WGET) -O $(LIBUAVCAN_PACKNAME) $(LIBUAVCAN_URL)$(DELIM)$(LIBUAVCAN_VERSION)$(PACKEXT)
|
||||||
|
|
||||||
$(LIBUAVCAN_UNPACKNAME): $(LIBUAVCAN_PACKNAME)
|
$(LIBUAVCAN_UNPACKNAME): $(LIBUAVCAN_PACKNAME)
|
||||||
@echo "Unpacking: $(LIBUAVCAN_PACKNAME) -> $(LIBUAVCAN_UNPACKNAME)"
|
@echo "Unpacking: $(LIBUAVCAN_PACKNAME) -> $(LIBUAVCAN_UNPACKNAME)"
|
||||||
@ -185,7 +186,7 @@ $(LIBUAVCAN_UNPACKNAME): $(LIBUAVCAN_PACKNAME)
|
|||||||
|
|
||||||
$(DSDL_PACKNAME):
|
$(DSDL_PACKNAME):
|
||||||
@echo "Downloading: $(DSDL_PACKNAME)"
|
@echo "Downloading: $(DSDL_PACKNAME)"
|
||||||
$(Q) $(WGET) -O $(DSDL_PACKNAME) $(DSDL_URL)/$(DSDL_VERSION)$(PACKEXT)
|
$(Q) $(WGET) -O $(DSDL_PACKNAME) $(DSDL_URL)$(DELIM)$(DSDL_VERSION)$(PACKEXT)
|
||||||
|
|
||||||
$(DSDL_UNPACKNAME): $(DSDL_PACKNAME)
|
$(DSDL_UNPACKNAME): $(DSDL_PACKNAME)
|
||||||
@echo "Unpacking: $(DSDL_PACKNAME) -> $(DSDL_UNPACKNAME)"
|
@echo "Unpacking: $(DSDL_PACKNAME) -> $(DSDL_UNPACKNAME)"
|
||||||
@ -194,7 +195,7 @@ $(DSDL_UNPACKNAME): $(DSDL_PACKNAME)
|
|||||||
|
|
||||||
$(PYUAVCAN_PACKNAME):
|
$(PYUAVCAN_PACKNAME):
|
||||||
@echo "Downloading: $(PYUAVCAN_PACKNAME)"
|
@echo "Downloading: $(PYUAVCAN_PACKNAME)"
|
||||||
$(Q) $(WGET) -O $(PYUAVCAN_PACKNAME) $(PYUAVCAN_URL)/$(PYUAVCAN_VERSION)$(PACKEXT)
|
$(Q) $(WGET) -O $(PYUAVCAN_PACKNAME) $(PYUAVCAN_URL)$(DELIM)$(PYUAVCAN_VERSION)$(PACKEXT)
|
||||||
|
|
||||||
$(PYUAVCAN_UNPACKNAME): $(PYUAVCAN_PACKNAME)
|
$(PYUAVCAN_UNPACKNAME): $(PYUAVCAN_PACKNAME)
|
||||||
@echo "Unpacking: $(PYUAVCAN_PACKNAME) -> $(PYUAVCAN_UNPACKNAME)"
|
@echo "Unpacking: $(PYUAVCAN_PACKNAME) -> $(PYUAVCAN_UNPACKNAME)"
|
||||||
@ -211,10 +212,10 @@ libuavcan: $(LIBUAVCAN_UNPACKNAME) $(DSDL_UNPACKNAME) $(PYUAVCAN_UNPACKNAME)
|
|||||||
dsdlc_generated: libuavcan
|
dsdlc_generated: libuavcan
|
||||||
$(info $(shell $(LIBUAVCAN_DSDLC) $(UAVCAN_DSDL_DIR)))
|
$(info $(shell $(LIBUAVCAN_DSDLC) $(UAVCAN_DSDL_DIR)))
|
||||||
|
|
||||||
$(APPDIR)/include/uavcan: libuavcan dsdlc_generated
|
$(APPDIR)$(DELIM)include$(DELIM)uavcan: dsdlc_generated
|
||||||
$(Q) mkdir -p $(APPDIR)/include/uavcan
|
$(Q) mkdir -p $(APPDIR)$(DELIM)include$(DELIM)uavcan
|
||||||
$(Q) cp -R libuavcan/libuavcan/include/uavcan/* $(APPDIR)/include/uavcan
|
$(Q) cp -R libuavcan$(DELIM)libuavcan$(DELIM)include$(DELIM)uavcan$(DELIM)* $(APPDIR)$(DELIM)include$(DELIM)uavcan
|
||||||
$(Q) cp -R dsdlc_generated/uavcan/* $(APPDIR)/include/uavcan
|
$(Q) cp -R dsdlc_generated$(DELIM)uavcan$(DELIM)* $(APPDIR)$(DELIM)include$(DELIM)uavcan
|
||||||
|
|
||||||
$(CXXOBJS): %$(OBJEXT): %$(CXXEXT)
|
$(CXXOBJS): %$(OBJEXT): %$(CXXEXT)
|
||||||
$(call COMPILEXX, $<, $@)
|
$(call COMPILEXX, $<, $@)
|
||||||
@ -225,7 +226,8 @@ $(CXXOBJS): %$(OBJEXT): %$(CXXEXT)
|
|||||||
|
|
||||||
install:
|
install:
|
||||||
|
|
||||||
context: libuavcan dsdlc_generated $(APPDIR)/include/uavcan
|
context: libuavcan
|
||||||
|
$(Q) $(MAKE) $(APPDIR)$(DELIM)include$(DELIM)uavcan TOPDIR="$(TOPDIR)" APPDIR="$(APPDIR)"
|
||||||
|
|
||||||
.depend: Makefile $(CXXSRCS)
|
.depend: Makefile $(CXXSRCS)
|
||||||
$(Q) $(MKDEP) $(ROOTDEPPATH) "$(CXX)" -- $(CXXFLAGS) -- $(CXXSRCS) >Make.dep
|
$(Q) $(MKDEP) $(ROOTDEPPATH) "$(CXX)" -- $(CXXFLAGS) -- $(CXXSRCS) >Make.dep
|
||||||
@ -235,9 +237,9 @@ depend: .depend
|
|||||||
|
|
||||||
clean:
|
clean:
|
||||||
$(call DELFILE, .built)
|
$(call DELFILE, .built)
|
||||||
$(call DELDIR, libuavcan)
|
$(foreach CXXOBJ, $(CXXOBJS), $(call DELFILE, $(CXXOBJ)))
|
||||||
$(call DELDIR, dsdlc_generated)
|
$(call DELDIR, dsdlc_generated)
|
||||||
$(call DELDIR, $(APPDIR)/include/uavcan)
|
$(call DELDIR, $(APPDIR)$(DELIM)include$(DELIM)uavcan)
|
||||||
|
|
||||||
distclean: clean
|
distclean: clean
|
||||||
$(call DELFILE, Make.dep)
|
$(call DELFILE, Make.dep)
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
config EXAMPLES_UAVCAN
|
config EXAMPLES_UAVCAN
|
||||||
bool "UAVCAN example"
|
bool "UAVCAN example"
|
||||||
default n
|
default n
|
||||||
depends on CANUTILS_UAVCAN && LIB_BOARDCTL
|
depends on CANUTILS_UAVCAN
|
||||||
---help---
|
---help---
|
||||||
Enable the UAVCAN example
|
Enable the UAVCAN example
|
||||||
|
|
||||||
|
@ -39,8 +39,6 @@
|
|||||||
|
|
||||||
#include <nuttx/config.h>
|
#include <nuttx/config.h>
|
||||||
|
|
||||||
#include <sys/boardctl.h>
|
|
||||||
|
|
||||||
#include <cstdio>
|
#include <cstdio>
|
||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
|
|
||||||
@ -67,17 +65,9 @@ int main(int argc, FAR char *argv[])
|
|||||||
extern "C" int uavcan_main(int argc, FAR char *argv[])
|
extern "C" int uavcan_main(int argc, FAR char *argv[])
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
int ret;
|
|
||||||
|
|
||||||
ret = boardctl(BOARDIOC_INIT, 0);
|
|
||||||
if (ret < 0)
|
|
||||||
{
|
|
||||||
std::fprintf(stderr, "ERROR: boardctl failed: %d\n", ret);
|
|
||||||
return EXIT_FAILURE;
|
|
||||||
}
|
|
||||||
|
|
||||||
uavcan::Node<CONFIG_EXAMPLES_UAVCAN_NODE_MEM_POOL_SIZE>
|
uavcan::Node<CONFIG_EXAMPLES_UAVCAN_NODE_MEM_POOL_SIZE>
|
||||||
node(getCanDriver(), getSystemClock());
|
node(getCanDriver(), getSystemClock());
|
||||||
|
int ret;
|
||||||
|
|
||||||
node.setNodeID(CONFIG_EXAMPLES_UAVCAN_NODE_ID);
|
node.setNodeID(CONFIG_EXAMPLES_UAVCAN_NODE_ID);
|
||||||
node.setName(CONFIG_EXAMPLES_UAVCAN_NODE_NAME);
|
node.setName(CONFIG_EXAMPLES_UAVCAN_NODE_NAME);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user