This application note explains how to install the U-Boot firmware to the STM32H7 SOM. Refer to Understanding STM32H7 SOM Boot Architecture (uClinux) as a pre-requisite to understanding the installation procedure.
1. 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.
2. Installable Images
The images to be installed onto the STM32H7 SOM can be obtained using one of the two approaches, as follows:
Build the images from the sources, as documented in: Building and self-updating U-Boot on the STM32H7 SOM.
Use the prebuilt images and the Kermit script provided by Emcraft.
3. 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:
Run the following command on the Linux development host:
[root@workbench linux-cm-stm32h7-2.6.1]# st-flash write u-boot/spl/\ u-boot-spl.bin 0x08000000 st-flash 1.7.0-120-gbeffed4 2024-05-03T05:15:24 INFO common.c: H74x/H75x: 128 KiB SRAM, 22633 KiB flash in at least 128 KiB pages. file u-boot-spl.bin md5 checksum: d4d01d8f8aa453144bbe499de1181, stlink checksum: 0x0050b4bb 2024-05-03T05:15:24 INFO common.c: Attempting to write 61229 (0xef2d) bytes to stm32 address: 134217728 (0x8000000) 2024-05-03T05:15:24 WARN common.c: unaligned len 0xef2d -- padding with zero 2024-05-03T05:15:25 INFO common.c: Flash page at addr: 0x08000000 erased 2024-05-03T05:15:25 INFO common.c: Finished erasing 1 pages of 131072 (0x20000) bytes 2024-05-03T05:15:25 INFO common.c: Starting Flash write for H7 61230/61230 bytes written 2024-05-03T05:15:27 INFO common.c: Starting verification of write complete 2024-05-03T05:15:27 INFO common.c: Flash written and verified! jolly good! [root@workbench linux-cm-stm32h7-2.6.1]#
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:
U-Boot SPL 2019.04- (May 03 2024 - 06:09:05 +0000) Hit 's' key to enter spl shell: Trying to boot from SPI
4. Installing U-Boot "Proper" to QSPI Flash
Step through the following procedure to install the U-Boot "Proper" to the QSPI Flash:
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:[sasha_d@workbench ~]$ killall picocom [sasha_d@workbench ~]$
Run the following command on the Linux development host:
[sasha_d@workbench linux-cm-stm32h7-2.6.1]$ ./u-boot/board/emcraft/stm32h7-som/stm32h7-som-uboot-install.kermit /dev/ttyUSB1 u-boot/u-boot.img
Reset the target board to start programming
u-boot/u-boot.img
via/dev/ttyUSB1
.Reset the SOM by pressing the S3 button on the carrier board.
Wait for the
kermit
utility to load the U-Boot image (observe the progress indicators).The script will exit successfully at the end of the installation procedure:
... 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.6.1]$
Connect to the SOM console using a serial terminal utility, for example:
[sasha_d@workbench ~]$ picocom -b 115200 /dev/ttyUSB1
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:
U-Boot SPL 2019.04- (May 03 2024 - 06:09:05 +0000) Hit 's' key to enter spl shell: Trying to boot from SPI U-Boot 2019.04- (May 03 2024 - 06:09:05 +0000) Model: STMicroelectronics STM32H7 SOM DRAM: 32 MiB SF: Detected n25q512ax3 with page size 256 Bytes, erase size 4 KiB, total 64 MiB Flash: 128 KiB MMC: STM32 SDMMC2: 0 Loading Environment from UBI... ubi0: default fastmap pool size: 256 ubi0: default fastmap WL pool size: 128 ubi0: attaching mtd2 ubi0: scanning is finished ubi0: attached mtd2 (name "system", size 31 MiB) ubi0: PEB size: 4096 bytes (4 KiB), LEB size: 3968 bytes ubi0: min./max. I/O unit sizes: 1/256, sub-page size 1 ubi0: VID header offset: 64 (aligned 64), data offset: 128 ubi0: good PEBs: 7936, bad PEBs: 0, corrupted PEBs: 0 ubi0: user volume: 4, internal volumes: 1, max. volumes count: 23 ubi0: max/mean erase counter: 2/1, WL threshold: 4096, image sequence number: 0 ubi0: available PEBs: 1518, total reserved PEBs: 6418, PEBs reserved for bad PEB handling: 0 Read 16384 bytes from volume env1 to d196f520 Read 16384 bytes from volume env2 to d1973540 *** 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 >
5. 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:
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:[sasha_d@workbench ~]$ killall picocom [sasha_d@workbench ~]$
Run the following command on the Linux development host:
[sasha_d@workbench linux-cm-stm32h7-2.6.1]$ ./u-boot/board/emcraft/stm32h7-som/stm32h7-som-splash-install.kermit /dev/ttyUSB1 ./u-boot/board/emcraft/stm32h7-som/stm32h7-splash-24bpp.bmp
Reset the target board to start programming
./u-boot/board/emcraft/stm32h7-som/stm32h7-splash-24bpp.bmp
via/dev/ttyUSB1
.Reset the SOM by pressing the S3 button on the carrier board.
Wait for the
kermit
utility to load the splash image (observe the progress indicators).The script will exit successfully at the end of the installation procedure:.
... 391736 bytes written to volume splash STM32H7-SOM U-Boot > [sasha_d@workbench linux-cm-stm32h7-2.6.1]$
Reset the SOM by pressing the S3 button on the carrier board and confirm that the splash image is displayed on the LCD.