Skip to content

Commit e8100c3

Browse files
committed
boards: arm: Add stm32f072-eval board support
Add the STM32F072-EVAL Board minimal support. Signed-off-by: Neil Armstrong <[email protected]>
1 parent c7e621b commit e8100c3

15 files changed

+436
-0
lines changed
+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
zephyr_library()
2+
zephyr_library_sources(pinmux.c)
3+
zephyr_library_include_directories(${PROJECT_SOURCE_DIR}/drivers)
+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# Kconfig - STM32F072-EVAL board configuration
2+
#
3+
# Copyright (c) 2017 BayLibre, SAS
4+
#
5+
# SPDX-License-Identifier: Apache-2.0
6+
#
7+
8+
config BOARD_STM32F072_EVAL
9+
bool "STM32F072-EVAL Development Board"
10+
depends on SOC_STM32F072XB
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Kconfig - STM32F072-EVAL board configuration
2+
#
3+
# Copyright (c) 2017 BayLibre, SAS
4+
#
5+
# SPDX-License-Identifier: Apache-2.0
6+
#
7+
8+
if BOARD_STM32F072_EVAL
9+
10+
config BOARD
11+
default stm32f072_eval
12+
13+
if UART_CONSOLE
14+
15+
config UART_STM32_PORT_2
16+
default y
17+
18+
endif # UART_CONSOLE
19+
20+
endif # BOARD_STM32F072_EVAL

boards/arm/stm32f072_eval/board.cmake

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

boards/arm/stm32f072_eval/board.h

