Building FreeRTOS Print


This application note explains how to build the U-Boot and FreeRTOS target run-time images for the Emcraft STM32H7 SOM and Starter kit.

FreeRTOS gits

Emcraft maintains the U-Boot and FreeRTOS sources for the STM32H7 SOM and Starter Kit in the following repositories:

Build Host

The FreeRTOS build runs on a Linux development host.

The following Linux distributions have been explicitly validated by Emcraft:

  • Fedora CoreOS 31;
  • Ubuntu 20.04.

Software Set-Up

The following software set-up is required on the Linux development host, in order to build U-Boot and FreeRTOS:

  1. Install the M7 toolchain.

    For Fedora:

    $ sudo dnf install arm-none-eabi-gcc-cs arm-none-eabi-binutils-cs

    For Ubuntu:

    $ sudo add-apt-repository ppa:team-gcc-arm-embedded/ppa
    $ sudo apt-get update
    $ sudo apt install gcc-arm-none-eabi binutils

  2. Install the uboot-tools package.
  3. For Fedora:

    $ sudo dnf install uboot-tools

    For Ubuntu:

    $ sudo apt install u-boot-tools

  4. Install the openss-devel package.
  5. For Fedora:

    $ sudo dnf install openssl-devel

    For Ubuntu:

    $ sudo apt install libssl-dev

  6. Install the stlink package.
  7. For Fedora:

    $ sudo dnf install stlink

    For Ubuntu:

    $ sudo apt install stlink

    Please note that the stlink package should be version 1.7.0 or higher. If the new version is not available for your distribution then build it manually from the sources, refer to

  8. Install the ckermit package.
  9. For Fedora:

    $ sudo dnf install ckermit

    For Ubuntu:

    $ sudo apt install ckermit

Build Procedure

Run the following step-wise procedure to build the U-Boot and FreeRTOS run-time images for the STM32H7 SOM and Starter Kit:

  1. Create a separate directory and clone the U-Boot and FreeRTOS repositories:
  2. $ mkdir stm32h7-som
    $ cd stm32h7-som
    $ git clone -b \ emcraft-2019.04
    $ git clone -b master-1.11.0

  3. Generate cryptographic keys to sign the bootable image:
  4. $ mkdir keys
    $ openssl genrsa -F4 -out keys/dev.key 2048
    $ openssl req -batch -new -x509 -key keys/dev.key -out keys/dev.crt

  5. Create links to the keys in the U-Boot and FreeRTOS sources:
  6. $ ln -s ../keys u-boot-upstream/
    $ ln -s ../keys STM32CubeH7/

  7. Go to the top of the U-Boot source tree:
  8. $ cd u-boot-upstream/

  9. Configure the U-Boot sources to build for the STM32H750 System-on-Module:
  10. $ make ARCH=arm CROSS_COMPILE=arm-none-eabi- stm32h7_som_nor_defconfig HOSTCC scripts/basic/fixdep ... # configuration written to .config ... $

  11. Build U-Boot for the STM32H750 System-on-Module:
  12. $ make ARCH=arm CROSS_COMPILE=arm-none-eabi- scripts/kconfig/conf --syncconfig Kconfig CHK include/config.h ... CFGCHK u-boot.cfg $

  13. Go to the top of the FreeRTOS source tree:
  14. $ cd -
    $ cd STM32CubeH7/

  15. Configure the BSP for your STM32H7-BSB revision in Projects/STM32H7_SOM/Applications/FreeRTOS/freertos_stm32h750/Inc/stm32h7xx_hal_conf.h:
    • For the STM32H7-BSB Rev 1A board, set the BSB_REV_2B constant value to 0.
    • For the STM32H7-BSB Rev 2A board, set the BSB_REV_2B constant value to 1.
  16. Build the firmware image:
  17. $ sh

Build Artifacts

The build procedure described above creates the following target run-time images. These images are ready for installation to the STM32H7 SOM:

  • stm32h7-som/u-boot-upstream/spl/u-boot-spl.bin - U-Boot SPL image;
  • stm32h7-som/u-boot-upstream/u-boot.img - U-Boot main image;
  • stm32h7-som/STM32CubeH7/Release/freertos_stm32h750.img - FreeRTOS image.

The BSP also contains the script required to install images to the STM32H7 SOM and a splash screen image:

  • stm32h7-som/u-boot-upstream/board/emcraft/stm32h7-som/stm32h7-som-prog.kermit - installation script;
  • stm32h7-som/u-boot-upstream/board/emcraft/stm32h7-som/stm32h7-splash-24bpp.bmp - splash screen image.