Merged in paulpatience/nuttx-apps (pull request #15)

Changes to apps/examples/uavcan and apps/canutils/uavcan
This commit is contained in:
Gregory Nutt 2015-10-09 15:58:16 -06:00
commit 3fc4039db1
4 changed files with 18 additions and 26 deletions

View File

@ -9,7 +9,7 @@ config CANUTILS_UAVCAN
depends on STM32_HAVE_CAN1
depends on !STM32_CAN1
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 HAVE_CXX
depends on !DISABLE_POLL
@ -62,7 +62,7 @@ config UAVCAN_STM32_NUM_IFACES
choice
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_TIM4 if STM32_HAVE_TIM4 && !STM32_TIM4
default UAVCAN_STM32_TIM5 if STM32_HAVE_TIM5 && !STM32_TIM5
@ -71,7 +71,7 @@ choice
config UAVCAN_STM32_TIM2
bool "TIM2"
depends on STM32_HAVE_TIM2 && !STM32_TIM2
depends on !STM32_TIM2
---help---
The library will use TIM2.

View File

@ -64,7 +64,8 @@ PYUAVCAN_PACKNAME = $(PYUAVCAN_UNPACKNAME)$(PACKEXT)
CXXSRCS = platform_stm32.cpp $(LIBUAVCAN_SRC) $(LIBUAVCAN_STM32_SRC)
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 += -DUAVCAN_STM32_NUTTX=1
@ -176,7 +177,7 @@ all: .built
$(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)
@echo "Unpacking: $(LIBUAVCAN_PACKNAME) -> $(LIBUAVCAN_UNPACKNAME)"
@ -185,7 +186,7 @@ $(LIBUAVCAN_UNPACKNAME): $(LIBUAVCAN_PACKNAME)
$(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)
@echo "Unpacking: $(DSDL_PACKNAME) -> $(DSDL_UNPACKNAME)"
@ -194,7 +195,7 @@ $(DSDL_UNPACKNAME): $(DSDL_PACKNAME)
$(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)
@echo "Unpacking: $(PYUAVCAN_PACKNAME) -> $(PYUAVCAN_UNPACKNAME)"
@ -211,10 +212,10 @@ libuavcan: $(LIBUAVCAN_UNPACKNAME) $(DSDL_UNPACKNAME) $(PYUAVCAN_UNPACKNAME)
dsdlc_generated: libuavcan
$(info $(shell $(LIBUAVCAN_DSDLC) $(UAVCAN_DSDL_DIR)))
$(APPDIR)/include/uavcan: libuavcan dsdlc_generated
$(Q) mkdir -p $(APPDIR)/include/uavcan
$(Q) cp -R libuavcan/libuavcan/include/uavcan/* $(APPDIR)/include/uavcan
$(Q) cp -R dsdlc_generated/uavcan/* $(APPDIR)/include/uavcan
$(APPDIR)$(DELIM)include$(DELIM)uavcan: dsdlc_generated
$(Q) mkdir -p $(APPDIR)$(DELIM)include$(DELIM)uavcan
$(Q) cp -R libuavcan$(DELIM)libuavcan$(DELIM)include$(DELIM)uavcan$(DELIM)* $(APPDIR)$(DELIM)include$(DELIM)uavcan
$(Q) cp -R dsdlc_generated$(DELIM)uavcan$(DELIM)* $(APPDIR)$(DELIM)include$(DELIM)uavcan
$(CXXOBJS): %$(OBJEXT): %$(CXXEXT)
$(call COMPILEXX, $<, $@)
@ -225,7 +226,8 @@ $(CXXOBJS): %$(OBJEXT): %$(CXXEXT)
install:
context: libuavcan dsdlc_generated $(APPDIR)/include/uavcan
context: libuavcan
$(Q) $(MAKE) $(APPDIR)$(DELIM)include$(DELIM)uavcan TOPDIR="$(TOPDIR)" APPDIR="$(APPDIR)"
.depend: Makefile $(CXXSRCS)
$(Q) $(MKDEP) $(ROOTDEPPATH) "$(CXX)" -- $(CXXFLAGS) -- $(CXXSRCS) >Make.dep
@ -235,9 +237,9 @@ depend: .depend
clean:
$(call DELFILE, .built)
$(call DELDIR, libuavcan)
$(foreach CXXOBJ, $(CXXOBJS), $(call DELFILE, $(CXXOBJ)))
$(call DELDIR, dsdlc_generated)
$(call DELDIR, $(APPDIR)/include/uavcan)
$(call DELDIR, $(APPDIR)$(DELIM)include$(DELIM)uavcan)
distclean: clean
$(call DELFILE, Make.dep)

View File

@ -6,7 +6,7 @@
config EXAMPLES_UAVCAN
bool "UAVCAN example"
default n
depends on CANUTILS_UAVCAN && LIB_BOARDCTL
depends on CANUTILS_UAVCAN
---help---
Enable the UAVCAN example

View File

@ -39,8 +39,6 @@
#include <nuttx/config.h>
#include <sys/boardctl.h>
#include <cstdio>
#include <cstdlib>
@ -67,17 +65,9 @@ int main(int argc, FAR char *argv[])
extern "C" int uavcan_main(int argc, FAR char *argv[])
#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>
node(getCanDriver(), getSystemClock());
int ret;
node.setNodeID(CONFIG_EXAMPLES_UAVCAN_NODE_ID);
node.setName(CONFIG_EXAMPLES_UAVCAN_NODE_NAME);