+60
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
/*
2+
* Copyright (c) 2017 BayLibre, SAS
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
7+
#ifndef __INC_BOARD_H
8+
#define __INC_BOARD_H
9+
10+
#include <soc.h>
11+
12+
/* TAMPER push button */
13+
#define TAMPER_PB_GPIO_PORT "GPIOC"
14+
#define TAMPER_PB_GPIO_PIN 13
15+
16+
/* Joystick Right push button */
17+
#define JOYSTICK_RIGHT_PB_GPIO_PORT "GPIOE"
18+
#define JOYSTICK_RIGHT_PB_GPIO_PIN 3
19+
20+
/* Joystick Left push button */
21+
#define JOYSTICK_LEFT_PB_GPIO_PORT "GPIOF"
22+
#define JOYSTICK_LEFT_PB_GPIO_PIN 2
23+
24+
/* Joystick UP push button */
25+
#define JOYSTICK_UP_PB_GPIO_PORT "GPIOF"
26+
#define JOYSTICK_UP_PB_GPIO_PIN 9
27+
28+
/* Joystick Down push button */
29+
#define JOYSTICK_DOWN_PB_GPIO_PORT "GPIOF"
30+
#define JOYSTICK_DOWN_PB_GPIO_PIN 10
31+
32+
/* Joystick Sel push button */
33+
#define JOYSTICK_SEL_PB_GPIO_PORT "GPIOA"
34+
#define JOYSTICK_SEL_PB_GPIO_PIN 0
35+
36+
/* LD1 green LED */
37+
#define LD1_GPIO_PORT "GPIOD"
38+
#define LD1_GPIO_PIN 8
39+
40+
/* LD2 orange LED */
41+
#define LD2_GPIO_PORT "GPIOD"
42+
#define LD2_GPIO_PIN 9
43+
44+
/* LD3 red LED */
45+
#define LD3_GPIO_PORT "GPIOD"
46+
#define LD3_GPIO_PIN 10
47+
48+
/* LD4 blue LED */
49+
#define LD4_GPIO_PORT "GPIOD"
50+
#define LD4_GPIO_PIN 11
51+
52+
/* Create aliases to make the basic samples work */
53+
#define SW0_GPIO_NAME TAMPER_PB_GPIO_PORT
54+
#define SW0_GPIO_PIN TAMPER_PB_GPIO_PIN
55+
#define LED0_GPIO_PORT LD1_GPIO_PORT
56+
#define LED0_GPIO_PIN LD1_GPIO_PIN
57+
#define LED1_GPIO_PORT LD2_GPIO_PORT
58+
#define LED1_GPIO_PIN LD2_GPIO_PIN
59+
60+
#endif /* __INC_BOARD_H */
Loading
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,195 @@
1+
.. _stm32f072_eval_board:
2+
3+
ST STM32F072-EVAL
4+
###################
5+
6+
Overview
7+
********
8+
9+
The STM32F072-EVAL Discovery kit features an ARM Cortex-M0 based STM32F072VBT6 MCU
10+
with a wide range of connectivity support and configurations.
11+
Here are some highlights of the STM32F072-EVAL board:
12+
13+
- Four 5 V power supply options: power jack, ST-LINK/V2 USB connector, user USB connector, or daughter board
14+
- Stereo audio jack, which supports a headset with microphone connected to DAC and ADC of STM32F072VBT6.
15+
- 2G Byte (or more) SPI interface MicroSD card
16+
- I2C compatible serial interface temperature sensor
17+
- RF E2PROM
18+
- RS232 and RS485 communication
19+
- IrDA transceiver
20+
- IR LED and IR receiver
21+
- SWD debug support, ST-LINK/V2 embedded
22+
- 240x320 TFT color LCD connected to SPI interface of STM32F072VBT6
23+
- Joystick with 4-direction control and selector
24+
- Reset and tamper buttons
25+
- Four color user LEDs and two LEDs as MCU low power alarm
26+
- Extension connector for daughter board or wrapping board
27+
- MCU voltage choice: fixed 3.3 V or adjustable from 1.65 V to 3.6 V
28+
- USB full-speed connector
29+
- Touch sensing buttons
30+
- RTC with backup battery
31+
- CAN2.0A/B compliant connector
32+
- Light Dependent Resistor (LDR)
33+
- Potentiometer
34+
- Two HDMI connectors with DDC and CEC
35+
- Smart Card slot
36+
- Motor control connector
37+
38+
39+
.. image:: img/stm32f072_eval.jpg
40+
:width: 540px
41+
:align: center
42+
:height: 549px
43+
:alt: STM32F072-EVAL
44+
45+
More information about the board can be found at the `STM32F072-EVAL website`_.
46+
47+
Hardware
48+
********
49+
50+
STM32F072-EVAL Discovery kit provides the following hardware components:
51+
52+
- STM32F072VBT6 in LQFP100 package
53+
- ARM |reg| 32-bit Cortex |reg| -M0 CPU
54+
- 48 MHz max CPU frequency
55+
- VDD from 2.0 V to 3.6 V
56+
- 128 KB Flash
57+
- 16 KB SRAM with HW parity
58+
- GPIO with external interrupt capability
59+
- one 12-bit ADC with 16 channels
60+
- one 12-bit D/A converters with 2 channels
61+
- RTC
62+
- Advanced-control Timer
63+
- General Purpose Timers (8)
64+
- Watchdog Timers (2)
65+
- USART (4)
66+
- I2C (2)
67+
- SPI (2)
68+
- CAN
69+
- USB 2.0 OTG FS with on-chip PHY
70+
- CRC calculation unit
71+
- DMA Controller
72+
- HDMI CEC Controller
73+
- 24 capacitive sensing channels for touchkey, linear, and rotary touch sensors
74+
- Up to 87 fast I/Os: 68 I/Os with 5V tolerant capability and 19 with independent supply
75+
76+
More information about STM32F072VB can be found here:
77+
- `STM32F072VB on www.st.com`_
78+
- `STM32F072 reference manual`_
79+
80+
Supported Features
81+
==================
82+
83+
The Zephyr stm32f072_eval board configuration supports the following hardware features:
84+
85+
+-----------+------------+-------------------------------------+
86+
| Interface | Controller | Driver/Component |
87+
+===========+============+=====================================+
88+
| NVIC | on-chip | nested vector interrupt controller |
89+
+-----------+------------+-------------------------------------+
90+
| UART | on-chip | serial port-polling; |
91+
| | | serial port-interrupt |
92+
+-----------+------------+-------------------------------------+
93+
| PINMUX | on-chip | pinmux |
94+
+-----------+------------+-------------------------------------+
95+
| GPIO | on-chip | gpio |
96+
+-----------+------------+-------------------------------------+
97+
| PWM | on-chip | pwm |
98+
+-----------+------------+-------------------------------------+
99+
| CLOCK | on-chip | reset and clock control |
100+
+-----------+------------+-------------------------------------+
101+
| IWDG | on-chip | independent watchdog |
102+
+-----------+------------+-------------------------------------+
103+
104+
Other hardware features are not yet supported on this Zephyr porting.
105+
106+
The default configuration can be found in the defconfig file:
107+
108+
``boards/arm/stm32f072_eval/stm32f072_eval_defconfig``
109+
110+
111+
Pin Mapping
112+
===========
113+
114+
STM32F072-EVAL Discovery kit has 6 GPIO controllers. These controllers are responsible for pin muxing,
115+
input/output, pull-up, etc.
116+
117+
For mode details please refer to `STM32F072-EVAL board User Manual`_.
118+
119+
Default Zephyr Peripheral Mapping:
120+
----------------------------------
121+
- UART_2_TX : PD5
122+
- UART_2_RX : PD6
123+
- TAMPER_PB : PC13
124+
- JOYSTICK_RIGHT_PB : PE3
125+
- JOYSTICK_LEFT_PB : PF2
126+
- JOYSTICK_UP_PB : PF9
127+
- JOYSTICK_DOWN_PB : PF10
128+
- JOYSTICK_SEL_PB : PA0
129+
- LD1 : PD8
130+
- LD2 : PD9
131+
- LD3 : PD10
132+
- LD4 : PD11
133+
134+
System Clock
135+
============
136+
137+
STM32F072-EVAL System Clock could be driven by an internal or external oscillator,
138+
as well as the main PLL clock. By default the System clock is driven by the PLL clock at 48MHz,
139+
driven by an 8MHz high speed internal clock.
140+
141+
Serial Port
142+
===========
143+
144+
STM32F072-EVAL Discovery kit has up to 4 UARTs. The Zephyr console output is assigned to UART2.
145+
Default settings are 115200 8N1.
146+
147+
Programming and Debugging
148+
*************************
149+
150+
Applications for the ``stm32f072_eval`` board configuration can be built and
151+
flashed in the usual way (see :ref:`build_an_application` and
152+
:ref:`application_run` for more details).
153+
154+
Flashing
155+
========
156+
157+
STM32F072-EVAL Discovery kit includes an ST-LINK/V2 embedded debug tool interface.
158+
This interface is supported by the openocd version included in Zephyr SDK.
159+
160+
Flashing an application to STM32F072-EVAL
161+
-------------------------------------------
162+
163+
Here is an example for the :ref:`blinky-sample` application.
164+
165+
.. zephyr-app-commands::
166+
:zephyr-app: samples/basic/blinky
167+
:board: stm32f072_eval
168+
:goals: build flash
169+
170+
You will see the LED blinking every second.
171+
172+
Debugging
173+
=========
174+
175+
You can debug an application in the usual way. Here is an example for the
176+
:ref:`blinky-sample` application.
177+
178+
.. zephyr-app-commands::
179+
:zephyr-app: samples/basic/blinky
180+
:board: stm32f072_eval
181+
:maybe-skip-config:
182+
:goals: debug
183+
184+
185+
.. _STM32F072-EVAL website:
186+
http://www.st.com/en/evaluation-tools/stm32072b-eval.html
187+
188+
.. _STM32F072-EVAL board User Manual:
189+
http://www.st.com/resource/en/user_manual/dm00104135.pdf
190+
191+
.. _STM32F072VB on www.st.com:
192+
http://www.st.com/en/microcontrollers/stm32f072vb.html
193+
194+
.. _STM32F072 reference manual:
195+
http://www.st.com/resource/en/reference_manual/dm00031936.pdf

