boards: arm: Add stm32f072-eval board support

Add the STM32F072-EVAL Board minimal support.

Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
This commit is contained in:
Neil Armstrong 2017-09-08 15:59:38 +02:00 committed by Kumar Gala
parent c406b95c40
commit 7474ad6286
15 changed files with 436 additions and 0 deletions

View file

@ -0,0 +1,3 @@
zephyr_library()
zephyr_library_sources(pinmux.c)
zephyr_library_include_directories(${PROJECT_SOURCE_DIR}/drivers)

View file

@ -0,0 +1,10 @@
# Kconfig - STM32F072-EVAL board configuration
#
# Copyright (c) 2017 BayLibre, SAS
#
# SPDX-License-Identifier: Apache-2.0
#
config BOARD_STM32F072_EVAL
bool "STM32F072-EVAL Development Board"
depends on SOC_STM32F072XB

View file

@ -0,0 +1,20 @@
# Kconfig - STM32F072-EVAL board configuration
#
# Copyright (c) 2017 BayLibre, SAS
#
# SPDX-License-Identifier: Apache-2.0
#
if BOARD_STM32F072_EVAL
config BOARD
default stm32f072_eval
if UART_CONSOLE
config UART_STM32_PORT_2
default y
endif # UART_CONSOLE
endif # BOARD_STM32F072_EVAL

View file

@ -0,0 +1 @@
include(${ZEPHYR_BASE}/boards/common/openocd.board.cmake)

View file

@ -0,0 +1,60 @@
/*
* Copyright (c) 2017 BayLibre, SAS
*
* SPDX-License-Identifier: Apache-2.0
*/
#ifndef __INC_BOARD_H
#define __INC_BOARD_H
#include <soc.h>
/* TAMPER push button */
#define TAMPER_PB_GPIO_PORT "GPIOC"
#define TAMPER_PB_GPIO_PIN 13
/* Joystick Right push button */
#define JOYSTICK_RIGHT_PB_GPIO_PORT "GPIOE"
#define JOYSTICK_RIGHT_PB_GPIO_PIN 3
/* Joystick Left push button */
#define JOYSTICK_LEFT_PB_GPIO_PORT "GPIOF"
#define JOYSTICK_LEFT_PB_GPIO_PIN 2
/* Joystick UP push button */
#define JOYSTICK_UP_PB_GPIO_PORT "GPIOF"
#define JOYSTICK_UP_PB_GPIO_PIN 9
/* Joystick Down push button */
#define JOYSTICK_DOWN_PB_GPIO_PORT "GPIOF"
#define JOYSTICK_DOWN_PB_GPIO_PIN 10
/* Joystick Sel push button */
#define JOYSTICK_SEL_PB_GPIO_PORT "GPIOA"
#define JOYSTICK_SEL_PB_GPIO_PIN 0
/* LD1 green LED */
#define LD1_GPIO_PORT "GPIOD"
#define LD1_GPIO_PIN 8
/* LD2 orange LED */
#define LD2_GPIO_PORT "GPIOD"
#define LD2_GPIO_PIN 9
/* LD3 red LED */
#define LD3_GPIO_PORT "GPIOD"
#define LD3_GPIO_PIN 10
/* LD4 blue LED */
#define LD4_GPIO_PORT "GPIOD"
#define LD4_GPIO_PIN 11
/* Create aliases to make the basic samples work */
#define SW0_GPIO_NAME TAMPER_PB_GPIO_PORT
#define SW0_GPIO_PIN TAMPER_PB_GPIO_PIN
#define LED0_GPIO_PORT LD1_GPIO_PORT
#define LED0_GPIO_PIN LD1_GPIO_PIN
#define LED1_GPIO_PORT LD2_GPIO_PORT
#define LED1_GPIO_PIN LD2_GPIO_PIN
#endif /* __INC_BOARD_H */

Binary file not shown.

After

Width:  |  Height:  |  Size: 79 KiB

View file

