Skip to content

Commit 9f6a287

Browse files
FRASTMMaureenHelm
authored andcommitted
boards: arm: Add nucleo for nucleo_g071rb board
This patch adds support for the STM32 nucleo_g071rb board from STMicroelectronics. Signed-off-by: Philippe Retornaz <[email protected]> Signed-off-by: Francois Ramu <[email protected]>
1 parent 26c38a4 commit 9f6a287

File tree

10 files changed

+355
-0
lines changed

10 files changed

+355
-0
lines changed
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# SPDX-License-Identifier: Apache-2.0
2+
3+
if(CONFIG_PINMUX)
4+
zephyr_library()
5+
zephyr_library_sources(pinmux.c)
6+
zephyr_library_include_directories(${ZEPHYR_BASE}/drivers)
7+
endif()
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# Kconfig - STM32 Nucleo-64 development board with STM32G071RB MCU configuration
2+
#
3+
# Copyright (c) 2019 Philippe Retornaz <[email protected]>
4+
# Copyright (c) 2019 STMicroelectronics
5+
#
6+
# SPDX-License-Identifier: Apache-2.0
7+
#
8+
9+
config BOARD_NUCLEO_G071RB
10+
bool "NUCLEO-64 G071RB Development Board"
11+
depends on SOC_STM32G071XX
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Kconfig - STM32 Nucleo-64 development board with STM32G071RB MCU
2+
#
3+
# Copyright (c) 2019 Philippe Retornaz <[email protected]>
4+
# Copyright (c) 2019 STMicroelectronics
5+
#
6+
# SPDX-License-Identifier: Apache-2.0
7+
#
8+
9+
if BOARD_NUCLEO_G071RB
10+
11+
config BOARD
12+
default "nucleo_g071rb"
13+
14+
if UART_CONSOLE
15+
16+
config UART_2
17+
default y
18+
19+
endif # UART_CONSOLE
20+
21+
endif # BOARD_NUCLEO_G071RB
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# SPDX-License-Identifier: Apache-2.0
2+
board_runner_args(pyocd "--target=stm32g071rb")
3+
4+
include(${ZEPHYR_BASE}/boards/common/pyocd.board.cmake)
157 KB
Loading
Lines changed: 179 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,179 @@
1+
.. _nucleo_g071rb_board:
2+
3+
ST Nucleo G071RB
4+
################
5+
6+
Overview
7+
********
8+
The Nucleo G071RB board features an ARM Cortex-M0+ based STM32G071RB MCU
9+
with a wide range of connectivity support and configurations. Here are
10+
some highlights of the Nucleo G071RB board:
11+
12+
- STM32 microcontroller in QFP64 package
13+
- Two types of extension resources:
14+
15+
- Arduino Uno V3 connectivity
16+
- ST morpho extension pin headers for full access to all STM32 I/Os
17+
18+
- On-board ST-LINK/V2-1 debugger/programmer with SWD connector
19+
- Flexible board power supply:
20+
21+
- USB VBUS or external source(3.3V, 5V, 7 - 12V)
22+
- Power management access point
23+
24+
- Three LEDs: USB communication (LD1), user LED (LD4), power LED (LD3)
25+
- Two push-buttons: USER and RESET
26+
27+
.. image:: img/nucleo_g071rb.jpg
28+
:width: 500px
29+
:height: 367px
30+
:align: center
31+
:alt: Nucleo G071RB
32+
33+
More information about the board can be found at the `Nucleo G071RB website`_.
34+
35+
Hardware
36+
********
37+
Nucleo G071RB provides the following hardware components:
38+
39+
- STM32 microcontroller in LQFP64 package
40+
- Two types of extension resources:
41+
42+
- Arduino* Uno V3 connectivity
43+
- ST morpho extension pin headers for full access to all STM32 I/Os
44+
45+
- ARM* mbed*
46+
- On-board ST-LINK/V2-1 debugger/programmer with SWD connector:
47+
48+
- Selection-mode switch to use the kit as a standalone ST-LINK/V2-1
49+
50+
- Flexible board power supply:
51+
52+
- USB VBUS or external source (3.3V, 5V, 7 - 12V)
53+
- Power management access point
54+
55+
- Three LEDs:
56+
57+
- USB communication (LD1), user LED (LD4), power LED (LD3)
58+
59+
- Two push-buttons: USER and RESET
60+
- USB re-enumeration capability. Three different interfaces supported on USB:
61+
62+
- Virtual COM port
63+
- Mass storage
64+
- Debug port
65+
66+
- Support of wide choice of Integrated Development Environments (IDEs) including:
67+
68+
- IAR
69+
- ARM Keil
70+
- GCC-based IDEs
71+
72+
More information about STM32G071RB can be found here:
73+
74+
- `G071RB on www.st.com`_
75+
- `STM32G071 reference manual`_
76+
77+
78+
Supported Features
79+
==================
80+
81+
The Zephyr nucleo_g071rb board configuration supports the following hardware features:
82+
83+
+-----------+------------+-------------------------------------+
84+
| Interface | Controller | Driver/Component |
85+
+===========+============+=====================================+
86+
| NVIC | on-chip | nested vector interrupt controller |
87+
+-----------+------------+-------------------------------------+
88+
| UART | on-chip | serial port-polling; |
89+
| | | serial port-interrupt |
90+
+-----------+------------+-------------------------------------+
91+
| PINMUX | on-chip | pinmux |
92+
+-----------+------------+-------------------------------------+
93+
| GPIO | on-chip | gpio |
94+
+-----------+------------+-------------------------------------+
95+
| CLOCK | on-chip | reset and clock control |
96+
+-----------+------------+-------------------------------------+
97+
98+
Other hardware features are not yet supported in this Zephyr port.
99+
100+
The default configuration can be found in the defconfig file:
101+
``boards/arm/nucleo_g071rb/nucleo_g071rb_defconfig``
102+
103+
Connections and IOs
104+
===================
105+
106+
Each of the GPIO pins can be configured by software as output (push-pull or open-drain), as
107+
input (with or without pull-up or pull-down), or as peripheral alternate function. Most of the
108+
GPIO pins are shared with digital or analog alternate functions. All GPIOs are high current
109+
capable except for analog inputs.
110+
111+
Default Zephyr Peripheral Mapping:
112+
----------------------------------
113+
114+
- UART_1 TX/RX : PC4/PC5
115+
- UART_2 TX/RX : PA2/PA3 (ST-Link Virtual Port Com)
116+
- USER_PB : PC13
117+
- LD4 : PA5
118+
119+
For mode details please refer to `STM32 Nucleo-64 board User Manual`_.
120+
121+
Programming and Debugging
122+
*************************
123+
124+
Applications for the ``nucleo_g071rb`` board configuration can be built and
125+
flashed in the usual way (see :ref:`build_an_application` and
126+
:ref:`application_run` for more details).
127+
128+
Flashing
129+
========
130+
131+
Nucleo G071RB board includes an ST-LINK/V2-1 embedded debug tool interface.
132+
This interface is not yet supported by the openocd version included in the Zephyr SDK.
133+
Instead, support can be enabled on pyocd by adding "pack" support with
134+
the following pyocd command:
135+
136+
.. code-block:: console
137+
138+
$ pyocd pack --install stm32g071rb
139+
140+
Flashing an application to Nucleo G071RB
141+
----------------------------------------
142+
143+
Here is an example for the :ref:`blinky-sample` application.
144+
145+
.. zephyr-app-commands::
146+
:zephyr-app: samples/basic/blinky
147+
:board: nucleo_g071rb
148+
:goals: build flash
149+
150+
You will see the LED blinking every second.
151+
152+
Debugging
153+
=========
154+
155+
You can debug an application in the usual way. Here is an example for the
156+
:ref:`hello_world` application.
157+
158+
.. zephyr-app-commands::
159+
:zephyr-app: samples/hello_world
160+
:board: nucleo_g071rb
161+
:maybe-skip-config:
162+
:goals: debug
163+
164+
References
165+
**********
166+
167+
.. target-notes::
168+
169+
.. _Nucleo G071RB website:
170+
http://www.st.com/en/evaluation-tools/nucleo-g071rb.html
171+
172+
.. _STM32G071 reference manual:
173+
http://www.st.com/resource/en/reference_manual/dm00371828.pdf
174+
175+
.. _STM32 Nucleo-64 board User Manual:
176+
http://www.st.com/resource/en/user_manual/dm00452640.pdf
177+
178+
.. _G071RB on www.st.com:
179+
http://www.st.com/en/microcontrollers/stm32g071rb.html
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
/*
2+
* Copyright (c) 2019 Philippe Retornaz <[email protected]>
3+
* Copyright (c) 2019 STMicroelectronics
4+
*
5+
* SPDX-License-Identifier: Apache-2.0
6+
*/
7+
8+
/dts-v1/;
9+
#include <st/g0/stm32g071Xb.dtsi>
10+
11+
/ {
12+
model = "STMicroelectronics STM32G071RB-NUCLEO board";
13+
compatible = "st,stm32g071rb-nucleo", "st,stm32g071";
14+
15+
chosen {
16+
zephyr,console = &usart2;
17+
zephyr,shell-uart = &usart2;
18+
zephyr,sram = &sram0;
19+
zephyr,flash = &flash0;
20+
};
21+
22+
leds {
23+
compatible = "gpio-leds";
24+
green_led_1: led_4 {
25+
gpios = <&gpioa 5 GPIO_INT_ACTIVE_LOW>;
26+
label = "User LD4";
27+
};
28+
};
29+
30+
gpio_keys {
31+
compatible = "gpio-keys";
32+
user_button: button {
33+
label = "User";
34+
gpios = <&gpioa 0 GPIO_INT_ACTIVE_LOW>;
35+
};
36+
};
37+
38+
aliases {
39+
led0 = &green_led_1;
40+
sw0 = &user_button;
41+
};
42+
};
43+
44+
&usart2 {
45+
current-speed = <115200>;
46+
pinctrl-0 = <&usart2_pins_a>;
47+
pinctrl-names = "default";
48+
status = "ok";
49+
};
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
identifier: nucleo_g071rb
2+
name: NUCLEO-G071RB
3+
type: mcu
4+
arch: arm
5+
toolchain:
6+
- zephyr
7+
- gnuarmemb
8+
- xtools
9+
ram: 36
10+
flash: 128
11+
supported:
12+
- uart
13+
- gpio
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# Zephyr Kernel Configuration
2+
CONFIG_ARM=y
3+
CONFIG_SOC_SERIES_STM32G0X=y
4+
CONFIG_SOC_STM32G071XX=y
5+
CONFIG_CORTEX_M_SYSTICK=y
6+
CONFIG_BOARD_NUCLEO_G071RB=y
7+
8+
# 64MHz system clock
9+
CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC=64000000
10+
11+
# Serial Drivers
12+
CONFIG_SERIAL=y
13+
CONFIG_UART_INTERRUPT_DRIVEN=y
14+
# enable console
15+
CONFIG_CONSOLE=y
16+
CONFIG_UART_CONSOLE=y
17+
18+
# Pinmux Driver
19+
CONFIG_PINMUX=y
20+
21+
# GPIO Controller
22+
CONFIG_GPIO=y
23+
24+
# Clock configuration
25+
CONFIG_CLOCK_CONTROL=y
26+
# SYSCLK selection
27+
CONFIG_CLOCK_STM32_SYSCLK_SRC_PLL=y
28+
# PLL configuration
29+
CONFIG_CLOCK_STM32_PLL_SRC_HSI=y
30+
# produce 64MHz clock at PLL output
31+
CONFIG_CLOCK_STM32_PLL_M_DIVISOR=1
32+
CONFIG_CLOCK_STM32_PLL_N_MULTIPLIER=8
33+
CONFIG_CLOCK_STM32_PLL_P_DIVISOR=2
34+
CONFIG_CLOCK_STM32_PLL_Q_DIVISOR=2
35+
CONFIG_CLOCK_STM32_PLL_R_DIVISOR=2
36+
CONFIG_CLOCK_STM32_AHB_PRESCALER=1
37+
CONFIG_CLOCK_STM32_APB1_PRESCALER=1

