-
Notifications
You must be signed in to change notification settings - Fork 7.4k
Add support for the STM32F072-EVAL Board #5171
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
galak
merged 3 commits into
zephyrproject-rtos:master
from
superna9999:for-pr/stm32f072_eval
Jan 25, 2018
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
22 changes: 22 additions & 0 deletions
22
arch/arm/soc/st_stm32/stm32f0/Kconfig.defconfig.stm32f072xb
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# Kconfig - ST Microelectronics STM32F072XB MCU | ||
# | ||
# Copyright (c) 2017 BayLibre, SAS | ||
# | ||
# SPDX-License-Identifier: Apache-2.0 | ||
# | ||
|
||
if SOC_STM32F072XB | ||
|
||
config SOC | ||
string | ||
default stm32f072xb | ||
|
||
config FLASH_PAGE_SIZE | ||
hex | ||
default 0x800 | ||
|
||
config NUM_IRQS | ||
int | ||
default 32 | ||
|
||
endif # SOC_STM32F072XB |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
zephyr_library() | ||
zephyr_library_sources(pinmux.c) | ||
zephyr_library_include_directories(${PROJECT_SOURCE_DIR}/drivers) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
include(${ZEPHYR_BASE}/boards/common/openocd.board.cmake) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 */ |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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); |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I haven't looked at the F0 flash driver yet, but if this value isn't coming from DT, why not just use FLASH_PAGE_SIZE as defined in drivers/include/stm32f0xx_hal_flash_ex.h?