Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

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 TST-LINK/V2 debugger/programmer connected to the 20-pin P3 ARM JTAG connector on the baseboard.

2. Connecting STM32H7-SOM Starter Kit to the Local Network

2.1. Connecting the Kit with the STM32H7-BSB Rev 1A

The Waveshare LAN8720 ETH board connected to the P2 header with a special cable. The pin-out is as follows:

...

The following picture illustrates the above hardware set-up:

...

2.2. Connecting the Kit with the STM32H7-BSB Rev 2A

Connect Ethernet cable to the J5 Ethernet connector on the baseboard.

The following picture illustrates the this hardware set-up:

...

3. Installing FreeRTOS to Flash

3.1. Installable Images

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

  1. Build the images from the sources, as documented in Building FreeRTOS .

  2. Use the prebuilt images provided by Emcraft. The prebuilt images can be found in the location documented in Release Notes.

3.2. 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:

    Code Block
    $ st-flash write u-boot-spl.bin 0x08000000
    st-flash 1.7.0-120-gbeffed4
    2023-10-03T14:41:17 INFO common.c: H74x/H75x: 128 KiB SRAM, 45069 KiB flash in at least 128 KiB pages.
    file u-boot-spl.bin md5 checksum: b262768ecdb3a41d7380ad9f3a3b1a6, stlink checksum: 0x005232a9
    2023-10-03T14:41:17 INFO common.c: Attempting to write 62085 (0xf285) bytes to stm32 address:
    134217728 (0x8000000)
    2023-10-03T14:41:17 WARN common.c: unaligned len 0xf285 -- padding with zero
    2023-10-03T14:41:18 INFO common.c: Flash page at addr: 0x08000000 erased
    2023-10-03T14:41:18 INFO common.c: Finished erasing 1 pages of 131072 (0x20000) bytes
    2023-10-03T14:41:18 INFO common.c: Starting Flash write for H7
    62086/62086 bytes written
    2023-10-03T14:41:19 INFO common.c: Starting verification of write complete
    2023-10-03T14:41:19 INFO common.c: Flash written and verified! jolly good!
  2. 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:

    Code Block
    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

