This application note explains how to install FreeRTOS to the STM32H7 System-On-Module using the UART interface as the download channel.
Refer to Understanding STM32H7 SOM Boot Architecture 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 1A soldered onto the STM32H7-BSB Rev 1A or STM32H7-BSB Rev 2A baseboard;
The microUSB cable connected to the P1 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 for STM32H7-BSB Rev 1A:
The following picture illustrates the above hardware set-up for STM32H7-BSB Rev 2A:
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 FreeRTOS .
Use the prebuilt images provided by Emcraft. The prebuilt images can be found in the location documented in Release Notes.
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 stm32h7-som]# st-flash write u-boot-upstream/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 stm32h7-som]#
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-emcraft-h7-2.0.0-g5445b38714 (Apr 19 2023 - 14:03:32 +0400) Hit 's' key to enter spl shell: Trying to boot from SPI
4. Installing U-Boot "Proper" and FreeRTOS to QSPI Flash
Step through the following procedure to install the U-Boot "Proper" and FreeRTOS 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).Run the following command on the Linux development host:
[sasha_d@workbench stm32h7-som]$ ./u-boot-upstream/board/emcraft/ stm32h7-som/stm32h7-som-prog.kermit /dev/ttyUSB1 u-boot-upstream/ u-boot.img STM32CubeH7/Release/freertos_stm32h750.img Reset the board to start programming "u-boot-upstream/u-boot.img" via "/dev/ttyUSB1"
Reset the SOM by pressing the S3 button on the carrier board.
Wait for the C-Kermit utility to load the U-Boot and FreeRTOS images (observe the progress indicators).
The script will exit successfully at the end of the installation procedure:
... Successfully programmed STM32CubeH7/Release/freertos_stm32h750.img to the rtos1 UBI volume setenv boot1_valid 1 STM32H7-SOM U-Boot > setenv boot2_active 0 STM32H7-SOM U-Boot > setenv upgrade_available 0 STM32H7-SOM U-Boot > setenv bootcount 0 STM32H7-SOM U-Boot > saveenv Saving Environment to UBI... ubi0: detaching mtd2 ... Writing to UBI... done OK STM32H7-SOM U-Boot > [sasha_d@workbench stm32h7-som]$
Verify that the U-Boot "proper" and FreeRTOS have 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-emcraft-h7-2.0.0-g5445b38714 (Apr 19 2023 - 14:03:32 +0400) Hit 's' key to enter spl shell: Trying to boot from SPI U-Boot 2019.04-emcraft-h7-2.0.0-g5445b38714 (Apr 19 2023 - 14:03:32 +0400) 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: 190 ... In: serial Out: serial Err: serial No size specified -> Using max size (2099072) Read 2099072 bytes from volume splash to d0400000 Net: Net Initialization Skipped No ethernet found. Hit any key to stop autoboot: 0 Booting Image #1 No size specified -> Using max size (4198144) Read 4198144 bytes from volume rtos1 to d0400000 ## Loading kernel from FIT Image at d0400000 ... ... Starting kernel ... STM32H7 SOM FreeRTOS CLI, www.emcraft.com Type help to view a list of available commands. CLI>
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. It is done simultaneously with installing U-Boot "Proper" and FreeRTOS, as described above. Use the following command on the Linux development host to install the stm32h7-splash-24bpp.bmp
picture as the splash screen:
[sasha_d@workbench stm32h7-som]$ ./u-boot-upstream/board/emcraft/stm32h7-som/stm32h7-som-prog.kermit /dev/ttyUSB1 u-boot-upstream/u-boot.img STM32CubeH7/Release/freertos_stm32h750.img ./u-boot-upstream/board/emcraft/stm32h7-som/stm32h7-splash-24bpp.bmp