boards: arm: Add STM32F3DISCOVERY board

Add support for STM32F3DISCOVERY board.

Origin: original

Signed-off-by: Yannis Damigos <giannis.damigos@gmail.com>
This commit is contained in:
Yannis Damigos 2017-06-21 21:57:25 +03:00 committed by Anas Nashif
commit 4668ecbbd2
16 changed files with 504 additions and 1 deletions

View file

@ -0,0 +1,10 @@
# Kconfig - STM32F3DISCOVERY board configuration
#
# Copyright (c) 2017 I-SENSE group of ICCS
#
# SPDX-License-Identifier: Apache-2.0
#
config BOARD_STM32F3_DISCO
bool "STM32F3DISCOVERY Development Board"
depends on SOC_STM32F303XC

View file

@ -0,0 +1,13 @@
# Kconfig - STM32F3DISCOVERY board configuration
#
# Copyright (c) 2017 I-SENSE group of ICCS
#
# SPDX-License-Identifier: Apache-2.0
#
if BOARD_STM32F3_DISCO
config BOARD
default stm32f3_disco
endif # BOARD_STM32F3_DISCO

View file

@ -0,0 +1,2 @@
# No C files (yet)
obj- += dummy.o

View file

@ -0,0 +1,7 @@
FLASH_SCRIPT = openocd.sh
DEBUG_SCRIPT = openocd.sh
OPENOCD_LOAD_CMD = "flash write_image erase ${O}/${KERNEL_BIN_NAME} ${CONFIG_FLASH_BASE_ADDRESS}"
OPENOCD_VERIFY_CMD = "verify_image ${O}/${KERNEL_BIN_NAME} ${CONFIG_FLASH_BASE_ADDRESS}"
export FLASH_SCRIPT OPENOCD_LOAD_CMD OPENOCD_VERIFY_CMD

View file

@ -0,0 +1,54 @@
/*
* Copyright (c) 2017 I-SENSE group of ICCS
*
* SPDX-License-Identifier: Apache-2.0
*/
#ifndef __INC_BOARD_H
#define __INC_BOARD_H
#include <soc.h>
/* USER push button */
#define USER_PB_GPIO_PORT "GPIOA"
#define USER_PB_GPIO_PIN 0
/* LD3 red LED */
#define LD3_GPIO_PORT "GPIOE"
#define LD3_GPIO_PIN 9
/* LD4 blue LED */
#define LD4_GPIO_PORT "GPIOE"
#define LD4_GPIO_PIN 8
/* LD5 orange LED */
#define LD5_GPIO_PORT "GPIOE"
#define LD5_GPIO_PIN 10
/* LD6 green LED */
#define LD6_GPIO_PORT "GPIOE"
#define LD6_GPIO_PIN 15
/* LD7 green LED */
#define LD7_GPIO_PORT "GPIOE"
#define LD7_GPIO_PIN 11
/* LD8 orange LED */
#define LD8_GPIO_PORT "GPIOE"
#define LD8_GPIO_PIN 14
/* LD9 blue LED */
#define LD9_GPIO_PORT "GPIOE"
#define LD9_GPIO_PIN 12
/* LD10 red LED */
#define LD10_GPIO_PORT "GPIOE"
#define LD10_GPIO_PIN 13
/* Create aliases to make the basic samples work */
#define SW0_GPIO_NAME USER_PB_GPIO_PORT
#define SW0_GPIO_PIN USER_PB_GPIO_PIN
#define LED0_GPIO_PORT LD3_GPIO_PORT
#define LED0_GPIO_PIN LD3_GPIO_PIN
#endif /* __INC_BOARD_H */

Binary file not shown.

After

Width:  |  Height:  |  Size: 256 KiB

View file

