Nucleo-F072RB: Add board configuration
This commit is contained in:
parent
8420e68a9b
commit
b45472baf8
@ -474,11 +474,10 @@ config STM32F0_VALUELINE
|
||||
select STM32F0_HAVE_USART4
|
||||
select STM32F0_HAVE_USART5
|
||||
select STM32F0_HAVE_TIM1
|
||||
select STM32F0_HAVE_TIM5
|
||||
select STM32F0_HAVE_TIM2
|
||||
select STM32F0_HAVE_TIM3
|
||||
select STM32F0_HAVE_TIM6
|
||||
select STM32F0_HAVE_TIM7
|
||||
select STM32F0_HAVE_TIM12
|
||||
select STM32F0_HAVE_TIM13
|
||||
select STM32F0_HAVE_TIM14
|
||||
select STM32F0_HAVE_TIM15
|
||||
select STM32F0_HAVE_TIM16
|
||||
@ -489,46 +488,62 @@ config STM32F0_VALUELINE
|
||||
config STM32F0_ACCESSLINE
|
||||
bool
|
||||
default n
|
||||
select STM32F0_HAVE_OTGFS
|
||||
select STM32F0_HAVE_USART3
|
||||
select STM32F0_HAVE_USART4
|
||||
select STM32F0_HAVE_USART5
|
||||
select STM32F0_HAVE_TIM1
|
||||
select STM32F0_HAVE_TIM5
|
||||
select STM32F0_HAVE_TIM2
|
||||
select STM32F0_HAVE_TIM3
|
||||
select STM32F0_HAVE_TIM6
|
||||
select STM32F0_HAVE_TIM7
|
||||
select STM32F0_HAVE_TIM14
|
||||
select STM32F0_HAVE_TIM15
|
||||
select STM32F0_HAVE_TIM16
|
||||
select STM32F0_HAVE_TIM17
|
||||
select STM32F0_HAVE_ADC2
|
||||
select STM32F0_HAVE_CAN1
|
||||
select STM32F0_HAVE_CAN2
|
||||
select STM32F0_HAVE_ETHMAC
|
||||
select STM32F0_HAVE_SPI2
|
||||
select STM32F0_HAVE_SPI3
|
||||
|
||||
config STM32F0_LOWVOLTLINE
|
||||
bool
|
||||
default n
|
||||
select STM32F0_HAVE_OTGFS
|
||||
select STM32F0_HAVE_USART3
|
||||
select STM32F0_HAVE_USART4
|
||||
select STM32F0_HAVE_USART5
|
||||
select STM32F0_HAVE_TIM1
|
||||
select STM32F0_HAVE_TIM5
|
||||
select STM32F0_HAVE_TIM2
|
||||
select STM32F0_HAVE_TIM3
|
||||
select STM32F0_HAVE_TIM6
|
||||
select STM32F0_HAVE_TIM7
|
||||
select STM32F0_HAVE_TIM14
|
||||
select STM32F0_HAVE_TIM15
|
||||
select STM32F0_HAVE_TIM16
|
||||
select STM32F0_HAVE_TIM17
|
||||
select STM32F0_HAVE_ADC2
|
||||
select STM32F0_HAVE_CAN1
|
||||
select STM32F0_HAVE_CAN2
|
||||
select STM32F0_HAVE_ETHMAC
|
||||
select STM32F0_HAVE_SPI2
|
||||
select STM32F0_HAVE_SPI3
|
||||
|
||||
config STM32F0_USBLINE
|
||||
bool
|
||||
default n
|
||||
select STM32F0_HAVE_USBDEV
|
||||
select STM32F0_HAVE_FSMC
|
||||
select STM32F0_HAVE_USART3
|
||||
select STM32F0_HAVE_USART4
|
||||
select STM32F0_HAVE_TIM1
|
||||
select STM32F0_HAVE_TIM2
|
||||
select STM32F0_HAVE_TIM3
|
||||
select STM32F0_HAVE_TIM6
|
||||
select STM32F0_HAVE_TIM7
|
||||
select STM32F0_HAVE_TIM14
|
||||
select STM32F0_HAVE_TIM15
|
||||
select STM32F0_HAVE_TIM16
|
||||
select STM32F0_HAVE_TIM17
|
||||
select STM32F0_HAVE_ADC2
|
||||
select STM32F0_HAVE_CAN1
|
||||
select STM32F0_HAVE_SPI2
|
||||
select STM32F0_HAVE_SPI3
|
||||
select STM32F0_HAVE_USBDEV
|
||||
|
||||
config STM32F0_DFU
|
||||
bool "DFU bootloader"
|
||||
@ -565,10 +580,6 @@ config STM32F0_HAVE_USBDEV
|
||||
bool
|
||||
default n
|
||||
|
||||
config STM32F0_HAVE_OTGFS
|
||||
bool
|
||||
default n
|
||||
|
||||
config STM32F0_HAVE_FSMC
|
||||
bool
|
||||
default n
|
||||
@ -617,14 +628,6 @@ config STM32F0_HAVE_TIM3
|
||||
bool
|
||||
default n
|
||||
|
||||
config STM32F0_HAVE_TIM4
|
||||
bool
|
||||
default n
|
||||
|
||||
config STM32F0_HAVE_TIM5
|
||||
bool
|
||||
default n
|
||||
|
||||
config STM32F0_HAVE_TIM6
|
||||
bool
|
||||
default n
|
||||
@ -633,30 +636,6 @@ config STM32F0_HAVE_TIM7
|
||||
bool
|
||||
default n
|
||||
|
||||
config STM32F0_HAVE_TIM8
|
||||
bool
|
||||
default n
|
||||
|
||||
config STM32F0_HAVE_TIM9
|
||||
bool
|
||||
default n
|
||||
|
||||
config STM32F0_HAVE_TIM10
|
||||
bool
|
||||
default n
|
||||
|
||||
config STM32F0_HAVE_TIM11
|
||||
bool
|
||||
default n
|
||||
|
||||
config STM32F0_HAVE_TIM12
|
||||
bool
|
||||
default n
|
||||
|
||||
config STM32F0_HAVE_TIM13
|
||||
bool
|
||||
default n
|
||||
|
||||
config STM32F0_HAVE_TIM14
|
||||
bool
|
||||
default n
|
||||
@ -733,10 +712,6 @@ config STM32F0_HAVE_CAN1
|
||||
bool
|
||||
default n
|
||||
|
||||
config STM32F0_HAVE_CAN2
|
||||
bool
|
||||
default n
|
||||
|
||||
config STM32F0_HAVE_COMP1
|
||||
bool
|
||||
default n
|
||||
@ -777,10 +752,6 @@ config STM32F0_HAVE_RNG
|
||||
bool
|
||||
default n
|
||||
|
||||
config STM32F0_HAVE_ETHMAC
|
||||
bool
|
||||
default n
|
||||
|
||||
config STM32F0_HAVE_I2C2
|
||||
bool
|
||||
default n
|
||||
@ -930,13 +901,6 @@ config STM32F0_CAN1
|
||||
select STM32F0_CAN
|
||||
depends on STM32F0_HAVE_CAN1
|
||||
|
||||
config STM32F0_CAN2
|
||||
bool "CAN2"
|
||||
default n
|
||||
select CAN
|
||||
select STM32F0_CAN
|
||||
depends on STM32F0_HAVE_CAN2
|
||||
|
||||
config STM32F0_CEC
|
||||
bool "CEC"
|
||||
default n
|
||||
@ -1083,16 +1047,6 @@ config STM32F0_TIM3
|
||||
default n
|
||||
depends on STM32F0_HAVE_TIM3
|
||||
|
||||
config STM32F0_TIM4
|
||||
bool "TIM4"
|
||||
default n
|
||||
depends on STM32F0_HAVE_TIM4
|
||||
|
||||
config STM32F0_TIM5
|
||||
bool "TIM5"
|
||||
default n
|
||||
depends on STM32F0_HAVE_TIM5
|
||||
|
||||
config STM32F0_TIM6
|
||||
bool "TIM6"
|
||||
default n
|
||||
@ -1103,36 +1057,6 @@ config STM32F0_TIM7
|
||||
default n
|
||||
depends on STM32F0_HAVE_TIM7
|
||||
|
||||
config STM32F0_TIM8
|
||||
bool "TIM8"
|
||||
default n
|
||||
depends on STM32F0_HAVE_TIM8
|
||||
|
||||
config STM32F0_TIM9
|
||||
bool "TIM9"
|
||||
default n
|
||||
depends on STM32F0_HAVE_TIM9
|
||||
|
||||
config STM32F0_TIM10
|
||||
bool "TIM10"
|
||||
default n
|
||||
depends on STM32F0_HAVE_TIM10
|
||||
|
||||
config STM32F0_TIM11
|
||||
bool "TIM11"
|
||||
default n
|
||||
depends on STM32F0_HAVE_TIM11
|
||||
|
||||
config STM32F0_TIM12
|
||||
bool "TIM12"
|
||||
default n
|
||||
depends on STM32F0_HAVE_TIM12
|
||||
|
||||
config STM32F0_TIM13
|
||||
bool "TIM13"
|
||||
default n
|
||||
depends on STM32F0_HAVE_TIM13
|
||||
|
||||
config STM32F0_TIM14
|
||||
bool "TIM14"
|
||||
default n
|
||||
@ -1291,7 +1215,6 @@ config USART1_RS485_DIR_POLARITY
|
||||
|
||||
endif # STM32F0_USART1_SERIALDRIVER
|
||||
|
||||
|
||||
choice
|
||||
prompt "USART2 Driver Configuration"
|
||||
default STM32F0_USART2_SERIALDRIVER
|
||||
@ -1329,7 +1252,6 @@ config USART2_RS485_DIR_POLARITY
|
||||
|
||||
endif # STM32F0_USART2_SERIALDRIVER
|
||||
|
||||
|
||||
choice
|
||||
prompt "USART3 Driver Configuration"
|
||||
default STM32F0_USART3_SERIALDRIVER
|
||||
@ -1481,7 +1403,6 @@ config USART6_RS485_DIR_POLARITY
|
||||
|
||||
endif # STM32F0_USART6_SERIALDRIVER
|
||||
|
||||
|
||||
choice
|
||||
prompt "USART7 Driver Configuration"
|
||||
default STM32F0_USART7_SERIALDRIVER
|
||||
@ -1519,7 +1440,6 @@ config USART7_RS485_DIR_POLARITY
|
||||
|
||||
endif # STM32F0_USART7_SERIALDRIVER
|
||||
|
||||
|
||||
choice
|
||||
prompt "USART8 Driver Configuration"
|
||||
default STM32F0_USART8_SERIALDRIVER
|
||||
|
@ -724,6 +724,15 @@ config ARCH_BOARD_NUCLEO_144
|
||||
NUCLEO-F767ZI - STM32F767ZIT6 a 216MHz Cortex-M7, w/DPFPU -
|
||||
2048KiB Flash memory and 512KiB SRAM.
|
||||
|
||||
config ARCH_BOARD_NUCLEO_F072RB
|
||||
bool "STM32F072 Nucleo F072RB"
|
||||
depends on ARCH_CHIP_STM32F072RB
|
||||
select ARCH_HAVE_LEDS
|
||||
select ARCH_HAVE_BUTTONS
|
||||
select ARCH_HAVE_IRQBUTTONS
|
||||
---help---
|
||||
STMicro Nucleo F072RB board based on the STMicro STM32F072RBT6 MCU.
|
||||
|
||||
config ARCH_BOARD_NUCLEO_F303RE
|
||||
bool "STM32F303 Nucleo F303RE"
|
||||
depends on ARCH_CHIP_STM32F303RE
|
||||
@ -1504,6 +1513,7 @@ config ARCH_BOARD
|
||||
default "pic32mx7mmb" if ARCH_BOARD_PIC32MX7MMB
|
||||
default "pic32mz-starterkit" if ARCH_BOARD_PIC32MZ_STARTERKIT
|
||||
default "nucleo-144" if ARCH_BOARD_NUCLEO_144
|
||||
default "nucleo-f072rb" if ARCH_BOARD_NUCLEO_F072RB
|
||||
default "nucleo-f303re" if ARCH_BOARD_NUCLEO_F303RE
|
||||
default "nucleo-f334r8" if ARCH_BOARD_NUCLEO_F334R8
|
||||
default "nucleo-f4x1re" if ARCH_BOARD_NUCLEO_F401RE || ARCH_BOARD_NUCLEO_F411RE
|
||||
@ -1810,6 +1820,9 @@ endif
|
||||
if ARCH_BOARD_NUCLEO_144
|
||||
source "configs/nucleo-144/Kconfig"
|
||||
endif
|
||||
if ARCH_BOARD_NUCLEO_F072RB
|
||||
source "configs/nucleo-f072rb/Kconfig"
|
||||
endif
|
||||
if ARCH_BOARD_NUCLEO_F303RE
|
||||
source "configs/nucleo-f303re/Kconfig"
|
||||
endif
|
||||
|
@ -411,6 +411,9 @@ configs/nucleo-144
|
||||
STM32F767ZIT6 is a 216MHz Cortex-M7 operation with 2048Kb Flash memory
|
||||
and 512Kb SRAM.
|
||||
|
||||
configs/nucleo-f072rb
|
||||
STMicro Nucleo F072RB board based on the STMicro STM32F072RBT6 MCU.
|
||||
|
||||
configs/nucleo-f4x1re
|
||||
STMicro ST Nucleo F401RE and F411RE boards. See
|
||||
http://mbed.org/platforms/ST-Nucleo-F401RE and
|
||||
|
8
configs/nucleo-f072rb/Kconfig
Normal file
8
configs/nucleo-f072rb/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_NUCLEO_F072RB
|
||||
|
||||
endif
|
241
configs/nucleo-f072rb/include/board.h
Normal file
241
configs/nucleo-f072rb/include/board.h
Normal file
@ -0,0 +1,241 @@
|
||||
/************************************************************************************
|
||||
* configs/nucleo-f072rb/include/board.h
|
||||
*
|
||||
* Copyright (C) 2017 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
* Alan Carvalho de Assis <acassis@gmail.com>
|
||||
*
|
||||
* 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 __CONFIG_NUCLEO_F072RB_INCLUDE_BOARD_H
|
||||
#define __CONFIG_NUCLEO_F072RB_INCLUDE_BOARD_H
|
||||
|
||||
/************************************************************************************
|
||||
* Included Files
|
||||
************************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#ifndef __ASSEMBLY__
|
||||
# include <stdint.h>
|
||||
#endif
|
||||
|
||||
/************************************************************************************
|
||||
* Pre-processor Definitions
|
||||
************************************************************************************/
|
||||
|
||||
/* Clocking *************************************************************************/
|
||||
/* Four different clock sources can be used to drive the system clock (SYSCLK):
|
||||
*
|
||||
* - HSI high-speed internal oscillator clock
|
||||
* Generated from an internal 8 MHz RC oscillator
|
||||
* - HSE high-speed external oscillator clock
|
||||
* Normally driven by an external crystal (X3). However, this crystal is not
|
||||
* fitted on the Nucleo-F072RB board.
|
||||
* - PLL clock
|
||||
* - MSI multispeed internal oscillator clock
|
||||
* The MSI clock signal is generated from an internal RC oscillator. Seven frequency
|
||||
* ranges are available: 65.536 kHz, 131.072 kHz, 262.144 kHz, 524.288 kHz, 1.048 MHz,
|
||||
* 2.097 MHz (default value) and 4.194 MHz.
|
||||
*
|
||||
* The devices have the following two secondary clock sources
|
||||
* - LSI low-speed internal RC clock
|
||||
* Drives the watchdog and RTC. Approximately 37KHz
|
||||
* - LSE low-speed external oscillator clock
|
||||
* Driven by 32.768KHz crystal (X2) on the OSC32_IN and OSC32_OUT pins.
|
||||
*/
|
||||
|
||||
#define STM32F0_BOARD_XTAL 8000000ul /* X3 on board (not fitted)*/
|
||||
|
||||
#define STM32F0_HSI_FREQUENCY 8000000ul /* Approximately 8MHz */
|
||||
#define STM32F0_HSI14_FREQUENCY 14000000ul /* HSI14 for ADC */
|
||||
#define STM32F0_HSI48_FREQUENCY 48000000ul /* HSI48 for USB, only some STM32F0xx */
|
||||
#define STM32F0_HSE_FREQUENCY STM32F0_BOARD_XTAL
|
||||
#define STM32F0_LSI_FREQUENCY 40000 /* Approximately 40KHz */
|
||||
#define STM32F0_LSE_FREQUENCY 32768 /* X2 on board */
|
||||
|
||||
/* PLL Configuration
|
||||
*
|
||||
* - PLL source is HSI -> 8MHz input (nominal)
|
||||
* - PLL source predivider 2 -> 4MHz divided down PLL VCO clock output
|
||||
* - PLL multipler is 12 -> 48MHz PLL VCO clock output (for USB)
|
||||
*
|
||||
* Resulting SYSCLK frequency is 8MHz x 12 / 2 = 48MHz
|
||||
*
|
||||
* USB:
|
||||
* If the USB interface is used in the application, it requires a precise
|
||||
* 48MHz clock which can be generated from either the (1) the internal
|
||||
* main PLL with the HSE clock source using an HSE crystal oscillator. In
|
||||
* this case, the PLL VCO clock (defined by STM32F0_CFGR_PLLMUL) must be
|
||||
* programmed to output a 96 MHz frequency. This is required to provide a
|
||||
* 48MHz clock to the (USBCLK = PLLVCO/2). Or (2) by using the internal
|
||||
* 48MHz oscillator in automatic trimming mode. The synchronization for
|
||||
* this oscillator can be taken from the USB data stream itself (SOF
|
||||
* signalization) which allows crystal-less operation.
|
||||
* SYSCLK
|
||||
* The system clock is derived from the PLL VCO divided by the output
|
||||
* division factor.
|
||||
* Limitations:
|
||||
* - 96 MHz as PLLVCO when the product is in range 1 (1.8V),
|
||||
* - 48 MHz as PLLVCO when the product is in range 2 (1.5V),
|
||||
* - 24 MHz when the product is in range 3 (1.2V).
|
||||
* - Output division to avoid exceeding 32 MHz as SYSCLK.
|
||||
* - The minimum input clock frequency for PLL is 2 MHz (when using HSE as
|
||||
* PLL source).
|
||||
*/
|
||||
|
||||
#define STM32F0_CFGR_PLLSRC RCC_CFGR_PLLSRC_HSId2 /* Source is HSI/2 */
|
||||
#define STM32F0_PLLSRC_FREQUENCY (STM32F0_HSI_FREQUENCY/2) /* 8MHz / 2 = 4MHz */
|
||||
#ifdef CONFIG_STM32F0_USB
|
||||
# undef STM32F0_CFGR2_PREDIV /* Not used with source HSI/2 */
|
||||
# define STM32F0_CFGR_PLLMUL RCC_CFGR_PLLMUL_CLKx12 /* PLLMUL = 12 */
|
||||
# define STM32F0_PLL_FREQUENCY (12*STM32F0_PLLSRC_FREQUENCY) /* PLL VCO Frequency is 48MHz */
|
||||
#else
|
||||
# undef STM32F0_CFGR2_PREDIV /* Not used with source HSI/2 */
|
||||
# define STM32F0_CFGR_PLLMUL RCC_CFGR_PLLMUL_CLKx12 /* PLLMUL = 12 */
|
||||
# define STM32F0_PLL_FREQUENCY (12*STM32F0_PLLSRC_FREQUENCY) /* PLL VCO Frequency is 48MHz */
|
||||
#endif
|
||||
|
||||
/* Use the PLL and set the SYSCLK source to be the divided down PLL VCO output
|
||||
* frequency (STM32F0_PLL_FREQUENCY divided by the PLLDIV value).
|
||||
*/
|
||||
|
||||
#define STM32F0_SYSCLK_SW RCC_CFGR_SW_PLL /* Use the PLL as the SYSCLK */
|
||||
#define STM32F0_SYSCLK_SWS RCC_CFGR_SWS_PLL
|
||||
#ifdef CONFIG_STM32F0_USB
|
||||
# define STM32F0_SYSCLK_FREQUENCY STM32F0_PLL_FREQUENCY /* SYSCLK frequency is PLL VCO = 48MHz */
|
||||
#else
|
||||
# define STM32F0_SYSCLK_FREQUENCY STM32F0_PLL_FREQUENCY /* SYSCLK frequency is PLL VCO = 48MHz */
|
||||
#endif
|
||||
|
||||
#define STM32F0_RCC_CFGR_HPRE RCC_CFGR_HPRE_SYSCLK
|
||||
#define STM32F0_HCLK_FREQUENCY STM32F0_SYSCLK_FREQUENCY
|
||||
#define STM32F0_BOARD_HCLK STM32F0_HCLK_FREQUENCY /* Same as above, to satisfy compiler */
|
||||
|
||||
/* APB1 clock (PCLK1) is HCLK (48MHz) */
|
||||
|
||||
#define STM32F0_RCC_CFGR_PPRE1 RCC_CFGR_PPRE1_HCLK
|
||||
#define STM32F0_PCLK1_FREQUENCY (STM32F0_HCLK_FREQUENCY)
|
||||
|
||||
/* APB2 clock (PCLK2) is HCLK (48MHz) */
|
||||
|
||||
#define STM32F0_RCC_CFGR_PPRE2 RCC_CFGR_PPRE2_HCLK
|
||||
#define STM32F0_PCLK2_FREQUENCY STM32F0_HCLK_FREQUENCY
|
||||
#define STM32F0_APB2_CLKIN (STM32F0_PCLK2_FREQUENCY)
|
||||
|
||||
/* APB1 timers 1-3, 6-7, and 14-17 will receive PCLK1 */
|
||||
|
||||
#define STM32F0_APB1_TIM1_CLKIN (STM32F0_PCLK1_FREQUENCY)
|
||||
#define STM32F0_APB1_TIM2_CLKIN (STM32F0_PCLK1_FREQUENCY)
|
||||
#define STM32F0_APB1_TIM3_CLKIN (STM32F0_PCLK1_FREQUENCY)
|
||||
|
||||
#define STM32F0_APB1_TIM6_CLKIN (STM32F0_PCLK1_FREQUENCY)
|
||||
#define STM32F0_APB1_TIM7_CLKIN (STM32F0_PCLK1_FREQUENCY)
|
||||
|
||||
#define STM32F0_APB1_TIM14_CLKIN (STM32F0_PCLK1_FREQUENCY)
|
||||
#define STM32F0_APB1_TIM15_CLKIN (STM32F0_PCLK1_FREQUENCY)
|
||||
#define STM32F0_APB1_TIM16_CLKIN (STM32F0_PCLK1_FREQUENCY)
|
||||
#define STM32F0_APB1_TIM17_CLKIN (STM32F0_PCLK1_FREQUENCY)
|
||||
|
||||
/* LED definitions ******************************************************************/
|
||||
/* LEDs
|
||||
*
|
||||
* The Nucleo-64 board has one user controlable LED, User LD2. This green
|
||||
* LED is a user LED connected to Arduino signal D13 corresponding to STM32
|
||||
* I/O PA5 (PB13 on other some other Nucleo-64 boards).
|
||||
*
|
||||
* - When the I/O is HIGH value, the LED is on
|
||||
* - When the I/O is LOW, the LED is off
|
||||
*/
|
||||
|
||||
/* LED index values for use with board_userled() */
|
||||
|
||||
#define BOARD_LD2 0
|
||||
#define BOARD_NLEDS 1
|
||||
|
||||
/* LED bits for use with board_userled_all() */
|
||||
|
||||
#define BOARD_LD2_BIT (1 << BOARD_LD2)
|
||||
|
||||
/* These LEDs are not used by the board port unless CONFIG_ARCH_LEDS is
|
||||
* defined. In that case, the usage by the board port is defined in
|
||||
* include/board.h and src/sam_leds.c. The LEDs are used to encode OS-related
|
||||
* events as follows when the red LED (PE24) is available:
|
||||
*
|
||||
* SYMBOL Meaning LD2
|
||||
* ------------------- ----------------------- -----------
|
||||
* LED_STARTED NuttX has been started OFF
|
||||
* LED_HEAPALLOCATE Heap has been allocated OFF
|
||||
* LED_IRQSENABLED Interrupts enabled OFF
|
||||
* LED_STACKCREATED Idle stack created ON
|
||||
* LED_INIRQ In an interrupt No change
|
||||
* LED_SIGNAL In a signal handler No change
|
||||
* LED_ASSERTION An assertion failed No change
|
||||
* LED_PANIC The system has crashed Blinking
|
||||
* LED_IDLE MCU is is sleep mode Not used
|
||||
*
|
||||
* Thus if LD2, NuttX has successfully booted and is, apparently, running
|
||||
* normally. If LD2 is flashing at approximately 2Hz, then a fatal error
|
||||
* has been detected and the system has halted.
|
||||
*/
|
||||
|
||||
#define LED_STARTED 0
|
||||
#define LED_HEAPALLOCATE 0
|
||||
#define LED_IRQSENABLED 0
|
||||
#define LED_STACKCREATED 1
|
||||
#define LED_INIRQ 2
|
||||
#define LED_SIGNAL 2
|
||||
#define LED_ASSERTION 2
|
||||
#define LED_PANIC 1
|
||||
|
||||
/* Button definitions ***************************************************************/
|
||||
/* Buttons
|
||||
*
|
||||
* B1 USER: the user button is connected to the I/O PC13 (pin 2) of the STM32
|
||||
* microcontroller.
|
||||
*/
|
||||
|
||||
#define BUTTON_USER 0
|
||||
#define NUM_BUTTONS 1
|
||||
|
||||
#define BUTTON_USER_BIT (1 << BUTTON_USER)
|
||||
|
||||
/* Alternate Pin Functions **********************************************************/
|
||||
/* USART 1 */
|
||||
|
||||
#define GPIO_USART1_TX GPIO_USART1_TX_2
|
||||
#define GPIO_USART1_RX GPIO_USART1_RX_2
|
||||
|
||||
/* USART 2 */
|
||||
|
||||
#define GPIO_USART2_TX GPIO_USART2_TX_3
|
||||
#define GPIO_USART2_RX GPIO_USART2_RX_3
|
||||
|
||||
#endif /* __CONFIG_NUCLEO_F072RB_INCLUDE_BOARD_H */
|
113
configs/nucleo-f072rb/nsh/Make.defs
Normal file
113
configs/nucleo-f072rb/nsh/Make.defs
Normal file
@ -0,0 +1,113 @@
|
||||
############################################################################
|
||||
# configs/nucleo-f072rb/nsh/Make.defs
|
||||
#
|
||||
# Copyright (C) 2017 Gregory Nutt. All rights reserved.
|
||||
# Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
# Alan Carvalho de Assis <acassis@gmail.com>
|
||||
#
|
||||
# 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/armv6-m/Toolchain.defs
|
||||
|
||||
LDSCRIPT = flash.ld
|
||||
|
||||
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 -fcheck-new -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 =
|
1043
configs/nucleo-f072rb/nsh/defconfig
Normal file
1043
configs/nucleo-f072rb/nsh/defconfig
Normal file
File diff suppressed because it is too large
Load Diff
81
configs/nucleo-f072rb/nsh/setenv.sh
Normal file
81
configs/nucleo-f072rb/nsh/setenv.sh
Normal file
@ -0,0 +1,81 @@
|
||||
#!/bin/bash
|
||||
# configs/nucleo-f072rb/nsh/setenv.sh
|
||||
#
|
||||
# Copyright (C) 2017 Gregory Nutt. All rights reserved.
|
||||
# Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
# Alan Carvalho de Assis <acassis@gmail.com>
|
||||
#
|
||||
# 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 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/Program Files (x86)/CodeSourcery/Sourcery_CodeBench_Lite_for_ARM_EABI/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"
|
||||
|
||||
# This is the path to the location where I installed the devkitARM toolchain
|
||||
# You can get this free toolchain from http://devkitpro.org/ or http://sourceforge.net/projects/devkitpro/
|
||||
#export TOOLCHAIN_BIN="/cygdrive/c/Program Files (x86)/devkitARM/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}"
|
127
configs/nucleo-f072rb/scripts/flash.ld
Normal file
127
configs/nucleo-f072rb/scripts/flash.ld
Normal file
@ -0,0 +1,127 @@
|
||||
/****************************************************************************
|
||||
* configs/nucleo-f072rb/scripts/flash.ld
|
||||
*
|
||||
* Copyright (C) 2017 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
* Alan Carvalho de Assis <acassis@gmail.com>
|
||||
*
|
||||
* 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 STM32F072RBT6 has 128KB of FLASH beginning at address 0x0800:0000 and
|
||||
* 16Kb of SRAM at address 0x20000000.
|
||||
*
|
||||
* 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 = 128K
|
||||
sram (rwx) : ORIGIN = 0x20000000, LENGTH = 16K
|
||||
}
|
||||
|
||||
OUTPUT_ARCH(arm)
|
||||
EXTERN(_vectors)
|
||||
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) }
|
||||
}
|
2
configs/nucleo-f072rb/src/.gitignore
vendored
Normal file
2
configs/nucleo-f072rb/src/.gitignore
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
/.depend
|
||||
/Make.dep
|
56
configs/nucleo-f072rb/src/Makefile
Normal file
56
configs/nucleo-f072rb/src/Makefile
Normal file
@ -0,0 +1,56 @@
|
||||
############################################################################
|
||||
# configs/nucleo-f072rb/src/Makefile
|
||||
#
|
||||
# Copyright (C) 2017 Gregory Nutt. All rights reserved.
|
||||
# Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
# Alan Carvalho de Assis <acassis@gmail.com>
|
||||
#
|
||||
# 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 stm32_bringup.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_LIB_BOARDCTL),y)
|
||||
CSRCS += stm32_appinit.c
|
||||
endif
|
||||
|
||||
include $(TOPDIR)/configs/Board.mk
|
123
configs/nucleo-f072rb/src/nucleo-f072rb.h
Normal file
123
configs/nucleo-f072rb/src/nucleo-f072rb.h
Normal file
@ -0,0 +1,123 @@
|
||||
/****************************************************************************
|
||||
* configs/nucleo-f072rb/src/nucleo-f072rb.h
|
||||
*
|
||||
* Copyright (C) 2017 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
* Alan Carvalho de Assis <acassis@gmail.com>
|
||||
*
|
||||
* 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_NUCLEO_F072RB_SRC_NUCLEO_F072RB_H
|
||||
#define __CONFIGS_NUCLEO_F072RB_SRC_NUCLEO_F072RB_H
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
#include <nuttx/compiler.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#include "stm32f0_gpio.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/* Configuration ************************************************************/
|
||||
/* How many SPI modules does this chip support? */
|
||||
|
||||
#if STM32F0_NSPI < 1
|
||||
# undef CONFIG_STM32F0_SPI1
|
||||
# undef CONFIG_STM32F0_SPI2
|
||||
# undef CONFIG_STM32F0_SPI3
|
||||
#elif STM32F0_NSPI < 2
|
||||
# undef CONFIG_STM32F0_SPI2
|
||||
# undef CONFIG_STM32F0_SPI3
|
||||
#elif STM32F0_NSPI < 3
|
||||
# undef CONFIG_STM32F0_SPI3
|
||||
#endif
|
||||
|
||||
/* Nucleo-F072RB GPIOs ******************************************************/
|
||||
/* LED. User LD2: the green LED is a user LED connected to Arduino signal
|
||||
* D13 corresponding to MCU I/O PA5 (pin 21) or PB13 (pin 34) depending on
|
||||
* the STM32 target.
|
||||
*
|
||||
* - When the I/O is HIGH value, the LED is on.
|
||||
* - When the I/O is LOW, the LED is off.
|
||||
*/
|
||||
|
||||
#define GPIO_LD2 (GPIO_OUTPUT | GPIO_PUSHPULL | GPIO_SPEED_10MHz | \
|
||||
GPIO_OUTPUT_CLEAR | GPIO_PORTA | GPIO_PIN5)
|
||||
|
||||
/* Button definitions *******************************************************/
|
||||
/* B1 USER: the user button is connected to the I/O PC13 (pin 2) of the STM32
|
||||
* microcontroller.
|
||||
*/
|
||||
|
||||
#define MIN_IRQBUTTON BUTTON_USER
|
||||
#define MAX_IRQBUTTON BUTTON_USER
|
||||
#define NUM_IRQBUTTONS 1
|
||||
|
||||
#define GPIO_BTN_USER (GPIO_INPUT | GPIO_FLOAT | GPIO_EXTI | \
|
||||
GPIO_PORTC | GPIO_PIN13)
|
||||
|
||||
/****************************************************************************
|
||||
* Public Types
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Public data
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef __ASSEMBLY__
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: stm32_bringup
|
||||
*
|
||||
* Description:
|
||||
* Perform architecture-specific initialization
|
||||
*
|
||||
* CONFIG_BOARD_INITIALIZE=y :
|
||||
* Called from board_initialize().
|
||||
*
|
||||
* CONFIG_BOARD_INITIALIZE=n && CONFIG_LIB_BOARDCTL=y :
|
||||
* Called from the NSH library
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
int stm32_bringup(void);
|
||||
|
||||
#endif /* __ASSEMBLY__ */
|
||||
#endif /* __CONFIGS_NUCLEO_F072RB_SRC_NUCLEO_F072RB_H */
|
87
configs/nucleo-f072rb/src/stm32_appinit.c
Normal file
87
configs/nucleo-f072rb/src/stm32_appinit.c
Normal file
@ -0,0 +1,87 @@
|
||||
/****************************************************************************
|
||||
* config/nucleo-f072rb/src/stm32_appinit.c
|
||||
*
|
||||
* Copyright (C) 2017 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
* Alan Carvalho de Assis <acassis@gmail.com>
|
||||
*
|
||||
* 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/board.h>
|
||||
|
||||
#include "nucleo-f072rb.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: board_app_initialize
|
||||
*
|
||||
* Description:
|
||||
* Perform application specific initialization. This function is never
|
||||
* called directly from application code, but only indirectly via the
|
||||
* (non-standard) boardctl() interface using the command BOARDIOC_INIT.
|
||||
*
|
||||
* Input Parameters:
|
||||
* arg - The boardctl() argument is passed to the board_app_initialize()
|
||||
* implementation without modification. The argument has no
|
||||
* meaning to NuttX; the meaning of the argument is a contract
|
||||
* between the board-specific initalization logic and the the
|
||||
* matching application logic. The value cold be such things as a
|
||||
* mode enumeration value, a set of DIP switch switch settings, a
|
||||
* pointer to configuration data read from a file or serial FLASH,
|
||||
* or whatever you would like to do with it. Every implementation
|
||||
* should accept zero/NULL as a default configuration.
|
||||
*
|
||||
* Returned Value:
|
||||
* Zero (OK) is returned on success; a negated errno value is returned on
|
||||
* any failure to indicate the nature of the failure.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
int board_app_initialize(uintptr_t arg)
|
||||
{
|
||||
/* Did we already initialize via board_initialize()? */
|
||||
|
||||
#ifndef CONFIG_BOARD_INITIALIZE
|
||||
return stm32_bringup();
|
||||
#else
|
||||
return OK;
|
||||
#endif
|
||||
}
|
96
configs/nucleo-f072rb/src/stm32_autoleds.c
Normal file
96
configs/nucleo-f072rb/src/stm32_autoleds.c
Normal file
@ -0,0 +1,96 @@
|
||||
/****************************************************************************
|
||||
* configs/nucleo-f072rb/src/stm32_autoleds.c
|
||||
*
|
||||
* Copyright (C) 2017 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 "nucleo-f072rb.h"
|
||||
|
||||
#ifdef CONFIG_ARCH_LEDS
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: board_autoled_initialize
|
||||
****************************************************************************/
|
||||
|
||||
void board_autoled_initialize(void)
|
||||
{
|
||||
/* Configure LD2 GPIO for output */
|
||||
|
||||
stm32_configgpio(GPIO_LD2);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: board_autoled_on
|
||||
****************************************************************************/
|
||||
|
||||
void board_autoled_on(int led)
|
||||
{
|
||||
if (led == 1)
|
||||
{
|
||||
stm32_gpiowrite(GPIO_LD2, true);
|
||||
}
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: board_autoled_off
|
||||
****************************************************************************/
|
||||
|
||||
void board_autoled_off(int led)
|
||||
{
|
||||
if (led == 1)
|
||||
{
|
||||
stm32_gpiowrite(GPIO_LD2, false);
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* CONFIG_ARCH_LEDS */
|
94
configs/nucleo-f072rb/src/stm32_boot.c
Normal file
94
configs/nucleo-f072rb/src/stm32_boot.c
Normal file
@ -0,0 +1,94 @@
|
||||
/************************************************************************************
|
||||
* configs/nucleo-f072rb/src/stm32f0_boot.c
|
||||
*
|
||||
* Copyright (C) 2017 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
* Alan Carvalho de Assis <acassis@gmail.com>
|
||||
*
|
||||
* 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/board.h>
|
||||
#include <arch/board/board.h>
|
||||
|
||||
#include "up_arch.h"
|
||||
#include "nucleo-f072rb.h"
|
||||
|
||||
/************************************************************************************
|
||||
* Public Functions
|
||||
************************************************************************************/
|
||||
|
||||
/************************************************************************************
|
||||
* Name: stm32f0_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 stm32f0_boardinitialize(void)
|
||||
{
|
||||
#ifdef CONFIG_ARCH_LEDS
|
||||
/* Configure on-board LEDs if LED support has been selected. */
|
||||
|
||||
board_autoled_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_initialize() 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)
|
||||
{
|
||||
/* Perform board-specific initialization here if so configured */
|
||||
|
||||
(void)stm32_bringup();
|
||||
}
|
||||
#endif
|
81
configs/nucleo-f072rb/src/stm32_bringup.c
Normal file
81
configs/nucleo-f072rb/src/stm32_bringup.c
Normal file
@ -0,0 +1,81 @@
|
||||
/****************************************************************************
|
||||
* config/nucleo-f072rb/src/stm32_bringup.c
|
||||
*
|
||||
* Copyright (C) 2017 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/mount.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
#include "nucleo-f072rb.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: stm32_bringup
|
||||
*
|
||||
* Description:
|
||||
* Perform architecture-specific initialization
|
||||
*
|
||||
* CONFIG_BOARD_INITIALIZE=y :
|
||||
* Called from board_initialize().
|
||||
*
|
||||
* CONFIG_BOARD_INITIALIZE=n && CONFIG_LIB_BOARDCTL=y :
|
||||
* Called from the NSH library
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
int stm32_bringup(void)
|
||||
{
|
||||
int ret;
|
||||
|
||||
#ifdef CONFIG_FS_PROCFS
|
||||
/* Mount the procfs file system */
|
||||
|
||||
ret = mount(NULL, "/proc", "procfs", 0, NULL);
|
||||
if (ret < 0)
|
||||
{
|
||||
syslog(LOG_ERR, "ERROR: Failed to mount procfs at /proc: %d\n", ret);
|
||||
}
|
||||
#endif
|
||||
|
||||
UNUSED(ret);
|
||||
return OK;
|
||||
}
|
126
configs/nucleo-f072rb/src/stm32_buttons.c
Normal file
126
configs/nucleo-f072rb/src/stm32_buttons.c
Normal file
@ -0,0 +1,126 @@
|
||||
/****************************************************************************
|
||||
* configs/nucleo-f072rb/src/stm32_buttons.c
|
||||
*
|
||||
* Copyright (C) 2017 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 <errno.h>
|
||||
|
||||
#include <nuttx/arch.h>
|
||||
#include <nuttx/board.h>
|
||||
#include <arch/board/board.h>
|
||||
|
||||
#include "nucleo-f072rb.h"
|
||||
|
||||
#ifdef CONFIG_ARCH_BUTTONS
|
||||
|
||||
/****************************************************************************
|
||||
* 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)
|
||||
{
|
||||
/* Configure the single button as an input. NOTE that EXTI interrupts are
|
||||
* also configured for the pin.
|
||||
*/
|
||||
|
||||
stm32_configgpio(GPIO_BTN_USER);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: board_buttons
|
||||
****************************************************************************/
|
||||
|
||||
uint32_t board_buttons(void)
|
||||
{
|
||||
/* Check that state of each USER button. A LOW value means that the key is
|
||||
* pressed.
|
||||
*/
|
||||
|
||||
bool released = stm32_gpioread(GPIO_BTN_USER);
|
||||
return !released;
|
||||
}
|
||||
|
||||
/************************************************************************************
|
||||
* 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 32-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.
|
||||
*
|
||||
************************************************************************************/
|
||||
|
||||
#ifdef CONFIG_ARCH_IRQBUTTONS
|
||||
int board_button_irq(int id, xcpt_t irqhandler, FAR void *arg)
|
||||
{
|
||||
int ret = -EINVAL;
|
||||
|
||||
if (id == BUTTON_USER)
|
||||
{
|
||||
ret = stm32_gpiosetevent(GPIO_BTN_USER, true, true, true, irqhandler, arg);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
#endif
|
||||
#endif /* CONFIG_ARCH_BUTTONS */
|
217
configs/nucleo-f072rb/src/stm32_userleds.c
Normal file
217
configs/nucleo-f072rb/src/stm32_userleds.c
Normal file
@ -0,0 +1,217 @@
|
||||
/****************************************************************************
|
||||
* configs/nucleo-f072rb/src/stm32_userleds.c
|
||||
*
|
||||
* Copyright (C) 2017 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 "nucleo-f072rb.h"
|
||||
|
||||
#ifndef CONFIG_ARCH_LEDS
|
||||
|
||||
/****************************************************************************
|
||||
* Private Function Prototypes
|
||||
****************************************************************************/
|
||||
|
||||
/* LED Power Management */
|
||||
|
||||
#ifdef CONFIG_PM
|
||||
static void led_pm_notify(struct pm_callback_s *cb, int domain,
|
||||
enum pm_state_e pmstate);
|
||||
static int led_pm_prepare(struct pm_callback_s *cb, int domain,
|
||||
enum pm_state_e pmstate);
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Private Data
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_PM
|
||||
static struct pm_callback_s g_ledscb =
|
||||
{
|
||||
.notify = led_pm_notify,
|
||||
.prepare = led_pm_prepare,
|
||||
};
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Private Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: led_pm_notify
|
||||
*
|
||||
* Description:
|
||||
* Notify the driver of new power state. This callback is called after
|
||||
* all drivers have had the opportunity to prepare for the new power state.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_PM
|
||||
static void led_pm_notify(struct pm_callback_s *cb, int domain,
|
||||
enum pm_state_e pmstate)
|
||||
{
|
||||
switch (pmstate)
|
||||
{
|
||||
case(PM_NORMAL):
|
||||
{
|
||||
/* Restore normal LEDs operation */
|
||||
|
||||
}
|
||||
break;
|
||||
|
||||
case(PM_IDLE):
|
||||
{
|
||||
/* Entering IDLE mode - Turn leds off */
|
||||
|
||||
}
|
||||
break;
|
||||
|
||||
case(PM_STANDBY):
|
||||
{
|
||||
/* Entering STANDBY mode - Logic for PM_STANDBY goes here */
|
||||
|
||||
}
|
||||
break;
|
||||
|
||||
case(PM_SLEEP):
|
||||
{
|
||||
/* Entering SLEEP mode - Logic for PM_SLEEP goes here */
|
||||
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
{
|
||||
/* Should not get here */
|
||||
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Name: led_pm_prepare
|
||||
*
|
||||
* Description:
|
||||
* Request the driver to prepare for a new power state. This is a warning
|
||||
* that the system is about to enter into a new power state. The driver
|
||||
* should begin whatever operations that may be required to enter power
|
||||
* state. The driver may abort the state change mode by returning a
|
||||
* non-zero value from the callback function.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_PM
|
||||
static int led_pm_prepare(struct pm_callback_s *cb, int domain,
|
||||
enum pm_state_e pmstate)
|
||||
{
|
||||
/* No preparation to change power modes is required by the LEDs driver.
|
||||
* We always accept the state change by returning OK.
|
||||
*/
|
||||
|
||||
return OK;
|
||||
}
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: board_userled_initialize
|
||||
****************************************************************************/
|
||||
|
||||
void board_userled_initialize(void)
|
||||
{
|
||||
/* Configure LD2 GPIO for output */
|
||||
|
||||
stm32_configgpio(GPIO_LD2);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: board_userled
|
||||
****************************************************************************/
|
||||
|
||||
void board_userled(int led, bool ledon)
|
||||
{
|
||||
if (led == 1)
|
||||
{
|
||||
stm32_gpiowrite(GPIO_LD2, ldeon);
|
||||
}
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: board_userled_all
|
||||
****************************************************************************/
|
||||
|
||||
void board_userled_all(uint8_t ledset)
|
||||
{
|
||||
if (led == 1)
|
||||
{
|
||||
stm32_gpiowrite(GPIO_LD2, (ledset & BOARD_LD2_BIT) != 0);
|
||||
}
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: stm32_led_pminitialize
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_PM
|
||||
void stm32_led_pminitialize(void)
|
||||
{
|
||||
/* Register to receive power management callbacks */
|
||||
|
||||
int ret = pm_register(&g_ledscb);
|
||||
DEBUGASSERT(ret == OK);
|
||||
UNUSED(ret);
|
||||
}
|
||||
#endif /* CONFIG_PM */
|
||||
|
||||
#endif /* !CONFIG_ARCH_LEDS */
|
Loading…
Reference in New Issue
Block a user