boards: arm: olimex_stm32_e407: Initial Olimex STM32-E407 BSP

- board name olimex_stm32_e407
- CPU STM32F407ZGT6 Cortex M4
- LED/BUTTON support
- Console on USART1 with 8n1 115200 baud

Signed-off-by: Erwin Rol <erwin@erwinrol.com>
This commit is contained in:
Erwin Rol 2017-05-20 14:53:07 +02:00 committed by Kumar Gala
commit 0c4ba8f7d2
15 changed files with 624 additions and 1 deletions

View file

@ -0,0 +1,10 @@
# Kconfig - OLIMEX-STM32-E407 board configuration
#
# Copyright (c) 2017, Erwin Rol <erwin@erwinrol.com>
#
# SPDX-License-Identifier: Apache-2.0
#
config BOARD_OLIMEX_STM32_E407
bool "OLIMEX-STM32-E407 Development Board"
depends on SOC_STM32F407XG

View file

@ -0,0 +1,14 @@
# Kconfig - OLIMEX-STM32-E407 board configuration
#
# Copyright (c) 2017, Erwin Rol <erwin@erwinrol.com>
#
# SPDX-License-Identifier: Apache-2.0
#
if BOARD_OLIMEX_STM32_E407
config BOARD
default olimex_stm32_e407
endif # BOARD_OLIMEX_STM32_E407

View file

@ -0,0 +1,11 @@
# Makefile - Olimex STM32-E407 board
#
# Copyright (c) 2017, Erwin Rol <erwin@erwinrol.com>
#
# SPDX-License-Identifier: Apache-2.0
#
ccflags-y +=-I$(srctree)/drivers
obj-y += pinmux.o

View file

@ -0,0 +1,8 @@
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,26 @@
/*
* Copyright (c) 2015 Intel Corporation
*
* SPDX-License-Identifier: Apache-2.0
*/
#ifndef __INC_BOARD_H
#define __INC_BOARD_H
#include <soc.h>
/* USER push button BUT */
#define USER_PB_GPIO_PORT "GPIOA"
#define USER_PB_GPIO_PIN 0
/* LED1 green LED */
#define LED1_GPIO_PORT "GPIOC"
#define LED1_GPIO_PIN 13
/* Define 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 LED1_GPIO_PORT
#define LED0_GPIO_PIN LED1_GPIO_PIN
#endif /* __INC_BOARD_H */

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 423 KiB

View file