@ -0,0 +1,210 @@
.. _stm32f3_disco_board:
ST STM32F3DISCOVERY
###################
Overview
********
The STM32F3DISCOVERY Discovery kit features an ARM Cortex-M4 based STM32F303VC
MCU with everything required for beginners and experienced users to get
started quickly. Here are some highlights of the STM32F3DISCOVERY board:
- STM32 microcontroller in LQFP100 package
- Extension header for all LQFP100 I/Os for quick connection to prototyping
board and easy probing
- On-board, ST-LINK/V2 for PCB version A or B or ST-LINK/V2-B for PCB version
C and newer, debugger/programmer with SWD connector
- Board power supply: through USB bus or from an external 3 V or 5 V supply
voltage
- External application power supply: 3 V and 5 V
- Ten LEDs:
- 3.3 V power on (LD1)
- USB communication (LD2)
- Eight user LEDs: red (LD3/LD10), blue (LD4/LD9), orange (LD5/LD9)
and green (LD6/LD7)
- Two push-buttons: USER and RESET
- USB USER with Mini-B connector
- L3GD20, ST MEMS motion sensor, 3-axis digital output gyroscope
- LSM303DLHC, ST MEMS system-in-package featuring a 3D digital linear
acceleration sensor and a 3D digital magnetic sensor
.. image:: img/en.stm32f3discovery.jpg
:width: 350px
:align: center
:height: 531px
:alt: STM32F3DISCOVERY
More information about the board can be found at the
`STM32F3DISCOVERY website`_.
Hardware
********
STM32F3DISCOVERY Discovery kit provides the following hardware components:
- STM32F303VCT6 in LQFP100 package
- ARM |reg| 32-bit Cortex |reg| -M4 CPU with FPU
- 72 MHz max CPU frequency
- VDD from 2.0 V to 3.6 V
- 256 KB Flash
- 40 KB SRAM
- Routine booster: 8 Kbytes of SRAM on instruction and data bus
- GPIO with external interrupt capability
- 4x12-bit ADC with 39 channels
- 2x12-bit D/A converters
- RTC
- General Purpose Timers (13)
- USART/UART (5)
- I2C (2)
- SPI (3)
- CAN
- USB 2.0 full speed interface
- Infrared transmitter
- DMA Controller
More information about STM32F303VC can be found here:
- `STM32F303VC on www.st.com`_
- `STM32F303xC reference manual`_
Supported Features
==================
The Zephyr stm32f3_disco board configuration supports the following hardware
features:
+-----------+------------+-------------------------------------+
| Interface | Controller | Driver/Component |
+===========+============+=====================================+
| NVIC | on-chip | nested vector interrupt controller |
+-----------+------------+-------------------------------------+
| UART | on-chip | serial port-polling; |
| | | serial port-interrupt |
+-----------+------------+-------------------------------------+
| PINMUX | on-chip | pinmux |
+-----------+------------+-------------------------------------+
| GPIO | on-chip | gpio |
+-----------+------------+-------------------------------------+
Other hardware features are not yet supported on Zephyr porting.
The default configuration can be found in the defconfig file:
``boards/arm/stm32f3_disco/stm32f3_disco_defconfig``
Pin Mapping
===========
STM32F3DISCOVERY Discovery kit has 6 GPIO controllers. These controllers are
responsible for pin muxing, input/output, pull-up, etc.
For mode details please refer to `STM32F3DISCOVERY board User Manual`_.
Default Zephyr Peripheral Mapping:
----------------------------------
- UART_1_TX : PA9
- UART_1_RX : PA10
- UART_2_TX : PA2
- UART_2_RX : PA3
- USER_PB : PA0
- LD3 : PE9
- LD4 : PE8
- LD5 : PE10
- LD6 : PE15
- LD7 : PE11
- LD8 : PE14
- LD9 : PE12
- LD10 : PE13
System Clock
============
STM32F3DISCOVERY System Clock could be driven by internal or external
oscillator, as well as main PLL clock. By default System clock is driven
by PLL clock at 72 MHz, driven by 8 MHz MCO from the ST Link.
Serial Port
===========
STM32F3DISCOVERY Discovery kit has up to 5 UARTs. The Zephyr console output
is assigned to UART1. Default settings are 115200 8N1.
Programming and Debugging
*************************
Flashing
========
STM32F3DISCOVERY Discovery kit includes a ST-LINK/V2 or ST-LINK/V2-B embedded
debug tool interface. This interface is supported by the openocd version
included in Zephyr SDK.
Flashing an application to STM32F3DISCOVERY
-------------------------------------------
The sample application :ref:`hello_world` is being used in this tutorial:
.. code-block:: console
$<zephyr_root_path>/samples/hello_world
To build the Zephyr kernel and application, enter:
.. code-block:: console
$ cd <zephyr_root_path>
$ source zephyr-env.sh
$ cd $ZEPHYR_BASE/samples/hello_world/
$ make BOARD=stm32f3_disco
Connect the STM32F3DISCOVERY Discovery kit to your host computer using the USB
ST-LINK port. Then, enter the following command:
.. code-block:: console
$ make BOARD=stm32f3_disco flash
Run a serial host program to connect with your board. For PCB version A or B a
TTL(3.3V) serial adapter is required. For PCB version C and newer a Virtual Com
Port (VCP) is available on the USB ST-LINK port.
.. code-block:: console
$ minicom -D /dev/<tty device>
Replace <tty_device> with the port where the STM32F3DISCOVERY board can be
found. For example, under Linux, /dev/ttyUSB0.
You should see the following message:
.. code-block:: console
Hello World! arm
Debugging
=========
Access gdb with the following make command:
.. code-block:: console
$ make BOARD=stm32f3_disco debug
.. _STM32F3DISCOVERY website:
http://www.st.com/en/evaluation-tools/stm32f3discovery.html
.. _STM32F3DISCOVERY board User Manual:
http://www.st.com/resource/en/user_manual/dm00063382.pdf
.. _STM32F303VC on www.st.com:
http://www.st.com/en/microcontrollers/stm32f303vc.html
.. _STM32F303xC reference manual:
http://www.st.com/resource/en/reference_manual/dm00043574.pdf

