Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions boards/arm/arduino_portenta_h7/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Copyright (c) 2022 Benjamin Björnsson <[email protected]>.
# SPDX-License-Identifier: Apache-2.0

if(CONFIG_BOARD_ARDUINO_PORTENTA_H7_M7)

zephyr_library()
zephyr_library_sources(board.c)

endif()
14 changes: 14 additions & 0 deletions boards/arm/arduino_portenta_h7/Kconfig.board
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Arduino Portenta H7 board configuration

# Copyright (c) 2022 Benjamin Björnsson <[email protected]>.
# SPDX-License-Identifier: Apache-2.0

config BOARD_ARDUINO_PORTENTA_H7_M7
bool "Arduino Portenta H7 Board"
depends on SOC_STM32H747XX
select CPU_CORTEX_M7

config BOARD_ARDUINO_PORTENTA_H7_M4
bool "Arduino Portenta H7 Board"
depends on SOC_STM32H747XX
select CPU_CORTEX_M4
15 changes: 15 additions & 0 deletions boards/arm/arduino_portenta_h7/Kconfig.defconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Arduino Portenta H7 board configuration

# Copyright (c) 2022 Benjamin Björnsson <[email protected]>.
# SPDX-License-Identifier: Apache-2.0

if BOARD_ARDUINO_PORTENTA_H7_M7 || BOARD_ARDUINO_PORTENTA_H7_M4

config BOARD
default "arduino_portenta_h7_m7" if BOARD_ARDUINO_PORTENTA_H7_M7
default "arduino_portenta_h7_m4" if BOARD_ARDUINO_PORTENTA_H7_M4

config STM32H7_DUAL_CORE
default y

endif # BOARD_ARDUINO_PORTENTA_H7_M7 || BOARD_ARDUINO_PORTENTA_H7_M4
113 changes: 113 additions & 0 deletions boards/arm/arduino_portenta_h7/arduino_portenta_h7-common.dtsi
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
/*
* Copyright (c) 2022 Benjamin Björnsson <[email protected]>.
*
* SPDX-License-Identifier: Apache-2.0
*/

/ {
leds {
compatible = "gpio-leds";
red_led: led_0 {
gpios = <&gpiok 5 GPIO_ACTIVE_LOW>;
};
green_led: led_1 {
gpios = <&gpiok 6 GPIO_ACTIVE_LOW>;
};
blue_led: led_2 {
gpios = <&gpiok 7 GPIO_ACTIVE_LOW>;
};
};

aliases {
led0 = &red_led;
led1 = &green_led;
led2 = &blue_led;
};
};

&rcc {
d1cpre = <1>;
hpre = <1>;
d1ppre = <1>;
d2ppre1 = <1>;
d2ppre2 = <2>;
d3ppre = <1>;
};

/* UART0 in datasheet */
&uart4 {
pinctrl-0 = <&uart4_tx_pa0 &uart4_rx_pi9>;
pinctrl-names = "default";
current-speed = <115200>;
};

/* UART1 in datasheet */
&usart1 {
pinctrl-0 = <&usart1_tx_pa9 &usart1_rx_pa10>;
pinctrl-names = "default";
current-speed = <115200>;
};

/* UART2 in datasheet */
&usart6 {
pinctrl-0 = <&usart6_tx_pg14 &usart6_rx_pg9>;
pinctrl-names = "default";
current-speed = <115200>;
};

/* UART3 in datasheet */
&uart8 {
pinctrl-0 = <&uart8_tx_pj8 &uart8_rx_pj9>;
pinctrl-names = "default";
current-speed = <115200>;
};

/* I2C0 in datasheet */
&i2c3 {
pinctrl-0 = <&i2c3_scl_ph7 &i2c3_sda_ph8>;
pinctrl-names = "default";
clock-frequency = <I2C_BITRATE_FAST>;
};

/* I2C1 in datasheet */
&i2c1 {
pinctrl-0 = <&i2c1_scl_pb6 &i2c1_sda_pb7>;
pinctrl-names = "default";
clock-frequency = <I2C_BITRATE_FAST>;
};

/* I2C2 in datasheet */
&i2c4 {
pinctrl-0 = <&i2c4_scl_ph11 &i2c4_sda_ph12>;
pinctrl-names = "default";
clock-frequency = <I2C_BITRATE_FAST>;
};

/* I2C3 in datasheet */
&i2c3 {
pinctrl-0 = <&i2c3_scl_ph7 &i2c3_sda_ph8>;
pinctrl-names = "default";
clock-frequency = <I2C_BITRATE_FAST>;
};

/* SPI1 in datasheet */
&spi2 {
pinctrl-0 = <&spi2_nss_pi0 &spi2_sck_pi1
&spi2_miso_pc2 &spi2_mosi_pc3>;
pinctrl-names = "default";
};

&can1 {
pinctrl-0 = <&fdcan1_rx_pb8 &fdcan1_tx_ph13>;
pinctrl-names = "default";
};

&rtc {
status = "okay";
};

zephyr_udc0: &usbotg_fs {
pinctrl-0 = <&usb_otg_fs_dm_pa11 &usb_otg_fs_dp_pa12>;
pinctrl-names = "default";
status = "disabled";
};
32 changes: 32 additions & 0 deletions boards/arm/arduino_portenta_h7/arduino_portenta_h7_m4.dts
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/*
* Copyright (c) 2022 Benjamin Björnsson <[email protected]>.
*
* SPDX-License-Identifier: Apache-2.0
*/

/dts-v1/;
#include <st/h7/stm32h747Xi_m4.dtsi>
#include <st/h7/stm32h747xihx-pinctrl.dtsi>
#include "arduino_portenta_h7-common.dtsi"

