Browse Source

Changes to px4io-v2 for upstream Nuttx

sbg
David Sidrane 8 years ago committed by Lorenz Meier
parent
commit
feda3e8c5c
  1. 34
      nuttx-configs/px4io-v2/include/board.h
  2. 25
      nuttx-configs/px4io-v2/nsh/Make.defs
  3. 32
      nuttx-configs/px4io-v2/nsh/appconfig
  4. 1502
      nuttx-configs/px4io-v2/nsh/defconfig
  5. 2
      nuttx-configs/px4io-v2/nsh/setenv.sh
  6. 2
      nuttx-configs/px4io-v2/scripts/ld.script
  7. 5
      nuttx-configs/px4io-v2/src/Makefile
  8. 3
      src/drivers/boards/px4io-v2/board_config.h
  9. 71
      src/drivers/boards/px4io-v2/px4io_init.c

34
nuttx-configs/px4io-v2/include/board.h

@ -1,5 +1,5 @@
/************************************************************************************ /************************************************************************************
* configs/px4io/include/board.h * nuttx-configs/px4io/include/board.h
* include/arch/board/board.h * include/arch/board/board.h
* *
* Copyright (C) 2009 Gregory Nutt. All rights reserved. * Copyright (C) 2009 Gregory Nutt. All rights reserved.
@ -79,7 +79,9 @@
/* APB2 timer 1 will receive PCLK2. */ /* APB2 timer 1 will receive PCLK2. */
#define STM32_APB2_TIM1_CLKIN (STM32_PCLK2_FREQUENCY) #define STM32_APB2_TIM1_CLKIN (STM32_PCLK2_FREQUENCY)
#define STM32_APB2_TIM8_CLKIN (STM32_PCLK2_FREQUENCY) #define STM32_APB2_TIM15_CLKIN (STM32_PCLK2_FREQUENCY)
#define STM32_APB2_TIM16_CLKIN (STM32_PCLK2_FREQUENCY)
#define STM32_APB2_TIM17_CLKIN (STM32_PCLK2_FREQUENCY)
/* APB1 clock (PCLK1) is HCLK (24MHz) */ /* APB1 clock (PCLK1) is HCLK (24MHz) */
@ -88,10 +90,36 @@
/* All timers run off PCLK */ /* All timers run off PCLK */
#define STM32_APB1_TIM1_CLKIN (STM32_PCLK2_FREQUENCY)
#define STM32_APB1_TIM2_CLKIN (STM32_PCLK1_FREQUENCY) #define STM32_APB1_TIM2_CLKIN (STM32_PCLK1_FREQUENCY)
#define STM32_APB1_TIM3_CLKIN (STM32_PCLK1_FREQUENCY) #define STM32_APB1_TIM3_CLKIN (STM32_PCLK1_FREQUENCY)
#define STM32_APB1_TIM4_CLKIN (STM32_PCLK1_FREQUENCY) #define STM32_APB1_TIM4_CLKIN (STM32_PCLK1_FREQUENCY)
#define STM32_APB1_TIM5_CLKIN (STM32_PCLK1_FREQUENCY)
#define STM32_APB1_TIM6_CLKIN (STM32_PCLK1_FREQUENCY)
#define STM32_APB1_TIM7_CLKIN (STM32_PCLK1_FREQUENCY)
#define STM32_APB1_TIM12_CLKIN (STM32_PCLK1_FREQUENCY)
#define STM32_APB1_TIM13_CLKIN (STM32_PCLK1_FREQUENCY)
#define STM32_APB1_TIM14_CLKIN (STM32_PCLK1_FREQUENCY)
/* Timer Frequencies, if APBx is set to 1, frequency is same to APBx
* otherwise frequency is 2xAPBx.
* Note: TIM1, 15-17 are on APB2, others on APB1
*/
#define BOARD_TIM1_FREQUENCY STM32_APB2_TIM1_CLKIN
#define BOARD_TIM2_FREQUENCY STM32_APB1_TIM2_CLKIN
#define BOARD_TIM3_FREQUENCY STM32_APB1_TIM3_CLKIN
#define BOARD_TIM4_FREQUENCY STM32_APB1_TIM4_CLKIN
#define BOARD_TIM5_FREQUENCY STM32_APB1_TIM5_CLKIN
#define BOARD_TIM6_FREQUENCY STM32_APB1_TIM6_CLKIN
#define BOARD_TIM7_FREQUENCY STM32_APB1_TIM7_CLKIN
#define BOARD_TIM12_FREQUENCY STM32_APB1_TIM12_CLKIN
#define BOARD_TIM13_FREQUENCY STM32_APB1_TIM13_CLKIN
#define BOARD_TIM14_FREQUENCY STM32_APB1_TIM14_CLKIN
#define BOARD_TIM15_FREQUENCY STM32_APB2_TIM15_CLKIN
#define BOARD_TIM16_FREQUENCY STM32_APB2_TIM16_CLKIN
#define BOARD_TIM17_FREQUENCY STM32_APB2_TIM17_CLKIN
/* /*
* Some of the USART pins are not available; override the GPIO * Some of the USART pins are not available; override the GPIO

25
nuttx-configs/px4io-v2/nsh/Make.defs

@ -1,5 +1,5 @@
############################################################################ ############################################################################
# configs/px4io-v2/nsh/Make.defs # nuttx-configs/px4io-v2/nsh/Make.defs
# #
# Copyright (C) 2011 Gregory Nutt. All rights reserved. # Copyright (C) 2011 Gregory Nutt. All rights reserved.
# Author: Gregory Nutt <gnutt@nuttx.org> # Author: Gregory Nutt <gnutt@nuttx.org>
@ -35,14 +35,14 @@
include ${TOPDIR}/.config include ${TOPDIR}/.config
include ${TOPDIR}/tools/Config.mk include ${TOPDIR}/tools/Config.mk
include $(TOPDIR)/PX4_Warnings.mk include $(TOPDIR)/PX4_Warnings.mk
include $(TOPDIR)/PX4_Config.mk
# #
# We only support building with the ARM bare-metal toolchain from # We only support building with the ARM bare-metal toolchain from
# https://launchpad.net/gcc-arm-embedded on Windows, Linux or Mac OS. # https://launchpad.net/gcc-arm-embedded on Windows, Linux or Mac OS.
# #
CONFIG_ARMV7M_TOOLCHAIN := GNU_EABI CONFIG_ARMV7M_TOOLCHAIN := GNU_EABI${HOST_OS_FIRST_LETTER}
include ${TOPDIR}/arch/arm/src/armv7-m/Toolchain.defs include ${TOPDIR}/arch/arm/src/armv7-m/Toolchain.defs
@ -60,12 +60,14 @@ ARCHCPUFLAGS = -mcpu=cortex-m3 \
-mthumb \ -mthumb \
-march=armv7-m -march=armv7-m
# enable precise stack overflow tracking # Enable precise stack overflow tracking
ifeq ($(CONFIG_ARMV7M_STACKCHECK),y) ifeq ($(CONFIG_ARMV7M_STACKCHECK),y)
INSTRUMENTATIONDEFINES = -finstrument-functions -ffixed-r10 INSTRUMENTATIONDEFINES = -finstrument-functions -ffixed-r10
endif endif
# use our linker script # Use our linker script
LDSCRIPT = ld.script LDSCRIPT = ld.script
ifeq ($(WINTOOL),y) ifeq ($(WINTOOL),y)
@ -87,18 +89,20 @@ else
ARCHSCRIPT = -T$(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/scripts/$(LDSCRIPT) ARCHSCRIPT = -T$(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/scripts/$(LDSCRIPT)
else else
# Linux/Cygwin-native toolchain # Linux/Cygwin-native toolchain
MKDEP = $(TOPDIR)/tools/mkdeps.sh MKDEP = $(TOPDIR)/tools/mkdeps$(HOSTEXEEXT)
ARCHINCLUDES = -I. -isystem $(TOPDIR)/include ARCHINCLUDES = -I. -isystem $(TOPDIR)/include
ARCHXXINCLUDES = -I. -isystem $(TOPDIR)/include -isystem $(TOPDIR)/include/cxx ARCHXXINCLUDES = -I. -isystem $(TOPDIR)/include -isystem $(TOPDIR)/include/cxx
ARCHSCRIPT = -T$(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/scripts/$(LDSCRIPT) ARCHSCRIPT = -T$(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/scripts/$(LDSCRIPT)
endif endif
endif endif
# tool versions # Tool versions
ARCHCCVERSION = ${shell $(CC) -v 2>&1 | sed -n '/^gcc version/p' | sed -e 's/^gcc version \([0-9\.]\)/\1/g' -e 's/[-\ ].*//g' -e '1q'} ARCHCCVERSION = ${shell $(CC) -v 2>&1 | sed -n '/^gcc version/p' | sed -e 's/^gcc version \([0-9\.]\)/\1/g' -e 's/[-\ ].*//g' -e '1q'}
ARCHCCMAJOR = ${shell echo $(ARCHCCVERSION) | cut -d'.' -f1} ARCHCCMAJOR = ${shell echo $(ARCHCCVERSION) | cut -d'.' -f1}
# optimisation flags # Optimization flags
ARCHOPTIMIZATION = $(MAXOPTIMIZATION) \ ARCHOPTIMIZATION = $(MAXOPTIMIZATION) \
-fno-strict-aliasing \ -fno-strict-aliasing \
-fno-strength-reduce \ -fno-strength-reduce \
@ -120,7 +124,8 @@ ARCHWARNINGSXX = $(ARCHWARNINGS) $(PX4_ARCHWARNINGSXX)
ARCHDEFINES = ARCHDEFINES =
ARCHPICFLAGS = -fpic -msingle-pic-base -mpic-register=r10 ARCHPICFLAGS = -fpic -msingle-pic-base -mpic-register=r10
# this seems to be the only way to add linker flags # This seems to be the only way to add linker flags
EXTRA_LIBS += --warn-common \ EXTRA_LIBS += --warn-common \
--gc-sections --gc-sections
@ -139,8 +144,8 @@ OBJEXT = .o
LIBEXT = .a LIBEXT = .a
EXEEXT = EXEEXT =
# Produce partially-linked $1 from files in $2
# produce partially-linked $1 from files in $2
define PRELINK define PRELINK
@echo "PRELINK: $1" @echo "PRELINK: $1"
$(Q) $(LD) -Ur -o $1 $2 && $(OBJCOPY) --localize-hidden $1 $(Q) $(LD) -Ur -o $1 $2 && $(OBJCOPY) --localize-hidden $1