View file

@ -0,0 +1,7 @@
identifier: stm32f3_disco
name: STM32F3DISCOVERY
type: mcu
arch: arm
toolchain:
- zephyr
- gccarmemb

View file

@ -0,0 +1,52 @@
CONFIG_ARM=y
CONFIG_BOARD_STM32F3_DISCO=y
CONFIG_SOC_SERIES_STM32F3X=y
CONFIG_SOC_STM32F303XC=y
# 72MHz system clock
CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC=72000000
CONFIG_SYS_CLOCK_TICKS_PER_SEC=1000
# ARM Options
CONFIG_CPU_HAS_FPU=y
# Floating Point Options
CONFIG_FLOAT=y
# enable uart driver
CONFIG_SERIAL=y
CONFIG_UART_STM32=y
# enable USART1 - passthrough to STLINK v2-1 connector
CONFIG_UART_STM32_PORT_1=y
# enable console on this port by default
CONFIG_CONSOLE=y
CONFIG_UART_CONSOLE=y
CONFIG_UART_CONSOLE_ON_DEV_NAME="UART_1"
# enable pinmux
CONFIG_PINMUX=y
CONFIG_PINMUX_STM32=y
# enable GPIO ports A, B, E
CONFIG_GPIO=y
CONFIG_GPIO_STM32=y
CONFIG_GPIO_STM32_PORTA=y
CONFIG_GPIO_STM32_PORTB=y
CONFIG_GPIO_STM32_PORTE=y
# clock configuration
CONFIG_CLOCK_CONTROL=y
# Clock configuration for Cube Clock control driver
CONFIG_CLOCK_STM32_HSE_CLOCK=8000000
CONFIG_CLOCK_STM32_SYSCLK_SRC_PLL=y
# use HSE as PLL input
CONFIG_CLOCK_STM32_PLL_SRC_HSE=y
# however, the board does not have an external oscillator, so just use
# the 8MHz clock signal coming from integrated STLink
CONFIG_CLOCK_STM32_HSE_BYPASS=y
# produce 72MHz clock at PLL output
CONFIG_CLOCK_STM32_PLL_PREDIV=1
CONFIG_CLOCK_STM32_PLL_MULTIPLIER=9
CONFIG_CLOCK_STM32_AHB_PRESCALER=1
CONFIG_CLOCK_STM32_APB1_PRESCALER=2
CONFIG_CLOCK_STM32_APB2_PRESCALER=1

