Installing Linux uImage on the STM32H7 SOM (uClinux)

This application note explains how to install (or update) a bootable Linux image (rootfs.uImage) to the STM32H7 System-On-Module using the Ethernet interface as the download channel.

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 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 (optional);

  • The Ethernet cable connected to the J5 connector on the baseboard.

The following picture illustrates the above hardware set-up:

NOTE: The STM32H7-BSB Rev 1A/2A baseboards doesn't have the RJ-45 connector so the Waveshare LAN8720 ETH board should be connected to the P2 header with a special cable. The pin-out is as follows:

STM32H7

Function

BSB

ETH

Name

LAN8720

Comment

 

3V3

P2.1

P2.1

VCC

 

 

 

3V3

P2.2

P2.2

VCC

 

 

 

GND

P2.3

P2.3

GND

 

 

 

GND

P2.4

P2.4

GND

 

 

PC1

ETH_MDC

P2.5

P2.5

MDC

 

 

PA2

ETH_MDIO

P2.6

P2.6

MDIO

MDIO

 

PA7

RMII_CRS_DV

P2.7

P2.7

CRS_DV

CRS_DV/MODE2

 

PA1

RMII_REF_CLK

P2.8

P2.8

R_RXCLK

 

50MHz from LAN8720

PC5

RMII_RXD1

P2.9

P2.9

RXD1

RXD1/MODE1

 

PC4

RMII_RXD0

P2.10

P2.10

RXD0

RXD0/MODE0

 

PG13

RMII_TXD0

P2.11

P2.11

TXD0

TXD0

 

PG11

RMII_TXEN

P2.12

P2.12

TX_EN

TXEN

 

PG10

-

P2.13

-

-

-

 

PG12

RMII_TXD1

P2.14

P2.14

TXD1

TXD1

 

The following picture illustrates the hardware set-up for the STM32H7-BSB Rev 1A/2A baseboards:

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 Linux uImage

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

  1. Build the image from the sources, as documented in .

  2. Use the prebuilt image provided by Emcraft.

3. Configuring Network in U-Boot

The Linux image is installed from U-Boot using the Ethernet interface as the download channel.

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):

    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:

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

    STM32H7-SOM U-Boot > setenv serverip 192.168.0.3 STM32H7-SOM U-Boot >
  4. Save the network parameters in the QSPI Flash:

  5. Try to download a non-existent file from the TFTP server and confirm that the "File not found" error is reported:

  6. Copy the Linux image to the TFTP server and try to download it:

4. Installing Linux to QSPI Flash

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

  1. Copy the Linux image to the TFTP server, adjust the image environment variable, if needed:

  2. Check the image_vol_size environment variable, which specifies the size of the UBI volume containing the Linux image. Note that this size should correlate with the size of the system MTD partition configured by CONFIG_MTDPARTS_DEFAULT in u-boot/configs/stm32h7_som_nor_defconfig:

  3. Download the Linux image from the TFTP server and install it to the QSPI Flash:

5. Troubleshooting Ethernet

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

  • As trivial as it sounds make sure that the board is connected to the LAN with an Ethernet cable.

  • Suppose you are still not getting your file from the TFTP server. It is possible that the problem is on the host side - you must set up a TFTP server correctly. Just google for "how to set up a tftp server" and follow the advice from some top articles.

  • Make sure you have copied a file you are trying to download to the TFTP server directory on the host.

  • Disable the firewall on the host since get enabled, it will block TFTP requests from the target.

  • On the target, make sure that you have set ipaddr and serverip correctly. Check ethaddr and make sure that you don't have another embedded board (eg. another STM32H7 SOM) configured for the same MAC address.