32
nuttx-configs/px4io-v2/nsh/appconfig

@ -1,32 +0,0 @@
############################################################################
#
# Copyright (C) 2012 PX4 Development Team. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in
# the documentation and/or other materials provided with the
# distribution.
# 3. Neither the name PX4 nor the names of its contributors may be
# used to endorse or promote products derived from this software
# without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
#
############################################################################

1502
nuttx-configs/px4io-v2/nsh/defconfig

File diff suppressed because it is too large Load Diff

2
nuttx-configs/px4io-v2/nsh/setenv.sh

@ -1,5 +1,5 @@
#!/bin/bash #!/bin/bash
# configs/stm3210e-eval/dfu/setenv.sh # nuttx-configs/px4io-v2/nsh/setenv.sh
# #
# Copyright (C) 2009 Gregory Nutt. All rights reserved. # Copyright (C) 2009 Gregory Nutt. All rights reserved.
# Author: Gregory Nutt <gnutt@nuttx.org> # Author: Gregory Nutt <gnutt@nuttx.org>

2
nuttx-configs/px4io-v2/scripts/ld.script

@ -1,5 +1,5 @@
/**************************************************************************** /****************************************************************************
* configs/stm3210e-eval/nsh/ld.script * configs/px4io-v2/scripts/ld.script
* *
* Copyright (C) 2009, 2011 Gregory Nutt. All rights reserved. * Copyright (C) 2009, 2011 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <spudmonkey@racsa.co.cr> * Author: Gregory Nutt <spudmonkey@racsa.co.cr>

5
nuttx-configs/px4io-v2/src/Makefile

@ -1,5 +1,4 @@
############################################################################ ############################################################################
# configs/stm3210e-eval/src/Makefile
# #
# Copyright (C) 2009-2010 Gregory Nutt. All rights reserved. # Copyright (C) 2009-2010 Gregory Nutt. All rights reserved.
# Author: Gregory Nutt <spudmonkey@racsa.co.cr> # Author: Gregory Nutt <spudmonkey@racsa.co.cr>
@ -81,4 +80,8 @@ distclean: clean
$(call DELFILE, Make.dep) $(call DELFILE, Make.dep)
$(call DELFILE, .depend) $(call DELFILE, .depend)
ifneq ($(BOARD_CONTEXT),y)
context:
endif
-include Make.dep -include Make.dep

3
src/drivers/boards/px4io-v2/board_config.h

@ -47,9 +47,6 @@
#include <nuttx/compiler.h> #include <nuttx/compiler.h>
#include <stdint.h> #include <stdint.h>
#include <stm32.h>
#include <arch/board/board.h>
/****************************************************************************** /******************************************************************************
* Definitions * Definitions
******************************************************************************/ ******************************************************************************/