/ {
model = "Arduino Portenta H7 board";
compatible = "arduino,portenta-h7";

/* HW resources are split between CM7 and CM4 */

chosen {
zephyr,console = &usart1;
zephyr,shell-uart = &usart1;
zephyr,sram = &sram1;
zephyr,flash = &flash1;
};
};

&rcc {
clock-frequency = <DT_FREQ_M(96)>;
};

&usart1 {
status = "disabled";
};
16 changes: 16 additions & 0 deletions boards/arm/arduino_portenta_h7/arduino_portenta_h7_m4.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
identifier: arduino_portenta_h7_m4
name: Arduino Portenta H7
type: mcu
arch: arm
toolchain:
- zephyr
- gnuarmemb
- xtools
ram: 288
flash: 1024
supported:
- gpio
testing:
ignore_tags:
- mpu
- nfc
30 changes: 30 additions & 0 deletions boards/arm/arduino_portenta_h7/arduino_portenta_h7_m4_defconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Copyright (c) 2022 Benjamin Björnsson <[email protected]>.
# SPDX-License-Identifier: Apache-2.0

CONFIG_SOC_SERIES_STM32H7X=y
CONFIG_SOC_STM32H747XX=y

# Board config should be specified since there are 2 possible targets
CONFIG_BOARD_ARDUINO_PORTENTA_H7_M4=y

# Enable GPIO
CONFIG_GPIO=y

# Clock configuration
CONFIG_CLOCK_CONTROL=y

# Enable MPU
CONFIG_ARM_MPU=y

# Enable HW stack protection
CONFIG_HW_STACK_PROTECTION=y

# Enable pin controller
CONFIG_PINCTRL=y

# Enable uart driver
# CONFIG_SERIAL=y

# By default CONSOLE is assigned to m7
# CONFIG_CONSOLE=y
# CONFIG_UART_CONSOLE=y
96 changes: 96 additions & 0 deletions boards/arm/arduino_portenta_h7/arduino_portenta_h7_m7.dts
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
/*
* Copyright (c) 2022 Benjamin Björnsson <[email protected]>.
*
* SPDX-License-Identifier: Apache-2.0
*/

/dts-v1/;
#include <st/h7/stm32h747Xi_m7.dtsi>
#include <st/h7/stm32h747xihx-pinctrl.dtsi>
#include "arduino_portenta_h7-common.dtsi"

/ {
model = "Arduino Portenta H7 board";
compatible = "arduino,portenta-h7";

/* HW resources are split between CM7 and CM4 */
chosen {
zephyr,console = &usart1;
zephyr,shell-uart = &usart1;
zephyr,sram = &sram0;
zephyr,flash = &flash0;
zephyr,code-partition = &code_partition;
};

oscen: oscen {
compatible = "regulator-fixed-sync", "regulator-fixed";
regulator-name = "oscen";
enable-gpios = <&gpioh 1 GPIO_ACTIVE_HIGH>;
regulator-boot-on;
};
};

&clk_hsi {
hsi-div = <8>;
status = "okay";
};

&pll {
div-m = <1>;
mul-n = <24>;
div-p = <2>;
div-q = <4>;
div-r = <2>;
clocks = <&clk_hsi>;
status = "okay";
};

&rcc {
clocks = <&pll>;
clock-frequency = <DT_FREQ_M(96)>;
};


&usart1 {
status = "okay";
};

&i2c1 {
status = "okay";
};

&usbotg_fs {
status = "okay";
};

&flash0 {
partitions {
compatible = "fixed-partitions";
#address-cells = <1>;
#size-cells = <1>;

boot_partition: partition@0 {
label = "bootloader";
reg = <0x0 0x00040000>;
read-only;
};

code_partition: partition@40000 {
label = "code";
reg = <0x40000 0x000c0000>;
read-only;
};

/*
* The flash starting at 0x000f8000 and ending at
* 0x000fffff is reserved for use by the application.
*
* Storage partition will be used by FCB/LittleFS/NVS
* if enabled.
*/
storage_partition: partition@f8000 {
label = "storage";
reg = <0x000f8000 0x00008000>;
};
};
};
12 changes: 12 additions & 0 deletions boards/arm/arduino_portenta_h7/arduino_portenta_h7_m7.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
identifier: arduino_portenta_h7_m7
name: Arduino Portenta H7
type: mcu
arch: arm
toolchain:
- zephyr
- gnuarmemb
- xtools
ram: 512
flash: 1024
supported:
- gpio
42 changes: 42 additions & 0 deletions boards/arm/arduino_portenta_h7/arduino_portenta_h7_m7_defconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# Copyright (c) 2022 Benjamin Björnsson <[email protected]>.
# SPDX-License-Identifier: Apache-2.0

CONFIG_SOC_SERIES_STM32H7X=y
CONFIG_SOC_STM32H747XX=y

# Board config should be specified since there are 2 possible targets
CONFIG_BOARD_ARDUINO_PORTENTA_H7_M7=y

# Enable the internal SMPS regulator
CONFIG_POWER_SUPPLY_DIRECT_SMPS=y

# Enable GPIO
CONFIG_GPIO=y

# Enable clocks
CONFIG_CLOCK_CONTROL=y

# Enable MPU
CONFIG_ARM_MPU=y

# Enable HW stack protection
CONFIG_HW_STACK_PROTECTION=y

# enable pin controller
CONFIG_PINCTRL=y

# Use zephyr,code-partition as flash offset
CONFIG_USE_DT_CODE_PARTITION=y

# Disable following to assign serial ports to m4 core

# Enable uart driver
CONFIG_SERIAL=y

# Enable console
CONFIG_CONSOLE=y
CONFIG_UART_CONSOLE=y

# Enable regulator
CONFIG_REGULATOR=y
CONFIG_REGULATOR_FIXED=y
Loading