From e1460c9987b787682578354f759ac299aa2ae474 Mon Sep 17 00:00:00 2001 From: "Paul A. Patience" Date: Tue, 29 Sep 2015 17:11:47 -0400 Subject: [PATCH] UAVCAN: Changes to build system --- canutils/uavcan/Kconfig | 38 +++++++++++++++++++++++++++++++++++--- canutils/uavcan/Makefile | 15 +++++++-------- include/.gitignore | 1 + 3 files changed, 43 insertions(+), 11 deletions(-) diff --git a/canutils/uavcan/Kconfig b/canutils/uavcan/Kconfig index 81b65290c..4a66485f8 100644 --- a/canutils/uavcan/Kconfig +++ b/canutils/uavcan/Kconfig @@ -6,8 +6,10 @@ config CANUTILS_UAVCAN bool "UAVCAN Library" default n - depends on STM32_CAN1 - depends on STM32_TIM2 || STM32_TIM3 || STM32_TIM4 || STM32_TIM5 || STM32_TIM6 || STM32_TIM7 + 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 C99_BOOL8 depends on HAVE_CXX depends on !DISABLE_POLL @@ -52,9 +54,39 @@ config UAVCAN_PYUAVCAN_VERSION ---help--- Python UAVCAN version. +config UAVCAN_STM32_NUM_IFACES + int "Number of CAN Interfaces" + default 1 + range 1 1 if !STM32_HAVE_CAN2 + range 1 2 if STM32_HAVE_CAN2 + +if UAVCAN_STM32_TIMER_NUMBER = 2 && STM32_TIM2 +comment "Timer 2 is already configured for NuttX" +endif +if UAVCAN_STM32_TIMER_NUMBER = 3 && STM32_TIM3 +comment "Timer 3 is already configured for NuttX" +endif +if UAVCAN_STM32_TIMER_NUMBER = 4 && STM32_TIM4 +comment "Timer 4 is already configured for NuttX" +endif +if UAVCAN_STM32_TIMER_NUMBER = 5 && STM32_TIM5 +comment "Timer 5 is already configured for NuttX" +endif +if UAVCAN_STM32_TIMER_NUMBER = 6 && STM32_TIM6 +comment "Timer 6 is already configured for NuttX" +endif +if UAVCAN_STM32_TIMER_NUMBER = 7 && STM32_TIM7 +comment "Timer 7 is already configured for NuttX" +endif + config UAVCAN_STM32_TIMER_NUMBER int "Timer Number" - default 2 + default 2 if STM32_HAVE_TIM2 && !STM32_TIM2 + default 3 if STM32_HAVE_TIM3 && !STM32_TIM3 + default 4 if STM32_HAVE_TIM4 && !STM32_TIM4 + default 5 if STM32_HAVE_TIM5 && !STM32_TIM5 + default 6 if STM32_HAVE_TIM6 && !STM32_TIM6 + default 7 if STM32_HAVE_TIM7 && !STM32_TIM7 range 2 7 ---help--- Specifies the timer number. diff --git a/canutils/uavcan/Makefile b/canutils/uavcan/Makefile index 8908e2018..7cd43033d 100644 --- a/canutils/uavcan/Makefile +++ b/canutils/uavcan/Makefile @@ -67,14 +67,9 @@ CXXFLAGS += -I$(LIBUAVCAN_INC) -I$(LIBUAVCAN_STM32_INC) -Idsdlc_generated CXXFLAGS += -I$(TOPDIR)/arch/arm/src/common -I$(TOPDIR)/arch/arm/src/stm32 CXXFLAGS += -DUAVCAN_STM32_NUTTX=1 +CXXFLAGS += -DUAVCAN_STM32_NUM_IFACES=$(CONFIG_UAVCAN_STM32_NUM_IFACES) CXXFLAGS += -DUAVCAN_STM32_TIMER_NUMBER=$(CONFIG_UAVCAN_STM32_TIMER_NUMBER) -ifeq ($(CONFIG_STM32_CAN2),y) -CXXFLAGS += -DUAVCAN_STM32_NUM_IFACES=2 -else -CXXFLAGS += -DUAVCAN_STM32_NUM_IFACES=1 -endif - ifeq ($(CONFIG_UAVCAN_CPP03),y) CXXFLAGS += -std=c++03 -DUAVCAN_CPP_VERSION=UAVCAN_CPP03 else @@ -164,6 +159,9 @@ libuavcan: $(LIBUAVCAN_UNPACKNAME) $(DSDL_UNPACKNAME) $(PYUAVCAN_UNPACKNAME) dsdlc_generated: libuavcan $(info $(shell $(LIBUAVCAN_DSDLC) $(UAVCAN_DSDL_DIR))) +$(APPDIR)/include/uavcan: libuavcan/libuavcan/include/uavcan + $(Q) cp -R libuavcan/libuavcan/include/uavcan $(APPDIR)/include + $(CXXOBJS): %$(OBJEXT): %$(CXXEXT) $(call COMPILEXX, $<, $@) @@ -173,9 +171,9 @@ $(CXXOBJS): %$(OBJEXT): %$(CXXEXT) install: -context: +context: libuavcan dsdlc_generated $(APPDIR)/include/uavcan -.depend: Makefile $(CXXSRCS) dsdlc_generated +.depend: Makefile $(CXXSRCS) $(Q) $(MKDEP) $(ROOTDEPPATH) "$(CXX)" -- $(CXXFLAGS) -- $(CXXSRCS) >Make.dep $(Q) touch $@ @@ -185,6 +183,7 @@ clean: $(call DELFILE, .built) $(call DELDIR, libuavcan) $(call DELDIR, dsdlc_generated) + $(call DELDIR, $(APPDIR)/include/uavcan) distclean: clean $(call DELFILE, Make.dep) diff --git a/include/.gitignore b/include/.gitignore index bee9a7372..a86d54aac 100644 --- a/include/.gitignore +++ b/include/.gitignore @@ -1 +1,2 @@ /pcode +/uavcan