71
src/drivers/boards/px4io-v2/px4io_init.c

@ -35,10 +35,10 @@
* @file px4iov2_init.c * @file px4iov2_init.c
* *
* PX4FMU-specific early startup code. This file implements the * PX4FMU-specific early startup code. This file implements the
* nsh_archinitialize() function that is called early by nsh during startup. * stm32_boardinitialize() function that is called during cpu startup.
* *
* Code here is run before the rcS script is invoked; it should start required * Code here is run before the rcS script is invoked; it should start required
* subsystems and perform board-specific initialisation. * subsystems and perform board-specific initialization.
*/ */
/**************************************************************************** /****************************************************************************
@ -53,6 +53,7 @@
#include <errno.h> #include <errno.h>
#include <nuttx/arch.h> #include <nuttx/arch.h>
#include <nuttx/board.h>
#include <stm32.h> #include <stm32.h>
#include "board_config.h" #include "board_config.h"
@ -69,13 +70,13 @@
#ifdef CONFIG_CPP_HAVE_VARARGS #ifdef CONFIG_CPP_HAVE_VARARGS
# ifdef CONFIG_DEBUG # ifdef CONFIG_DEBUG
# define message(...) lowsyslog(__VA_ARGS__) # define message(...) syslog(__VA_ARGS__)
# else # else
# define message(...) printf(__VA_ARGS__) # define message(...) printf(__VA_ARGS__)
# endif # endif
#else #else
# ifdef CONFIG_DEBUG # ifdef CONFIG_DEBUG
# define message lowsyslog # define message syslog
# else # else
# define message printf # define message printf
# endif # endif
@ -105,55 +106,55 @@ __EXPORT void stm32_boardinitialize(void)
/* configure GPIOs */ /* configure GPIOs */
/* LEDS - default to off */ /* LEDS - default to off */
px4_arch_configgpio(GPIO_LED1); stm32_configgpio(GPIO_LED1);
px4_arch_configgpio(GPIO_LED2); stm32_configgpio(GPIO_LED2);
px4_arch_configgpio(GPIO_LED3); stm32_configgpio(GPIO_LED3);
px4_arch_configgpio(GPIO_LED4); stm32_configgpio(GPIO_LED4);
px4_arch_configgpio(GPIO_BTN_SAFETY); stm32_configgpio(GPIO_BTN_SAFETY);
/* spektrum power enable is active high - enable it by default */ /* spektrum power enable is active high - enable it by default */
px4_arch_configgpio(GPIO_SPEKTRUM_PWR_EN); stm32_configgpio(GPIO_SPEKTRUM_PWR_EN);
px4_arch_configgpio(GPIO_SERVO_FAULT_DETECT); stm32_configgpio(GPIO_SERVO_FAULT_DETECT);
/* RSSI inputs */ /* RSSI inputs */
px4_arch_configgpio(GPIO_TIM_RSSI); /* xxx alternate function */ stm32_configgpio(GPIO_TIM_RSSI); /* xxx alternate function */
px4_arch_configgpio(GPIO_ADC_RSSI); stm32_configgpio(GPIO_ADC_RSSI);
/* servo rail voltage */ /* servo rail voltage */
px4_arch_configgpio(GPIO_ADC_VSERVO); stm32_configgpio(GPIO_ADC_VSERVO);
px4_arch_configgpio(GPIO_SBUS_INPUT); /* xxx alternate function */ stm32_configgpio(GPIO_SBUS_INPUT); /* xxx alternate function */
px4_arch_configgpio(GPIO_SBUS_OUTPUT); stm32_configgpio(GPIO_SBUS_OUTPUT);
/* sbus output enable is active low - disable it by default */ /* sbus output enable is active low - disable it by default */
px4_arch_gpiowrite(GPIO_SBUS_OENABLE, true); stm32_gpiowrite(GPIO_SBUS_OENABLE, true);
px4_arch_configgpio(GPIO_SBUS_OENABLE); stm32_configgpio(GPIO_SBUS_OENABLE);
px4_arch_configgpio(GPIO_PPM); /* xxx alternate function */ stm32_configgpio(GPIO_PPM); /* xxx alternate function */
px4_arch_gpiowrite(GPIO_PWM1, true); stm32_gpiowrite(GPIO_PWM1, true);
px4_arch_configgpio(GPIO_PWM1); stm32_configgpio(GPIO_PWM1);
px4_arch_gpiowrite(GPIO_PWM2, true); stm32_gpiowrite(GPIO_PWM2, true);
px4_arch_configgpio(GPIO_PWM2); stm32_configgpio(GPIO_PWM2);
px4_arch_gpiowrite(GPIO_PWM3, true); stm32_gpiowrite(GPIO_PWM3, true);
px4_arch_configgpio(GPIO_PWM3); stm32_configgpio(GPIO_PWM3);
px4_arch_gpiowrite(GPIO_PWM4, true); stm32_gpiowrite(GPIO_PWM4, true);
px4_arch_configgpio(GPIO_PWM4); stm32_configgpio(GPIO_PWM4);
px4_arch_gpiowrite(GPIO_PWM5, true); stm32_gpiowrite(GPIO_PWM5, true);
px4_arch_configgpio(GPIO_PWM5); stm32_configgpio(GPIO_PWM5);
px4_arch_gpiowrite(GPIO_PWM6, true); stm32_gpiowrite(GPIO_PWM6, true);
px4_arch_configgpio(GPIO_PWM6); stm32_configgpio(GPIO_PWM6);
px4_arch_gpiowrite(GPIO_PWM7, true); stm32_gpiowrite(GPIO_PWM7, true);
px4_arch_configgpio(GPIO_PWM7); stm32_configgpio(GPIO_PWM7);
px4_arch_gpiowrite(GPIO_PWM8, true); stm32_gpiowrite(GPIO_PWM8, true);
px4_arch_configgpio(GPIO_PWM8); stm32_configgpio(GPIO_PWM8);
} }

Loading…
Cancel
Save