-
Notifications
You must be signed in to change notification settings - Fork 8.2k
Add support arduino portenta h7 #45221
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
MaureenHelm
merged 3 commits into
zephyrproject-rtos:main
from
benjaminbjornsson:add_support_arduino_portenta_h7
Oct 6, 2022
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
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,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() |
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 @@ | ||
| # 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 |
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,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
113
boards/arm/arduino_portenta_h7/arduino_portenta_h7-common.dtsi
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,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"; | ||
| }; | ||
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,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
16
boards/arm/arduino_portenta_h7/arduino_portenta_h7_m4.yaml
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,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
30
boards/arm/arduino_portenta_h7/arduino_portenta_h7_m4_defconfig
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,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 |
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,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
12
boards/arm/arduino_portenta_h7/arduino_portenta_h7_m7.yaml
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,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
42
boards/arm/arduino_portenta_h7/arduino_portenta_h7_m7_defconfig
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,42 @@ | ||
| # Copyright (c) 2022 Benjamin Björnsson <[email protected]>. | ||
| # SPDX-License-Identifier: Apache-2.0 | ||
erwango marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| 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 | ||
erwango marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| # 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 | ||
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.
Uh oh!
There was an error while loading. Please reload this page.