Skip to content

Commit f3cf86e

Browse files
benjaminbjornssonMaureenHelm
authored andcommitted
boards: arm: arduino_portenta_h7: Add support for Arduino Portenta H7
This commit adds support for the Arduino Portenta H7 board. The board functionallity has been verified by running following samples: - hello_world on m7 core - usb/console on m7 core - blinky on m4 core Signed-off-by: Benjamin Björnsson <[email protected]>
1 parent 3435659 commit f3cf86e

14 files changed

+552
-0
lines changed
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# Copyright (c) 2022 Benjamin Björnsson <[email protected]>.
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
if(CONFIG_BOARD_ARDUINO_PORTENTA_H7_M7)
5+
6+
zephyr_library()
7+
zephyr_library_sources(board.c)
8+
9+
endif()
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# Arduino Portenta H7 board configuration
2+
3+
# Copyright (c) 2022 Benjamin Björnsson <[email protected]>.
4+
# SPDX-License-Identifier: Apache-2.0
5+
6+
config BOARD_ARDUINO_PORTENTA_H7_M7
7+
bool "Arduino Portenta H7 Board"
8+
depends on SOC_STM32H747XX
9+
select CPU_CORTEX_M7
10+
11+
config BOARD_ARDUINO_PORTENTA_H7_M4
12+
bool "Arduino Portenta H7 Board"
13+
depends on SOC_STM32H747XX
14+
select CPU_CORTEX_M4
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# Arduino Portenta H7 board configuration
2+
3+
# Copyright (c) 2022 Benjamin Björnsson <[email protected]>.
4+
# SPDX-License-Identifier: Apache-2.0
5+
6+
if BOARD_ARDUINO_PORTENTA_H7_M7 || BOARD_ARDUINO_PORTENTA_H7_M4
7+
8+
config BOARD
9+
default "arduino_portenta_h7_m7" if BOARD_ARDUINO_PORTENTA_H7_M7
10+
default "arduino_portenta_h7_m4" if BOARD_ARDUINO_PORTENTA_H7_M4
11+
12+
config STM32H7_DUAL_CORE
13+
default y
14+
15+
endif # BOARD_ARDUINO_PORTENTA_H7_M7 || BOARD_ARDUINO_PORTENTA_H7_M4
Lines changed: 113 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
1+
/*
2+
* Copyright (c) 2022 Benjamin Björnsson <[email protected]>.
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
7+
/ {
8+
leds {
9+
compatible = "gpio-leds";
10+
red_led: led_0 {
11+
gpios = <&gpiok 5 GPIO_ACTIVE_LOW>;
12+
};
13+
green_led: led_1 {
14+
gpios = <&gpiok 6 GPIO_ACTIVE_LOW>;
15+
};
16+
blue_led: led_2 {
17+
gpios = <&gpiok 7 GPIO_ACTIVE_LOW>;
18+
};
19+
};
20+
21+
aliases {
22+
led0 = &red_led;
23+
led1 = &green_led;
24+
led2 = &blue_led;
25+
};
26+
};
27+
28+
&rcc {
29+
d1cpre = <1>;
30+
hpre = <1>;
31+
d1ppre = <1>;
32+
d2ppre1 = <1>;
33+
d2ppre2 = <2>;
34+
d3ppre = <1>;
35+
};
36+
37+
/* UART0 in datasheet */
38+
&uart4 {
39+
pinctrl-0 = <&uart4_tx_pa0 &uart4_rx_pi9>;
40+
pinctrl-names = "default";
41+
current-speed = <115200>;
42+
};
43+
44+
/* UART1 in datasheet */
45+
&usart1 {
46+
pinctrl-0 = <&usart1_tx_pa9 &usart1_rx_pa10>;
47+
pinctrl-names = "default";
48+
current-speed = <115200>;
49+
};
50+
51+
/* UART2 in datasheet */
52+
&usart6 {
53+
pinctrl-0 = <&usart6_tx_pg14 &usart6_rx_pg9>;
54+
pinctrl-names = "default";
55+
current-speed = <115200>;
56+
};
57+
58+
/* UART3 in datasheet */
59+
&uart8 {
60+
pinctrl-0 = <&uart8_tx_pj8 &uart8_rx_pj9>;
61+
pinctrl-names = "default";
62+
current-speed = <115200>;
63+
};
64+
65+
/* I2C0 in datasheet */
66+
&i2c3 {
67+
pinctrl-0 = <&i2c3_scl_ph7 &i2c3_sda_ph8>;
68+
pinctrl-names = "default";
69+
clock-frequency = <I2C_BITRATE_FAST>;
70+
};
71+
72+
/* I2C1 in datasheet */
73+
&i2c1 {
74+
pinctrl-0 = <&i2c1_scl_pb6 &i2c1_sda_pb7>;
75+
pinctrl-names = "default";
76+
clock-frequency = <I2C_BITRATE_FAST>;
77+
};
78+
79+
/* I2C2 in datasheet */
80+
&i2c4 {
81+
pinctrl-0 = <&i2c4_scl_ph11 &i2c4_sda_ph12>;
82+
pinctrl-names = "default";
83+
clock-frequency = <I2C_BITRATE_FAST>;
84+
};
85+
86+
/* I2C3 in datasheet */
87+
&i2c3 {
88+
pinctrl-0 = <&i2c3_scl_ph7 &i2c3_sda_ph8>;
89+
pinctrl-names = "default";
90+
clock-frequency = <I2C_BITRATE_FAST>;
91+
};
92+
93+
/* SPI1 in datasheet */
94+
&spi2 {
95+
pinctrl-0 = <&spi2_nss_pi0 &spi2_sck_pi1
96+
&spi2_miso_pc2 &spi2_mosi_pc3>;
97+
pinctrl-names = "default";
98+
};
99+
100+
&can1 {
101+
pinctrl-0 = <&fdcan1_rx_pb8 &fdcan1_tx_ph13>;
102+
pinctrl-names = "default";
103+
};
104+
105+
&rtc {
106+
status = "okay";
107+
};
108+
109+
zephyr_udc0: &usbotg_fs {
110+
pinctrl-0 = <&usb_otg_fs_dm_pa11 &usb_otg_fs_dp_pa12>;
111+
pinctrl-names = "default";
112+
status = "disabled";
113+
};
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
/*
2+
* Copyright (c) 2022 Benjamin Björnsson <[email protected]>.
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
7+
/dts-v1/;
8+
#include <st/h7/stm32h747Xi_m4.dtsi>
9+
#include <st/h7/stm32h747xihx-pinctrl.dtsi>
10+
#include "arduino_portenta_h7-common.dtsi"
11+
12+
/ {
13+
model = "Arduino Portenta H7 board";
14+
compatible = "arduino,portenta-h7";
15+
16+
/* HW resources are split between CM7 and CM4 */
17+
18+
chosen {
19+
zephyr,console = &usart1;
20+
zephyr,shell-uart = &usart1;
21+
zephyr,sram = &sram1;
22+
zephyr,flash = &flash1;
23+
};
24+
};
25+
26+
&rcc {
27+
clock-frequency = <DT_FREQ_M(96)>;
28+
};
29+
30+
&usart1 {
31+
status = "disabled";
32+
};
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
identifier: arduino_portenta_h7_m4
2+
name: Arduino Portenta H7
3+
type: mcu
4+
arch: arm
5+
toolchain:
6+
- zephyr
7+
- gnuarmemb
8+
- xtools
9+
ram: 288
10+
flash: 1024
11+
supported:
12+
- gpio
13+
testing:
14+
ignore_tags:
15+
- mpu
16+
- nfc
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# Copyright (c) 2022 Benjamin Björnsson <[email protected]>.
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
CONFIG_SOC_SERIES_STM32H7X=y
5+
CONFIG_SOC_STM32H747XX=y
6+
7+
# Board config should be specified since there are 2 possible targets
8+
CONFIG_BOARD_ARDUINO_PORTENTA_H7_M4=y
9+
10+
# Enable GPIO
11+
CONFIG_GPIO=y
12+
13+
# Clock configuration
14+
CONFIG_CLOCK_CONTROL=y
15+
16+
# Enable MPU
17+
CONFIG_ARM_MPU=y
18+
19+
# Enable HW stack protection
20+
CONFIG_HW_STACK_PROTECTION=y
21+
22+
# Enable pin controller
23+
CONFIG_PINCTRL=y
24+
25+
# Enable uart driver
26+
# CONFIG_SERIAL=y
27+
28+
# By default CONSOLE is assigned to m7
29+
# CONFIG_CONSOLE=y
30+
# CONFIG_UART_CONSOLE=y
Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
/*
2+
* Copyright (c) 2022 Benjamin Björnsson <[email protected]>.
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
7+
/dts-v1/;
8+
#include <st/h7/stm32h747Xi_m7.dtsi>
9+
#include <st/h7/stm32h747xihx-pinctrl.dtsi>
10+
#include "arduino_portenta_h7-common.dtsi"
11+
12+
/ {
13+
model = "Arduino Portenta H7 board";
14+
compatible = "arduino,portenta-h7";
15+
16+
/* HW resources are split between CM7 and CM4 */
17+
chosen {
18+
zephyr,console = &usart1;
19+
zephyr,shell-uart = &usart1;
20+
zephyr,sram = &sram0;
21+
zephyr,flash = &flash0;
22+
zephyr,code-partition = &code_partition;
23+
};
24+
25+
oscen: oscen {
26+
compatible = "regulator-fixed-sync", "regulator-fixed";
27+
regulator-name = "oscen";
28+
enable-gpios = <&gpioh 1 GPIO_ACTIVE_HIGH>;
29+
regulator-boot-on;
30+
};
31+
};
32+
33+
&clk_hsi {
34+
hsi-div = <8>;
35+
status = "okay";
36+
};
37+
38+
&pll {
39+
div-m = <1>;
40+
mul-n = <24>;
41+
div-p = <2>;
42+
div-q = <4>;
43+
div-r = <2>;
44+
clocks = <&clk_hsi>;
45+
status = "okay";
46+
};
47+
48+
&rcc {
49+
clocks = <&pll>;
50+
clock-frequency = <DT_FREQ_M(96)>;
51+
};
52+
53+
54+
&usart1 {
55+
status = "okay";
56+
};
57+
58+
&i2c1 {
59+
status = "okay";
60+
};
61+
62+
&usbotg_fs {
63+
status = "okay";
64+
};
65+
66+
&flash0 {
67+
partitions {
68+
compatible = "fixed-partitions";
69+
#address-cells = <1>;
70+
#size-cells = <1>;
71+
72+
boot_partition: partition@0 {
73+
label = "bootloader";
74+
reg = <0x0 0x00040000>;
75+
read-only;
76+
};
77+
78+
code_partition: partition@40000 {
79+
label = "code";
80+
reg = <0x40000 0x000c0000>;
81+
read-only;
82+
};
83+
84+
/*
85+
* The flash starting at 0x000f8000 and ending at
86+
* 0x000fffff is reserved for use by the application.
87+
*
88+
* Storage partition will be used by FCB/LittleFS/NVS
89+
* if enabled.
90+
*/
91+
storage_partition: partition@f8000 {
92+
label = "storage";
93+
reg = <0x000f8000 0x00008000>;
94+
};
95+
};
96+
};
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
identifier: arduino_portenta_h7_m7
2+
name: Arduino Portenta H7
3+
type: mcu
4+
arch: arm
5+
toolchain:
6+
- zephyr
7+
- gnuarmemb
8+
- xtools
9+
ram: 512
10+
flash: 1024
11+
supported:
12+
- gpio
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# Copyright (c) 2022 Benjamin Björnsson <[email protected]>.
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
CONFIG_SOC_SERIES_STM32H7X=y
5+
CONFIG_SOC_STM32H747XX=y
6+
7+
# Board config should be specified since there are 2 possible targets
8+
CONFIG_BOARD_ARDUINO_PORTENTA_H7_M7=y
9+
10+
# Enable the internal SMPS regulator
11+
CONFIG_POWER_SUPPLY_DIRECT_SMPS=y
12+
13+
# Enable GPIO
14+
CONFIG_GPIO=y
15+
16+
# Enable clocks
17+
CONFIG_CLOCK_CONTROL=y
18+
19+
# Enable MPU
20+
CONFIG_ARM_MPU=y
21+
22+
# Enable HW stack protection
23+
CONFIG_HW_STACK_PROTECTION=y
24+
25+
# enable pin controller
26+
CONFIG_PINCTRL=y
27+
28+
# Use zephyr,code-partition as flash offset
29+
CONFIG_USE_DT_CODE_PARTITION=y
30+
31+
# Disable following to assign serial ports to m4 core
32+
33+
# Enable uart driver
34+
CONFIG_SERIAL=y
35+
36+
# Enable console
37+
CONFIG_CONSOLE=y
38+
CONFIG_UART_CONSOLE=y
39+
40+
# Enable regulator
41+
CONFIG_REGULATOR=y
42+
CONFIG_REGULATOR_FIXED=y

0 commit comments

Comments
 (0)