@ -0,0 +1,195 @@
.. _stm32f072_eval_board:
ST STM32F072-EVAL
###################
Overview
********
The STM32F072-EVAL Discovery kit features an ARM Cortex-M0 based STM32F072VBT6 MCU
with a wide range of connectivity support and configurations.
Here are some highlights of the STM32F072-EVAL board:
- Four 5 V power supply options: power jack, ST-LINK/V2 USB connector, user USB connector, or daughter board
- Stereo audio jack, which supports a headset with microphone connected to DAC and ADC of STM32F072VBT6.
- 2G Byte (or more) SPI interface MicroSD card
- I2C compatible serial interface temperature sensor
- RF E2PROM
- RS232 and RS485 communication
- IrDA transceiver
- IR LED and IR receiver
- SWD debug support, ST-LINK/V2 embedded
- 240x320 TFT color LCD connected to SPI interface of STM32F072VBT6
- Joystick with 4-direction control and selector
- Reset and tamper buttons
- Four color user LEDs and two LEDs as MCU low power alarm
- Extension connector for daughter board or wrapping board
- MCU voltage choice: fixed 3.3 V or adjustable from 1.65 V to 3.6 V
- USB full-speed connector
- Touch sensing buttons
- RTC with backup battery
- CAN2.0A/B compliant connector
- Light Dependent Resistor (LDR)
- Potentiometer
- Two HDMI connectors with DDC and CEC
- Smart Card slot
- Motor control connector
.. image:: img/stm32f072_eval.jpg
:width: 540px
:align: center
:height: 549px
:alt: STM32F072-EVAL
More information about the board can be found at the `STM32F072-EVAL website`_.
Hardware
********
STM32F072-EVAL Discovery kit provides the following hardware components:
- STM32F072VBT6 in LQFP100 package
- ARM |reg| 32-bit Cortex |reg| -M0 CPU
- 48 MHz max CPU frequency
- VDD from 2.0 V to 3.6 V
- 128 KB Flash
- 16 KB SRAM with HW parity
- GPIO with external interrupt capability
- one 12-bit ADC with 16 channels
- one 12-bit D/A converters with 2 channels
- RTC
- Advanced-control Timer
- General Purpose Timers (8)
- Watchdog Timers (2)
- USART (4)
- I2C (2)
- SPI (2)
- CAN
- USB 2.0 OTG FS with on-chip PHY
- CRC calculation unit
- DMA Controller
- HDMI CEC Controller
- 24 capacitive sensing channels for touchkey, linear, and rotary touch sensors
- Up to 87 fast I/Os: 68 I/Os with 5V tolerant capability and 19 with independent supply
More information about STM32F072VB can be found here:
- `STM32F072VB on www.st.com`_
- `STM32F072 reference manual`_
Supported Features
==================
The Zephyr stm32f072_eval 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 |
+-----------+------------+-------------------------------------+
| PWM | on-chip | pwm |
+-----------+------------+-------------------------------------+
| CLOCK | on-chip | reset and clock control |
+-----------+------------+-------------------------------------+
| IWDG | on-chip | independent watchdog |
+-----------+------------+-------------------------------------+
Other hardware features are not yet supported on this Zephyr porting.
The default configuration can be found in the defconfig file:
``boards/arm/stm32f072_eval/stm32f072_eval_defconfig``
Pin Mapping
===========
STM32F072-EVAL Discovery kit has 6 GPIO controllers. These controllers are responsible for pin muxing,
input/output, pull-up, etc.
For mode details please refer to `STM32F072-EVAL board User Manual`_.
Default Zephyr Peripheral Mapping:
----------------------------------
- UART_2_TX : PD5
- UART_2_RX : PD6
- TAMPER_PB : PC13
- JOYSTICK_RIGHT_PB : PE3
- JOYSTICK_LEFT_PB : PF2
- JOYSTICK_UP_PB : PF9
- JOYSTICK_DOWN_PB : PF10
- JOYSTICK_SEL_PB : PA0
- LD1 : PD8
- LD2 : PD9
- LD3 : PD10
- LD4 : PD11
System Clock
============
STM32F072-EVAL System Clock could be driven by an internal or external oscillator,
as well as the main PLL clock. By default the System clock is driven by the PLL clock at 48MHz,
driven by an 8MHz high speed internal clock.
Serial Port
===========
STM32F072-EVAL Discovery kit has up to 4 UARTs. The Zephyr console output is assigned to UART2.
Default settings are 115200 8N1.
Programming and Debugging
*************************
Applications for the ``stm32f072_eval`` board configuration can be built and
flashed in the usual way (see :ref:`build_an_application` and
:ref:`application_run` for more details).
Flashing
========
STM32F072-EVAL Discovery kit includes an ST-LINK/V2 embedded debug tool interface.
This interface is supported by the openocd version included in Zephyr SDK.
Flashing an application to STM32F072-EVAL
-------------------------------------------
Here is an example for the :ref:`blinky-sample` application.
.. zephyr-app-commands::
:zephyr-app: samples/basic/blinky
:board: stm32f072_eval
:goals: build flash
You will see the LED blinking every second.
Debugging
=========
You can debug an application in the usual way. Here is an example for the
:ref:`blinky-sample` application.
.. zephyr-app-commands::
:zephyr-app: samples/basic/blinky
:board: stm32f072_eval
:maybe-skip-config:
:goals: debug
.. _STM32F072-EVAL website:
http://www.st.com/en/evaluation-tools/stm32072b-eval.html
.. _STM32F072-EVAL board User Manual:
http://www.st.com/resource/en/user_manual/dm00104135.pdf
.. _STM32F072VB on www.st.com:
http://www.st.com/en/microcontrollers/stm32f072vb.html
.. _STM32F072 reference manual:
http://www.st.com/resource/en/reference_manual/dm00031936.pdf