boards/arm/nucleo_g071rb/pinmux.c

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
/*
2+
* Copyright (c) 2019 Philippe Retornaz <[email protected]>
3+
* Copyright (c) 2019 STMicroelectronics
4+
*
5+
* SPDX-License-Identifier: Apache-2.0
6+
*/
7+
8+
#include <kernel.h>
9+
#include <device.h>
10+
#include <init.h>
11+
#include <pinmux.h>
12+
#include <sys_io.h>
13+
14+
#include <pinmux/stm32/pinmux_stm32.h>
15+
16+
/* pin assignments for NUCLEO-G071RB board */
17+
static const struct pin_config pinconf[] = {
18+
#ifdef CONFIG_UART_2
19+
{STM32_PIN_PA2, STM32G0_PINMUX_FUNC_PA2_USART2_TX},
20+
{STM32_PIN_PA3, STM32G0_PINMUX_FUNC_PA3_USART2_RX},
21+
#endif /* CONFIG_UART_2 */
22+
};
23+
24+
static int pinmux_stm32_init(struct device *port)
25+
{
26+
ARG_UNUSED(port);
27+
28+
stm32_setup_pins(pinconf, ARRAY_SIZE(pinconf));
29+
30+
return 0;
31+
}
32+
33+
SYS_INIT(pinmux_stm32_init, PRE_KERNEL_1,
34+
CONFIG_PINMUX_STM32_DEVICE_INITIALIZATION_PRIORITY);

0 commit comments

Comments
 (0)