View file

@ -0,0 +1,12 @@
source [find board/stm32f3discovery.cfg]
$_TARGETNAME configure -event gdb-attach {
echo "Debugger attaching: halting execution"
reset halt
gdb_breakpoint_override hard
}
$_TARGETNAME configure -event gdb-detach {
echo "Debugger detaching: resuming execution"
resume
}

View file

@ -11,6 +11,7 @@ obj-$(CONFIG_BOARD_STM3210C_EVAL) += stm32/pinmux_board_stm3210c_eval.o
obj-$(CONFIG_BOARD_NUCLEO_F334R8) += stm32/pinmux_board_nucleo_f334r8.o
obj-$(CONFIG_BOARD_STM32373C_EVAL) += stm32/pinmux_board_stm32373c_eval.o
obj-$(CONFIG_BOARD_NUCLEO_F401RE) += stm32/pinmux_board_nucleo_f401re.o
obj-$(CONFIG_BOARD_STM32F3_DISCO) += stm32/pinmux_board_stm32f3_disco.o
obj-$(CONFIG_BOARD_STM32F4_DISCO) += stm32/pinmux_board_stm32f4_disco.o
obj-$(CONFIG_BOARD_STM32F469I_DISCO) += stm32/pinmux_board_stm32f469i_disco.o
obj-$(CONFIG_BOARD_NUCLEO_F411RE) += stm32/pinmux_board_nucleo_f411re.o

View file

@ -0,0 +1,38 @@
/*
* Copyright (c) 2017 I-SENSE group of ICCS
*
* SPDX-License-Identifier: Apache-2.0
*/
#include <kernel.h>
#include <device.h>
#include <init.h>
#include <pinmux.h>
#include <sys_io.h>
#include "pinmux/pinmux.h"
#include "pinmux_stm32.h"
/* pin assignments for STM32F3DISCOVERY board */
static const struct pin_config pinconf[] = {
#ifdef CONFIG_UART_STM32_PORT_1
{STM32_PIN_PA9, STM32F3_PINMUX_FUNC_PA9_USART1_TX},
{STM32_PIN_PA10, STM32F3_PINMUX_FUNC_PA10_USART1_RX},
#endif /* CONFIG_UART_STM32_PORT_1 */
#ifdef CONFIG_UART_STM32_PORT_2
{STM32_PIN_PA2, STM32F3_PINMUX_FUNC_PA2_USART2_TX},
{STM32_PIN_PA3, STM32F3_PINMUX_FUNC_PA3_USART2_RX},
#endif /* CONFIG_UART_STM32_PORT_2 */
};
static int pinmux_stm32_init(struct device *port)
{
ARG_UNUSED(port);
stm32_setup_pins(pinconf, ARRAY_SIZE(pinconf));
return 0;
}
SYS_INIT(pinmux_stm32_init, PRE_KERNEL_1,
CONFIG_PINMUX_STM32_DEVICE_INITIALIZATION_PRIORITY);

View file

@ -43,6 +43,6 @@ dtb-$(CONFIG_BOARD_SAM4S_XPLAINED) = sam4s_xplained.dts_compiled
dtb-$(CONFIG_BOARD_OLIMEX_STM32_E407) = olimex_stm32_e407.dts_compiled
dtb-$(CONFIG_BOARD_CC2650_SENSORTAG) = cc2650_sensortag.dts_compiled
dtb-$(CONFIG_BOARD_STM32_MIN_DEV) = stm32_min_dev.dts_compiled
dtb-$(CONFIG_BOARD_STM32F3_DISCO) = stm32f3_disco.dts_compiled
always := $(dtb-y)
endif