3.3. 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:

    Code Block
    [sasha_d@workbench ~]$ killall picocom
    [sasha_d@workbench ~]$
  2. Run the following command on the Linux development host:

    Code Block
    [sasha_d@workbench stm32h7]$ ./u-boot-upstream/board/emcraft/stm32h7-som/stm32h7-som-prog.kermit /dev/ttyUSB1 u-boot-upstream/u-boot.img
  3. Reset the board to start programming u-boot-upstream/u-boot.img via /dev/ttyUSB1.

  4. Reset the SOM by pressing the S3 button on the carrier board.

  5. Wait for the kermit utility to load the U-Boot image (observe the progress indicators).

  6. The script will exit successfully at the end of the installation procedure:

    Code Block
    ...
    STM32H7-SOM U-Boot >
    Successfully programmed u-boot-upstream/u-boot.img to SPI NAND at 0x00000000
    ubi part system
    ...
    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 stm32h7]$
  7. Connect to the SOM console using a serial terminal utility, for example:

    Code Block
    [sasha_d@workbench ~]$ picocom -b 115200 /dev/ttyUSB1
  8. 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:

    Code Block
    U-Boot SPL 2019.04--00057-g53e40e44f4-dirty (May 01 2023 - 21:11:52 +0300)
    Hit 's' key to enter spl shell:
    Trying to boot from SPI
    
    U-Boot 2019.04--00057-g53e40e44f4-dirty (May 01 2023 - 21:11:52 +0300)
    
    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
    ubi0: default fastmap WL pool size: 95
    ubi0: attaching mtd2
    ubi0: scanning is finished
    ubi0: attached mtd2 (name "system", size 15 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: 3840, bad PEBs: 0, corrupted PEBs: 0
    ubi0: user volume: 2, internal volumes: 1, max. volumes count: 23
    ubi0: max/mean erase counter: 2/1, WL threshold: 4096, 
    image sequence number: 0
    ubi0: available PEBs: 3790, total reserved PEBs: 50, PEBs reserved 
    for bad PEB handling: 0
    Read 16384 bytes from volume env1 to d1e70620
    Read 16384 bytes from volume env2 to d1e74640
    *** 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 >
    

3.4. Configuring Network in U-Boot

Step through the following procedure to configure the network parameters in U-Boot:

  1. Set the MAC address of the Ethernet interface (you can choose an arbitrary address for development purposes but make sure that it is unique within your LAN):

    Code Block
    STM32H7-SOM U-Boot > setenv -f ethaddr
    STM32H7-SOM U-Boot > setenv ethaddr 12:34:56:78:9a:bc
    STM32H7-SOM U-Boot >
  2. Set the IP address of the board to a value that makes sense for your LAN, for example:

    Code Block
    STM32H7-SOM U-Boot > setenv ipaddr 172.17.0.66
    STM32H7-SOM U-Boot >
  3. Set the TFTP server IP address, for example:

  4. Code Block
    STM32H7-SOM U-Boot > setenv serverip 172.17.0.1
    STM32H7-SOM U-Boot >
  5. Save the network parameters in the QSPI Flash:

    Code Block
    STM32H7-SOM U-Boot > saveenv
    Saving Environment to UBI... ubi0: detaching mtd2
    ...
    Writing to redundant UBI... done
    OK
    STM32H7-SOM U-Boot >
  6. Try to download a non-existent file from the TFTP server and confirm that the File not found error is reported:

    Code Block
    STM32H7-SOM U-Boot > tftp dummy
    Using ethernet@40028000 device
    TFTP from server 172.17.0.1; our IP address is 172.17.0.66
    Filename 'dummy'.
    Load address: 0xd0400000
    Loading: *                                                                      
    TFTP error: 'File not found' (1)
    ...
    Copy the FreeRTOS image to the TFTP server and try to download it:
    
    STM32H7-SOM U-Boot > tftp freertos_stm32h750.img
    ethernet@40028000 Waiting for PHY auto negotiation to complete. done
    Using ethernet@40028000 device
    TFTP from server 172.17.0.1; our IP address is 172.17.0.66
    Filename 'freertos_stm32h750.img'.
    Load address: 0xd0400000
    Loading: ######
             14.6 KiB/s
    done
    Bytes transferred = 79070 (134de hex)
    STM32H7-SOM U-Boot >

3.5. Installing FreeRTOS to QSPI Flash

Step through the following procedure to install the FreeRTOS to the QSPI Flash:

  1. Create the pair of the redundant 4 MB UBI volumes for the FreeRTOS images (this step can be skipped if the volumes have been already created earlier):

    Code Block
    STM32H7-SOM U-Boot > ubi create rtos1 0x400000
    Creating dynamic volume rtos1 of size 4194304
    STM32H7-SOM U-Boot > ubi create rtos2 0x400000
    Creating dynamic volume rtos2 of size 4194304
    STM32H7-SOM U-Boot >
  2. Initialize and save the boot variables:

    Code Block
    STM32H7-SOM U-Boot > 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 redundant UBI... done
    OK
    STM32H7-SOM U-Boot >
  3. Download the FreeRTOS image from the TFTP server:

    Code Block
    STM32H7-SOM U-Boot > tftp freertos_stm32h750.img
    ethernet@40028000 Waiting for PHY auto negotiation to complete. done
    Using ethernet@40028000 device
    TFTP from server 172.17.0.1; our IP address is 172.17.0.66
    Filename 'freertos_stm32h750.img'.
    Load address: 0xd0400000
    Loading: ######
             14.6 KiB/s
    done
    Bytes transferred = 79070 (134de hex)
    STM32H7-SOM U-Boot >
  4. Install the FreeRTOS image to the QSPI Flash:

    Code Block
    STM32H7-SOM U-Boot > ubi write $loadaddr rtos1 $filesize
    79070 bytes written to volume rtos1
    STM32H7-SOM U-Boot >
  5. Verify that the FreeRTOS 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:

    Code Block
    U-Boot SPL 2019.04--00057-g53e40e44f4-dirty (May 01 2023 - 21:11:52 +0300)
    Hit 's' key to enter spl shell:
    Trying to boot from SPI
    
    U-Boot 2019.04--00057-g53e40e44f4-dirty (May 01 2023 - 21:11:52 +0300)
    
    Model: STMicroelectronics STM32H7 SOM                [15/1941]
    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
    ubi0: default fastmap WL pool size: 95
    ubi0: attaching mtd2
    ubi0: scanning is finished
    ubi0: attached mtd2 (name "system", size 15 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: 3840, 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: 1674, total reserved PEBs: 2166, PEBs reserved 
    for bad PEB handling: 0
    Read 16384 bytes from volume env1 to d1e70620
    Read 16384 bytes from volume env2 to d1e74640
    OK
    In:    serial
    Out:   serial
    Err:   serial
    Volume splash not found!
    splash_screen_display: ubi_volume_read error=19
    Net:   eth0: ethernet@40028000
    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 ...
       Using 'config-1' configuration
       Verifying Hash Integrity ... sha1,rsa2048:dev+ OK
       Trying 'kernel' kernel subimage
         Description:  FreeRTOS Image
         Type:         Kernel Image
         Compression:  uncompressed
         Data Start:   0xd04000d0
         Data Size:    77376 Bytes = 75.6 KiB
         Architecture: ARM
         OS:           Linux
         Load Address: 0xd0600000
         Entry Point:  0xd0610279
         Hash algo:    sha1
         Hash value:   413d02bfc42ad673db4f077d8f84dd4e48d2de79
       Verifying Hash Integrity ... sha1+ OK
       Loading Kernel Image ... OK
    
    Starting kernel ...
    
    STM32H7 SOM FreeRTOS CLI, www.emcraft.com
    Type help to view a list of available commands.
    CLI>

3.6. 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. Create the 2 MB UBI volume for the splash screen image (this step can be skipped if the volume has been already created earlier):

    Code Block
    STM32H7-SOM U-Boot > ubi create splash 0x200000
    Creating dynamic volume splash of size 2097152
    STM32H7-SOM U-Boot >
  2. Download the splash screen image from the TFTP server:

    Code Block
    STM32H7-SOM U-Boot > tftp stm32h7-splash-24bpp.bmp
    Using ethernet@40028000 device
    TFTP from server 172.17.0.1; our IP address is 172.17.0.66
    Filename 'stm32h7-splash-24bpp.bmp'.
    Load address: 0xd0400000
    Loading: ###########################
             1.7 MiB/s
    done
    Bytes transferred = 391736 (5fa38 hex)
    STM32H7-SOM U-Boot >
  3. Install the splash screen image to the QSPI Flash:

    Code Block
    STM32H7-SOM U-Boot > ubi write $loadaddr splash $filesize
    391736 bytes written to volume splash
    STM32H7-SOM U-Boot >

4. Upgrading U-Boot "Proper" via Ethernet

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

  1. Download the U-Boot image from the TFTP server:

    Code Block
    STM32H7-SOM U-Boot > tftp u-boot.img
    ethernet@40028000 Waiting for PHY auto negotiation to complete. done
    Using ethernet@40028000 device
    TFTP from server 172.17.0.1; our IP address is 172.17.0.66
    Filename 'u-boot.img'.
    Load address: 0xd0400000
    Loading: ##################################
             91.8 KiB/s
    done
    Bytes transferred = 490985 (77de9 hex)
    STM32H7-SOM U-Boot >
  2. Install the U-Boot image to the QSPI Flash:

    Code Block
    STM32H7-SOM U-Boot > mtd erase u-boot
    Erasing 0x00000000 ... 0x000fffff (256 eraseblock(s))
    STM32H7-SOM U-Boot > mtd write u-boot $loadaddr 0 $filesize
    Writing 490985 byte(s) at offset 0x00000000
    STM32H7-SOM U-Boot >

5. Troubleshooting Ethernet

Here are some troubleshooting tips, in case tftpboot does not work for you from U-Boot:

...