@ -0,0 +1,378 @@
.. _olimex_stm32_e407:
OLIMEX-STM32-E407
#################
Overview
********
Zephyr applications use the olimex_stm32_e407 board configuration
to run on the OLIMEX-STM32-E407 open source hardware. It is based on
the STMicroelectronics STM32F407ZG ARM Cortex-M4 CPU.
.. figure:: img/olimex-stm32-e407.png
:width: 540px
:align: center
:height: 454px
:alt: OLIMEX-STM32-E407
OLIMEX-STM32-E407
More information about the board can be found at the
`OLIMEX-STM32-E407 website`_ and `OLIMEX-STM32-E407 user manual`_.
The `ST STM32F407ZG Datasheet`_ contains the processor's
information and the datasheet.
Supported Features
==================
The olimex_stm32_e407 board configuration supports the following
hardware features:
+-----------+------------+----------------------+
| Interface | Controller | Driver/Component |
+===========+============+======================+
| NVIC | on-chip | nested vectored |
| | | interrupt controller |
+-----------+------------+----------------------+
| SYSTICK | on-chip | system clock |
+-----------+------------+----------------------+
| UART | on-chip | serial port |
+-----------+------------+----------------------+
| GPIO | on-chip | gpio |
+-----------+------------+----------------------+
Other hardware features are not supported by the Zephyr kernel.
Pin Mapping
===========
.. figure:: img/olimex-stm32-e407-front.png
:width: 739px
:align: center
:height: 530px
:alt: OLIMEX-STM32-E407 connectors
OLIMEX-STM32-E407 connectors
LED
---
* LED (green) = PC13
* PWR_LED (red) = power
Push buttons
------------
* BUT = PA0
* RST = NRST
External Connectors
-------------------
JTAG/SWD debug
+-------+--------------+-------+--------------+
| PIN # | Signal Name | Pin # | Signal Name |
+=======+==============+=======+==============+
| 1 | +3.3V | 11 | - |
+-------+--------------+-------+--------------+
| 2 | +3.3V | 12 | GND |
+-------+--------------+-------+--------------+
| 3 | PB4 / TRST | 13 | PB3 / TDO |
+-------+--------------+-------+--------------+
| 4 | GND | 14 | GND |
+-------+--------------+-------+--------------+
| 5 | PA15 / TDI | 15 | PB4 / TRST |
+-------+--------------+-------+--------------+
| 6 | GND | 16 | GND |
+-------+--------------+-------+--------------+
| 7 | PA13 / TMS | 17 | - |
+-------+--------------+-------+--------------+
| 8 | GND | 18 | GND |
+-------+--------------+-------+--------------+
| 9 | PA14 / TCK | 19 | +5V_JTAG |
+-------+--------------+-------+--------------+
| 10 | GND | 20 | GND |
+-------+--------------+-------+--------------+
UEXT
+-------+-----------------------+----------------+
| PIN # | Wire Name | STM32F407 port |
+=======+=======================+================+
| 1 | +3.3V | - |
+-------+-----------------------+----------------+
| 2 | GND | - |
+-------+-----------------------+----------------+
| 3 | PC6/USART6_TX | PC6 |
+-------+-----------------------+----------------+
| 4 | PC7/USART6_RX | PC7 |
+-------+-----------------------+----------------+
| 5 | PB8/I2C1_SCL | PB8 |
+-------+-----------------------+----------------+
| 6 | PB9/I2C1_SDA | PB9 |
+-------+-----------------------+----------------+
| 7 | PC2/SPI2_MISO | PC2 |
+-------+-----------------------+----------------+
| 8 | PC3/SPI2_MOSI | PC3 |
+-------+-----------------------+----------------+
| 9 | PB10/SPI_SCK/UART3_TX | PB10 |
+-------+-----------------------+----------------+
| 10 | RB7/UEXT_CS | PB7 |
+-------+-----------------------+----------------+
Arduino Headers
---------------
CON1 power
+-------+--------------+-------------------------+
| Pin | Signal Name | STM32F407 Pin# |
+=======+==============+=========================+
| RST | RESET | 23 |
+-------+--------------+-------------------------+
| 3V3 | VCC (3V3) | N/A |
+-------+--------------+-------------------------+
| 5V | VDD (5V) | N/A |
+-------+--------------+-------------------------+
| GND | GND | N/A |
+-------+--------------+-------------------------+
| GND | GND | N/A |
+-------+--------------+-------------------------+
| VIN | VIN | N/A |
+-------+--------------+-------------------------+
CON2 analog
+-------+--------------+-------------------------+
| Pin | Signal Name | STM32F407 Pin# |
+=======+==============+=========================+
| A0 | PC0 | 26 |
+-------+--------------+-------------------------+
| A1 | PF6 | 18 |
+-------+--------------+-------------------------+
| A2 | PF7 | 19 |
+-------+--------------+-------------------------+
| A3 | PF8 | 20 |
+-------+--------------+-------------------------+
| A4 | PF9 | 21 |
+-------+--------------+-------------------------+
| A5 | PF10 | 22 |
+-------+--------------+-------------------------+
CON3 digital
+-------+---------------+-------------------------+
| Pin | Signal Name | STM32F407 Pin# |
+=======+===============+=========================+
| D0 | PB7/USART1_RX | 137 |
+-------+---------------+-------------------------+
| D1 | PB6/USART1_TX | 136 |
+-------+---------------+-------------------------+
| D2 | PE2 | 1 |
+-------+---------------+-------------------------+
| D3 | PE4 | 3 |
+-------+---------------+-------------------------+
| D4 | PE5 | 4 |
+-------+---------------+-------------------------+
| D5 | PR6 | 5 |
+-------+---------------+-------------------------+
| D6 | PG7 | 92 |
+-------+---------------+-------------------------+
| D7 | PG8 | 93 |
+-------+---------------+-------------------------+
CON4 digital
+-------+--------------+-------------------------+
| Pin | Signal Name | STM32F407 Pin# |
+=======+==============+=========================+
| D8 | PG12 | 35 |
+-------+--------------+-------------------------+
| D9 | PG15 | 70 |
+-------+--------------+-------------------------+
| D10 | PA4 | 40 |
+-------+--------------+-------------------------+
| D11 | PB5 | 43 |
+-------+--------------+-------------------------+
| D12 | PA6 | 42 |
+-------+--------------+-------------------------+
| D13 | PA5 | 41 |
+-------+--------------+-------------------------+
| GND | AGND | 31 |
+-------+--------------+-------------------------+
| AREF | AREF | 32 |
+-------+--------------+-------------------------+
PD
+-------+--------------+-------+--------------+
| PIN # | Signal Name | Pin # | Signal Name |
+=======+==============+=======+==============+
| 1 | +3.3V | 11 | PD8 |
+-------+--------------+-------+--------------+
| 2 | GND | 12 | PD9 |
+-------+--------------+-------+--------------+
| 3 | PD0 | 13 | PD10 |
+-------+--------------+-------+--------------+
| 4 | PD1 | 14 | PD11 |
+-------+--------------+-------+--------------+
| 5 | PD2/SD_MMC | 15 | PD12 |
+-------+--------------+-------+--------------+
| 6 | PD3 | 16 | PD13 |
+-------+--------------+-------+--------------+
| 7 | PD4 | 17 | PD14 |
+-------+--------------+-------+--------------+
| 8 | PD5 | 18 | PD15 |
+-------+--------------+-------+--------------+
| 9 | PD6 | 19 | +5V |
+-------+--------------+-------+--------------+
| 10 | PD7 | 20 | GND |
+-------+--------------+-------+--------------+
PE
+-------+--------------+-------+--------------+
| PIN # | Signal Name | Pin # | Signal Name |
+=======+==============+=======+==============+
| 1 | +3.3V | 11 | PE8 |
+-------+--------------+-------+--------------+
| 2 | GND | 12 | PE9 |
+-------+--------------+-------+--------------+
| 3 | PE0 | 13 | PE10 |
+-------+--------------+-------+--------------+
| 4 | PE1 | 14 | PE11 |
+-------+--------------+-------+--------------+
| 5 | PE2/D2 | 15 | PE12 |
+-------+--------------+-------+--------------+
| 6 | PE3 | 16 | PE13 |
+-------+--------------+-------+--------------+
| 7 | PE4/D3 | 17 | PE14 |
+-------+--------------+-------+--------------+
| 8 | PE5/D4 | 18 | PE15 |
+-------+--------------+-------+--------------+
| 9 | PE6/D5 | 19 | +5V |
+-------+--------------+-------+--------------+
| 10 | PE7 | 20 | GND |
+-------+--------------+-------+--------------+
PF
+-------+--------------+-------+--------------+
| PIN # | Signal Name | Pin # | Signal Name |
+=======+==============+=======+==============+
| 1 | +3.3V | 11 | PF8/A3 |
+-------+--------------+-------+--------------+
| 2 | GND | 12 | PF9/A4 |
+-------+--------------+-------+--------------+
| 3 | PF0 | 13 | PF10/A5 |
+-------+--------------+-------+--------------+
| 4 | PF1 | 14 | PF11/A6 |
+-------+--------------+-------+--------------+
| 5 | PF2 | 15 | PF12 |
+-------+--------------+-------+--------------+
| 6 | PF3 | 16 | PF13 |
+-------+--------------+-------+--------------+
| 7 | PF4 | 17 | PF14 |
+-------+--------------+-------+--------------+
| 8 | PF5 | 18 | PF15 |
+-------+--------------+-------+--------------+
| 9 | PF6/A1 | 19 | +5V |
+-------+--------------+-------+--------------+
| 10 | PF7/A2 | 20 | GND |
+-------+--------------+-------+--------------+
PG
+-------+--------------+-------+--------------+
| PIN # | Signal Name | Pin # | Signal Name |
+=======+==============+=======+==============+
| 1 | +3.3V | 11 | PG8/D7 |
+-------+--------------+-------+--------------+
| 2 | GND | 12 | PG9 |
+-------+--------------+-------+--------------+
| 3 | PG0 | 13 | PG10/UEXT_CS |
+-------+--------------+-------+--------------+
| 4 | PG1 | 14 | PG11/TX_EN |
+-------+--------------+-------+--------------+
| 5 | PG2 | 15 | PG12/D8 |
+-------+--------------+-------+--------------+
| 6 | PG3 | 16 | PG13/TXD0 |
+-------+--------------+-------+--------------+
| 7 | PG4 | 17 | PG14/TXD1 |
+-------+--------------+-------+--------------+
| 8 | PG5 | 18 | PG15/D9 |
+-------+--------------+-------+--------------+
| 9 | PG6 | 19 | +5V |
+-------+--------------+-------+--------------+
| 10 | PG7/D6 | 20 | GND |
+-------+--------------+-------+--------------+
System Clock
============
OLIMEX-STM32-E407 has two external oscillators. The frequency of
the slow clock is 32.768 kHz. The frequency of the main clock
is 12 MHz. The processor can setup HSE to drive the master clock,
which can be set as high as 168 MHz.
Programming and Debugging
=========================
The OLIMEX-STM32-E407 board does not include an embedded debug tool
interface. You will need to use ST tools or an external JTAG probe.
In the following examples a ST-Link V2 USB dongle is used.
Flashing an application to STM32F4DISCOVERY
-------------------------------------------
The sample application :ref:`hello_world` is being used in this tutorial. 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=olimex_stm32_e407
Connect the ST-Link USB dongle to your host computer and to the JTAG port of
the OLIMEX-STM32-E407 board.
Then, enter the following command:
.. code-block:: console
$ make BOARD=olimex_stm32_e407 flash
Run a serial host program to connect with your board:
.. code-block:: console
$ minicom -D /dev/ttyACM0
You should see the following message:
.. code-block:: console
***** BOOTING ZEPHYR OS v1.7.99 - BUILD: May 29 2017 22:31:53 *****
Hello World! arm
Debugging
=========
Access gdb with the following make command:
.. code-block:: console
$ make BOARD=olimex_stm32_e407 debug
.. _OLIMEX-STM32-E407 website:
https://www.olimex.com/Products/ARM/ST/STM32-E407/open-source-hardware
.. _OLIMEX-STM32-E407 user manual:
https://www.olimex.com/Products/ARM/ST/STM32-E407/resources/STM32-E407.pdf
.. _ST STM32F407ZG Datasheet:
http://www.st.com/resource/en/reference_manual/dm00031020.pdf

