diff --git a/boards/st/stm32h573i_dk/Kconfig.sysbuild b/boards/st/stm32h573i_dk/Kconfig.sysbuild new file mode 100644 index 0000000000000..4f2afc0b2c4de --- /dev/null +++ b/boards/st/stm32h573i_dk/Kconfig.sysbuild @@ -0,0 +1,18 @@ +# SPDX-FileCopyrightText: Copyright The Zephyr Project Contributors +# SPDX-License-Identifier: Apache-2.0 + +choice BOOTLOADER + default BOOTLOADER_MCUBOOT +endchoice + +choice BOOT_SIGNATURE_TYPE + default BOOT_SIGNATURE_TYPE_NONE +endchoice + +if BOARD_STM32H573I_DK_STM32H573XX_EXT_FLASH_APP + +choice MCUBOOT_MODE + default MCUBOOT_MODE_SWAP_USING_OFFSET +endchoice + +endif # BOARD_STM32H573I_DK_STM32H573XX_EXT_FLASH_APP diff --git a/boards/st/stm32h573i_dk/board.yml b/boards/st/stm32h573i_dk/board.yml index 55f3820099981..8b9adab2eedbc 100644 --- a/boards/st/stm32h573i_dk/board.yml +++ b/boards/st/stm32h573i_dk/board.yml @@ -4,3 +4,5 @@ board: vendor: st socs: - name: stm32h573xx + variants: + - name: ext_flash_app diff --git a/boards/st/stm32h573i_dk/stm32h573i_dk-common.dtsi b/boards/st/stm32h573i_dk/stm32h573i_dk-common.dtsi new file mode 100644 index 0000000000000..cf0c211cfcc63 --- /dev/null +++ b/boards/st/stm32h573i_dk/stm32h573i_dk-common.dtsi @@ -0,0 +1,410 @@ +/* + * Copyright (c) 2023 STMicroelectronics + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include +#include +#include "arduino_r3_connector.dtsi" +#include +#include +#include +#include +#include + +/ { + model = "STMicroelectronics STM32H573I DISCOVERY KIT board"; + compatible = "st,stm32h573i-dk"; + + chosen { + zephyr,console = &usart1; + zephyr,shell-uart = &usart1; + zephyr,sram = &sram1; + zephyr,canbus = &fdcan1; + zephyr,display = &st7789v; + }; + + leds { + compatible = "gpio-leds"; + + green_led_0: led_1 { + gpios = <&gpioi 9 GPIO_ACTIVE_LOW>; + label = "User LD1"; + }; + + orange_led_0: led_2 { + gpios = <&gpioi 8 GPIO_ACTIVE_LOW>; + label = "User LD2"; + }; + + red_led_0: led_3 { + gpios = <&gpiof 1 GPIO_ACTIVE_LOW>; + label = "User LD3"; + }; + + blue_led_0: led_4 { + gpios = <&gpiof 4 GPIO_ACTIVE_LOW>; + label = "User LD4"; + }; + }; + + gpio_keys { + compatible = "gpio-keys"; + + user_button: button { + label = "User"; + gpios = <&gpioc 13 GPIO_ACTIVE_LOW>; + zephyr,code = ; + }; + }; + + lcd_bl_ctrl { + compatible = "regulator-fixed"; + regulator-name = "LCD Backlight Driver"; + enable-gpios = <&gpioi 3 GPIO_ACTIVE_HIGH>; + regulator-boot-on; + }; + + aliases { + led0 = &blue_led_0; + sw0 = &user_button; + watchdog0 = &iwdg; + die-temp0 = &die_temp; + die-temp1 = &digi_die_temp; + volt-sensor0 = &vref; + volt-sensor1 = &vbat; + }; + + ext_flash_mem: memory@90000000 { + compatible = "zephyr,memory-region"; + reg = <0x90000000 DT_SIZE_M(64)>; + zephyr,memory-region = "EXT_FLASH"; + /* DT_MEM_ARM_MPU_EXTMEM and DT_MEM_ARM_MPU_FLASH cause MPU issues */ + zephyr,memory-attr = ; + }; + + lvgl_pointer { + compatible = "zephyr,lvgl-pointer-input"; + input = <&ft3267>; + display = <&st7789v>; + invert-y; + }; +}; + +&fmc { + pinctrl-0 = <&fmc_a0_pf0 &fmc_ne1_pc7 &fmc_nwe_pd5 &fmc_noe_pd4 + &fmc_d0_pd14 &fmc_d1_pd15 &fmc_d2_pd0 &fmc_d3_pd1 + &fmc_d4_pe7 &fmc_d5_pe8 &fmc_d6_pe9 &fmc_d7_pe10 + &fmc_d8_pe11 &fmc_d9_pe12 &fmc_d10_pe13 &fmc_d11_pe14 + &fmc_d12_pe15 &fmc_d13_pd8 &fmc_d14_pd9 &fmc_d15_pd10>; + pinctrl-names = "default"; + status = "okay"; + + sram { + compatible = "st,stm32-fmc-nor-psram"; + + #address-cells = <1>; + #size-cells = <0>; + + bank@0 { + reg = ; + st,control = ; + st,timing = <1 1 32 0 2 2 STM32_FMC_ACCESS_MODE_A>; + + fmc-mipi-dbi { + compatible = "st,stm32-fmc-mipi-dbi"; + reset-gpios = <&gpioh 13 GPIO_ACTIVE_LOW>; + power-gpios = <&gpioc 6 GPIO_ACTIVE_LOW>; + register-select-pin = <0>; + #address-cells = <1>; + #size-cells = <0>; + + st7789v: lcd-panel@0 { + compatible = "sitronix,st7789v"; + reg = <0>; + mipi-mode = "MIPI_DBI_MODE_8080_BUS_16_BIT"; + /* A write cycle should be 68ns */ + mipi-max-frequency = <14705882>; + width = <240>; + height = <240>; + x-offset = <0>; + y-offset = <0>; + vcom = <0x1F>; + gctrl = <0x35>; + vdvs = <0x20>; + mdac = <0x00>; + gamma = <0x01>; + colmod = <0x05>; + lcm = <0x2c>; + porch-param = [0c 0c 00 33 33]; + cmd2en-param = [5a 69 02 00]; + pwctrl1-param = [a4 a1]; + pvgam-param = [D0 08 11 08 0C 15 39 33 50 36 13 14 29 2D]; + nvgam-param = [D0 08 10 08 06 06 39 44 51 0B 16 14 2F 31]; + ram-param = [00 F0]; + rgb-param = [40 02 14]; + }; + }; + }; + }; +}; + +&clk_hsi48 { + status = "okay"; +}; + +&clk_lse { + status = "okay"; +}; + +&clk_hse { + clock-frequency = ; + hse-bypass; /* X3 is a 25MHz oscillator on PH0 */ + status = "okay"; +}; + +&pll { + div-m = <5>; + mul-n = <96>; + div-p = <2>; + div-q = <6>; + div-r = <2>; + clocks = <&clk_hse>; + status = "okay"; +}; + +&rcc { + clocks = <&pll>; + clock-frequency = ; + ahb-prescaler = <1>; + apb1-prescaler = <2>; + apb2-prescaler = <1>; + apb3-prescaler = <1>; +}; + +&i2c1 { + pinctrl-0 = <&i2c1_scl_pb6 &i2c1_sda_pb7>; + pinctrl-names = "default"; + clock-frequency = ; + status = "okay"; +}; + +&i2c2 { + pinctrl-0 = <&i2c2_scl_pb10 &i2c2_sda_pb11>; + pinctrl-names = "default"; + clock-frequency = ; + status = "okay"; +}; + +&i2c4 { + pinctrl-0 = <&i2c4_scl_pb8 &i2c4_sda_pb9>; + pinctrl-names = "default"; + clock-frequency = ; + status = "okay"; + + ft3267: ft3267@38 { + compatible = "focaltech,ft5336"; + reg = <0x38>; + int-gpios = <&gpiog 7 GPIO_ACTIVE_LOW>; + reset-gpios = <&gpiog 3 GPIO_ACTIVE_LOW>; + }; +}; + +&usart1 { + pinctrl-0 = <&usart1_tx_pa9 &usart1_rx_pa10>; + pinctrl-names = "default"; + current-speed = <115200>; + status = "okay"; +}; + +&usart3 { + pinctrl-0 = <&usart3_tx_pb10 &usart3_rx_pb11>; + pinctrl-names = "default"; + current-speed = <115200>; + status = "okay"; +}; + +&timers2 { + st,prescaler = <10000>; + status = "okay"; + + pwm2: pwm { + status = "okay"; + pinctrl-0 = <&tim2_ch4_pa3>; + pinctrl-names = "default"; + }; +}; + +&timers3 { + st,prescaler = <10000>; + status = "okay"; + + pwm3: pwm { + status = "okay"; + pinctrl-0 = <&tim3_ch2_pb5>; + pinctrl-names = "default"; + }; +}; + +&aes { + status = "okay"; +}; + +&rng { + status = "okay"; +}; + +&mac { + status = "okay"; + pinctrl-0 = <ð_rxd0_pc4 + ð_rxd1_pc5 + ð_ref_clk_pa1 + ð_crs_dv_pa7 + ð_tx_en_pg11 + ð_txd0_pg13 + ð_txd1_pg12>; + pinctrl-names = "default"; + phy-connection-type = "rmii"; + phy-handle = <ð_phy>; +}; + +&mdio { + status = "okay"; + pinctrl-0 = <ð_mdio_pa2 ð_mdc_pc1>; + pinctrl-names = "default"; + + eth_phy: ethernet-phy@0 { + compatible = "ethernet-phy"; + reg = <0x00>; + }; +}; + +&rtc { + clocks = <&rcc STM32_CLOCK(APB3, 21)>, + <&rcc STM32_SRC_LSE RTC_SEL(1)>; + status = "okay"; +}; + +&iwdg { + status = "okay"; +}; + +&gpdma1 { + status = "okay"; +}; + +&gpdma2 { + status = "okay"; +}; + +&dac1 { + /* only 2 output channels : out1 on pa4 or out2 on pa5 */ + pinctrl-0 = <&dac1_out1_pa4>; /* Arduino A1 */ + pinctrl-names = "default"; + status = "okay"; +}; + +&adc1 { + clocks = <&rcc STM32_CLOCK(AHB2, 10)>, + <&rcc STM32_SRC_HCLK ADCDAC_SEL(0)>; + pinctrl-0 = <&adc1_inp6_pf12>; /* Arduino A5 */ + pinctrl-names = "default"; + st,adc-clock-source = "ASYNC"; + st,adc-prescaler = <6>; + status = "okay"; +}; + +&spi2 { + pinctrl-0 = <&spi2_nss_pa3 &spi2_sck_pi1 + &spi2_miso_pi2 &spi2_mosi_pb15>; + pinctrl-names = "default"; + status = "okay"; +}; + +&fdcan1 { + clocks = <&rcc STM32_CLOCK(APB1_2, 9)>, + <&rcc STM32_SRC_PLL1_Q FDCAN_SEL(1)>; + pinctrl-0 = <&fdcan1_rx_pa11 &fdcan1_tx_pa12>; + pinctrl-names = "default"; + status = "okay"; +}; + +&xspi1 { + pinctrl-0 = <&octospi1_io0_pb1 &octospi1_io1_pd12 + &octospi1_io2_pc2 &octospi1_io3_pd13 + &octospi1_io4_ph2 &octospi1_io5_ph3 + &octospi1_io6_pg9 &octospi1_io7_pc0 + &octospi1_clk_pf10 &octospi1_ncs_pg6 + &octospi1_dqs_pb2>; + pinctrl-names = "default"; + + status = "okay"; + + ext_flash_ctrl: xspi-flash-controller@0 { + compatible = "st,stm32-xspi-nor"; + reg = <0>; + size = ; /* 512 Mbits */ + ospi-max-frequency = ; + spi-bus-width = ; + data-rate = ; + four-byte-opcodes; + status = "okay"; + + #address-cells = <1>; + #size-cells = <1>; + ranges = <0x0 0x90000000 DT_SIZE_M(64)>; /* Ext Flash mem-mapped to 0x90000000 */ + + ext_flash: mx25lm51245: ext-flash@0 { + compatible = "soc-nv-flash"; + reg = <0x0 DT_SIZE_M(64)>; + write-block-size = <1>; + erase-block-size = ; + }; + }; +}; + +&sdmmc1 { + pinctrl-0 = <&sdmmc1_d0_pc8 &sdmmc1_d1_pc9 + &sdmmc1_d2_pc10 &sdmmc1_d3_pc11 + &sdmmc1_ck_pc12 &sdmmc1_cmd_pd2>; + pinctrl-names = "default"; + cd-gpios = <&gpioh 14 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>; + disk-name = "SD"; + status = "okay"; +}; + +zephyr_udc0: &usb { + pinctrl-0 = <&usb_dm_pa11 &usb_dp_pa12>; + pinctrl-names = "default"; + status = "okay"; +}; + +&die_temp { + status = "okay"; +}; + +&digi_die_temp { + status = "okay"; +}; + +&vref { + status = "okay"; +}; + +&vbat { + status = "okay"; +}; diff --git a/boards/st/stm32h573i_dk/stm32h573i_dk.dts b/boards/st/stm32h573i_dk/stm32h573i_dk.dts index f4bdf653a1399..4884d83f7ff68 100644 --- a/boards/st/stm32h573i_dk/stm32h573i_dk.dts +++ b/boards/st/stm32h573i_dk/stm32h573i_dk.dts @@ -5,294 +5,16 @@ */ /dts-v1/; -#include -#include -#include "arduino_r3_connector.dtsi" -#include -#include -#include -#include -#include +#include "stm32h573i_dk-common.dtsi" / { model = "STMicroelectronics STM32H573I DISCOVERY KIT board"; compatible = "st,stm32h573i-dk"; chosen { - zephyr,console = &usart1; - zephyr,shell-uart = &usart1; - zephyr,sram = &sram1; zephyr,flash = &flash0; + zephyr,flash-controller = &flash; zephyr,code-partition = &slot0_partition; - zephyr,canbus = &fdcan1; - zephyr,display = &st7789v; - }; - - leds { - compatible = "gpio-leds"; - - green_led_0: led_1 { - gpios = <&gpioi 9 GPIO_ACTIVE_LOW>; - label = "User LD1"; - }; - - orange_led_0: led_2 { - gpios = <&gpioi 8 GPIO_ACTIVE_LOW>; - label = "User LD2"; - }; - - red_led_0: led_3 { - gpios = <&gpiof 1 GPIO_ACTIVE_LOW>; - label = "User LD3"; - }; - - blue_led_0: led_4 { - gpios = <&gpiof 4 GPIO_ACTIVE_LOW>; - label = "User LD4"; - }; - }; - - gpio_keys { - compatible = "gpio-keys"; - - user_button: button { - label = "User"; - gpios = <&gpioc 13 GPIO_ACTIVE_LOW>; - zephyr,code = ; - }; - }; - - lcd_bl_ctrl { - compatible = "regulator-fixed"; - regulator-name = "LCD Backlight Driver"; - enable-gpios = <&gpioi 3 GPIO_ACTIVE_HIGH>; - regulator-boot-on; - }; - - aliases { - led0 = &blue_led_0; - sw0 = &user_button; - watchdog0 = &iwdg; - die-temp0 = &die_temp; - die-temp1 = &digi_die_temp; - volt-sensor0 = &vref; - volt-sensor1 = &vbat; - }; - - ext_memory: memory@90000000 { - compatible = "zephyr,memory-region"; - reg = <0x90000000 DT_SIZE_M(64)>; - zephyr,memory-region = "EXTMEM"; - /* The ATTR_MPU_EXTMEM attribut causing a MPU FAULT */ - zephyr,memory-attr = ; - }; - - lvgl_pointer { - compatible = "zephyr,lvgl-pointer-input"; - input = <&ft3267>; - display = <&st7789v>; - invert-y; - }; -}; - -&fmc { - pinctrl-0 = <&fmc_a0_pf0 &fmc_ne1_pc7 &fmc_nwe_pd5 &fmc_noe_pd4 - &fmc_d0_pd14 &fmc_d1_pd15 &fmc_d2_pd0 &fmc_d3_pd1 - &fmc_d4_pe7 &fmc_d5_pe8 &fmc_d6_pe9 &fmc_d7_pe10 - &fmc_d8_pe11 &fmc_d9_pe12 &fmc_d10_pe13 &fmc_d11_pe14 - &fmc_d12_pe15 &fmc_d13_pd8 &fmc_d14_pd9 &fmc_d15_pd10>; - pinctrl-names = "default"; - status = "okay"; - - sram { - compatible = "st,stm32-fmc-nor-psram"; - - #address-cells = <1>; - #size-cells = <0>; - - bank@0 { - reg = ; - st,control = ; - st,timing = <1 1 32 0 2 2 STM32_FMC_ACCESS_MODE_A>; - - fmc-mipi-dbi { - compatible = "st,stm32-fmc-mipi-dbi"; - reset-gpios = <&gpioh 13 GPIO_ACTIVE_LOW>; - power-gpios = <&gpioc 6 GPIO_ACTIVE_LOW>; - register-select-pin = <0>; - #address-cells = <1>; - #size-cells = <0>; - - st7789v: lcd-panel@0 { - compatible = "sitronix,st7789v"; - reg = <0>; - mipi-mode = "MIPI_DBI_MODE_8080_BUS_16_BIT"; - /* A write cycle should be 68ns */ - mipi-max-frequency = <14705882>; - width = <240>; - height = <240>; - x-offset = <0>; - y-offset = <0>; - vcom = <0x1F>; - gctrl = <0x35>; - vdvs = <0x20>; - mdac = <0x00>; - gamma = <0x01>; - colmod = <0x05>; - lcm = <0x2c>; - porch-param = [0c 0c 00 33 33]; - cmd2en-param = [5a 69 02 00]; - pwctrl1-param = [a4 a1]; - pvgam-param = [D0 08 11 08 0C 15 39 33 50 36 13 14 29 2D]; - nvgam-param = [D0 08 10 08 06 06 39 44 51 0B 16 14 2F 31]; - ram-param = [00 F0]; - rgb-param = [40 02 14]; - }; - }; - }; - }; -}; - -&clk_hsi48 { - status = "okay"; -}; - -&clk_lse { - status = "okay"; -}; - -&clk_hse { - clock-frequency = ; - hse-bypass; /* X3 is a 25MHz oscillator on PH0 */ - status = "okay"; -}; - -&pll { - div-m = <5>; - mul-n = <96>; - div-p = <2>; - div-q = <6>; - div-r = <2>; - clocks = <&clk_hse>; - status = "okay"; -}; - -&rcc { - clocks = <&pll>; - clock-frequency = ; - ahb-prescaler = <1>; - apb1-prescaler = <2>; - apb2-prescaler = <1>; - apb3-prescaler = <1>; -}; - -&i2c1 { - pinctrl-0 = <&i2c1_scl_pb6 &i2c1_sda_pb7>; - pinctrl-names = "default"; - clock-frequency = ; - status = "okay"; -}; - -&i2c2 { - pinctrl-0 = <&i2c2_scl_pb10 &i2c2_sda_pb11>; - pinctrl-names = "default"; - clock-frequency = ; - status = "okay"; -}; - -&i2c4 { - pinctrl-0 = <&i2c4_scl_pb8 &i2c4_sda_pb9>; - pinctrl-names = "default"; - clock-frequency = ; - status = "okay"; - - ft3267: ft3267@38 { - compatible = "focaltech,ft5336"; - reg = <0x38>; - int-gpios = <&gpiog 7 GPIO_ACTIVE_LOW>; - reset-gpios = <&gpiog 3 GPIO_ACTIVE_LOW>; - }; -}; - -&usart1 { - pinctrl-0 = <&usart1_tx_pa9 &usart1_rx_pa10>; - pinctrl-names = "default"; - current-speed = <115200>; - status = "okay"; -}; - -&usart3 { - pinctrl-0 = <&usart3_tx_pb10 &usart3_rx_pb11>; - pinctrl-names = "default"; - current-speed = <115200>; - status = "okay"; -}; - -&timers2 { - st,prescaler = <10000>; - status = "okay"; - - pwm2: pwm { - status = "okay"; - pinctrl-0 = <&tim2_ch4_pa3>; - pinctrl-names = "default"; - }; -}; - -&timers3 { - st,prescaler = <10000>; - status = "okay"; - - pwm3: pwm { - status = "okay"; - pinctrl-0 = <&tim3_ch2_pb5>; - pinctrl-names = "default"; - }; -}; - -&aes { - status = "okay"; -}; - -&rng { - status = "okay"; -}; - -&mac { - status = "okay"; - pinctrl-0 = <ð_rxd0_pc4 - ð_rxd1_pc5 - ð_ref_clk_pa1 - ð_crs_dv_pa7 - ð_tx_en_pg11 - ð_txd0_pg13 - ð_txd1_pg12>; - pinctrl-names = "default"; - phy-connection-type = "rmii"; - phy-handle = <ð_phy>; -}; - -&mdio { - status = "okay"; - pinctrl-0 = <ð_mdio_pa2 ð_mdc_pc1>; - pinctrl-names = "default"; - - eth_phy: ethernet-phy@0 { - compatible = "ethernet-phy"; - reg = <0x00>; }; }; @@ -308,136 +30,33 @@ reg = <0x00000000 DT_SIZE_K(64)>; }; - /* Set 64KB of storage at the end of Bank1 */ - storage_partition: partition@f0000 { - label = "storage"; - reg = <0x000f0000 DT_SIZE_K(64)>; + slot0_partition: partition@10000 { + label = "image-0"; + reg = <0x00010000 DT_SIZE_K(448)>; }; - }; -}; - -&rtc { - clocks = <&rcc STM32_CLOCK(APB3, 21)>, - <&rcc STM32_SRC_LSE RTC_SEL(1)>; - status = "okay"; -}; - -&iwdg { - status = "okay"; -}; - -&gpdma1 { - status = "okay"; -}; - -&gpdma2 { - status = "okay"; -}; - -&dac1 { - /* only 2 output channels : out1 on pa4 or out2 on pa5 */ - pinctrl-0 = <&dac1_out1_pa4>; /* Arduino A1 */ - pinctrl-names = "default"; - status = "okay"; -}; -&adc1 { - clocks = <&rcc STM32_CLOCK(AHB2, 10)>, - <&rcc STM32_SRC_HCLK ADCDAC_SEL(0)>; - pinctrl-0 = <&adc1_inp6_pf12>; /* Arduino A5 */ - pinctrl-names = "default"; - st,adc-clock-source = "ASYNC"; - st,adc-prescaler = <6>; - status = "okay"; -}; - -&spi2 { - pinctrl-0 = <&spi2_nss_pa3 &spi2_sck_pi1 - &spi2_miso_pi2 &spi2_mosi_pb15>; - pinctrl-names = "default"; - status = "okay"; -}; - -&fdcan1 { - clocks = <&rcc STM32_CLOCK(APB1_2, 9)>, - <&rcc STM32_SRC_PLL1_Q FDCAN_SEL(1)>; - pinctrl-0 = <&fdcan1_rx_pa11 &fdcan1_tx_pa12>; - pinctrl-names = "default"; - status = "okay"; -}; - -&xspi1 { - pinctrl-0 = <&octospi1_io0_pb1 &octospi1_io1_pd12 - &octospi1_io2_pc2 &octospi1_io3_pd13 - &octospi1_io4_ph2 &octospi1_io5_ph3 - &octospi1_io6_pg9 &octospi1_io7_pc0 - &octospi1_clk_pf10 &octospi1_ncs_pg6 - &octospi1_dqs_pb2>; - pinctrl-names = "default"; - - status = "okay"; - - mx25lm51245: ospi-nor-flash@0 { - compatible = "st,stm32-xspi-nor"; - reg = <0>; - size = ; /* 512 Mbits */ - ospi-max-frequency = ; - spi-bus-width = ; - data-rate = ; - four-byte-opcodes; - status = "okay"; - - partitions { - compatible = "fixed-partitions"; - #address-cells = <1>; - #size-cells = <1>; - - slot0_partition: partition@0 { - label = "image-0"; - reg = <0x00000000 DT_SIZE_M(16)>; - }; - - slot1_partition: partition@1000000 { - label = "image-1"; - reg = <0x01000000 DT_SIZE_M(16)>; - }; + slot1_partition: partition@80000 { + label = "image-1"; + reg = <0x00080000 DT_SIZE_K(440)>; + }; - scratch_partition: partition@2000000 { - label = "image-scratch"; - reg = <0x02000000 DT_SIZE_M(24)>; - }; + /* Set 72KB of storage at the end of Bank1 */ + storage_partition: partition@ee000 { + label = "storage"; + reg = <0x000ee000 DT_SIZE_K(72)>; }; }; }; -&sdmmc1 { - pinctrl-0 = <&sdmmc1_d0_pc8 &sdmmc1_d1_pc9 - &sdmmc1_d2_pc10 &sdmmc1_d3_pc11 - &sdmmc1_ck_pc12 &sdmmc1_cmd_pd2>; - pinctrl-names = "default"; - cd-gpios = <&gpioh 14 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>; - disk-name = "SD"; - status = "okay"; -}; - -zephyr_udc0: &usb { - pinctrl-0 = <&usb_dm_pa11 &usb_dp_pa12>; - pinctrl-names = "default"; - status = "okay"; -}; - -&die_temp { - status = "okay"; -}; - -&digi_die_temp { - status = "okay"; -}; - -&vref { - status = "okay"; -}; +&ext_flash { + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; -&vbat { - status = "okay"; + partition@0 { + label = "nor"; + reg = <0x00000000 DT_SIZE_M(64)>; + }; + }; }; diff --git a/boards/st/stm32h573i_dk/stm32h573i_dk_defconfig b/boards/st/stm32h573i_dk/stm32h573i_dk_defconfig index 3421a525fcd25..a534a3716ced8 100644 --- a/boards/st/stm32h573i_dk/stm32h573i_dk_defconfig +++ b/boards/st/stm32h573i_dk/stm32h573i_dk_defconfig @@ -7,11 +7,12 @@ CONFIG_ARM_MPU=y # Enable HW stack protection CONFIG_HW_STACK_PROTECTION=y -# enable uart driver +# Enable UART driver CONFIG_SERIAL=y -# enable console + +# Enable console CONFIG_CONSOLE=y CONFIG_UART_CONSOLE=y -# enable GPIO +# Enable GPIO CONFIG_GPIO=y diff --git a/boards/st/stm32h573i_dk/stm32h573i_dk_stm32h573xx_ext_flash_app.dts b/boards/st/stm32h573i_dk/stm32h573i_dk_stm32h573xx_ext_flash_app.dts new file mode 100644 index 0000000000000..8f87a70b86088 --- /dev/null +++ b/boards/st/stm32h573i_dk/stm32h573i_dk_stm32h573xx_ext_flash_app.dts @@ -0,0 +1,56 @@ +/* + * Copyright (c) 2023 STMicroelectronics + * + * SPDX-License-Identifier: Apache-2.0 + */ + +/dts-v1/; +#include "stm32h573i_dk-common.dtsi" + +/ { + model = "STMicroelectronics STM32H573I DISCOVERY KIT board"; + compatible = "st,stm32h573i-dk"; + + chosen { + zephyr,flash = &ext_flash; + zephyr,flash-controller = &ext_flash_ctrl; + zephyr,code-partition = &slot0_partition; + }; +}; + +&flash0 { + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + /* Set the partitions with first MB to make use of the whole Bank1 */ + boot_partition: partition@0 { + label = "mcuboot"; + reg = <0x00000000 DT_SIZE_K(64)>; + }; + + storage_partition: partition@10000 { + label = "storage"; + reg = <0x00010000 DT_SIZE_K(960)>; + }; + }; +}; + +&ext_flash { + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + slot0_partition: partition@0 { + label = "image-0"; + reg = <0x00000000 DT_SIZE_M(32)>; + }; + + slot1_partition: partition@2000000 { + label = "image-1"; + reg = <0x02000000 DT_SIZE_M(32)>; + }; + }; +}; diff --git a/boards/st/stm32h573i_dk/stm32h573i_dk_stm32h573xx_ext_flash_app.yaml b/boards/st/stm32h573i_dk/stm32h573i_dk_stm32h573xx_ext_flash_app.yaml new file mode 100644 index 0000000000000..3db5add57cacb --- /dev/null +++ b/boards/st/stm32h573i_dk/stm32h573i_dk_stm32h573xx_ext_flash_app.yaml @@ -0,0 +1,31 @@ +identifier: stm32h573i_dk/stm32h573xx/ext_flash_app +name: ST STM32H573I Discovery Kit with App in Ext Flash +type: mcu +arch: arm +toolchain: + - zephyr +sysbuild: true +ram: 640 +flash: 32767 # size in kB of 1 app slot minus MCUboot header size (1KB) +supported: + - arduino_gpio + - arduino_i2c + - arduino_serial + - arduino_spi + - gpio + - uart + - watchdog + - entropy + - dma + - adc + - dac + - netif:eth + - pwm + - counter + - spi + - octospi + - can + - i2c + - rtc + - usbd +vendor: st diff --git a/boards/st/stm32h573i_dk/stm32h573i_dk_stm32h573xx_ext_flash_app_defconfig b/boards/st/stm32h573i_dk/stm32h573i_dk_stm32h573xx_ext_flash_app_defconfig new file mode 100644 index 0000000000000..a534a3716ced8 --- /dev/null +++ b/boards/st/stm32h573i_dk/stm32h573i_dk_stm32h573xx_ext_flash_app_defconfig @@ -0,0 +1,18 @@ +# Copyright (c) 2023 STMicroelectronics +# SPDX-License-Identifier: Apache-2.0 + +# Enable MPU +CONFIG_ARM_MPU=y + +# Enable HW stack protection +CONFIG_HW_STACK_PROTECTION=y + +# Enable UART driver +CONFIG_SERIAL=y + +# Enable console +CONFIG_CONSOLE=y +CONFIG_UART_CONSOLE=y + +# Enable GPIO +CONFIG_GPIO=y diff --git a/samples/subsys/mgmt/hawkbit/boards/stm32h573i_dk.overlay b/samples/subsys/mgmt/hawkbit/boards/stm32h573i_dk.overlay deleted file mode 100644 index 2e4030e522419..0000000000000 --- a/samples/subsys/mgmt/hawkbit/boards/stm32h573i_dk.overlay +++ /dev/null @@ -1,16 +0,0 @@ -/* - * Copyright (c) 2025 STMicroelectronics - * - * SPDX-License-Identifier: Apache-2.0 - */ - -/* - * Define the device, controller and partition to be the external memory - * for running the application in external NOR from MCUboot - */ -/ { - chosen { - zephyr,flash = &mx25lm51245; - zephyr,flash-controller = &mx25lm51245; - }; -}; diff --git a/samples/subsys/mgmt/hawkbit/sample.yaml b/samples/subsys/mgmt/hawkbit/sample.yaml index 8aa32e3d5c51a..8e9543e4d2fca 100644 --- a/samples/subsys/mgmt/hawkbit/sample.yaml +++ b/samples/subsys/mgmt/hawkbit/sample.yaml @@ -7,10 +7,12 @@ common: platform_allow: - frdm_k64f - stm32h573i_dk + - stm32h573i_dk/stm32h573xx/ext_flash_app - stm32h750b_dk/stm32h750xx/ext_flash_app integration_platforms: - frdm_k64f - stm32h573i_dk + - stm32h573i_dk/stm32h573xx/ext_flash_app sample: description: hawkBit Firmware Over-the-Air (FOTA) name: hawkbit diff --git a/samples/sysbuild/with_mcuboot/boards/stm32h573i_dk.overlay b/samples/sysbuild/with_mcuboot/boards/stm32h573i_dk.overlay deleted file mode 100644 index 2e4030e522419..0000000000000 --- a/samples/sysbuild/with_mcuboot/boards/stm32h573i_dk.overlay +++ /dev/null @@ -1,16 +0,0 @@ -/* - * Copyright (c) 2025 STMicroelectronics - * - * SPDX-License-Identifier: Apache-2.0 - */ - -/* - * Define the device, controller and partition to be the external memory - * for running the application in external NOR from MCUboot - */ -/ { - chosen { - zephyr,flash = &mx25lm51245; - zephyr,flash-controller = &mx25lm51245; - }; -}; diff --git a/samples/sysbuild/with_mcuboot/sample.yaml b/samples/sysbuild/with_mcuboot/sample.yaml index 5797bb823c135..4e8b0f22669ee 100644 --- a/samples/sysbuild/with_mcuboot/sample.yaml +++ b/samples/sysbuild/with_mcuboot/sample.yaml @@ -18,6 +18,7 @@ tests: - nucleo_u385rg_q - stm32h7s78_dk - stm32h573i_dk + - stm32h573i_dk/stm32h573xx/ext_flash_app - stm32h750b_dk/stm32h750xx/ext_flash_app integration_platforms: - nrf52840dk/nrf52840 diff --git a/soc/st/stm32/Kconfig.defconfig b/soc/st/stm32/Kconfig.defconfig index 767b6c2321c5c..5e0a6fd467264 100644 --- a/soc/st/stm32/Kconfig.defconfig +++ b/soc/st/stm32/Kconfig.defconfig @@ -55,6 +55,11 @@ DT_FLASH_PARENT_IS_XSPI := $(dt_node_has_compat,$(DT_CHOSEN_FLASH_PARENT),$(DT_C DT_FLASH_PARENT_IS_OSPI := $(dt_node_has_compat,$(DT_CHOSEN_FLASH_PARENT),$(DT_COMPAT_OSPI)) DT_FLASH_PARENT_IS_QSPI := $(dt_node_has_compat,$(DT_CHOSEN_FLASH_PARENT),$(DT_COMPAT_QSPI)) +DT_CHOSEN_Z_FLASH_CTRL := zephyr,flash-controller +DT_COMPAT_XSPI_NOR_CTRL := st,stm32-xspi-nor +DT_CHOSEN_FLASH_CTRL_NODE := $(dt_chosen_path,$(DT_CHOSEN_Z_FLASH_CTRL)) +DT_FLASH_CTRL_IS_XSPI_NOR := $(dt_node_has_compat,$(DT_CHOSEN_FLASH_CTRL_NODE),$(DT_COMPAT_XSPI_NOR_CTRL)) + config SYS_CLOCK_HW_CYCLES_PER_SEC default "$(DT_STM32WB0_TIMER_FREQ)" if STM32WB0_RADIO_TIMER default "$(DT_STM32_RCC_CLOCK_FREQ)" if "$(dt_nodelabel_enabled,rcc)" @@ -104,7 +109,7 @@ config FLASH_BASE_ADDRESS default $(dt_chosen_reg_addr_hex,$(DT_CHOSEN_Z_FLASH)) config STM32_APP_IN_EXT_FLASH - default $(DT_FLASH_PARENT_IS_XSPI) + default $(DT_FLASH_PARENT_IS_XSPI) || $(DT_FLASH_CTRL_IS_XSPI_NOR) # The XSPI PSRAM driver creates a SMH region with attribute SMH_REG_ATTR_EXTERNAL (2) # If applicable set the LTDC / VIDEO_BUFFER SMH attribute to SMH_REG_ATTR_EXTERNAL (2) diff --git a/tests/boot/test_mcuboot/testcase.yaml b/tests/boot/test_mcuboot/testcase.yaml index 6cfb6d1b8de1a..0e2395469d1b7 100644 --- a/tests/boot/test_mcuboot/testcase.yaml +++ b/tests/boot/test_mcuboot/testcase.yaml @@ -55,6 +55,8 @@ tests: - esp32c6_devkitc/esp32c6/hpcore - esp8684_devkitm - stm32h750b_dk/stm32h750xx/ext_flash_app + - stm32h573i_dk + - stm32h573i_dk/stm32h573xx/ext_flash_app integration_platforms: - frdm_k64f - nrf52840dk/nrf52840 @@ -62,6 +64,8 @@ tests: platform_allow: - b_u585i_iot02a - stm32h750b_dk/stm32h750xx/ext_flash_app + - stm32h573i_dk + - stm32h573i_dk/stm32h573xx/ext_flash_app extra_configs: - CONFIG_ASSERT=y bootloader.mcuboot.swap_using_move: @@ -71,6 +75,8 @@ tests: - nrf52840dk/nrf52840 - nucleo_wba55cg - stm32h750b_dk/stm32h750xx/ext_flash_app + - stm32h573i_dk + - stm32h573i_dk/stm32h573xx/ext_flash_app integration_platforms: - frdm_k64f - nrf5340dk/nrf5340/cpuapp