View file

@ -0,0 +1,14 @@
/* 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_V6M_NVIC_E000E100_ARM_NUM_IRQ_PRIORITY_BITS
#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

View file

@ -0,0 +1,33 @@
/*
* Copyright (c) 2017 BayLibre, SAS
*
* 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 STM32F072-EVAL board */
static const struct pin_config pinconf[] = {
#ifdef CONFIG_UART_STM32_PORT_2
{STM32_PIN_PD5, STM32F0_PINMUX_FUNC_PD5_USART2_TX},
{STM32_PIN_PD6, STM32F0_PINMUX_FUNC_PD6_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

@ -0,0 +1,26 @@
/*
* Copyright (c) 2017 BayLibre, SAS
*
* SPDX-License-Identifier: Apache-2.0
*/
/dts-v1/;
#include <st/stm32f072.dtsi>
/ {
model = "STMicroelectronics STM32F072-EVAL board";
compatible = "st,stm32f072-eval", "st,stm32f072";
chosen {
zephyr,console = &usart2;
zephyr,sram = &sram0;
zephyr,flash = &flash0;
};
};
&usart2 {
current-speed = <115200>;
pinctrl-0 = <&usart2_pins_d>;
pinctrl-names = "default";
status = "ok";
};

View file

@ -0,0 +1,12 @@
identifier: stm32f072_eval
name: STM32F072-EVAL
type: mcu
arch: arm
toolchain:
- zephyr
- gccarmemb
ram: 16
flash: 128
testing:
ignore_tags:
- net

View file

@ -0,0 +1,39 @@
# Zephyr Kernel Configuration
CONFIG_ARM=y
CONFIG_SOC_SERIES_STM32F0X=y
# Platform Configuration
CONFIG_SOC_FAMILY_STM32=y
CONFIG_SOC_STM32F072XB=y
CONFIG_BOARD_STM32F072_EVAL=y
# General Kernel Options
CONFIG_CORTEX_M_SYSTICK=y
CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC=48000000
# Serial Drivers
CONFIG_SERIAL=y
CONFIG_UART_INTERRUPT_DRIVEN=y
# enable console
CONFIG_CONSOLE=y
CONFIG_UART_CONSOLE=y
# Pinmux Driver
CONFIG_PINMUX=y
# GPIO Controller
CONFIG_GPIO=y
# Clock configuration
CONFIG_CLOCK_CONTROL=y
# SYSCLK selection
CONFIG_CLOCK_STM32_SYSCLK_SRC_PLL=y
# HSE configuration
CONFIG_CLOCK_STM32_HSE_CLOCK=8000000
# PLL configuration
CONFIG_CLOCK_STM32_PLL_SRC_HSE=y
# produce 48MHz clock at PLL output
CONFIG_CLOCK_STM32_PLL_PREDIV1=1
CONFIG_CLOCK_STM32_PLL_MULTIPLIER=6
CONFIG_CLOCK_STM32_AHB_PRESCALER=1
CONFIG_CLOCK_STM32_APB1_PRESCALER=1

View file

@ -0,0 +1,12 @@
source [find board/stm32f0discovery.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

@ -31,6 +31,11 @@
#define STM32F0_PINMUX_FUNC_PA15_USART2_RX \
(STM32_PINMUX_ALT_FUNC_1 | STM32_PUPDR_NO_PULL)
#define STM32F0_PINMUX_FUNC_PD5_USART2_TX \
(STM32_PINMUX_ALT_FUNC_0 | STM32_PUSHPULL_NOPULL)
#define STM32F0_PINMUX_FUNC_PD6_USART2_RX \
(STM32_PINMUX_ALT_FUNC_0 | STM32_PUPDR_NO_PULL)
#define STM32F0_PINMUX_FUNC_PB8_I2C1_SCL \
(STM32_PINMUX_ALT_FUNC_1 | STM32_OPENDRAIN_PULLUP)
#define STM32F0_PINMUX_FUNC_PB9_I2C1_SDA \

View file

@ -33,6 +33,12 @@
tx = <STM32_PIN_PA14 (STM32_PINMUX_ALT_FUNC_1 | STM32_PUSHPULL_NOPULL)>;
};
};
usart2_pins_d: usart2@2 {
rx_tx {
rx = <STM32_PIN_PD6 (STM32_PINMUX_ALT_FUNC_0 | STM32_PUPDR_NO_PULL)>;
tx = <STM32_PIN_PD5 (STM32_PINMUX_ALT_FUNC_0 | STM32_PUSHPULL_NOPULL)>;
};
};
};
};
};