Building and Self-updating U-Boot on the STM32H7 SOM (uClinux)

https://voxelbotics.atlassian.net/wiki/spaces/DOC/pages/302710825 explains how to install the U-Boot firmware to the board for the first time. Having installed U-Boot, U-Boot is immediately available on the STM32H7 SOM as a primary firmware monitor.

The default U-Boot configuration is a capable Linux bootloader so typically our customers do not require re-building and re-installing U-Boot. However, certain projects still do require customizations to the U-Boot firmware, which implies making changes to the U-Boot code, rebuilding the U-Boot binary and then updating it on the STM32H7 SOM.

1. Building U-Boot

The full U-Boot source for the Emcraft STM32H7 SOM board is included in the software distribution available from the Emcraft web site. Refer to the u-boot/ sub-directory in the software distribution tree.

The key board specific-configuration files for the Emcraft STM32H7 SOM board are as follows:

  • u-boot/configs/stm32h7_som_nor_defconfig - default U-Boot configuration;

  • u-boot/include/configs/stm32h7-som.h - configuration options;

  • u-boot/board/emcraft/stm32h7-som/stm32h7-som.c - board-specific initialization code.

Step through the following procedure to build U-Boot for the Emcraft STM32H7 SOM board:

  1. On the Linux development host, activate the cross-build environment as described in https://voxelbotics.atlassian.net/wiki/spaces/DOC/pages/303169537 :

    $ . ./ACTIVATE.sh
  2. Change to the U-Boot top directory:

    $ cd u-boot
  3. Configure U-Boot for the Emcraft STM32H7 SOM board:

    $ make distclean $ make stm32h7_som_nor_defconfig
  4. Run make to create the u-boot.img binary:

2. Upgrading U-Boot "Proper" via Ethernet

The U-Boot command line interface provides a special command that can be used to self-upgrade the U-Boot image on the running target. Before you can run this command, you need to load an upgrade U-Boot binary to the target via Ethernet from a TFTP host, refer to TBD Installing Linux uImage on the STM32H7 SOM for details of the network configuration.

Step through the following procedure to upgrade the U-Boot "Proper" via Ethernet using the previously installed U-Boot:

  1. Copy the U-Boot image to the TFTP server, adjust the uboot_image environment variable, if needed:

  2. Download the U-Boot image from the TFTP server and install it to the QSPI Flash:

  3. Verify that the new U-Boot has been successfully installed. Reset the SOM by pressing the S3 button on the carrier board and confirm that the U-Boot has been upgraded:

Note that the self-upgrade sequence is a dangerous operation. You must be sure that you load and install a functional U-Boot image, which is always a tricky thing when you develop customizations to U-Boot. If something goes wrong, you can re-install the release U-Boot image as documented in https://voxelbotics.atlassian.net/wiki/spaces/DOC/pages/302710825 .