Running Linux on STM32H753I-EVAL in 5 Minutes Print

 

Hardware Setup

Prepare hardware as described below:

  1. Change the JP7/JP8 jumpers’ settings to the "2-3" position to access the board serial console via the USB composite device.
  2. Set the JP10 jumper to supply the STM32H753I-EVAL board through the jack (CN10) and connect the 5V DC power adapter to the jack.
  3. Connect the microUSB cable to the CN23 connector on the STM32H753I-EVAL board and the development host to provide access to the serial console and the embedded ST-LINK debugger/programmer that are required to run Linux (uClinux) on the STM32H753I-EVAL. The serial console operates in U-Boot and uCLinux with the following parameters:
    1. Baud rate - 115200
    2. Data bits - 8
    3. Stop bits - 1
    4. Parity - none
  4. Connect Ethernet cable to the CN1 connector on the STM32H753I-EVAL board.
  5. The MicroSD Card used to boot the system on the STM32H753I-EVAL board. Since U-Boot environment is located at the 0x80000..0x100000 range of the raw SD Card address-space, the SD Card must be partitioned properly, so that U-Boot does not overwrite the file system on the partition. The SD Card must contain at least one partition started at a at least 1MB raw offset. The partition must be FATFS-formatted. Usually, a new SD Card satisfies these requirements by default so most likely no special preparations are required unless the card has been reformatted in some other way in other projects.

Installing U-Boot to STM32H753I-EVAL Board

  1. Download the prebuilt U-Boot image from the Emcraft web site:
  2. Run the following command on the Linux development host:
  3. $ st-flash write u-boot.bin 0x08000000
    st-flash 1.7.0-246-gc721751
    2023-08-09T10:52:47 INFO common.c: STM32H74x_H75x: 128 KiB SRAM, 2048 KiB flash in at least 128 KiB pages. file u-boot.bin md5 checksum: 9da4d3227766882d2d2f5d9f914117, stlink checksum: 0x01a79b48
    2023-08-09T10:52:47 INFO common_flash.c: Attempting to write 320790 (0x4e516) bytes to stm32 address:
    134217728 (0x8000000)
    -> Flash page at 0x8000000 erased (size: 0x20000)
    -> Flash page at 0x8020000 erased (size: 0x20000)
    -> Flash page at 0x8040000 erased (size: 0x20000)

    2023-08-09T10:52:50 INFO flashloader.c: Starting Flash write for H7
    320790/320790 bytes written
    2023-08-09T10:52:57 INFO common_flash.c: Starting verification of write complete
    2023-08-09T10:53:00 INFO common_flash.c: Flash written and verified! jolly good!
    $

  4. Connect to the STM32H753I-EVAL console using a serial terminal utility, for example:
  5. $ picocom -b 115200 /dev/ttyACM0

  6. Verify that the U-Boot has been successfully installed. Reset the board and confirm that the following output appears on the serial UART console:
  7. U-Boot 2019.04- (Aug 09 2023 - 10:31:06 +0000)

    Model: STMicroelectronics STM32H753i-EVAL board
    DRAM: 32 MiB
    Flash: 2 MiB
    MMC: STM32 SDMMC2: 0
    *** Warning - bad CRC, using default environment

    In: serial@40011000
    Out: serial@40011000
    Err: serial@40011000
    Net: eth0: ethernet@40028000
    Hit any key to stop autoboot: 0
    STM32H7-EVAL U-Boot >

