Installing U-Boot to the STM32H7 SOM Print

 

This application note explains how to install the U-Boot firmware to the STM32H7 SOM. Refer to Understanding STM32H7 SOM Boot Architecture as a pre-requisite to understanding the installation procedure.

Hardware Set-Up

The following hardware set-up is required for installation of the software to the STM32H7 SOM:

  • STM32H7-SOM Rev 2A soldered onto the STM32H7-BSB Rev 4A baseboard;
  • The USB Type C cable connected to the J10 connector on the baseboard (to provide the STM32H7 serial console to the development host);
  • The ST-LINK/V2 debugger/programmer connected to the 20-pin P3 ARM JTAG connector on the baseboard.

The following picture illustrates the above hardware set-up:

NOTE: The STM32H7-BSB Rev 1A/2A baseboards are supported by BSP version 2.5.0. The newer versions support the STM32H7-BSB Rev 4A baseboard only.

Installable Images

The images to be installed onto the STM32H7 SOM can be obtained using one of the two approaches, as follows:

Installing U-Boot SPL to Internal Flash

Step through the following procedure to install the U-Boot SPL to the internal Flash of the STM32H750:

  1. Run the following command on the Linux development host:
  2. [root@workbench linux-cm-stm32h7-2.5.0]# st-flash write u-boot/spl/\ u-boot-spl.bin 0x08000000 st-flash 1.7.0-246-gc721751 2023-04-21T01:27:56 INFO common.c: STM32H74x_H75x: 128 KiB SRAM, 128 KiB flash in at least 128 KiB pages. file u-boot-spl.bin md5 checksum: 5b12ae3943ed667fd35456dbae306ab9, stlink checksum: 0x00519191 2023-04-21T01:27:56 INFO common_flash.c: Attempting to write 61757 (0xf13d) bytes to stm32 address: 134217728 (0x8000000) 2023-04-21T01:27:56 WARN common_flash.c: unaligned len 0xf13d -- padding with zero -> Flash page at 0x8000000 erased (size: 0x20000) 2023-04-21T01:27:57 INFO flashloader.c: Starting Flash write for H7 61758/61758 bytes written 2023-04-21T01:27:58 INFO common_flash.c: Starting verification of write complete 2023-04-21T01:27:59 INFO common_flash.c: Flash written and verified! jolly good! [root@workbench linux-cm-stm32h7-2.5.0]#

  3. Verify that the U-Boot SPL has been successfully installed. Reset the SOM by pressing the S3 button on the carrier board and confirm that the following output appears on the serial UART console:
  4. U-Boot SPL 2019.04-gec287f63c5 (Jun 16 2023 - 14:31:30 +0000) Hit 's' key to enter spl shell: Trying to boot from SPI

Installing U-Boot "Proper" to QSPI Flash