48
dts/arm/st/stm32f303.dtsi Normal file
View file

@ -0,0 +1,48 @@
/*
* Copyright (c) 2017 I-SENSE group of ICCS
*
* SPDX-License-Identifier: Apache-2.0
*/
#include <arm/armv7-m.dtsi>
#include <st/mem.h>
/ {
flash0: flash {
reg = <0x08000000 DT_FLASH_SIZE>;
};
sram0: memory {
reg = <0x20000000 DT_SRAM_SIZE>;
};
soc {
usart1: serial@40013800 {
compatible = "st,stm32-usart", "st,stm32-uart";
reg = <0x40013800 0x400>;
interrupts = <37 0>;
status = "disabled";
label = "UART_1";
};
usart2: serial@40004400 {
compatible = "st,stm32-usart", "st,stm32-uart";
reg = <0x40004400 0x400>;
interrupts = <38 0>;
status = "disabled";
label = "UART_2";
};
usart3: serial@40004800 {
compatible = "st,stm32-usart", "st,stm32-uart";
reg = <0x40004800 0x400>;
interrupts = <39 0>;
status = "disabled";
label = "UART_3";
};
};
};
&nvic {
arm,num-irq-priority-bits = <4>;
};

29
dts/arm/stm32f3_disco.dts Normal file
View file

@ -0,0 +1,29 @@
/*
* Copyright (c) 2017 I-SENSE group of ICCS
*
* SPDX-License-Identifier: Apache-2.0
*/
/dts-v1/;
#include <st/stm32f303.dtsi>
/ {
model = "STMicroelectronics STM32F3DISCOVERY board";
compatible = "st,stm32f3discovery", "st,stm32f303";
chosen {
zephyr,console = &usart1;
zephyr,sram = &sram0;
zephyr,flash = &flash0;
};
};
&usart1 {
current-speed = <115200>;
status = "ok";
};
&usart2 {
current-speed = <115200>;
status = "ok";
};

View file

@ -0,0 +1,20 @@
/* This file is a temporary workaround for mapping of the generated information
* to the current driver definitions. This will be removed when the drivers
* are modified to handle the generated information, or the mapping of
* generated data matches the driver definitions.
*/
#define CONFIG_NUM_IRQ_PRIO_BITS ARM_V7M_NVIC_E000E100_ARM_NUM_IRQ_PRIORITY_BITS
#define CONFIG_UART_STM32_PORT_1_BASE_ADDRESS ST_STM32_USART_40013800_BASE_ADDRESS
#define CONFIG_UART_STM32_PORT_1_BAUD_RATE ST_STM32_USART_40013800_CURRENT_SPEED
#define CONFIG_UART_STM32_PORT_1_IRQ_PRI ST_STM32_USART_40013800_IRQ_0_PRIORITY
#define CONFIG_UART_STM32_PORT_1_NAME ST_STM32_USART_40013800_LABEL
#define PORT_1_IRQ ST_STM32_USART_40013800_IRQ_0
#define CONFIG_UART_STM32_PORT_2_BASE_ADDRESS ST_STM32_USART_40004400_BASE_ADDRESS
#define CONFIG_UART_STM32_PORT_2_BAUD_RATE ST_STM32_USART_40004400_CURRENT_SPEED
#define CONFIG_UART_STM32_PORT_2_IRQ_PRI ST_STM32_USART_40004400_IRQ_0_PRIORITY
#define CONFIG_UART_STM32_PORT_2_NAME ST_STM32_USART_40004400_LABEL
#define PORT_2_IRQ ST_STM32_USART_40004400_IRQ_0