Installing Linux to STM32H753I-EVAL Board

  1. Download the prebuilt rootfs project image from the Emcraft web site:
  2. Plug in the MicroSD card to the cross-development host.
  3. Find out a /dev/sdX device the system has assigned to your SD Card:
  4. $ dmesg | tail
    [ 456.470775] usbcore: registered new interface driver usb-storage
    [ 456.482079] usbcore: registered new interface driver uas
    [ 457.501716] scsi 3:0:0:0: Direct-Access Generic STORAGE DEVICE 0821 PQ: 0 ANSI: 6
    [ 457.508132] sd 3:0:0:0: Attached scsi generic sg2 type 0
    [ 457.715113] sd 3:0:0:0: [sdb] 15446016 512-byte logical blocks: (7.91 GB/7.37 GiB)
    [ 457.733992] sd 3:0:0:0: [sdb] Write Protect is off
    [ 457.733999] sd 3:0:0:0: [sdb] Mode Sense: 23 00 00 00
    [ 457.753808] sd 3:0:0:0: [sdb] Write cache: disabled, read cache: enabled, doesn't support DPO or FUA
    [ 457.840489] sdb: sdb1
    [ 457.840845] sd 3:0:0:0: [sdb] Attached SCSI removable disk

  5. Install the rootfs project to the microSD card:
  6. $ cd $INSTALL_ROOT/projects/rootfs
    $ mount /dev/sdb1 /mnt/sdcard
    $ cp roofts.uImage /mnt/sdcard

  7. Insert the micro SD card in the board and power the board. The system should boot up on the board:
  8. U-Boot 2019.04- (Aug 09 2023 - 10:31:06 +0000) Model: STMicroelectronics STM32H753i-EVAL board DRAM: 32 MiB Flash: 2 MiB MMC: STM32 SDMMC2: 0 *** Warning - bad CRC, using default environment In: serial@40011000 Out: serial@40011000 Err: serial@40011000 Net: eth0: ethernet@40028000 Hit any key to stop autoboot: 0 8192999 bytes read in 597 ms (13.1 MiB/s) ## Booting kernel from Legacy Image at d0c00000 ... Image Name: Linux-6.1.28-gde22b499e426 Image Type: ARM Linux Multi-File Image (uncompressed) Data Size: 8192935 Bytes = 7.8 MiB Load Address: d0008000 Entry Point: d0008001 Contents: Image 0: 8176896 Bytes = 7.8 MiB Image 1: 16027 Bytes = 15.7 KiB Verifying Checksum ... OK ## Loading init Ramdisk from multi component Legacy Image at d0c00000 ... ## Flattened Device Tree from multi component Image at D0C00000 Booting using the fdt at 0xd13cc54c Loading Multi-File Image ... OK Loading Ramdisk to d1a7f000, end d1a82e9b ... OK ERROR: reserving fdt memory region failed (addr=d1c00000 size=300000) ERROR: reserving fdt memory region failed (addr=d1f00000 size=100000) Loading Device Tree to d1a78000, end d1a7ee9a ... OK Starting kernel ... [ 0.000000] Booting Linux on physical CPU 0x0 [ 0.000000] Linux version 6.1.28-gde22b499e426 (sasha_d @workbench.emcraft.com) (arm-none-eabi-gcc (GNU Arm Embedded Toolchain 10.3-2021.10) 10.3.1 20210824 (release), GNU ld (GNU Arm Embedded Toolchain 10.3-2021.10) 2.36.1.20210621) #11 PREEMPT Fri Aug 11 13:48:10 UTC 2023 …… [ 2.350520] ARMv7-M VFP coprocessor found [ 2.354085] VFP: Double precision floating points are supported [ 2.359782] mmc0: host does not support reading read-only switch, assuming write-enable [ 2.370286] input: gpio-keys as /devices/platform/gpio-keys/input/input0 [ 2.380873] mmc0: new high speed SD card at address 0002 [ 2.401454] Freeing unused kernel image (initmem) memory: 3108K [ 2.406092] This architecture does not have kernel memory protection. [ 2.414048] mmcblk0: mmc0:0002 00000 487 MiB [ 2.420784] Run /init as init process [ 2.423762] mmcblk0: p1 [ 2.427125] with arguments: [ 2.428765] /init [ 2.430965] with environment: [ 2.434338] HOME=/ [ 2.436465] TERM=linux [ 2.439183] consoleblank=0 [ 2.442305] ip=192.168.0.168:192.168.0.3::::eth0:off init started: BusyBox v1.24.2 (2023-08-11 13:47:34 UTC) [43] Jan 01 00:00:02 Running in background / # [ 2.833395] stm32-dwmac 40028000.ethernet eth0: Register MEM_TYPE_PAGE_POOL RxQ-0 [ 2.922113] stm32-dwmac 40028000.ethernet eth0: PHY [stmmac-0:00] driver [Microchip LAN8742] (irq=POLL) [ 2.940329] stm32-dwmac 40028000.ethernet eth0: No Safety Features support found [ 2.946509] stm32-dwmac 40028000.ethernet eth0: IEEE 1588-2008 Advanced Timestamp supported [ 2.955706] stm32-dwmac 40028000.ethernet eth0: registered PTP clock [ 2.962801] stm32-dwmac 40028000.ethernet eth0: configuring for phy/rmii link mode [ 5.062949] stm32-dwmac 40028000.ethernet eth0: Link is Up - 100Mbps/Full - flow control rx/tx [ 5.070320] IPv6: ADDRCONF(NETDEV_CHANGE): eth0: link becomes ready