View file

@ -0,0 +1,46 @@
CONFIG_ARM=y
CONFIG_BOARD_OLIMEX_STM32_E407=y
CONFIG_SOC_SERIES_STM32F4X=y
CONFIG_SOC_STM32F407XG=y
# 168MHz system clock
CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC=168000000
CONFIG_SYS_CLOCK_TICKS_PER_SEC=1000
# Enable MPU
CONFIG_STM32_ARM_MPU_ENABLE=y
# enable USART1
CONFIG_UART_STM32_PORT_1=y
# enable console on this port by default
CONFIG_UART_CONSOLE_ON_DEV_NAME="UART_1"
# enable pinmux
CONFIG_PINMUX=y
# enable GPIO ports A, B, C
CONFIG_GPIO=y
# clock configuration
CONFIG_CLOCK_CONTROL=y
# Clock configuration for Cube Clock control driver
CONFIG_CLOCK_STM32_HSE_CLOCK=12000000
CONFIG_CLOCK_STM32_SYSCLK_SRC_PLL=y
# use HSE as PLL input
CONFIG_CLOCK_STM32_PLL_SRC_HSE=y
# produce 168MHz clock at PLL output
CONFIG_CLOCK_STM32_PLL_M_DIVISOR=6
CONFIG_CLOCK_STM32_PLL_N_MULTIPLIER=168
CONFIG_CLOCK_STM32_PLL_P_DIVISOR=2
CONFIG_CLOCK_STM32_PLL_Q_DIVISOR=4
CONFIG_CLOCK_STM32_AHB_PRESCALER=1
CONFIG_CLOCK_STM32_APB1_PRESCALER=4
CONFIG_CLOCK_STM32_APB2_PRESCALER=2
CONFIG_RANDOM_GENERATOR=y
# CONFIG_RANDOM_HAS_DRIVER is not set
CONFIG_RANDOM_NAME="RANDOM_0"
CONFIG_TEST_RANDOM_GENERATOR=y
CONFIG_TIMER_RANDOM_GENERATOR=y