boards/arm/stm32f072_eval/dts.fixup

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
/* This file is a temporary workaround for mapping of the generated information
2+
* to the current driver definitions. This will be removed when the drivers
3+
* are modified to handle the generated information, or the mapping of
4+
* generated data matches the driver definitions.
5+
*/
6+
7+
8+
#define CONFIG_NUM_IRQ_PRIO_BITS ARM_V6M_NVIC_E000E100_ARM_NUM_IRQ_PRIORITY_BITS
9+
10+
#define CONFIG_UART_STM32_PORT_2_BASE_ADDRESS ST_STM32_USART_40004400_BASE_ADDRESS
11+
#define CONFIG_UART_STM32_PORT_2_BAUD_RATE ST_STM32_USART_40004400_CURRENT_SPEED
12+
#define CONFIG_UART_STM32_PORT_2_IRQ_PRI ST_STM32_USART_40004400_IRQ_0_PRIORITY
13+
#define CONFIG_UART_STM32_PORT_2_NAME ST_STM32_USART_40004400_LABEL
14+
#define PORT_2_IRQ ST_STM32_USART_40004400_IRQ_0

boards/arm/stm32f072_eval/pinmux.c

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
/*
2+
* Copyright (c) 2017 BayLibre, SAS
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
7+
#include <kernel.h>
8+
#include <device.h>
9+
#include <init.h>
10+
#include <pinmux.h>
11+
#include <sys_io.h>
12+
13+
#include "pinmux/stm32/pinmux_stm32.h"
14+
15+
/* pin assignments for STM32F072-EVAL board */
16+
static const struct pin_config pinconf[] = {
17+
#ifdef CONFIG_UART_STM32_PORT_2
18+
{STM32_PIN_PD5, STM32F0_PINMUX_FUNC_PD5_USART2_TX},
19+
{STM32_PIN_PD6, STM32F0_PINMUX_FUNC_PD6_USART2_RX},
20+
#endif /* CONFIG_UART_STM32_PORT_2 */
21+
};
22+
23+
static int pinmux_stm32_init(struct device *port)
24+
{
25+
ARG_UNUSED(port);
26+
27+
stm32_setup_pins(pinconf, ARRAY_SIZE(pinconf));
28+
29+
return 0;
30+
}
31+
32+
SYS_INIT(pinmux_stm32_init, PRE_KERNEL_1,
33+
CONFIG_PINMUX_STM32_DEVICE_INITIALIZATION_PRIORITY);
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
/*
2+
* Copyright (c) 2017 BayLibre, SAS
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
7+
/dts-v1/;
8+
#include <st/stm32f072.dtsi>
9+
10+
/ {
11+
model = "STMicroelectronics STM32F072-EVAL board";
12+
compatible = "st,stm32f072-eval", "st,stm32f072";
13+
14+
chosen {
15+
zephyr,console = &usart2;
16+
zephyr,sram = &sram0;
17+
zephyr,flash = &flash0;
18+
};
19+
};
20+
21+
&usart2 {
22+
current-speed = <115200>;
23+
pinctrl-0 = <&usart2_pins_d>;
24+
pinctrl-names = "default";
25+
status = "ok";
26+
};
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
identifier: stm32f072_eval
2+
name: STM32F072-EVAL
3+
type: mcu
4+
arch: arm
5+
toolchain:
6+
- zephyr
7+
- gccarmemb
8+
ram: 16
9+
flash: 128
10+
testing:
11+
ignore_tags:
12+
- net

0 commit comments

Comments
 (0)