Step through the following procedure to install the U-Boot "Proper" to the QSPI Flash:

  1. On the development host, make sure that your serial terminal utility (such as picocom) is not connected to the board serial console (/dev/ttyUSB1 in this example). Exit the utility or just kill it, for example:
  2. [sasha_d@workbench ~]$ killall picocom [sasha_d@workbench ~]$

  3. Run the following command on the Linux development host:
  4. [sasha_d@workbench linux-cm-stm32h7-2.5.0]$ ./u-boot/board/emcraft/stm32h7-som/stm32h7-som-uboot-install.kermit /dev/ttyUSB1 u-boot/u-boot.img

  5. Reset the target board to start programming u-boot/u-boot.img via /dev/ttyUSB1.
  6. Reset the SOM by pressing the S3 button on the carrier board.
  7. Wait for the kermit utility to load the U-Boot image (observe the progress indicators).
  8. The script will exit successfully at the end of the installation procedure:
  9. ... Successfully programmed u-boot/u-boot.img to SPI Flash ... STM32H7-SOM U-Boot > ubi create env1 0x8000 Creating dynamic volume env1 of size 32768 STM32H7-SOM U-Boot > ubi create env2 0x8000 Creating dynamic volume env2 of size 32768 STM32H7-SOM U-Boot > [sasha_d@workbench linux-cm-stm32h7-2.5.0]$

  10. Connect to the SOM console using a serial terminal utility, for example:
  11. [sasha_d@workbench ~]$ picocom -b 115200 /dev/ttyUSB1

  12. Verify that the U-Boot "proper" has been successfully installed. Reset the SOM by pressing the S3 button on the carrier board and confirm that the following output appears on the serial UART console:
  13. U-Boot SPL 2019.04-gec287f63c5 (Jun 16 2023 - 14:31:30 +0000) Hit 's' key to enter spl shell: Trying to boot from SPI U-Boot 2019.04-gec287f63c5 (Jun 16 2023 - 14:31:30 +0000) Model: STMicroelectronics STM32H7 SOM DRAM: 28 MiB Flash: 128 KiB MMC: STM32 SDMMC2: 0 Loading Environment from UBI... ubi0: default fastmap pool size: 8 ubi0: default fastmap WL pool size: 4 ubi0: attaching mtd2 ubi0: scanning is finished ubi0: attached mtd2 (name "system", size 23 MiB) ubi0: PEB size: 131072 bytes (128 KiB), LEB size: 126976 bytes ubi0: min./max. I/O unit sizes: 2048/2048, sub-page size 2048 ubi0: VID header offset: 2048 (aligned 2048), data offset: 4096 ubi0: good PEBs: 184, bad PEBs: 0, corrupted PEBs: 0 ubi0: user volume: 2, internal volumes: 1, max. volumes count: 128 ubi0: max/mean erase counter: 2/1, WL threshold: 4096, image sequence number: 0 ubi0: available PEBs: 156, total reserved PEBs: 28, PEBs reserved for bad PEB handling: 20 Read 16384 bytes from volume env1 to d1e6d6e0 Read 16384 bytes from volume env2 to d1e71700 *** Warning - bad CRC, using default environment In: serial Out: serial Err: serial Volume splash not found! splash_screen_display: ubi_volume_read error=19 Net: Error: ethernet@40028000 address not set. eth-1: ethernet@40028000 Hit any key to stop autoboot: 0 ERROR: Active image set is invalid STM32H7-SOM U-Boot >

Enabling LCD and Splash Screen on Starter Kit with LCD

If your starter kit includes the LCD, it can be enabled in software by installing the U-Boot splash screen image to the QSPI Flash. Step through the following procedure to install the stm32h7-splash-24bpp.bmp picture as the splash screen:

  1. On the development host, make sure that your serial terminal utility (such as picocom) is not connected to the board serial console (/dev/ttyUSB1 in this example). Exit the utility or just kill it, for example:
  2. [sasha_d@workbench ~]$ killall picocom
    [sasha_d@workbench ~]$

  3. Run the following command on the Linux development host:
  4. [sasha_d@workbench linux-cm-stm32h7-2.5.0]$ ./u-boot/board/emcraft/stm32h7-som/stm32h7-som-splash-install.kermit /dev/ttyUSB1 ./u-boot/board/emcraft/stm32h7-som/stm32h7-splash-24bpp.bmp

  5. Reset the target board to start programming ./u-boot/board/emcraft/stm32h7-som/stm32h7-splash-24bpp.bmp via /dev/ttyUSB1.
  6. Reset the SOM by pressing the S3 button on the carrier board.
  7. Wait for the kermit utility to load the splash image (observe the progress indicators).
  8. The script will exit successfully at the end of the installation procedure:.
  9. ... 391736 bytes written to volume splash STM32H7-SOM U-Boot > [sasha_d@workbench linux-cm-stm32h7-2.5.0]$

  10. Reset the SOM by pressing the S3 button on the carrier board and confirm that the splash image is displayed on the LCD.