Add olimex-stm32-e407 to configs
This commit is contained in:
parent
d58bbeaca5
commit
10985347e3
22 changed files with 4958 additions and 0 deletions
|
@ -518,6 +518,15 @@ config ARCH_BOARD_OLIMEX_STM32H407
|
||||||
toolchain* under Linux or Cygwin. See the http://www.olimex.com for
|
toolchain* under Linux or Cygwin. See the http://www.olimex.com for
|
||||||
further information. This board features the STMicro STM32F407ZGT6 (144pins).
|
further information. This board features the STMicro STM32F407ZGT6 (144pins).
|
||||||
|
|
||||||
|
config ARCH_BOARD_OLIMEX_STM32E407
|
||||||
|
bool "Olimex STM32 E407 board"
|
||||||
|
depends on ARCH_CHIP_STM32F407ZG
|
||||||
|
select ARCH_HAVE_LEDS
|
||||||
|
select ARCH_HAVE_BUTTONS
|
||||||
|
select ARCH_HAVE_IRQBUTTONS
|
||||||
|
---help---
|
||||||
|
Olimex STM32 E407 board based on the STMicro STM32F407ZGT6 (144pins).
|
||||||
|
|
||||||
config ARCH_BOARD_OLIMEX_STM32P107
|
config ARCH_BOARD_OLIMEX_STM32P107
|
||||||
bool "Olimex STM32 P107 board"
|
bool "Olimex STM32 P107 board"
|
||||||
depends on ARCH_CHIP_STM32F107VC
|
depends on ARCH_CHIP_STM32F107VC
|
||||||
|
@ -1375,6 +1384,7 @@ config ARCH_BOARD
|
||||||
default "olimex-lpc-h3131" if ARCH_BOARD_OLIMEX_LPC_H3131
|
default "olimex-lpc-h3131" if ARCH_BOARD_OLIMEX_LPC_H3131
|
||||||
default "olimex-stm32-h405" if ARCH_BOARD_OLIMEX_STM32H405
|
default "olimex-stm32-h405" if ARCH_BOARD_OLIMEX_STM32H405
|
||||||
default "olimex-stm32-h407" if ARCH_BOARD_OLIMEX_STM32H407
|
default "olimex-stm32-h407" if ARCH_BOARD_OLIMEX_STM32H407
|
||||||
|
default "olimex-stm32-e407" if ARCH_BOARD_OLIMEX_STM32E407
|
||||||
default "olimex-stm32-p107" if ARCH_BOARD_OLIMEX_STM32P107
|
default "olimex-stm32-p107" if ARCH_BOARD_OLIMEX_STM32P107
|
||||||
default "olimex-stm32-p207" if ARCH_BOARD_OLIMEX_STM32P207
|
default "olimex-stm32-p207" if ARCH_BOARD_OLIMEX_STM32P207
|
||||||
default "olimex-strp711" if ARCH_BOARD_OLIMEX_STRP711
|
default "olimex-strp711" if ARCH_BOARD_OLIMEX_STRP711
|
||||||
|
@ -1642,6 +1652,9 @@ endif
|
||||||
if ARCH_BOARD_OLIMEX_STM32H407
|
if ARCH_BOARD_OLIMEX_STM32H407
|
||||||
source "configs/olimex-stm32-h407/Kconfig"
|
source "configs/olimex-stm32-h407/Kconfig"
|
||||||
endif
|
endif
|
||||||
|
if ARCH_BOARD_OLIMEX_STM32E407
|
||||||
|
source "configs/olimex-stm32-e407/Kconfig"
|
||||||
|
endif
|
||||||
if ARCH_BOARD_OLIMEX_STM32P107
|
if ARCH_BOARD_OLIMEX_STM32P107
|
||||||
source "configs/olimex-stm32-p107/Kconfig"
|
source "configs/olimex-stm32-p107/Kconfig"
|
||||||
endif
|
endif
|
||||||
|
|
|
@ -438,6 +438,10 @@ configs/olimex-stm32-h407
|
||||||
further information. This board features the STMicro STM32F407ZGT6 (144
|
further information. This board features the STMicro STM32F407ZGT6 (144
|
||||||
pins). Contributed by Neil Hancock.
|
pins). Contributed by Neil Hancock.
|
||||||
|
|
||||||
|
configs/olimex-stm32-e407
|
||||||
|
Olimex STM32 E407 board based on the STMicro STM32F407ZGT6 (144pins).
|
||||||
|
Contributed by Mateusz Szafoni.
|
||||||
|
|
||||||
configs/olimex-stm32-p107
|
configs/olimex-stm32-p107
|
||||||
This port uses the Olimex STM32-P107 board (STM32F107VC) and a GNU arm-nuttx-elf
|
This port uses the Olimex STM32-P107 board (STM32F107VC) and a GNU arm-nuttx-elf
|
||||||
toolchain* under Linux or Cygwin. See the https://www.olimex.com/dev/stm32-p107.html
|
toolchain* under Linux or Cygwin. See the https://www.olimex.com/dev/stm32-p107.html
|
||||||
|
|
8
configs/olimex-stm32-e407/Kconfig
Normal file
8
configs/olimex-stm32-e407/Kconfig
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
#
|
||||||
|
# For a description of the syntax of this configuration file,
|
||||||
|
# see the file kconfig-language.txt in the NuttX tools repository.
|
||||||
|
#
|
||||||
|
|
||||||
|
if ARCH_BOARD_OLIMEX_STM32E407
|
||||||
|
|
||||||
|
endif
|
6
configs/olimex-stm32-e407/README.txt
Normal file
6
configs/olimex-stm32-e407/README.txt
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
README
|
||||||
|
======
|
||||||
|
The Olimex STM32-E407 configuration is based on the configuration olimex-stm32-h407 and stm32f4discovery.
|
||||||
|
|
||||||
|
nsh - Basic shell run on USART2.
|
||||||
|
usbnsh - Basic shell run on the virtual serial port.
|
289
configs/olimex-stm32-e407/include/board.h
Normal file
289
configs/olimex-stm32-e407/include/board.h
Normal file
|
@ -0,0 +1,289 @@
|
||||||
|
/************************************************************************************
|
||||||
|
* configs/olimex-stm32-e407/include/board.h
|
||||||
|
*
|
||||||
|
* Copyright (C) 2016 Gregory Nutt. All rights reserved.
|
||||||
|
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||||
|
* Modified for H407 Neil Hancock
|
||||||
|
* Modified for E407 Mateusz Szafoni
|
||||||
|
*
|
||||||
|
* 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 NuttX 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.
|
||||||
|
*
|
||||||
|
************************************************************************************/
|
||||||
|
|
||||||
|
#ifndef __CONFIGS_OLIMEX_STM32_E407_INCLUDE_BOARD_H
|
||||||
|
#define __CONFIGS_OLIMEX_STM32_E407_INCLUDE_BOARD_H 1
|
||||||
|
|
||||||
|
/************************************************************************************
|
||||||
|
* Included Files
|
||||||
|
************************************************************************************/
|
||||||
|
|
||||||
|
#include <nuttx/config.h>
|
||||||
|
|
||||||
|
#ifndef __ASSEMBLY__
|
||||||
|
# include <stdint.h>
|
||||||
|
# include <stdbool.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef __KERNEL__
|
||||||
|
# include "stm32_rcc.h"
|
||||||
|
# include "stm32_sdio.h"
|
||||||
|
# include "stm32.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/************************************************************************************
|
||||||
|
* Pre-processor Definitions
|
||||||
|
************************************************************************************/
|
||||||
|
|
||||||
|
/* Clocking *************************************************************************/
|
||||||
|
/* The Olimex-STM32-E407 board features a 12MHz crystal and
|
||||||
|
* a 32kHz RTC backup crystal.
|
||||||
|
*
|
||||||
|
* This is the canonical configuration:
|
||||||
|
* System Clock source : PLL (HSE)
|
||||||
|
* SYSCLK(Hz) : 168000000 Determined by PLL configuration
|
||||||
|
* HCLK(Hz) : 168000000 (STM32_RCC_CFGR_HPRE)
|
||||||
|
* AHB Prescaler : 1 (STM32_RCC_CFGR_HPRE)
|
||||||
|
* APB1 Prescaler : 4 (STM32_RCC_CFGR_PPRE1)
|
||||||
|
* APB2 Prescaler : 2 (STM32_RCC_CFGR_PPRE2)
|
||||||
|
* HSE Frequency(Hz) : 8000000 (STM32_BOARD_XTAL)
|
||||||
|
* PLLM : 8 (STM32_PLLCFG_PLLM)
|
||||||
|
* PLLN : 336 (STM32_PLLCFG_PLLN)
|
||||||
|
* PLLP : 2 (STM32_PLLCFG_PLLP)
|
||||||
|
* PLLQ : 7 (STM32_PLLCFG_PLLQ)
|
||||||
|
* Main regulator output voltage : Scale1 mode Needed for high speed SYSCLK
|
||||||
|
* Flash Latency(WS) : 5
|
||||||
|
* Prefetch Buffer : OFF
|
||||||
|
* Instruction cache : ON
|
||||||
|
* Data cache : ON
|
||||||
|
* Require 48MHz for USB OTG FS, : Enabled
|
||||||
|
* SDIO and RNG clock
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* HSI - 16 MHz RC factory-trimmed
|
||||||
|
* LSI - 32 KHz RC (30-60KHz, uncalibrated)
|
||||||
|
* HSE - On-board crystal frequency is 12MHz
|
||||||
|
* LSE - 32.768 kHz
|
||||||
|
* STM32F407ZGT6 - too 168Mhz
|
||||||
|
*/
|
||||||
|
|
||||||
|
#define STM32_BOARD_XTAL 12000000ul
|
||||||
|
|
||||||
|
#define STM32_HSI_FREQUENCY 16000000ul
|
||||||
|
#define STM32_LSI_FREQUENCY 32000
|
||||||
|
#define STM32_HSE_FREQUENCY STM32_BOARD_XTAL
|
||||||
|
#define STM32_LSE_FREQUENCY 32768
|
||||||
|
|
||||||
|
/* Main PLL Configuration.
|
||||||
|
*
|
||||||
|
* PLL source is HSE
|
||||||
|
* PLL_VCO = (STM32_HSE_FREQUENCY / PLLM) * PLLN
|
||||||
|
* = (25,000,000 / 12) * 360
|
||||||
|
* = 240,000,000
|
||||||
|
* SYSCLK = PLL_VCO / PLLP
|
||||||
|
* = 240,000,000 / 2 = 120,000,000
|
||||||
|
* USB OTG FS, SDIO and RNG Clock
|
||||||
|
* = PLL_VCO / PLLQ
|
||||||
|
* = 240,000,000 / 5 = 48,000,000
|
||||||
|
* = 48,000,000
|
||||||
|
*
|
||||||
|
* Xtal /M *n /P SysClk AHB HCLK APB1 PCLK1
|
||||||
|
* 12Mhz HSE /12 336 /2 PLLCLK 168Mhz /1 168 /4 42Mhz
|
||||||
|
* 12Mhz HSE /6 168 /2 PLLCLK 168Mhz /1 168 /4 42Mhz
|
||||||
|
*/
|
||||||
|
|
||||||
|
#define STM32_PLLCFG_PLLM RCC_PLLCFG_PLLM(3)
|
||||||
|
#define STM32_PLLCFG_PLLN RCC_PLLCFG_PLLN(84)
|
||||||
|
#define STM32_PLLCFG_PLLP RCC_PLLCFG_PLLP_2
|
||||||
|
#define STM32_PLLCFG_PLLQ RCC_PLLCFG_PLLQ(5)
|
||||||
|
#define STM32_PLLCFG_PLLQ RCC_PLLCFG_PLLQ(7)
|
||||||
|
|
||||||
|
#define STM32_SYSCLK_FREQUENCY 168000000ul
|
||||||
|
|
||||||
|
/* AHB clock (HCLK) is SYSCLK (168MHz) */
|
||||||
|
|
||||||
|
#define STM32_RCC_CFGR_HPRE RCC_CFGR_HPRE_SYSCLK /* HCLK = SYSCLK / 1 */
|
||||||
|
#define STM32_HCLK_FREQUENCY STM32_SYSCLK_FREQUENCY
|
||||||
|
#define STM32_BOARD_HCLK STM32_HCLK_FREQUENCY /* same as above, to satisfy compiler */
|
||||||
|
|
||||||
|
/* APB1 clock (PCLK1) is HCLK/4 (42MHz) */
|
||||||
|
|
||||||
|
#define STM32_RCC_CFGR_PPRE1 RCC_CFGR_PPRE1_HCLKd4 /* PCLK1 = HCLK / 4 */
|
||||||
|
#define STM32_PCLK1_FREQUENCY (STM32_HCLK_FREQUENCY/4)
|
||||||
|
|
||||||
|
/* Timers driven from APB1 will be twice PCLK1 */
|
||||||
|
|
||||||
|
#define STM32_APB1_TIM2_CLKIN (2*STM32_PCLK1_FREQUENCY)
|
||||||
|
#define STM32_APB1_TIM3_CLKIN (2*STM32_PCLK1_FREQUENCY)
|
||||||
|
#define STM32_APB1_TIM4_CLKIN (2*STM32_PCLK1_FREQUENCY)
|
||||||
|
#define STM32_APB1_TIM5_CLKIN (2*STM32_PCLK1_FREQUENCY)
|
||||||
|
#define STM32_APB1_TIM6_CLKIN (2*STM32_PCLK1_FREQUENCY)
|
||||||
|
#define STM32_APB1_TIM7_CLKIN (2*STM32_PCLK1_FREQUENCY)
|
||||||
|
#define STM32_APB1_TIM12_CLKIN (2*STM32_PCLK1_FREQUENCY)
|
||||||
|
#define STM32_APB1_TIM13_CLKIN (2*STM32_PCLK1_FREQUENCY)
|
||||||
|
#define STM32_APB1_TIM14_CLKIN (2*STM32_PCLK1_FREQUENCY)
|
||||||
|
|
||||||
|
/* APB2 clock (PCLK2) is HCLK/2 */
|
||||||
|
|
||||||
|
#define STM32_RCC_CFGR_PPRE2 RCC_CFGR_PPRE2_HCLKd2 /* PCLK2 = HCLK / 2 */
|
||||||
|
#define STM32_PCLK2_FREQUENCY (STM32_HCLK_FREQUENCY/2)
|
||||||
|
|
||||||
|
/* Timers driven from APB2 will be twice PCLK2 */
|
||||||
|
|
||||||
|
#define STM32_APB2_TIM1_CLKIN (2*STM32_PCLK2_FREQUENCY)
|
||||||
|
#define STM32_APB2_TIM8_CLKIN (2*STM32_PCLK2_FREQUENCY)
|
||||||
|
#define STM32_APB2_TIM9_CLKIN (2*STM32_PCLK2_FREQUENCY)
|
||||||
|
#define STM32_APB2_TIM10_CLKIN (2*STM32_PCLK2_FREQUENCY)
|
||||||
|
#define STM32_APB2_TIM11_CLKIN (2*STM32_PCLK2_FREQUENCY)
|
||||||
|
|
||||||
|
/* Timer Frequencies, if APBx is set to 1, frequency is same to APBx
|
||||||
|
* otherwise frequency is 2xAPBx.
|
||||||
|
* Note: TIM1,8 are on APB2, others on APB1
|
||||||
|
*/
|
||||||
|
|
||||||
|
#define STM32_TIM18_FREQUENCY STM32_HCLK_FREQUENCY
|
||||||
|
#define STM32_TIM27_FREQUENCY STM32_HCLK_FREQUENCY
|
||||||
|
|
||||||
|
/* LED definitions ******************************************************************/
|
||||||
|
/* If CONFIG_ARCH_LEDS is not defined, then the user can control the status LED in any
|
||||||
|
* way. The following definitions are used to access individual LEDs.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* LED index values for use with board_userled() */
|
||||||
|
|
||||||
|
#define BOARD_LED_STATUS 0
|
||||||
|
#define BOARD_NLEDS 1
|
||||||
|
|
||||||
|
/* LED bits for use with board_userled_all() */
|
||||||
|
|
||||||
|
#define BOARD_LED_STATUS_BIT (1 << BOARD_LED1)
|
||||||
|
|
||||||
|
/* If CONFIG_ARCH_LEDs is defined, then NuttX will control the status LED of the
|
||||||
|
* Olimex STM32-E405. The following definitions describe how NuttX controls the LEDs:
|
||||||
|
*/
|
||||||
|
|
||||||
|
#define LED_STARTED 0 /* LED_STATUS on */
|
||||||
|
#define LED_HEAPALLOCATE 1 /* no change */
|
||||||
|
#define LED_IRQSENABLED 2 /* no change */
|
||||||
|
#define LED_STACKCREATED 3 /* no change */
|
||||||
|
#define LED_INIRQ 4 /* no change */
|
||||||
|
#define LED_SIGNAL 5 /* no change */
|
||||||
|
#define LED_ASSERTION 6 /* LED_STATUS off */
|
||||||
|
#define LED_PANIC 7 /* LED_STATUS blinking */
|
||||||
|
|
||||||
|
/* Button definitions ***************************************************************/
|
||||||
|
/* The Olimex STM32-E405 supports one buttons: */
|
||||||
|
|
||||||
|
#define BUTTON_BUT 0
|
||||||
|
#define NUM_BUTTONS 1
|
||||||
|
|
||||||
|
#define BUTTON_BUT_BIT (1 << BUTTON_BUT)
|
||||||
|
|
||||||
|
/* Alternate function pin selections ************************************************/
|
||||||
|
|
||||||
|
/* USART1 */
|
||||||
|
#define GPIO_USART1_RX GPIO_USART1_RX_2 /* PB7 */
|
||||||
|
#define GPIO_USART1_TX GPIO_USART1_TX_2 /* PB6 */
|
||||||
|
|
||||||
|
/* USART2 */
|
||||||
|
#define GPIO_USART2_RX GPIO_USART2_RX_2 /* PD6 */
|
||||||
|
#define GPIO_USART2_TX GPIO_USART2_TX_2 /* PD5 */
|
||||||
|
|
||||||
|
/* USART3 */
|
||||||
|
#define GPIO_USART3_RX GPIO_USART3_RX_1 /* PB11 */
|
||||||
|
#define GPIO_USART3_TX GPIO_USART3_TX_1 /* PB10 */
|
||||||
|
|
||||||
|
/* CAN */
|
||||||
|
#define GPIO_CAN1_RX GPIO_CAN1_RX_2 /* PB8 */
|
||||||
|
#define GPIO_CAN1_TX GPIO_CAN1_TX_2 /* PB9 */
|
||||||
|
|
||||||
|
/* I2C */
|
||||||
|
#define GPIO_I2C1_SCL GPIO_I2C1_SCL_1 /* PB6 */
|
||||||
|
#define GPIO_I2C1_SDA GPIO_I2C1_SDA_1 /* PB7 */
|
||||||
|
|
||||||
|
/* Ethernet *************************************************************************/
|
||||||
|
|
||||||
|
#if defined(CONFIG_STM32_ETHMAC)
|
||||||
|
/* RMII interface to the LAN8720 PHY */
|
||||||
|
|
||||||
|
# ifndef CONFIG_STM32_RMII
|
||||||
|
# error CONFIG_STM32_RMII must be defined
|
||||||
|
# endif
|
||||||
|
|
||||||
|
/* Clocking is provided by an external 50Mhz XTAL */
|
||||||
|
|
||||||
|
# ifndef CONFIG_STM32_RMII_EXTCLK
|
||||||
|
# error CONFIG_STM32_RMII_EXTCLK must be defined
|
||||||
|
# endif
|
||||||
|
|
||||||
|
/* Pin disambiguation */
|
||||||
|
|
||||||
|
# define GPIO_ETH_MII_COL GPIO_ETH_MII_COL_1 /* PA3 */
|
||||||
|
# define GPIO_ETH_RMII_TXD0 GPIO_ETH_RMII_TXD0_2 /* PG13 */
|
||||||
|
# define GPIO_ETH_RMII_TXD1 GPIO_ETH_RMII_TXD1_2 /* PG14 */
|
||||||
|
# define GPIO_ETH_RMII_TX_EN GPIO_ETH_RMII_TX_EN_2 /* PG11 */
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/*******************************************************************************
|
||||||
|
* Public Data
|
||||||
|
******************************************************************************/
|
||||||
|
|
||||||
|
#ifndef __ASSEMBLY__
|
||||||
|
|
||||||
|
#undef EXTERN
|
||||||
|
#if defined(__cplusplus)
|
||||||
|
#define EXTERN extern "C"
|
||||||
|
extern "C"
|
||||||
|
{
|
||||||
|
#else
|
||||||
|
#define EXTERN extern
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/******************************************************************************
|
||||||
|
* Public Function Prototypes
|
||||||
|
*****************************************************************************/
|
||||||
|
|
||||||
|
/******************************************************************************
|
||||||
|
* Name: stm32_boardinitialize
|
||||||
|
*
|
||||||
|
* Description:
|
||||||
|
* All STM32 architectures must provide the following entry point. This entry point
|
||||||
|
* is called early in the initialization -- after all memory has been configured
|
||||||
|
* and mapped but before any devices have been initialized.
|
||||||
|
*
|
||||||
|
*****************************************************************************/
|
||||||
|
|
||||||
|
void stm32_boardinitialize(void);
|
||||||
|
|
||||||
|
#undef EXTERN
|
||||||
|
#if defined(__cplusplus)
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* __ASSEMBLY__ */
|
||||||
|
#endif /* __CONFIGS_OLIMEX_STM32_E407_INCLUDE_BOARD_H */
|
113
configs/olimex-stm32-e407/nsh/Make.defs
Normal file
113
configs/olimex-stm32-e407/nsh/Make.defs
Normal file
|
@ -0,0 +1,113 @@
|
||||||
|
############################################################################
|
||||||
|
# configs/olimex-stm32-e407/nsh/Make.defs
|
||||||
|
#
|
||||||
|
# Copyright (C) 2011-2012 Gregory Nutt. All rights reserved.
|
||||||
|
# Author: Gregory Nutt <gnutt@nuttx.org>
|
||||||
|
#
|
||||||
|
# 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 NuttX 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.
|
||||||
|
#
|
||||||
|
############################################################################
|
||||||
|
|
||||||
|
include ${TOPDIR}/.config
|
||||||
|
include ${TOPDIR}/tools/Config.mk
|
||||||
|
include ${TOPDIR}/arch/arm/src/armv7-m/Toolchain.defs
|
||||||
|
|
||||||
|
LDSCRIPT = ld.script
|
||||||
|
|
||||||
|
ifeq ($(WINTOOL),y)
|
||||||
|
# Windows-native toolchains
|
||||||
|
DIRLINK = $(TOPDIR)/tools/copydir.sh
|
||||||
|
DIRUNLINK = $(TOPDIR)/tools/unlink.sh
|
||||||
|
MKDEP = $(TOPDIR)/tools/mkwindeps.sh
|
||||||
|
ARCHINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}"
|
||||||
|
ARCHXXINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}" -isystem "${shell cygpath -w $(TOPDIR)/include/cxx}"
|
||||||
|
ARCHSCRIPT = -T "${shell cygpath -w $(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/scripts/$(LDSCRIPT)}"
|
||||||
|
else
|
||||||
|
# Linux/Cygwin-native toolchain
|
||||||
|
MKDEP = $(TOPDIR)/tools/mkdeps$(HOSTEXEEXT)
|
||||||
|
ARCHINCLUDES = -I. -isystem $(TOPDIR)/include
|
||||||
|
ARCHXXINCLUDES = -I. -isystem $(TOPDIR)/include -isystem $(TOPDIR)/include/cxx
|
||||||
|
ARCHSCRIPT = -T$(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/scripts/$(LDSCRIPT)
|
||||||
|
endif
|
||||||
|
|
||||||
|
CC = $(CROSSDEV)gcc
|
||||||
|
CXX = $(CROSSDEV)g++
|
||||||
|
CPP = $(CROSSDEV)gcc -E
|
||||||
|
LD = $(CROSSDEV)ld
|
||||||
|
AR = $(ARCROSSDEV)ar rcs
|
||||||
|
NM = $(ARCROSSDEV)nm
|
||||||
|
OBJCOPY = $(CROSSDEV)objcopy
|
||||||
|
OBJDUMP = $(CROSSDEV)objdump
|
||||||
|
|
||||||
|
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}
|
||||||
|
|
||||||
|
ifeq ($(CONFIG_DEBUG_SYMBOLS),y)
|
||||||
|
ARCHOPTIMIZATION = -g
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifneq ($(CONFIG_DEBUG_NOOPT),y)
|
||||||
|
ARCHOPTIMIZATION += $(MAXOPTIMIZATION) -fno-strict-aliasing -fno-strength-reduce -fomit-frame-pointer
|
||||||
|
endif
|
||||||
|
|
||||||
|
ARCHCFLAGS = -fno-builtin
|
||||||
|
ARCHCXXFLAGS = -fno-builtin -fno-exceptions -fno-rtti
|
||||||
|
ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow -Wundef
|
||||||
|
ARCHWARNINGSXX = -Wall -Wshadow -Wundef
|
||||||
|
ARCHDEFINES =
|
||||||
|
ARCHPICFLAGS = -fpic -msingle-pic-base -mpic-register=r10
|
||||||
|
|
||||||
|
CFLAGS = $(ARCHCFLAGS) $(ARCHWARNINGS) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
|
||||||
|
CPICFLAGS = $(ARCHPICFLAGS) $(CFLAGS)
|
||||||
|
CXXFLAGS = $(ARCHCXXFLAGS) $(ARCHWARNINGSXX) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHXXINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
|
||||||
|
CXXPICFLAGS = $(ARCHPICFLAGS) $(CXXFLAGS)
|
||||||
|
CPPFLAGS = $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES)
|
||||||
|
AFLAGS = $(CFLAGS) -D__ASSEMBLY__
|
||||||
|
|
||||||
|
NXFLATLDFLAGS1 = -r -d -warn-common
|
||||||
|
NXFLATLDFLAGS2 = $(NXFLATLDFLAGS1) -T$(TOPDIR)/binfmt/libnxflat/gnu-nxflat-pcrel.ld -no-check-sections
|
||||||
|
LDNXFLATFLAGS = -e main -s 2048
|
||||||
|
|
||||||
|
ASMEXT = .S
|
||||||
|
OBJEXT = .o
|
||||||
|
LIBEXT = .a
|
||||||
|
EXEEXT =
|
||||||
|
|
||||||
|
ifneq ($(CROSSDEV),arm-nuttx-elf-)
|
||||||
|
LDFLAGS += -nostartfiles -nodefaultlibs
|
||||||
|
endif
|
||||||
|
ifeq ($(CONFIG_DEBUG_SYMBOLS),y)
|
||||||
|
LDFLAGS += -g
|
||||||
|
endif
|
||||||
|
|
||||||
|
|
||||||
|
HOSTCC = gcc
|
||||||
|
HOSTINCLUDES = -I.
|
||||||
|
HOSTCFLAGS = -Wall -Wstrict-prototypes -Wshadow -Wundef -g -pipe
|
||||||
|
HOSTLDFLAGS =
|
||||||
|
|
1184
configs/olimex-stm32-e407/nsh/defconfig
Normal file
1184
configs/olimex-stm32-e407/nsh/defconfig
Normal file
File diff suppressed because it is too large
Load diff
80
configs/olimex-stm32-e407/nsh/setenv.sh
Executable file
80
configs/olimex-stm32-e407/nsh/setenv.sh
Executable file
|
@ -0,0 +1,80 @@
|
||||||
|
#!/bin/bash
|
||||||
|
# configs/olimex-stm32-e407/nsh/setenv.sh
|
||||||
|
#
|
||||||
|
# Copyright (C) 2011-2012 Gregory Nutt. All rights reserved.
|
||||||
|
# Author: Gregory Nutt <gnutt@nuttx.org>
|
||||||
|
#
|
||||||
|
# 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 NuttX 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.
|
||||||
|
#
|
||||||
|
|
||||||
|
if [ "$_" = "$0" ] ; then
|
||||||
|
echo "You must source this script, not run it!" 1>&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
WD=`pwd`
|
||||||
|
if [ ! -x "setenv.sh" ]; then
|
||||||
|
echo "This script must be executed from the top-level NuttX build directory"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -z "${PATH_ORIG}" ]; then
|
||||||
|
export PATH_ORIG="${PATH}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# This is the Cygwin path to the location where I installed the RIDE
|
||||||
|
# toolchain under windows. You will also have to edit this if you install
|
||||||
|
# the RIDE toolchain in any other location
|
||||||
|
#export TOOLCHAIN_BIN="/cygdrive/c/Program Files (x86)/Raisonance/Ride/arm-gcc/bin"
|
||||||
|
|
||||||
|
# This is the Cygwin path to the location where I installed the CodeSourcery
|
||||||
|
# toolchain under windows. You will also have to edit this if you install
|
||||||
|
# the CodeSourcery toolchain in any other location
|
||||||
|
export TOOLCHAIN_BIN="/cygdrive/c/Program Files (x86)/CodeSourcery/Sourcery G++ Lite/bin"
|
||||||
|
#export TOOLCHAIN_BIN="/cygdrive/c/Users/MyName/MentorGraphics/Sourcery_CodeBench_Lite_for_ARM_EABI/bin"
|
||||||
|
|
||||||
|
# This is the location where I installed the ARM "GNU Tools for ARM Embedded Processors"
|
||||||
|
# You can this free toolchain here https://launchpad.net/gcc-arm-embedded
|
||||||
|
#export TOOLCHAIN_BIN="/cygdrive/c/Program Files (x86)/GNU Tools ARM Embedded/4.9 2015q2/bin"
|
||||||
|
|
||||||
|
# These are the Cygwin paths to the locations where I installed the Atollic
|
||||||
|
# toolchain under windows. You will also have to edit this if you install
|
||||||
|
# the Atollic toolchain in any other location. /usr/bin is added before
|
||||||
|
# the Atollic bin path because there is are binaries named gcc.exe and g++.exe
|
||||||
|
# at those locations as well.
|
||||||
|
#export TOOLCHAIN_BIN="/usr/bin:/cygdrive/c/Program Files (x86)/Atollic/TrueSTUDIO for ARM Pro 2.3.0/ARMTools/bin"
|
||||||
|
#export TOOLCHAIN_BIN="/usr/bin:/cygdrive/c/Program Files (x86)/Atollic/TrueSTUDIO for STMicroelectronics STM32 Lite 2.3.0/ARMTools/bin"
|
||||||
|
|
||||||
|
# This is the Cygwin path to the location where I build the buildroot
|
||||||
|
# toolchain.
|
||||||
|
#export TOOLCHAIN_BIN="${WD}/../buildroot/build_arm_nofpu/staging_dir/bin"
|
||||||
|
|
||||||
|
# Add the path to the toolchain to the PATH variable
|
||||||
|
export PATH="${TOOLCHAIN_BIN}:/sbin:/usr/sbin:${PATH_ORIG}"
|
||||||
|
|
||||||
|
echo "PATH : ${PATH}"
|
122
configs/olimex-stm32-e407/scripts/ld.script
Normal file
122
configs/olimex-stm32-e407/scripts/ld.script
Normal file
|
@ -0,0 +1,122 @@
|
||||||
|
/****************************************************************************
|
||||||
|
* configs/olimex-stm32-h405/scripts/ld.script
|
||||||
|
*
|
||||||
|
* Copyright (C) 2016 Gregory Nutt. All rights reserved.
|
||||||
|
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||||
|
*
|
||||||
|
* 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 NuttX 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.
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
/* The STM32F407ZGT6 has 1024Kb of FLASH beginning at address 0x0800:0000 and
|
||||||
|
* 192Kb of SRAM. SRAM is split up into two blocks:
|
||||||
|
*
|
||||||
|
* 1) 112Kb of SRAM beginning at address 0x2000:0000
|
||||||
|
* 2) 16Kb of SRAM beginning at address 0x2001:c000
|
||||||
|
* 3) 64Kb of SRAM beginning at address 0x2002:0000
|
||||||
|
*
|
||||||
|
* When booting from FLASH, FLASH memory is aliased to address 0x0000:0000
|
||||||
|
* where the code expects to begin execution by jumping to the entry point in
|
||||||
|
* the 0x0800:0000 address
|
||||||
|
* range.
|
||||||
|
*/
|
||||||
|
|
||||||
|
MEMORY
|
||||||
|
{
|
||||||
|
flash (rx) : ORIGIN = 0x08000000, LENGTH = 1024K
|
||||||
|
sram (rwx) : ORIGIN = 0x20000000, LENGTH = 112K
|
||||||
|
}
|
||||||
|
|
||||||
|
OUTPUT_ARCH(arm)
|
||||||
|
ENTRY(_stext)
|
||||||
|
SECTIONS
|
||||||
|
{
|
||||||
|
.text : {
|
||||||
|
_stext = ABSOLUTE(.);
|
||||||
|
*(.vectors)
|
||||||
|
*(.text .text.*)
|
||||||
|
*(.fixup)
|
||||||
|
*(.gnu.warning)
|
||||||
|
*(.rodata .rodata.*)
|
||||||
|
*(.gnu.linkonce.t.*)
|
||||||
|
*(.glue_7)
|
||||||
|
*(.glue_7t)
|
||||||
|
*(.got)
|
||||||
|
*(.gcc_except_table)
|
||||||
|
*(.gnu.linkonce.r.*)
|
||||||
|
_etext = ABSOLUTE(.);
|
||||||
|
} > flash
|
||||||
|
|
||||||
|
.init_section : {
|
||||||
|
_sinit = ABSOLUTE(.);
|
||||||
|
*(.init_array .init_array.*)
|
||||||
|
_einit = ABSOLUTE(.);
|
||||||
|
} > flash
|
||||||
|
|
||||||
|
.ARM.extab : {
|
||||||
|
*(.ARM.extab*)
|
||||||
|
} > flash
|
||||||
|
|
||||||
|
__exidx_start = ABSOLUTE(.);
|
||||||
|
.ARM.exidx : {
|
||||||
|
*(.ARM.exidx*)
|
||||||
|
} > flash
|
||||||
|
__exidx_end = ABSOLUTE(.);
|
||||||
|
|
||||||
|
_eronly = ABSOLUTE(.);
|
||||||
|
|
||||||
|
.data : {
|
||||||
|
_sdata = ABSOLUTE(.);
|
||||||
|
*(.data .data.*)
|
||||||
|
*(.gnu.linkonce.d.*)
|
||||||
|
CONSTRUCTORS
|
||||||
|
_edata = ABSOLUTE(.);
|
||||||
|
} > sram AT > flash
|
||||||
|
|
||||||
|
.bss : {
|
||||||
|
_sbss = ABSOLUTE(.);
|
||||||
|
*(.bss .bss.*)
|
||||||
|
*(.gnu.linkonce.b.*)
|
||||||
|
*(COMMON)
|
||||||
|
_ebss = ABSOLUTE(.);
|
||||||
|
} > sram
|
||||||
|
|
||||||
|
/* Stabs debugging sections. */
|
||||||
|
.stab 0 : { *(.stab) }
|
||||||
|
.stabstr 0 : { *(.stabstr) }
|
||||||
|
.stab.excl 0 : { *(.stab.excl) }
|
||||||
|
.stab.exclstr 0 : { *(.stab.exclstr) }
|
||||||
|
.stab.index 0 : { *(.stab.index) }
|
||||||
|
.stab.indexstr 0 : { *(.stab.indexstr) }
|
||||||
|
.comment 0 : { *(.comment) }
|
||||||
|
.debug_abbrev 0 : { *(.debug_abbrev) }
|
||||||
|
.debug_info 0 : { *(.debug_info) }
|
||||||
|
.debug_line 0 : { *(.debug_line) }
|
||||||
|
.debug_pubnames 0 : { *(.debug_pubnames) }
|
||||||
|
.debug_aranges 0 : { *(.debug_aranges) }
|
||||||
|
}
|
83
configs/olimex-stm32-e407/src/Makefile
Normal file
83
configs/olimex-stm32-e407/src/Makefile
Normal file
|
@ -0,0 +1,83 @@
|
||||||
|
############################################################################
|
||||||
|
# configs/olimex-stm32-e407/src/Makefile
|
||||||
|
#
|
||||||
|
# Copyright (C) 2016 Gregory Nutt. All rights reserved.
|
||||||
|
# Author: Gregory Nutt <gnutt@nuttx.org>
|
||||||
|
#
|
||||||
|
# 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 NuttX 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.
|
||||||
|
#
|
||||||
|
############################################################################
|
||||||
|
|
||||||
|
-include $(TOPDIR)/Make.defs
|
||||||
|
|
||||||
|
ASRCS =
|
||||||
|
CSRCS = stm32_boot.c
|
||||||
|
|
||||||
|
ifeq ($(CONFIG_ARCH_LEDS),y)
|
||||||
|
CSRCS += stm32_autoleds.c
|
||||||
|
else
|
||||||
|
CSRCS += stm32_userleds.c
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifeq ($(CONFIG_ARCH_BUTTONS),y)
|
||||||
|
CSRCS += stm32_buttons.c
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifeq ($(CONFIG_NSH_LIBRARY),y)
|
||||||
|
CSRCS += stm32_appinit.c
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifeq ($(CONFIG_ARCH_IDLE_CUSTOM),y)
|
||||||
|
CSRCS += stm32_idle.c
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifeq ($(CONFIG_STM32_FSMC),y)
|
||||||
|
CSRCS += stm32_extmem.c
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifeq ($(CONFIG_STM32_OTGFS),y)
|
||||||
|
CSRCS += stm32_usb.c
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifeq ($(CONFIG_STM32_OTGHS),y)
|
||||||
|
CSRCS += stm32_usb.c
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifeq ($(CONFIG_ADC),y)
|
||||||
|
CSRCS += stm32_adc.c
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifeq ($(CONFIG_CAN),y)
|
||||||
|
CSRCS += stm32_can.c
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifeq ($(CONFIG_ARCH_FPU),y)
|
||||||
|
CSRCS += stm32_ostest.c
|
||||||
|
endif
|
||||||
|
|
||||||
|
include $(TOPDIR)/configs/Board.mk
|
247
configs/olimex-stm32-e407/src/olimex-stm32-e407.h
Normal file
247
configs/olimex-stm32-e407/src/olimex-stm32-e407.h
Normal file
|
@ -0,0 +1,247 @@
|
||||||
|
/****************************************************************************
|
||||||
|
* configs/olimex-stm32-e407/src/olimex-stm32-e407.h
|
||||||
|
*
|
||||||
|
* Copyright (C) 2014 Max Holtzberg. All rights reserved.
|
||||||
|
* Author: Max Holtzberg <mholtzberg@uvc-ingenieure.de>
|
||||||
|
*
|
||||||
|
* 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 NuttX 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.
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#ifndef __CONFIGS_OLIMEX_STM32_E407_SRC_H
|
||||||
|
#define __CONFIGS_OLIMEX_STM32_E407_SRC_H
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Included Files
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#include <nuttx/config.h>
|
||||||
|
#include <nuttx/compiler.h>
|
||||||
|
#include <stdint.h>
|
||||||
|
#include <arch/stm32/chip.h>
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Pre-processor Definitions
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
/* Configuration from stm32f4discovert*/
|
||||||
|
|
||||||
|
/* Assume that we have everything */
|
||||||
|
|
||||||
|
#define HAVE_USBDEV 1
|
||||||
|
#define HAVE_USBHOST 1
|
||||||
|
#define HAVE_USBMONITOR 1
|
||||||
|
#define HAVE_SDIO 1
|
||||||
|
#define HAVE_RTC_DRIVER 1
|
||||||
|
#define HAVE_ELF 1
|
||||||
|
#define HAVE_NETMONITOR 1
|
||||||
|
|
||||||
|
/* Can't support USB host or device features if USB OTG FS is not enabled */
|
||||||
|
|
||||||
|
#ifndef CONFIG_STM32_OTGFS
|
||||||
|
# undef HAVE_USBDEV
|
||||||
|
# undef HAVE_USBHOST
|
||||||
|
# undef HAVE_USBMONITOR
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Can't support USB device monitor if USB device is not enabled */
|
||||||
|
|
||||||
|
#ifndef CONFIG_USBDEV
|
||||||
|
# undef HAVE_USBDEV
|
||||||
|
# undef HAVE_USBMONITOR
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Can't support USB host is USB host is not enabled */
|
||||||
|
|
||||||
|
#ifndef CONFIG_USBHOST
|
||||||
|
# undef HAVE_USBHOST
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Check if we should enable the USB monitor before starting NSH */
|
||||||
|
|
||||||
|
#if !defined(CONFIG_USBDEV_TRACE) || !defined(CONFIG_SYSTEM_USBMONITOR)
|
||||||
|
# undef HAVE_USBMONITOR
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* ELF */
|
||||||
|
|
||||||
|
#if defined(CONFIG_BINFMT_DISABLE) || !defined(CONFIG_ELF)
|
||||||
|
# undef HAVE_ELF
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* NSH Network monitor */
|
||||||
|
|
||||||
|
#if !defined(CONFIG_NET) || !defined(CONFIG_STM32_EMACMAC)
|
||||||
|
# undef HAVE_NETMONITOR
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if !defined(CONFIG_NSH_NETINIT_THREAD) || !defined(CONFIG_ARCH_PHY_INTERRUPT) || \
|
||||||
|
!defined(CONFIG_NETDEV_PHY_IOCTL) || !defined(CONFIG_NET_UDP) || \
|
||||||
|
defined(CONFIG_DISABLE_SIGNALS)
|
||||||
|
# undef HAVE_NETMONITOR
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* The NSH Network Monitor cannot be used with the STM32F4DIS-BB base board.
|
||||||
|
* That is because the LAN8720 is configured in REF_CLK OUT mode. In that
|
||||||
|
* mode, the PHY interrupt is not supported. The NINT pin serves instead as
|
||||||
|
* REFLCK0.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifdef CONFIG_STM32F4DISBB
|
||||||
|
# undef HAVE_NETMONITOR
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* procfs File System */
|
||||||
|
|
||||||
|
#ifdef CONFIG_FS_PROCFS
|
||||||
|
# ifdef CONFIG_NSH_PROC_MOUNTPOINT
|
||||||
|
# define STM32_PROCFS_MOUNTPOINT CONFIG_NSH_PROC_MOUNTPOINT
|
||||||
|
# else
|
||||||
|
# define STM32_PROCFS_MOUNTPOINT "/proc"
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Olimex-STM32-E407 GPIOs ****************************************************/
|
||||||
|
/* LEDs */
|
||||||
|
|
||||||
|
#define GPIO_LED_STATUS (GPIO_OUTPUT|GPIO_PUSHPULL|GPIO_SPEED_50MHz|\
|
||||||
|
GPIO_OUTPUT_CLEAR|GPIO_PORTC|GPIO_PIN13)
|
||||||
|
|
||||||
|
/* BUTTONS -- NOTE that all have EXTI interrupts configured */
|
||||||
|
|
||||||
|
#define MIN_IRQBUTTON BUTTON_BUT
|
||||||
|
#define MAX_IRQBUTTON BUTTON_BUT
|
||||||
|
#define NUM_IRQBUTTONS 1
|
||||||
|
|
||||||
|
#define GPIO_BTN_BUT (GPIO_INPUT|GPIO_FLOAT|GPIO_EXTI|GPIO_PORTA|GPIO_PIN0)
|
||||||
|
|
||||||
|
/* USB OTG FS - USB-A connector
|
||||||
|
*
|
||||||
|
* PC4 OTG_FS_VBUS VBUS sensing
|
||||||
|
* PB0 OTG_FS_PowerSwitchOn
|
||||||
|
* PB1 OTG_FS_Overcurrent
|
||||||
|
*/
|
||||||
|
|
||||||
|
#define GPIO_OTGFS_VBUS (GPIO_INPUT|GPIO_FLOAT|GPIO_SPEED_100MHz|\
|
||||||
|
GPIO_OPENDRAIN|GPIO_PORTA|GPIO_PIN9)
|
||||||
|
#define GPIO_OTGFS_PWRON (GPIO_OUTPUT|GPIO_FLOAT|GPIO_SPEED_100MHz|\
|
||||||
|
GPIO_PUSHPULL|GPIO_PORTB|GPIO_PIN0)
|
||||||
|
|
||||||
|
#ifdef CONFIG_USBHOST
|
||||||
|
# define GPIO_OTGFS_OVER (GPIO_INPUT|GPIO_EXTI|GPIO_FLOAT|\
|
||||||
|
GPIO_SPEED_100MHz|GPIO_PUSHPULL|\
|
||||||
|
GPIO_PORTB|GPIO_PIN1)
|
||||||
|
|
||||||
|
#else
|
||||||
|
# define GPIO_OTGFS_OVER (GPIO_INPUT|GPIO_FLOAT|GPIO_SPEED_100MHz|\
|
||||||
|
GPIO_PUSHPULL|GPIO_PORTB|GPIO_PIN1)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
/* USB OTG HS - miniUSB connector
|
||||||
|
*
|
||||||
|
* PB13 OTG_HS_VBUS VBUS sensing (also connected to the green LED)
|
||||||
|
* PA8 OTG_HS_PowerSwitchOn
|
||||||
|
* PF11 OTG_HS_Overcurrent
|
||||||
|
*/
|
||||||
|
|
||||||
|
#define GPIO_OTGHS_VBUS (GPIO_INPUT|GPIO_FLOAT|GPIO_SPEED_100MHz|GPIO_OPENDRAIN|GPIO_PORTB|GPIO_PIN13)
|
||||||
|
#define GPIO_OTGHS_PWRON (GPIO_OUTPUT|GPIO_OUTPUT_SET|GPIO_FLOAT|GPIO_SPEED_100MHz|GPIO_PUSHPULL|GPIO_PORTA|GPIO_PIN8)
|
||||||
|
|
||||||
|
#ifdef CONFIG_USBHOST
|
||||||
|
# define GPIO_OTGHS_OVER (GPIO_INPUT|GPIO_EXTI|GPIO_FLOAT|GPIO_SPEED_100MHz|GPIO_PUSHPULL|GPIO_PORTF|GPIO_PIN11)
|
||||||
|
|
||||||
|
#else
|
||||||
|
# define GPIO_OTGHS_OVER (GPIO_INPUT|GPIO_FLOAT|GPIO_SPEED_100MHz|GPIO_PUSHPULL|GPIO_PORTF|GPIO_PIN11)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/****************************************************************************************************
|
||||||
|
* Public Types
|
||||||
|
****************************************************************************************************/
|
||||||
|
|
||||||
|
/****************************************************************************************************
|
||||||
|
* Public data
|
||||||
|
****************************************************************************************************/
|
||||||
|
|
||||||
|
#ifndef __ASSEMBLY__
|
||||||
|
|
||||||
|
/************************************************************************************
|
||||||
|
* Public Functions
|
||||||
|
************************************************************************************/
|
||||||
|
|
||||||
|
/************************************************************************************
|
||||||
|
* Name: stm32_usbinitialize
|
||||||
|
*
|
||||||
|
* Description:
|
||||||
|
* Called from stm32_usbinitialize very early in initialization to setup USB-related
|
||||||
|
* GPIO pins for the Olimex-STM32-H405 board.
|
||||||
|
*
|
||||||
|
************************************************************************************/
|
||||||
|
|
||||||
|
#if defined(CONFIG_STM32_OTGFS) || defined(CONFIG_STM32_OTGHS)
|
||||||
|
void weak_function stm32_usbinitialize(void);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Name: stm32_sdio_initialize
|
||||||
|
*
|
||||||
|
* Description:
|
||||||
|
* Initialize SDIO-based MMC/SD card support
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#if !defined(CONFIG_DISABLE_MOUNTPOINT) && defined(CONFIG_STM32_SDIO)
|
||||||
|
int stm32_sdio_initialize(void);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/************************************************************************************
|
||||||
|
* Name: stm32_adc_initialize
|
||||||
|
*
|
||||||
|
* Description:
|
||||||
|
* Called at application startup time to initialize the ADC functionality.
|
||||||
|
*
|
||||||
|
************************************************************************************/
|
||||||
|
|
||||||
|
#ifdef CONFIG_ADC
|
||||||
|
int stm32_adc_initialize(void);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/************************************************************************************
|
||||||
|
* Name: stm32_can_initialize
|
||||||
|
*
|
||||||
|
* Description:
|
||||||
|
* Called at application startup time to initialize the CAN functionality.
|
||||||
|
*
|
||||||
|
************************************************************************************/
|
||||||
|
|
||||||
|
#if defined(CONFIG_CAN) && (defined(CONFIG_STM32_CAN1) || defined(CONFIG_STM32_CAN2))
|
||||||
|
int stm32_can_initialize(void);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* __ASSEMBLY__ */
|
||||||
|
#endif /* __CONFIGS_OLIMEX_STM32_E407_SRC_INTERNAL_H */
|
187
configs/olimex-stm32-e407/src/stm32_adc.c
Normal file
187
configs/olimex-stm32-e407/src/stm32_adc.c
Normal file
|
@ -0,0 +1,187 @@
|
||||||
|
/************************************************************************************
|
||||||
|
* configs/olimex-stm32-e407/src/stm32_adc.c
|
||||||
|
*
|
||||||
|
* Copyright (C) 2016 Gregory Nutt. All rights reserved.
|
||||||
|
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||||
|
*
|
||||||
|
* 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 NuttX 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.
|
||||||
|
*
|
||||||
|
************************************************************************************/
|
||||||
|
|
||||||
|
/************************************************************************************
|
||||||
|
* Included Files
|
||||||
|
************************************************************************************/
|
||||||
|
|
||||||
|
#include <nuttx/config.h>
|
||||||
|
|
||||||
|
#include <errno.h>
|
||||||
|
#include <debug.h>
|
||||||
|
|
||||||
|
#include <nuttx/board.h>
|
||||||
|
#include <nuttx/analog/adc.h>
|
||||||
|
#include <arch/board/board.h>
|
||||||
|
|
||||||
|
#include "chip.h"
|
||||||
|
#include "stm32_adc.h"
|
||||||
|
#include "olimex-stm32-e407.h"
|
||||||
|
|
||||||
|
#ifdef CONFIG_ADC
|
||||||
|
|
||||||
|
/************************************************************************************
|
||||||
|
* Pre-processor Definitions
|
||||||
|
************************************************************************************/
|
||||||
|
|
||||||
|
/* Configuration ********************************************************************/
|
||||||
|
/* Up to 3 ADC interfaces are supported */
|
||||||
|
|
||||||
|
#if STM32_NADC < 3
|
||||||
|
# undef CONFIG_STM32_ADC3
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if STM32_NADC < 2
|
||||||
|
# undef CONFIG_STM32_ADC2
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if STM32_NADC < 1
|
||||||
|
# undef CONFIG_STM32_ADC1
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(CONFIG_STM32_ADC1) || defined(CONFIG_STM32_ADC2) || defined(CONFIG_STM32_ADC3)
|
||||||
|
#ifndef CONFIG_STM32_ADC1
|
||||||
|
# warning "Channel information only available for ADC1"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* The number of ADC channels in the conversion list */
|
||||||
|
|
||||||
|
#define ADC1_NCHANNELS 1//14
|
||||||
|
|
||||||
|
/************************************************************************************
|
||||||
|
* Private Data
|
||||||
|
************************************************************************************/
|
||||||
|
/* The Olimex STM32-P405 has a 10 Kohm potentiometer AN_TR connected to PC0
|
||||||
|
* ADC123_IN10
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* Identifying number of each ADC channel: Variable Resistor.
|
||||||
|
*
|
||||||
|
* {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 15};
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifdef CONFIG_STM32_ADC1
|
||||||
|
static const uint8_t g_chanlist[ADC1_NCHANNELS] = {1};
|
||||||
|
|
||||||
|
/* Configurations of pins used byte each ADC channels
|
||||||
|
*
|
||||||
|
* {GPIO_ADC1_IN1, GPIO_ADC1_IN2, GPIO_ADC1_IN3, GPIO_ADC1_IN4, GPIO_ADC1_IN5,
|
||||||
|
* GPIO_ADC1_IN6, GPIO_ADC1_IN7, GPIO_ADC1_IN8, GPIO_ADC1_IN9, GPIO_ADC1_IN10,
|
||||||
|
* GPIO_ADC1_IN11, GPIO_ADC1_IN12, GPIO_ADC1_IN13, GPIO_ADC1_IN15};
|
||||||
|
*/
|
||||||
|
|
||||||
|
static const uint32_t g_pinlist[ADC1_NCHANNELS] = {GPIO_ADC1_IN1};
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/************************************************************************************
|
||||||
|
* Private Functions
|
||||||
|
************************************************************************************/
|
||||||
|
|
||||||
|
/************************************************************************************
|
||||||
|
* Public Functions
|
||||||
|
************************************************************************************/
|
||||||
|
|
||||||
|
/************************************************************************************
|
||||||
|
* Name: board_adc_setup
|
||||||
|
*
|
||||||
|
* Description:
|
||||||
|
* All STM32 architectures must provide the following interface to work with
|
||||||
|
* examples/adc.
|
||||||
|
*
|
||||||
|
************************************************************************************/
|
||||||
|
|
||||||
|
int board_adc_setup(void)
|
||||||
|
{
|
||||||
|
return stm32_adc_initialize();
|
||||||
|
}
|
||||||
|
|
||||||
|
/************************************************************************************
|
||||||
|
* Name: stm32_adc_initialize
|
||||||
|
*
|
||||||
|
* Description:
|
||||||
|
* Called at application startup time to initialize the ADC functionality.
|
||||||
|
*
|
||||||
|
************************************************************************************/
|
||||||
|
|
||||||
|
int stm32_adc_initialize(void)
|
||||||
|
{
|
||||||
|
#ifdef CONFIG_STM32_ADC1
|
||||||
|
static bool initialized = false;
|
||||||
|
struct adc_dev_s *adc;
|
||||||
|
int ret;
|
||||||
|
int i;
|
||||||
|
|
||||||
|
/* Check if we have already initialized */
|
||||||
|
|
||||||
|
if (!initialized)
|
||||||
|
{
|
||||||
|
/* Configure the pins as analog inputs for the selected channels */
|
||||||
|
|
||||||
|
for (i = 0; i < ADC1_NCHANNELS; i++)
|
||||||
|
{
|
||||||
|
stm32_configgpio(g_pinlist[i]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Call stm32_adcinitialize() to get an instance of the ADC interface */
|
||||||
|
|
||||||
|
adc = stm32_adcinitialize(1, g_chanlist, ADC1_NCHANNELS);
|
||||||
|
if (adc == NULL)
|
||||||
|
{
|
||||||
|
adbg("ERROR: Failed to get ADC interface\n");
|
||||||
|
return -ENODEV;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Register the ADC driver at "/dev/adc0" */
|
||||||
|
|
||||||
|
ret = adc_register("/dev/adc0", adc);
|
||||||
|
if (ret < 0)
|
||||||
|
{
|
||||||
|
adbg("adc_register failed: %d\n", ret);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Now we are initialized */
|
||||||
|
|
||||||
|
initialized = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return OK;
|
||||||
|
#else
|
||||||
|
return -ENOSYS;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif /* CONFIG_STM32_ADC1 || CONFIG_STM32_ADC2 || CONFIG_STM32_ADC3 */
|
||||||
|
#endif /* CONFIG_ADC */
|
237
configs/olimex-stm32-e407/src/stm32_appinit.c
Normal file
237
configs/olimex-stm32-e407/src/stm32_appinit.c
Normal file
|
@ -0,0 +1,237 @@
|
||||||
|
/****************************************************************************
|
||||||
|
* config/olimex-stm32-e407/src/stm32_appinit.c
|
||||||
|
*
|
||||||
|
* Copyright (C) 2016 Gregory Nutt. All rights reserved.
|
||||||
|
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||||
|
*
|
||||||
|
* 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 NuttX 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.
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Included Files
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#include <nuttx/config.h>
|
||||||
|
|
||||||
|
#include <stdbool.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <syslog.h>
|
||||||
|
#include <errno.h>
|
||||||
|
|
||||||
|
#include <nuttx/board.h>
|
||||||
|
|
||||||
|
#ifdef CONFIG_SYSTEM_USBMONITOR
|
||||||
|
# include <apps/usbmonitor.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef CONFIG_STM32_OTGFS
|
||||||
|
# include "stm32_usbhost.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "stm32.h"
|
||||||
|
#include "olimex-stm32-e407.h"
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Pre-processor Definitions
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
/* Configuration ************************************************************/
|
||||||
|
|
||||||
|
#define HAVE_USBDEV 1
|
||||||
|
#define HAVE_USBHOST 1
|
||||||
|
#define HAVE_USBMONITOR 1
|
||||||
|
/* #define HAVE_I2CTOOL 1 */
|
||||||
|
|
||||||
|
/* Can't support USB host or device features if USB OTG HS is not enabled */
|
||||||
|
|
||||||
|
#ifndef CONFIG_STM32_OTGHS
|
||||||
|
# undef HAVE_USBDEV
|
||||||
|
# undef HAVE_USBHOST
|
||||||
|
# undef HAVE_USBMONITOR
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Can't support USB device monitor if USB device is not enabled */
|
||||||
|
|
||||||
|
#ifndef CONFIG_USBDEV
|
||||||
|
# undef HAVE_USBDEV
|
||||||
|
# undef HAVE_USBMONITOR
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Can't support USB host is USB host is not enabled */
|
||||||
|
|
||||||
|
#ifndef CONFIG_USBHOST
|
||||||
|
# undef HAVE_USBHOST
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Check if we should enable the USB monitor before starting NSH */
|
||||||
|
|
||||||
|
#if !defined(CONFIG_USBDEV_TRACE) || !defined(CONFIG_SYSTEM_USBMONITOR)
|
||||||
|
# undef HAVE_USBMONITOR
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if !defined(CONFIG_STM32_CAN1) && !defined(CONFIG_STM32_CAN2)
|
||||||
|
# undef CONFIG_CAN
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Private Functions
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Name: stm32_i2c_register
|
||||||
|
*
|
||||||
|
* Description:
|
||||||
|
* Register one I2C drivers for the I2C tool.
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#ifdef HAVE_I2CTOOL
|
||||||
|
static void stm32_i2c_register(int bus)
|
||||||
|
{
|
||||||
|
FAR struct i2c_master_s *i2c;
|
||||||
|
int ret;
|
||||||
|
|
||||||
|
i2c = stm32_i2cbus_initialize(bus);
|
||||||
|
if (i2c == NULL)
|
||||||
|
{
|
||||||
|
_err("ERROR: Failed to get I2C%d interface\n", bus);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ret = i2c_register(i2c, bus);
|
||||||
|
if (ret < 0)
|
||||||
|
{
|
||||||
|
_err("ERROR: Failed to register I2C%d driver: %d\n", bus, ret);
|
||||||
|
stm32_i2cbus_uninitialize(i2c);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Name: stm32_i2ctool
|
||||||
|
*
|
||||||
|
* Description:
|
||||||
|
* Register I2C drivers for the I2C tool.
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#ifdef HAVE_I2CTOOL
|
||||||
|
static void stm32_i2ctool(void)
|
||||||
|
{
|
||||||
|
#ifdef CONFIG_STM32_I2C1
|
||||||
|
stm32_i2c_register(1);
|
||||||
|
#endif
|
||||||
|
#ifdef CONFIG_STM32_I2C2
|
||||||
|
stm32_i2c_register(2);
|
||||||
|
#endif
|
||||||
|
#ifdef CONFIG_STM32_I2C3
|
||||||
|
stm32_i2c_register(3);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
# define stm32_i2ctool()
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Public Functions
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Name: board_app_initialize
|
||||||
|
*
|
||||||
|
* Description:
|
||||||
|
* Perform architecture specific initialization
|
||||||
|
*
|
||||||
|
* CONFIG_LIB_BOARDCTL=y :
|
||||||
|
* Called from the NSH library
|
||||||
|
*
|
||||||
|
* CONFIG_BOARD_INITIALIZE=y, CONFIG_NSH_LIBRARY=y, &&
|
||||||
|
* CONFIG_LIB_BOARDCTL=n :
|
||||||
|
* Called from board_initialize().
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
int board_app_initialize(uintptr_t arg)
|
||||||
|
{
|
||||||
|
#if defined(CONFIG_CAN) || defined(CONFIG_ADC)
|
||||||
|
int ret;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Register I2C drivers on behalf of the I2C tool */
|
||||||
|
|
||||||
|
stm32_i2ctool();
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef CONFIG_CAN
|
||||||
|
/* Configure on-board CAN if CAN support has been selected. */
|
||||||
|
|
||||||
|
ret = stm32_can_initialize();
|
||||||
|
if (ret != OK)
|
||||||
|
{
|
||||||
|
syslog(LOG_ERR, "ERROR: Failed to initialize CAN: %d\n", ret);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef CONFIG_ADC
|
||||||
|
/* Configure on-board ADCs if ADC support has been selected. */
|
||||||
|
|
||||||
|
ret = stm32_adc_initialize();
|
||||||
|
if (ret != OK)
|
||||||
|
{
|
||||||
|
syslog(LOG_ERR, "ERROR: Failed to initialize ADC: %d\n", ret);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef HAVE_USBHOST
|
||||||
|
/* Initialize USB host operation. stm32_usbhost_initialize() starts a thread
|
||||||
|
* will monitor for USB connection and disconnection events.
|
||||||
|
*/
|
||||||
|
|
||||||
|
ret = stm32_usbhost_initialize();
|
||||||
|
if (ret != OK)
|
||||||
|
{
|
||||||
|
syslog(LOG_ERR, "ERROR: Failed to initialize USB host: %d\n", ret);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef HAVE_USBMONITOR
|
||||||
|
/* Start the USB Monitor */
|
||||||
|
|
||||||
|
ret = usbmonitor_start(0, NULL);
|
||||||
|
if (ret != OK)
|
||||||
|
{
|
||||||
|
syslog(LOG_ERR, "ERROR: Failed to start USB monitor: %d\n", ret);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
return OK;
|
||||||
|
}
|
110
configs/olimex-stm32-e407/src/stm32_autoleds.c
Normal file
110
configs/olimex-stm32-e407/src/stm32_autoleds.c
Normal file
|
@ -0,0 +1,110 @@
|
||||||
|
/****************************************************************************
|
||||||
|
* configs/olimex-stm32-e407/src/stm32_autoleds.c
|
||||||
|
*
|
||||||
|
* Copyright (C) 2016 Gregory Nutt. All rights reserved.
|
||||||
|
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||||
|
*
|
||||||
|
* 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 NuttX 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.
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Included Files
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#include <nuttx/config.h>
|
||||||
|
|
||||||
|
#include <stdint.h>
|
||||||
|
#include <stdbool.h>
|
||||||
|
#include <debug.h>
|
||||||
|
|
||||||
|
#include <nuttx/board.h>
|
||||||
|
#include <arch/board/board.h>
|
||||||
|
|
||||||
|
#include "chip.h"
|
||||||
|
#include "up_arch.h"
|
||||||
|
#include "up_internal.h"
|
||||||
|
#include "stm32.h"
|
||||||
|
#include "olimex-stm32-e407.h"
|
||||||
|
|
||||||
|
#ifdef CONFIG_ARCH_LEDS
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Pre-processor Definitions
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Public Functions
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Name: board_autoled_initialize
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
void board_autoled_initialize(void)
|
||||||
|
{
|
||||||
|
/* Configure LED_STATUS GPIO for output */
|
||||||
|
|
||||||
|
stm32_configgpio(GPIO_LED_STATUS);
|
||||||
|
}
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Name: board_autoled_on
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
void board_autoled_on(int led)
|
||||||
|
{
|
||||||
|
if (led == LED_STARTED)
|
||||||
|
{
|
||||||
|
stm32_gpiowrite(GPIO_LED_STATUS, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (led == LED_ASSERTION || led == LED_PANIC)
|
||||||
|
{
|
||||||
|
stm32_gpiowrite(GPIO_LED_STATUS, false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Name: board_autoled_off
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
void board_autoled_off(int led)
|
||||||
|
{
|
||||||
|
if (led == LED_STARTED)
|
||||||
|
{
|
||||||
|
stm32_gpiowrite(GPIO_LED_STATUS, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (led == LED_ASSERTION || led == LED_PANIC)
|
||||||
|
{
|
||||||
|
stm32_gpiowrite(GPIO_LED_STATUS, true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif /* CONFIG_ARCH_LEDS */
|
123
configs/olimex-stm32-e407/src/stm32_boot.c
Normal file
123
configs/olimex-stm32-e407/src/stm32_boot.c
Normal file
|
@ -0,0 +1,123 @@
|
||||||
|
/************************************************************************************
|
||||||
|
* configs/olimex-stm32-e407/src/stm32_boot.c
|
||||||
|
*
|
||||||
|
* Copyright (C) 2016 Gregory Nutt. All rights reserved.
|
||||||
|
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||||
|
*
|
||||||
|
* 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 NuttX 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.
|
||||||
|
*
|
||||||
|
************************************************************************************/
|
||||||
|
|
||||||
|
/************************************************************************************
|
||||||
|
* Included Files
|
||||||
|
************************************************************************************/
|
||||||
|
|
||||||
|
#include <nuttx/config.h>
|
||||||
|
|
||||||
|
#include <debug.h>
|
||||||
|
|
||||||
|
#include <nuttx/arch.h>
|
||||||
|
#include <nuttx/board.h>
|
||||||
|
#include <arch/board/board.h>
|
||||||
|
|
||||||
|
#include "up_arch.h"
|
||||||
|
#include "olimex-stm32-e407.h"
|
||||||
|
#include "stm32_ccm.h"
|
||||||
|
|
||||||
|
#include "stm32.h"
|
||||||
|
#include "stm32_i2c.h"
|
||||||
|
|
||||||
|
/************************************************************************************
|
||||||
|
* Public Functions
|
||||||
|
************************************************************************************/
|
||||||
|
|
||||||
|
/************************************************************************************
|
||||||
|
* Name: stm32_boardinitialize
|
||||||
|
*
|
||||||
|
* Description:
|
||||||
|
* All STM32 architectures must provide the following entry point. This entry point
|
||||||
|
* is called early in the intitialization -- after all memory has been configured
|
||||||
|
* and mapped but before any devices have been initialized.
|
||||||
|
*
|
||||||
|
************************************************************************************/
|
||||||
|
|
||||||
|
void stm32_boardinitialize(void)
|
||||||
|
{
|
||||||
|
#if defined(CONFIG_STM32_OTGFS) || defined(CONFIG_STM32_OTGHS)
|
||||||
|
/* Initialize USB if the 1) OTG FS controller is in the configuration and 2)
|
||||||
|
* disabled, and 3) the weak function stm32_usbinitialize() has been brought
|
||||||
|
* into the build. Presumeably either CONFIG_USBDEV is also selected.
|
||||||
|
*/
|
||||||
|
|
||||||
|
if (stm32_usbinitialize)
|
||||||
|
{
|
||||||
|
stm32_usbinitialize();
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef CONFIG_ARCH_LEDS
|
||||||
|
/* Configure on-board LEDs if LED support has been selected. */
|
||||||
|
|
||||||
|
board_autoled_initialize();
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef CONFIG_ARCH_BUTTONS
|
||||||
|
/* Configure on-board BUTTONs if BUTTON support has been selected. */
|
||||||
|
|
||||||
|
board_button_initialize();
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Name: board_initialize
|
||||||
|
*
|
||||||
|
* Description:
|
||||||
|
* If CONFIG_BOARD_INITIALIZE is selected, then an additional
|
||||||
|
* initialization call will be performed in the boot-up sequence to a
|
||||||
|
* function called board_initialize(). board_initialize() will be
|
||||||
|
* called immediately after up_intitialize() is called and just before the
|
||||||
|
* initial application is started. This additional initialization phase
|
||||||
|
* may be used, for example, to initialize board-specific device drivers.
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#ifdef CONFIG_BOARD_INITIALIZE
|
||||||
|
void board_initialize(void)
|
||||||
|
{
|
||||||
|
#if defined(CONFIG_NSH_LIBRARY) && !defined(CONFIG_LIB_BOARDCTL)
|
||||||
|
/* Perform NSH initialization here instead of from the NSH. This
|
||||||
|
* alternative NSH initialization is necessary when NSH is ran in user-space
|
||||||
|
* but the initialization function must run in kernel space.
|
||||||
|
*/
|
||||||
|
|
||||||
|
board_app_initialize();
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
#endif
|
150
configs/olimex-stm32-e407/src/stm32_buttons.c
Normal file
150
configs/olimex-stm32-e407/src/stm32_buttons.c
Normal file
|
@ -0,0 +1,150 @@
|
||||||
|
/****************************************************************************
|
||||||
|
* configs/olimex-stm32-e407/src/stm32_buttons.c
|
||||||
|
*
|
||||||
|
* Copyright (C) 2014-2015 Gregory Nutt. All rights reserved.
|
||||||
|
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||||
|
*
|
||||||
|
* 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 NuttX 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.
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Included Files
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#include <nuttx/config.h>
|
||||||
|
|
||||||
|
#include <stdint.h>
|
||||||
|
|
||||||
|
#include <nuttx/arch.h>
|
||||||
|
#include <nuttx/board.h>
|
||||||
|
#include <arch/board/board.h>
|
||||||
|
|
||||||
|
#include "olimex-stm32-e407.h"
|
||||||
|
|
||||||
|
#ifdef CONFIG_ARCH_BUTTONS
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Private Functions
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
/* Pin configuration for each Olimex-STM32-H405 button. This array is indexed by
|
||||||
|
* the BUTTON_* definitions in board.h
|
||||||
|
*/
|
||||||
|
|
||||||
|
static const uint32_t g_buttons[NUM_BUTTONS] =
|
||||||
|
{
|
||||||
|
GPIO_BTN_BUT
|
||||||
|
};
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Public Functions
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Name: board_button_initialize
|
||||||
|
*
|
||||||
|
* Description:
|
||||||
|
* board_button_initialize() must be called to initialize button resources. After
|
||||||
|
* that, board_buttons() may be called to collect the current state of all
|
||||||
|
* buttons or board_button_irq() may be called to register button interrupt
|
||||||
|
* handlers.
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
void board_button_initialize(void)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
|
||||||
|
/* Configure the GPIO pins as inputs. NOTE that EXTI interrupts are
|
||||||
|
* configured for all pins.
|
||||||
|
*/
|
||||||
|
|
||||||
|
for (i = 0; i < NUM_BUTTONS; i++)
|
||||||
|
{
|
||||||
|
stm32_configgpio(g_buttons[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Name: board_buttons
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
uint8_t board_buttons(void)
|
||||||
|
{
|
||||||
|
uint8_t ret = 0;
|
||||||
|
|
||||||
|
/* Check that state of each key */
|
||||||
|
|
||||||
|
if (!stm32_gpioread(g_buttons[BUTTON_BUT]))
|
||||||
|
{
|
||||||
|
ret |= BUTTON_BUT_BIT;
|
||||||
|
}
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
/************************************************************************************
|
||||||
|
* Button support.
|
||||||
|
*
|
||||||
|
* Description:
|
||||||
|
* board_button_initialize() must be called to initialize button resources. After
|
||||||
|
* that, board_buttons() may be called to collect the current state of all
|
||||||
|
* buttons or board_button_irq() may be called to register button interrupt
|
||||||
|
* handlers.
|
||||||
|
*
|
||||||
|
* After board_button_initialize() has been called, board_buttons() may be called to
|
||||||
|
* collect the state of all buttons. board_buttons() returns an 8-bit bit set
|
||||||
|
* with each bit associated with a button. See the BUTTON_*_BIT
|
||||||
|
* definitions in board.h for the meaning of each bit.
|
||||||
|
*
|
||||||
|
* board_button_irq() may be called to register an interrupt handler that will
|
||||||
|
* be called when a button is depressed or released. The ID value is a
|
||||||
|
* button enumeration value that uniquely identifies a button resource. See the
|
||||||
|
* BUTTON_* definitions in board.h for the meaning of enumeration
|
||||||
|
* value. The previous interrupt handler address is returned (so that it may
|
||||||
|
* restored, if so desired).
|
||||||
|
*
|
||||||
|
************************************************************************************/
|
||||||
|
|
||||||
|
#ifdef CONFIG_ARCH_IRQBUTTONS
|
||||||
|
xcpt_t board_button_irq(int id, xcpt_t irqhandler)
|
||||||
|
{
|
||||||
|
xcpt_t oldhandler = NULL;
|
||||||
|
|
||||||
|
/* The following should be atomic */
|
||||||
|
|
||||||
|
if (id >= MIN_IRQBUTTON && id <= MAX_IRQBUTTON)
|
||||||
|
{
|
||||||
|
oldhandler = stm32_gpiosetevent(g_buttons[id], true, true, true, irqhandler);
|
||||||
|
}
|
||||||
|
|
||||||
|
return oldhandler;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
#endif /* CONFIG_ARCH_BUTTONS */
|
130
configs/olimex-stm32-e407/src/stm32_can.c
Normal file
130
configs/olimex-stm32-e407/src/stm32_can.c
Normal file
|
@ -0,0 +1,130 @@
|
||||||
|
/************************************************************************************
|
||||||
|
* configs/olimex-stm32-405/src/stm32_can.c
|
||||||
|
*
|
||||||
|
* Copyright (C) 2016 Gregory Nutt. All rights reserved.
|
||||||
|
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||||
|
*
|
||||||
|
* 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 NuttX 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.
|
||||||
|
*
|
||||||
|
************************************************************************************/
|
||||||
|
|
||||||
|
/************************************************************************************
|
||||||
|
* Included Files
|
||||||
|
************************************************************************************/
|
||||||
|
|
||||||
|
#include <nuttx/config.h>
|
||||||
|
|
||||||
|
#include <errno.h>
|
||||||
|
#include <debug.h>
|
||||||
|
#include <nuttx/can.h>
|
||||||
|
#include <arch/board/board.h>
|
||||||
|
#include "stm32.h"
|
||||||
|
#include "stm32_can.h"
|
||||||
|
#include "olimex-stm32-e407.h"
|
||||||
|
|
||||||
|
#if defined(CONFIG_CAN) && (defined(CONFIG_STM32_CAN1) || defined(CONFIG_STM32_CAN2))
|
||||||
|
|
||||||
|
/************************************************************************************
|
||||||
|
* Pre-processor Definitions
|
||||||
|
************************************************************************************/
|
||||||
|
/* Configuration ********************************************************************/
|
||||||
|
|
||||||
|
#if defined(CONFIG_STM32_CAN1) && defined(CONFIG_STM32_CAN2)
|
||||||
|
# warning "Both CAN1 and CAN2 are enabled. Only CAN1 is used."
|
||||||
|
# undef CONFIG_STM32_CAN2
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef CONFIG_STM32_CAN1
|
||||||
|
# define CAN_PORT 1
|
||||||
|
#else
|
||||||
|
# define CAN_PORT 2
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/************************************************************************************
|
||||||
|
* Public Functions
|
||||||
|
************************************************************************************/
|
||||||
|
|
||||||
|
/************************************************************************************
|
||||||
|
* Name: board_can_initialize
|
||||||
|
*
|
||||||
|
* Description:
|
||||||
|
* All STM32 architectures must provide the following interface to work with
|
||||||
|
* examples/can.
|
||||||
|
*
|
||||||
|
************************************************************************************/
|
||||||
|
|
||||||
|
int board_can_initialize(void)
|
||||||
|
{
|
||||||
|
return stm32_can_initialize();
|
||||||
|
}
|
||||||
|
|
||||||
|
/****************************************************************************************************
|
||||||
|
* Name: stm32_can_initialize
|
||||||
|
*
|
||||||
|
* Description:
|
||||||
|
* Called at application startup time to initialize the CAN functionality.
|
||||||
|
*
|
||||||
|
****************************************************************************************************/
|
||||||
|
|
||||||
|
int stm32_can_initialize(void)
|
||||||
|
{
|
||||||
|
static bool initialized = false;
|
||||||
|
struct can_dev_s *can;
|
||||||
|
int ret;
|
||||||
|
|
||||||
|
/* Check if we have already initialized */
|
||||||
|
|
||||||
|
if (!initialized)
|
||||||
|
{
|
||||||
|
/* Call stm32_caninitialize() to get an instance of the CAN interface */
|
||||||
|
|
||||||
|
can = stm32_caninitialize(CAN_PORT);
|
||||||
|
if (can == NULL)
|
||||||
|
{
|
||||||
|
candbg("ERROR: Failed to get CAN interface\n");
|
||||||
|
return -ENODEV;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Register the CAN driver at "/dev/can0" */
|
||||||
|
|
||||||
|
ret = can_register("/dev/can0", can);
|
||||||
|
if (ret < 0)
|
||||||
|
{
|
||||||
|
candbg("ERROR: can_register failed: %d\n", ret);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Now we are initialized */
|
||||||
|
|
||||||
|
initialized = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif /* CONFIG_CAN && (CONFIG_STM32_CAN1 || CONFIG_STM32_CAN2) */
|
336
configs/olimex-stm32-e407/src/stm32_usb.c
Normal file
336
configs/olimex-stm32-e407/src/stm32_usb.c
Normal file
|
@ -0,0 +1,336 @@
|
||||||
|
/************************************************************************************
|
||||||
|
* configs/stm32f4discovery/src/stm32_usb.c
|
||||||
|
*
|
||||||
|
* Copyright (C) 2012-2013, 2015 Gregory Nutt. All rights reserved.
|
||||||
|
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||||
|
*
|
||||||
|
* 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 NuttX 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.
|
||||||
|
*
|
||||||
|
************************************************************************************/
|
||||||
|
|
||||||
|
/************************************************************************************
|
||||||
|
* Included Files
|
||||||
|
************************************************************************************/
|
||||||
|
|
||||||
|
#include <nuttx/config.h>
|
||||||
|
|
||||||
|
#include <sys/types.h>
|
||||||
|
#include <stdint.h>
|
||||||
|
#include <stdbool.h>
|
||||||
|
#include <sched.h>
|
||||||
|
#include <errno.h>
|
||||||
|
#include <assert.h>
|
||||||
|
#include <debug.h>
|
||||||
|
|
||||||
|
#include <nuttx/usb/usbdev.h>
|
||||||
|
#include <nuttx/usb/usbhost.h>
|
||||||
|
#include <nuttx/usb/usbdev_trace.h>
|
||||||
|
|
||||||
|
#include "up_arch.h"
|
||||||
|
#include "stm32.h"
|
||||||
|
#include "stm32_otgfs.h"
|
||||||
|
#include "olimex-stm32-e407.h"
|
||||||
|
|
||||||
|
#ifdef CONFIG_STM32_OTGFS
|
||||||
|
|
||||||
|
/************************************************************************************
|
||||||
|
* Pre-processor Definitions
|
||||||
|
************************************************************************************/
|
||||||
|
|
||||||
|
#if defined(CONFIG_USBDEV) || defined(CONFIG_USBHOST)
|
||||||
|
# define HAVE_USB 1
|
||||||
|
#else
|
||||||
|
# warning "CONFIG_STM32_OTGFS is enabled but neither CONFIG_USBDEV nor CONFIG_USBHOST"
|
||||||
|
# undef HAVE_USB
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef CONFIG_STM32F4DISCO_USBHOST_PRIO
|
||||||
|
# define CONFIG_STM32F4DISCO_USBHOST_PRIO 100
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef CONFIG_STM32F4DISCO_USBHOST_STACKSIZE
|
||||||
|
# define CONFIG_STM32F4DISCO_USBHOST_STACKSIZE 1024
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/************************************************************************************
|
||||||
|
* Private Data
|
||||||
|
************************************************************************************/
|
||||||
|
|
||||||
|
#ifdef CONFIG_USBHOST
|
||||||
|
static struct usbhost_connection_s *g_usbconn;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/************************************************************************************
|
||||||
|
* Private Functions
|
||||||
|
************************************************************************************/
|
||||||
|
|
||||||
|
/************************************************************************************
|
||||||
|
* Name: usbhost_waiter
|
||||||
|
*
|
||||||
|
* Description:
|
||||||
|
* Wait for USB devices to be connected.
|
||||||
|
*
|
||||||
|
************************************************************************************/
|
||||||
|
|
||||||
|
#ifdef CONFIG_USBHOST
|
||||||
|
static int usbhost_waiter(int argc, char *argv[])
|
||||||
|
{
|
||||||
|
struct usbhost_hubport_s *hport;
|
||||||
|
|
||||||
|
uinfo("Running\n");
|
||||||
|
for (;;)
|
||||||
|
{
|
||||||
|
/* Wait for the device to change state */
|
||||||
|
|
||||||
|
DEBUGVERIFY(CONN_WAIT(g_usbconn, &hport));
|
||||||
|
uinfo("%s\n", hport->connected ? "connected" : "disconnected");
|
||||||
|
|
||||||
|
/* Did we just become connected? */
|
||||||
|
|
||||||
|
if (hport->connected)
|
||||||
|
{
|
||||||
|
/* Yes.. enumerate the newly connected device */
|
||||||
|
|
||||||
|
(void)CONN_ENUMERATE(g_usbconn, hport);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Keep the compiler from complaining */
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/************************************************************************************
|
||||||
|
* Public Functions
|
||||||
|
************************************************************************************/
|
||||||
|
|
||||||
|
/************************************************************************************
|
||||||
|
* Name: stm32_usbinitialize
|
||||||
|
*
|
||||||
|
* Description:
|
||||||
|
* Called from stm32_usbinitialize very early in inialization to setup USB-related
|
||||||
|
* GPIO pins for the STM32F4Discovery board.
|
||||||
|
*
|
||||||
|
************************************************************************************/
|
||||||
|
|
||||||
|
void stm32_usbinitialize(void)
|
||||||
|
{
|
||||||
|
/* The OTG FS has an internal soft pull-up. No GPIO configuration is required */
|
||||||
|
|
||||||
|
/* Configure the OTG FS VBUS sensing GPIO, Power On, and Overcurrent GPIOs */
|
||||||
|
|
||||||
|
#ifdef CONFIG_STM32_OTGFS
|
||||||
|
stm32_configgpio(GPIO_OTGFS_VBUS);
|
||||||
|
stm32_configgpio(GPIO_OTGFS_PWRON);
|
||||||
|
stm32_configgpio(GPIO_OTGFS_OVER);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
/***********************************************************************************
|
||||||
|
* Name: stm32_usbhost_initialize
|
||||||
|
*
|
||||||
|
* Description:
|
||||||
|
* Called at application startup time to initialize the USB host functionality.
|
||||||
|
* This function will start a thread that will monitor for device
|
||||||
|
*nnnn connection/disconnection events.
|
||||||
|
*
|
||||||
|
***********************************************************************************/
|
||||||
|
|
||||||
|
#ifdef CONFIG_USBHOST
|
||||||
|
int stm32_usbhost_initialize(void)
|
||||||
|
{
|
||||||
|
int pid;
|
||||||
|
#if defined(CONFIG_USBHOST_HUB) || defined(CONFIG_USBHOST_MSC) || \
|
||||||
|
defined(CONFIG_USBHOST_HIDKBD) || defined(CONFIG_USBHOST_HIDMOUSE)
|
||||||
|
int ret;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* First, register all of the class drivers needed to support the drivers
|
||||||
|
* that we care about:
|
||||||
|
*/
|
||||||
|
|
||||||
|
uvdbg("Register class drivers\n");
|
||||||
|
|
||||||
|
#ifdef CONFIG_USBHOST_HUB
|
||||||
|
/* Initialize USB hub class support */
|
||||||
|
|
||||||
|
ret = usbhost_hub_initialize();
|
||||||
|
if (ret < 0)
|
||||||
|
{
|
||||||
|
uerr("ERROR: usbhost_hub_initialize failed: %d\n", ret);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef CONFIG_USBHOST_MSC
|
||||||
|
/* Register the USB mass storage class class */
|
||||||
|
|
||||||
|
ret = usbhost_msc_initialize();
|
||||||
|
if (ret != OK)
|
||||||
|
{
|
||||||
|
uerr("ERROR: Failed to register the mass storage class: %d\n", ret);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef CONFIG_USBHOST_CDCACM
|
||||||
|
/* Register the CDC/ACM serial class */
|
||||||
|
|
||||||
|
ret = usbhost_cdcacm_initialize();
|
||||||
|
if (ret != OK)
|
||||||
|
{
|
||||||
|
uerr("ERROR: Failed to register the CDC/ACM serial class: %d\n", ret);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef CONFIG_USBHOST_HIDKBD
|
||||||
|
/* Initialize the HID keyboard class */
|
||||||
|
|
||||||
|
ret = usbhost_kbdinit();
|
||||||
|
if (ret != OK)
|
||||||
|
{
|
||||||
|
uerr("Failed to register the HID keyboard class\n");
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef CONFIG_USBHOST_HIDMOUSE
|
||||||
|
/* Initialize the HID mouse class */
|
||||||
|
|
||||||
|
ret = usbhost_mouse_init();
|
||||||
|
if (ret != OK)
|
||||||
|
{
|
||||||
|
uerr("Failed to register the HID mouse class\n");
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Then get an instance of the USB host interface */
|
||||||
|
|
||||||
|
uinfo("Initialize USB host\n");
|
||||||
|
g_usbconn = stm32_otgfshost_initialize(0);
|
||||||
|
if (g_usbconn)
|
||||||
|
{
|
||||||
|
/* Start a thread to handle device connection. */
|
||||||
|
|
||||||
|
uinfo("Start usbhost_waiter\n");
|
||||||
|
|
||||||
|
pid = task_create("usbhost", CONFIG_STM32F4DISCO_USBHOST_PRIO,
|
||||||
|
CONFIG_STM32F4DISCO_USBHOST_STACKSIZE,
|
||||||
|
(main_t)usbhost_waiter, (FAR char * const *)NULL);
|
||||||
|
return pid < 0 ? -ENOEXEC : OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
return -ENODEV;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/***********************************************************************************
|
||||||
|
* Name: stm32_usbhost_vbusdrive
|
||||||
|
*
|
||||||
|
* Description:
|
||||||
|
* Enable/disable driving of VBUS 5V output. This function must be provided be
|
||||||
|
* each platform that implements the STM32 OTG FS host interface
|
||||||
|
*
|
||||||
|
* "On-chip 5 V VBUS generation is not supported. For this reason, a charge pump
|
||||||
|
* or, if 5 V are available on the application board, a basic power switch, must
|
||||||
|
* be added externally to drive the 5 V VBUS line. The external charge pump can
|
||||||
|
* be driven by any GPIO output. When the application decides to power on VBUS
|
||||||
|
* using the chosen GPIO, it must also set the port power bit in the host port
|
||||||
|
* control and status register (PPWR bit in OTG_FS_HPRT).
|
||||||
|
*
|
||||||
|
* "The application uses this field to control power to this port, and the core
|
||||||
|
* clears this bit on an overcurrent condition."
|
||||||
|
*
|
||||||
|
* Input Parameters:
|
||||||
|
* iface - For future growth to handle multiple USB host interface. Should be zero.
|
||||||
|
* enable - true: enable VBUS power; false: disable VBUS power
|
||||||
|
*
|
||||||
|
* Returned Value:
|
||||||
|
* None
|
||||||
|
*
|
||||||
|
***********************************************************************************/
|
||||||
|
|
||||||
|
#ifdef CONFIG_USBHOST
|
||||||
|
void stm32_usbhost_vbusdrive(int iface, bool enable)
|
||||||
|
{
|
||||||
|
DEBUGASSERT(iface == 0);
|
||||||
|
|
||||||
|
if (enable)
|
||||||
|
{
|
||||||
|
/* Enable the Power Switch by driving the enable pin low */
|
||||||
|
|
||||||
|
stm32_gpiowrite(GPIO_OTGFS_PWRON, false);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* Disable the Power Switch by driving the enable pin high */
|
||||||
|
|
||||||
|
stm32_gpiowrite(GPIO_OTGFS_PWRON, true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/************************************************************************************
|
||||||
|
* Name: stm32_setup_overcurrent
|
||||||
|
*
|
||||||
|
* Description:
|
||||||
|
* Setup to receive an interrupt-level callback if an overcurrent condition is
|
||||||
|
* detected.
|
||||||
|
*
|
||||||
|
* Input Parameter:
|
||||||
|
* handler - New overcurrent interrupt handler
|
||||||
|
*
|
||||||
|
* Returned value:
|
||||||
|
* Old overcurrent interrupt handler
|
||||||
|
*
|
||||||
|
************************************************************************************/
|
||||||
|
|
||||||
|
#ifdef CONFIG_USBHOST
|
||||||
|
xcpt_t stm32_setup_overcurrent(xcpt_t handler)
|
||||||
|
{
|
||||||
|
return stm32_gpiosetevent(GPIO_OTGFS_OVER, true, true, true, handler);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/************************************************************************************
|
||||||
|
* Name: stm32_usbsuspend
|
||||||
|
*
|
||||||
|
* Description:
|
||||||
|
* Board logic must provide the stm32_usbsuspend logic if the USBDEV driver is
|
||||||
|
* used. This function is called whenever the USB enters or leaves suspend mode.
|
||||||
|
* This is an opportunity for the board logic to shutdown clocks, power, etc.
|
||||||
|
* while the USB is suspended.
|
||||||
|
*
|
||||||
|
************************************************************************************/
|
||||||
|
|
||||||
|
#ifdef CONFIG_USBDEV
|
||||||
|
void stm32_usbsuspend(FAR struct usbdev_s *dev, bool resume)
|
||||||
|
{
|
||||||
|
uinfo("resume: %d\n", resume);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* CONFIG_STM32_OTGFS */
|
106
configs/olimex-stm32-e407/src/stm32_userleds.c
Normal file
106
configs/olimex-stm32-e407/src/stm32_userleds.c
Normal file
|
@ -0,0 +1,106 @@
|
||||||
|
/****************************************************************************
|
||||||
|
* configs/olimex-stm32-e407/src/stm32_leds.c
|
||||||
|
*
|
||||||
|
* Copyright (C) 2016 Gregory Nutt. All rights reserved.
|
||||||
|
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||||
|
*
|
||||||
|
* 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 NuttX 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.
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Included Files
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#include <nuttx/config.h>
|
||||||
|
|
||||||
|
#include <stdint.h>
|
||||||
|
#include <stdbool.h>
|
||||||
|
#include <debug.h>
|
||||||
|
#include <arch/board/board.h>
|
||||||
|
#include <nuttx/power/pm.h>
|
||||||
|
|
||||||
|
#include "chip.h"
|
||||||
|
#include "up_arch.h"
|
||||||
|
#include "up_internal.h"
|
||||||
|
#include "stm32.h"
|
||||||
|
#include "olimex-stm32-e407.h"
|
||||||
|
|
||||||
|
#ifndef CONFIG_ARCH_LEDS
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Pre-processor Definitions
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Private Data
|
||||||
|
****************************************************************************/
|
||||||
|
/* This array maps an LED number to GPIO pin configuration */
|
||||||
|
|
||||||
|
static uint32_t g_ledcfg[BOARD_NLEDS] =
|
||||||
|
{
|
||||||
|
GPIO_LED_STATUS
|
||||||
|
};
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Public Functions
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Name: board_userled_initialize
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
void board_userled_initialize(void)
|
||||||
|
{
|
||||||
|
/* Configure LED1-4 GPIOs for output */
|
||||||
|
|
||||||
|
stm32_configgpio(GPIO_LED_STATUS);
|
||||||
|
}
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Name: board_userled
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
void board_userled(int led, bool ledon)
|
||||||
|
{
|
||||||
|
if ((unsigned)led < BOARD_NLEDS)
|
||||||
|
{
|
||||||
|
stm32_gpiowrite(g_ledcfg[led], ledon);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Name: board_userled_all
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
void board_userled_all(uint8_t ledset)
|
||||||
|
{
|
||||||
|
stm32_gpiowrite(GPIO_LED_STATUS, (ledset & BOARD_LED1_BIT) != 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif /* !CONFIG_ARCH_LEDS */
|
113
configs/olimex-stm32-e407/usbnsh/Make.defs
Normal file
113
configs/olimex-stm32-e407/usbnsh/Make.defs
Normal file
|
@ -0,0 +1,113 @@
|
||||||
|
############################################################################
|
||||||
|
# configs/olimex-stm32-e407/usbnsh/Make.defs
|
||||||
|
#
|
||||||
|
# Copyright (C) 2013 Gregory Nutt. All rights reserved.
|
||||||
|
# Author: Gregory Nutt <gnutt@nuttx.org>
|
||||||
|
#
|
||||||
|
# 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 NuttX 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.
|
||||||
|
#
|
||||||
|
############################################################################
|
||||||
|
|
||||||
|
include ${TOPDIR}/.config
|
||||||
|
include ${TOPDIR}/tools/Config.mk
|
||||||
|
include ${TOPDIR}/arch/arm/src/armv7-m/Toolchain.defs
|
||||||
|
|
||||||
|
LDSCRIPT = ld.script
|
||||||
|
|
||||||
|
ifeq ($(WINTOOL),y)
|
||||||
|
# Windows-native toolchains
|
||||||
|
DIRLINK = $(TOPDIR)/tools/copydir.sh
|
||||||
|
DIRUNLINK = $(TOPDIR)/tools/unlink.sh
|
||||||
|
MKDEP = $(TOPDIR)/tools/mkwindeps.sh
|
||||||
|
ARCHINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}"
|
||||||
|
ARCHXXINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}" -isystem "${shell cygpath -w $(TOPDIR)/include/cxx}"
|
||||||
|
ARCHSCRIPT = -T "${shell cygpath -w $(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/scripts/$(LDSCRIPT)}"
|
||||||
|
else
|
||||||
|
# Linux/Cygwin-native toolchain
|
||||||
|
MKDEP = $(TOPDIR)/tools/mkdeps$(HOSTEXEEXT)
|
||||||
|
ARCHINCLUDES = -I. -isystem $(TOPDIR)/include
|
||||||
|
ARCHXXINCLUDES = -I. -isystem $(TOPDIR)/include -isystem $(TOPDIR)/include/cxx
|
||||||
|
ARCHSCRIPT = -T$(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/scripts/$(LDSCRIPT)
|
||||||
|
endif
|
||||||
|
|
||||||
|
CC = $(CROSSDEV)gcc
|
||||||
|
CXX = $(CROSSDEV)g++
|
||||||
|
CPP = $(CROSSDEV)gcc -E
|
||||||
|
LD = $(CROSSDEV)ld
|
||||||
|
AR = $(ARCROSSDEV)ar rcs
|
||||||
|
NM = $(ARCROSSDEV)nm
|
||||||
|
OBJCOPY = $(CROSSDEV)objcopy
|
||||||
|
OBJDUMP = $(CROSSDEV)objdump
|
||||||
|
|
||||||
|
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}
|
||||||
|
|
||||||
|
ifeq ($(CONFIG_DEBUG_SYMBOLS),y)
|
||||||
|
ARCHOPTIMIZATION = -g
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifneq ($(CONFIG_DEBUG_NOOPT),y)
|
||||||
|
ARCHOPTIMIZATION += $(MAXOPTIMIZATION) -fno-strict-aliasing -fno-strength-reduce -fomit-frame-pointer
|
||||||
|
endif
|
||||||
|
|
||||||
|
ARCHCFLAGS = -fno-builtin
|
||||||
|
ARCHCXXFLAGS = -fno-builtin -fno-exceptions -fno-rtti
|
||||||
|
ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow -Wundef
|
||||||
|
ARCHWARNINGSXX = -Wall -Wshadow -Wundef
|
||||||
|
ARCHDEFINES =
|
||||||
|
ARCHPICFLAGS = -fpic -msingle-pic-base -mpic-register=r10
|
||||||
|
|
||||||
|
CFLAGS = $(ARCHCFLAGS) $(ARCHWARNINGS) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
|
||||||
|
CPICFLAGS = $(ARCHPICFLAGS) $(CFLAGS)
|
||||||
|
CXXFLAGS = $(ARCHCXXFLAGS) $(ARCHWARNINGSXX) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHXXINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
|
||||||
|
CXXPICFLAGS = $(ARCHPICFLAGS) $(CXXFLAGS)
|
||||||
|
CPPFLAGS = $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES)
|
||||||
|
AFLAGS = $(CFLAGS) -D__ASSEMBLY__
|
||||||
|
|
||||||
|
NXFLATLDFLAGS1 = -r -d -warn-common
|
||||||
|
NXFLATLDFLAGS2 = $(NXFLATLDFLAGS1) -T$(TOPDIR)/binfmt/libnxflat/gnu-nxflat-pcrel.ld -no-check-sections
|
||||||
|
LDNXFLATFLAGS = -e main -s 2048
|
||||||
|
|
||||||
|
ASMEXT = .S
|
||||||
|
OBJEXT = .o
|
||||||
|
LIBEXT = .a
|
||||||
|
EXEEXT =
|
||||||
|
|
||||||
|
ifneq ($(CROSSDEV),arm-nuttx-elf-)
|
||||||
|
LDFLAGS += -nostartfiles -nodefaultlibs
|
||||||
|
endif
|
||||||
|
ifeq ($(CONFIG_DEBUG_SYMBOLS),y)
|
||||||
|
LDFLAGS += -g
|
||||||
|
endif
|
||||||
|
|
||||||
|
|
||||||
|
HOSTCC = gcc
|
||||||
|
HOSTINCLUDES = -I.
|
||||||
|
HOSTCFLAGS = -Wall -Wstrict-prototypes -Wshadow -Wundef -g -pipe
|
||||||
|
HOSTLDFLAGS =
|
||||||
|
|
1237
configs/olimex-stm32-e407/usbnsh/defconfig
Normal file
1237
configs/olimex-stm32-e407/usbnsh/defconfig
Normal file
File diff suppressed because it is too large
Load diff
80
configs/olimex-stm32-e407/usbnsh/setenv.sh
Executable file
80
configs/olimex-stm32-e407/usbnsh/setenv.sh
Executable file
|
@ -0,0 +1,80 @@
|
||||||
|
#!/bin/bash
|
||||||
|
# configs/olimex-stm32-e407/usbnsh/setenv.sh
|
||||||
|
#
|
||||||
|
# Copyright (C) 2013 Gregory Nutt. All rights reserved.
|
||||||
|
# Author: Gregory Nutt <gnutt@nuttx.org>
|
||||||
|
#
|
||||||
|
# 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 NuttX 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.
|
||||||
|
#
|
||||||
|
|
||||||
|
if [ "$_" = "$0" ] ; then
|
||||||
|
echo "You must source this script, not run it!" 1>&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
WD=`pwd`
|
||||||
|
if [ ! -x "setenv.sh" ]; then
|
||||||
|
echo "This script must be executed from the top-level NuttX build directory"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -z "${PATH_ORIG}" ]; then
|
||||||
|
export PATH_ORIG="${PATH}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# This is the Cygwin path to the location where I installed the RIDE
|
||||||
|
# toolchain under windows. You will also have to edit this if you install
|
||||||
|
# the RIDE toolchain in any other location
|
||||||
|
#export TOOLCHAIN_BIN="/cygdrive/c/Program Files (x86)/Raisonance/Ride/arm-gcc/bin"
|
||||||
|
|
||||||
|
# This is the Cygwin path to the location where I installed the CodeSourcery
|
||||||
|
# toolchain under windows. You will also have to edit this if you install
|
||||||
|
# the CodeSourcery toolchain in any other location
|
||||||
|
export TOOLCHAIN_BIN="/cygdrive/c/Program Files (x86)/CodeSourcery/Sourcery G++ Lite/bin"
|
||||||
|
#export TOOLCHAIN_BIN="/cygdrive/c/Users/MyName/MentorGraphics/Sourcery_CodeBench_Lite_for_ARM_EABI/bin"
|
||||||
|
|
||||||
|
# This is the location where I installed the ARM "GNU Tools for ARM Embedded Processors"
|
||||||
|
# You can this free toolchain here https://launchpad.net/gcc-arm-embedded
|
||||||
|
#export TOOLCHAIN_BIN="/cygdrive/c/Program Files (x86)/GNU Tools ARM Embedded/4.9 2015q2/bin"
|
||||||
|
|
||||||
|
# These are the Cygwin paths to the locations where I installed the Atollic
|
||||||
|
# toolchain under windows. You will also have to edit this if you install
|
||||||
|
# the Atollic toolchain in any other location. /usr/bin is added before
|
||||||
|
# the Atollic bin path because there is are binaries named gcc.exe and g++.exe
|
||||||
|
# at those locations as well.
|
||||||
|
#export TOOLCHAIN_BIN="/usr/bin:/cygdrive/c/Program Files (x86)/Atollic/TrueSTUDIO for ARM Pro 2.3.0/ARMTools/bin"
|
||||||
|
#export TOOLCHAIN_BIN="/usr/bin:/cygdrive/c/Program Files (x86)/Atollic/TrueSTUDIO for STMicroelectronics STM32 Lite 2.3.0/ARMTools/bin"
|
||||||
|
|
||||||
|
# This is the Cygwin path to the location where I build the buildroot
|
||||||
|
# toolchain.
|
||||||
|
#export TOOLCHAIN_BIN="${WD}/../buildroot/build_arm_nofpu/staging_dir/bin"
|
||||||
|
|
||||||
|
# Add the path to the toolchain to the PATH varialble
|
||||||
|
export PATH="${TOOLCHAIN_BIN}:/sbin:/usr/sbin:${PATH_ORIG}"
|
||||||
|
|
||||||
|
echo "PATH : ${PATH}"
|
Loading…
Reference in a new issue