Ethernet Driver Support

  1. Power cycle the board. While U-Boot is coming up, press any key on the serial console to enter the U-Boot command line interface:
  2. U-Boot 2019.04- (Aug 09 2023 - 10:31:06 +0000) Model: STMicroelectronics STM32H753i-EVAL board DRAM: 32 MiB Flash: 2 MiB MMC: STM32 SDMMC2: 0 Loading Environment from MMC... OK In: serial@40011000 Out: serial@40011000 Err: serial@40011000 Net: eth0: ethernet@40028000 Hit any key to stop autoboot: 0 STM32H7-EVAL U-Boot >

  3. From the U-Boot command line interface, reset to the default environment:
  4. => env default -a ## Resetting to default environment =>

  5. Set the ethaddr, ipaddr and serverip U-Boot environment variables:
  6. STM32H7-EVAL U-Boot > setenv ethaddr 56:78:9a:bc:12:34 STM32H7-EVAL U-Boot > setenv ipaddr 192.168.0.168 STM32H7-EVAL U-Boot > setenv serverip 192.168.0.3 STM32H7-EVAL U-Boot > saveenv Saving Environment to MMC... Writing to MMC(0)... OK STM32H7-EVAL U-Boot >

  7. ping the development host from the target board:
  8. STM32H7-EVAL U-Boot > ping 192.168.0.3
    ethernet@40028000 Waiting for PHY auto negotiation to complete. done
    Using ethernet@40028000 device
    host 192.168.0.3 is alive
    STM32H7-EVAL U-Boot >

  9. Load rootfs.uImage using the U-Boot tftp command:
  10. STM32H7-EVAL U-Boot > tftp stm32h753i-eval/rootfs.uImage Using ethernet@40028000 device TFTP from server 192.168.0.3; our IP address is 192.168.0.168 Filename 'stm32h753i-eval/rootfs.uImage'. Load address: 0xd0c00000 Loading: ################################################################# ################################################################# ################################################################# ################################################################# ################################################################# ################################################################# ################################################################# ################################################################# ####################################### 312.5 KiB/s done Bytes transferred = 8192999 (7d03e7 hex) STM32H7-EVAL U-Boot >

  11. Reset the board and let it boot up to the Linux shell:
  12. => reset resetting ... U-Boot 2019.04- (Aug 09 2023 - 10:31:06 +0000) ..... Starting kernel ... [ 0.000000] Booting Linux on physical CPU 0x0 [ 0.000000] Linux version 6.1.28-gde22b499e426 (sasha_d@workbench. emcraft.com) (arm-none-eabi-gcc (GNU Arm Embedded Toolchain 10.3-2021.10) 10.3.1 20210824 (release), GNU ld (GNU Arm Embedded Toolchain 10.3-2021.10) 2.36.1.20210621) #11 PREEMPT Fri Aug 11 13:48:10 UTC 2023 ..... / # [ 2.833242] stm32-dwmac 40028000.ethernet eth0: Register MEM_TYPE_ PAGE_POOL RxQ-0 [ 2.922249] stm32-dwmac 40028000.ethernet eth0: PHY [stmmac-0:00] driver [Microchip LAN8742] (irq=POLL) [ 2.940459] stm32-dwmac 40028000.ethernet eth0: No Safety Features support found [ 2.946635] stm32-dwmac 40028000.ethernet eth0: IEEE 1588-2008 Advanced Timestamp supported [ 2.955814] stm32-dwmac 40028000.ethernet eth0: registered PTP clock [ 2.962933] stm32-dwmac 40028000.ethernet eth0: configuring for phy/ rmii link mode [ 5.063089] stm32-dwmac 40028000.ethernet eth0: Link is Up - 100Mbps/ Full - flow control rx/tx [ 5.070469] IPv6: ADDRCONF(NETDEV_CHANGE): eth0: link becomes ready

  13. From the development host validate that the target board is visible using ping:
  14. $ ping 192.168.0.168 -c 5 PING 192.168.0.168 (192.168.0.168) 56(84) bytes of data. 64 bytes from 192.168.0.168: icmp_seq=1 ttl=64 time=1.69 ms 64 bytes from 192.168.0.168: icmp_seq=2 ttl=64 time=0.821 ms 64 bytes from 192.168.0.168: icmp_seq=3 ttl=64 time=0.885 ms 64 bytes from 192.168.0.168: icmp_seq=4 ttl=64 time=0.850 ms 64 bytes from 192.168.0.168: icmp_seq=5 ttl=64 time=0.850 ms --- 192.168.0.168 ping statistics --- 5 packets transmitted, 5 received, 0% packet loss, time 71ms rtt min/avg/max/mdev = 0.821/1.019/1.692/0.338 ms $

  15. From the target board, validate that the development host is visible using ping:
  16. / # ping 192.168.0.3 -c 5 PING 192.168.0.3 (192.168.0.3): 56 data bytes 64 bytes from 192.168.0.3: seq=0 ttl=128 time=3.759 ms 64 bytes from 192.168.0.3: seq=1 ttl=128 time=13.771 ms 64 bytes from 192.168.0.3: seq=2 ttl=128 time=1.391 ms 64 bytes from 192.168.0.3: seq=3 ttl=128 time=2.265 ms 64 bytes from 192.168.0.3: seq=4 ttl=128 time=1.708 ms --- 192.168.0.3 ping statistics --- 5 packets transmitted, 5 packets received, 0% packet loss round-trip min/avg/max = 1.391/4.578/13.771 ms / #