View file

@ -0,0 +1,42 @@
/*
* Copyright (c) 2017 Erwin Rol <erwin@erwinrol.com>
*
* SPDX-License-Identifier: Apache-2.0
*/
#include <kernel.h>
#include <device.h>
#include <init.h>
#include <pinmux.h>
#include <sys_io.h>
#include <pinmux/stm32/pinmux_stm32.h>
/* pin assignments for OLIMEX-STM32-E407 board */
static const struct pin_config pinconf[] = {
#ifdef CONFIG_UART_STM32_PORT_1
{STM32_PIN_PB6, STM32F4_PINMUX_FUNC_PB6_USART1_TX},
{STM32_PIN_PB7, STM32F4_PINMUX_FUNC_PB7_USART1_RX},
#endif /* CONFIG_UART_STM32_PORT_1 */
#ifdef CONFIG_UART_STM32_PORT_3
{STM32_PIN_PB10, STM32F4_PINMUX_FUNC_PB10_USART3_TX},
{STM32_PIN_PB11, STM32F4_PINMUX_FUNC_PB11_USART3_RX},
#endif /* CONFIG_UART_STM32_PORT_2 */
#ifdef CONFIG_UART_STM32_PORT_6
{STM32_PIN_PC6, STM32F4_PINMUX_FUNC_PC6_USART6_TX},
{STM32_PIN_PC7, STM32F4_PINMUX_FUNC_PC7_USART6_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

@ -0,0 +1,25 @@
source [find interface/stlink-v2.cfg]
set WORKAREASIZE 0x10000
transport select hla_swd
source [find target/stm32f4x.cfg]
adapter_khz 1000
adapter_nsrst_delay 100
jtag_ntrst_delay 100
reset_config srst_only srst_nogate
$_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

@ -40,6 +40,7 @@ dtb-$(CONFIG_BOARD_QEMU_CORTEX_M3) = qemu_cortex_m3.dts_compiled
dtb-$(CONFIG_BOARD_SAM_E70_XPLAINED) = sam_e70_xplained.dts_compiled
dtb-$(CONFIG_BOARD_ARDUINO_DUE) = arduino_due.dts_compiled
dtb-$(CONFIG_BOARD_SAM4S_XPLAINED) = sam4s_xplained.dts_compiled
dtb-$(CONFIG_BOARD_OLIMEX_STM32_E407) = olimex_stm32_e407.dts_compiled
always := $(dtb-y)
endif

View file

@ -0,0 +1,35 @@
/*
* Copyright (c) 2017, Erwin Rol <erwin@erwinrol.com>
*
* SPDX-License-Identifier: Apache-2.0
*/
/dts-v1/;
#include <st/stm32f407.dtsi>
/ {
model = "Olimex STM32-E407 board";
compatible = "olimex,stm32-e407", "st,stm32f407";
chosen {
zephyr,console = &usart1;
zephyr,sram = &sram0;
zephyr,flash = &flash0;
};
};
&usart1 {
current-speed = <115200>;
status = "ok";
};
&usart3 {
current-speed = <115200>;
status = "ok";
};
&usart6 {
current-speed = <115200>;
status = "ok";
};

View file

@ -0,0 +1,27 @@
/* 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_40011000_BASE_ADDRESS
#define CONFIG_UART_STM32_PORT_1_BAUD_RATE ST_STM32_USART_40011000_CURRENT_SPEED
#define CONFIG_UART_STM32_PORT_1_IRQ_PRI ST_STM32_USART_40011000_IRQ_0_PRIORITY
#define CONFIG_UART_STM32_PORT_1_NAME ST_STM32_USART_40011000_LABEL
#define PORT_1_IRQ ST_STM32_USART_40011000_IRQ_0
#define CONFIG_UART_STM32_PORT_3_NAME ST_STM32_USART_40004800_LABEL
#define CONFIG_UART_STM32_PORT_3_BASE_ADDRESS ST_STM32_USART_40004800_BASE_ADDRESS
#define CONFIG_UART_STM32_PORT_3_BAUD_RATE ST_STM32_USART_40004800_CURRENT_SPEED
#define CONFIG_UART_STM32_PORT_3_IRQ_PRI ST_STM32_USART_40004800_IRQ_0_PRIORITY
#define PORT_3_IRQ ST_STM32_USART_40004800_IRQ_0
#define CONFIG_UART_STM32_PORT_6_NAME ST_STM32_USART_40011400_LABEL
#define CONFIG_UART_STM32_PORT_6_BASE_ADDRESS ST_STM32_USART_40011400_BASE_ADDRESS
#define CONFIG_UART_STM32_PORT_6_BAUD_RATE ST_STM32_USART_40011400_CURRENT_SPEED
#define CONFIG_UART_STM32_PORT_6_IRQ_PRI ST_STM32_USART_40011400_IRQ_0_PRIORITY
#define PORT_6_IRQ ST_STM32_USART_40011400_IRQ_0

View file

@ -9,7 +9,7 @@ platforms = qemu_cortex_m3 frdm_k64f arduino_due nucleo_f103rb stm32_mini_a15
sam_e70_xplained curie_ble nrf52_blenano2 hexiwear_kw40z
cc3220sf_launchxl frdm_kl25z disco_l475_iot1 nucleo_l432kc
nucleo_f413zh stm32l496g_disco stm32f4_disco 96b_carbon_nrf51
stm32f469i_disco nucleo_f412zg sam4s_xplained
stm32f469i_disco nucleo_f412zg sam4s_xplained olimex_stm32_e407
supported_toolchains = zephyr gccarmemb