TCP/IP Stack Support

With uClinux running on the STM32H753I-EVAL, you get the full Linux TCP/IP stack (kernel version 6.1.28). User-space POSIX APIs are provided by the uClibc library. Key user-space networking tools and utilities are available from the multi-call busybox. Additional tools and packages, such as for instance the SSH dropbear server, can be built specifically for uClinux. All in all, you have the powerful Linux TCP/IP stack at your disposal.

  1. From the development host validate that the STM32H753I-EVAL is visible using ping:
  2. $ ping 192.168.0.168 -c 5
    PING 192.168.0.168 (192.168.0.168) 56(84) bytes of data.
    64 bytes from 192.168.0.168: icmp_seq=1 ttl=64 time=1.69 ms
    64 bytes from 192.168.0.168: icmp_seq=2 ttl=64 time=0.821 ms
    64 bytes from 192.168.0.168: icmp_seq=3 ttl=64 time=0.885 ms
    64 bytes from 192.168.0.168: icmp_seq=4 ttl=64 time=0.850 ms
    64 bytes from 192.168.0.168: icmp_seq=5 ttl=64 time=0.850 ms 

    --- 192.168.0.168 ping statistics ---
    5 packets transmitted, 5 received, 0% packet loss, time 71ms
    rtt min/avg/max/mdev = 0.821/1.019/1.692/0.338 ms
    $

  3. ping the development host from the STM32H753I-EVAL:
  4. / # ping 192.168.0.3 -c 5
    PING 192.168.0.3 (192.168.0.3): 56 data bytes
    64 bytes from 192.168.0.3: seq=0 ttl=128 time=3.759 ms
    64 bytes from 192.168.0.3: seq=1 ttl=128 time=13.771 ms
    64 bytes from 192.168.0.3: seq=2 ttl=128 time=1.391 ms
    64 bytes from 192.168.0.3: seq=3 ttl=128 time=2.265 ms
    64 bytes from 192.168.0.3: seq=4 ttl=128 time=1.708 ms

    --- 192.168.0.3 ping statistics ---
    5 packets transmitted, 5 packets received, 0% packet loss
    round-trip min/avg/max = 1.391/4.578/13.771 ms
    / #

  5. On the target, start the telnetd daemon to allow connections to the STM32H753I-EVAL:
  6. / # telnetd
    / # ps | grep telnetd
    72 root 724 S {busybox} telnetd
    74 root 724 S grep telnetd
    / #

  7. Connect to the target from the development host using telnet. The target is configured to accept the 123 password for root:
  8. [sasha_d@fedora ~]$ telnet 192.168.0.168
    Trying 192.168.0.168...
    Connected to 192.168.0.168.
    Escape character is '^]'.

    (none) login: root
    Password:
    / # ls
    bin etc httpd lib proc sbin tmp var
    dev hello.ko init mnt root sys usr
    / # exit
    Connection closed by foreign host.
    $

  9. The dropbear SSH daemon starts automatically on the target. Verify that dropbear allows secure connections to the target:
  10. / # ps | grep dropbear
    43 root 712 S dropbear -R
    81 root 724 S grep dropbear
    / #

  11. Connect to the target from the development host using ssh. The first connection takes several seconds to establish as the STM32H753I-EVAL runs computation-extensive key calculations. Again, enter 123 on the password prompt:
  12. $ ssh root@192.168.0.168 The authenticity of host '192.168.0.168 (192.168.0.168)' can't be established. ECDSA key fingerprint is SHA256:SY2N+sEZ38HwVhP06p/H63FERYlJ ACTITDL7eYMFBFY. Are you sure you want to continue connecting (yes/no/[fingerprint])? yes Warning: Permanently added '192.168.0.168' (ECDSA) to the list of known hosts. root@192.168.0.168's password: / # ls bin etc httpd lib proc sbin tmp var dev hello.ko init mnt root sys usr / # exit Connection to 192.168.0.168 closed. $

  13. On the target, enable access to the Internet by configuring a default gateway. Note also that the system makes use of the public name server provided by Google:
  14. / # route add default gw 192.168.0.1
    / # cat /etc/resolv.conf
    # This configuration makes use of the Google public DNS server.
    # If you would like to use something else, replace with the IP
    # of your DNS server

    nameserver 8.8.8.8
    / #

  15. Use ntpd to synchronize the time on the target with the time provided by a public server:
  16. / # date
    Thu Jan 1 00:00:28 UTC 1970
    / # ntpd -p 0.fedora.pool.ntp.org
    [ 40.891171] random: crng init done
    / # sleep 5
    / # date
    Fri Aug 11 20:46:15 UTC 2023
    / #

  17. Use wget to download a file from a remote server:
  18. / # wget ftp://ftp.gnu.org/README
    Connecting to ftp.gnu.org (209.51.188.20:21)
    README 100% |*******************************| 2748 0:00:00 ETA
    / # cat README
    This is ftp.gnu.org, the FTP server of the the GNU project.
    ...

  19. Start the HTTP daemon:
  20. httpd -h /httpd/html/
    / #

  21. From a local host, open a Web browser to the STM32H753I-EVAL and watch the demo web page provided by the target. The STM32H753I-EVAL shows the current time and date as well as the list of the currently running processes:

Support USB Host Stack Interface

  1. Attach a USB Flash device to the CN14 USB OTG2 HS connector using an appropriate cable. Verify that it is automatically detected and can be mounted:
  2. / # [ 3903.030069] dwc2 40040000.usb: new device is full-speed [ 3903.621224] usb 1-1: new high-speed USB device number 2 using dwc2 [ 3903.882727] usb 1-1: New USB device found, idVendor=0951, idProduct=160e, bcdDevice= 1.10 [ 3903.889549] usb 1-1: New USB device strings: Mfr=1, Product=2, SerialNumber =3 [ 3903.896811] usb 1-1: Product: DataTraveler 2.0 [ 3903.901177] usb 1-1: Manufacturer: Kingston [ 3903.905257] usb 1-1: SerialNumber: 5B84160009F8 [ 3903.912384] usb-storage 1-1:1.0: USB Mass Storage device detected [ 3903.918944] scsi host0: usb-storage 1-1:1.0 [ 3904.983539] scsi 0:0:0:0: Direct-Access Kingston DataTraveler 2.0 PMAP PQ: 0 ANSI: 0 CCS [ 3905.237389] sd 0:0:0:0: [sda] 1953792 512-byte logical blocks: (1.00 GB/954 MiB) [ 3905.245051] sd 0:0:0:0: [sda] Write Protect is off [ 3905.248473] sd 0:0:0:0: [sda] Mode Sense: 23 00 00 00 [ 3905.254490] sd 0:0:0:0: [sda] No Caching mode page found [ 3905.258821] sd 0:0:0:0: [sda] Assuming drive cache: write through [ 3905.272896] sda: sda1 [ 3905.275782] sd 0:0:0:0: [sda] Attached SCSI removable disk / # mount /dev/sda1 /mnt/usbflash/ / # ls -la /mnt/usbflash/ drwxr-xr-x 3 root root 4096 Jan 1 00:00 . drwxrwxrwx 8 root root 0 Aug 11 2023 .. -rwxr-xr-x 1 root root 319 Jan 1 1980 data.log / #

  3. Unmount the USB Flash device:
  4. / # umount /mnt/usbflash/
    / #

Support Loading / Unloading Kernel Modules

  1. From the Linux shell, load the demo kernel module:
  2. / # insmod hello.ko
    [ 4307.451610] Hello, world
    / #

  3. Show the status of the loaded kernel modules:
  4. / # lsmod
    Module Size Used by Not tainted
    hello 761 0
    / #

  5. Unload the module from the Linux kernel:
  6. / # rmmod hello
    [ 4355.168819] Goodbye, world
    / #