STM32MP2 EV1: Booting Linux from SD Card

 

Use the procedure documented below to install the U-Boot firmware, Linux kernel and filesystem images to an SD Card the STM32MP2 module will be bootable from. Having completed the installation, the STM32MP2 SOM will boot to Linux from the SD Card on next reset / power on.

Please note that the installation will erase files previously installed on your SD Card. The SD Card size should be at least 8GB for the Linux kernel and filesystem images to fit on the card.

Here is the procedure:

  1. Insert SD Card to the board.

  2. Follow the instructions in the https://voxelbotics.atlassian.net/wiki/spaces/DOC/pages/546275360/Setting+up+the+STM32MP257F-EV1+Evaluation+Board#Installing-the-STM32CubeProgrammer-tool to install the STM32CubeProgrammer Tool to your host.

  3. Add STM32_Programmer_CLI to your PATH:

    $ export PATH=$PATH:/bin: $ STM32_Programmer_CLI [psl@sergmir programmer]$ STM32_Programmer_CLI       -------------------------------------------------------------------                         STM32CubeProgrammer v2.17.0                       ------------------------------------------------------------------- Usage : STM32_Programmer_CLI.exe [command_1] [Arguments_1][[command_2][Arguments_2]...] ...
  4. Power off the board and select the USB Serial Downloader mode (see in https://voxelbotics.atlassian.net/wiki/spaces/DOC/pages/561709057/Selecting+STM32MP2+EV1+Boot+Device?atl_f=content-tree ).

  5. Attach USB-C (for STM32MP2 EV) cable to connector CN15 and to the Linux host.

  6. Power on the board, attaching another USB-C cable to connector CN15.

  7. Check that the programming USB port appeared on the host (note the "Device Index" in the output):

    ------------------------------------------------------------------- STM32CubeProgrammer v2.17.0 ------------------------------------------------------------------- ===== DFU Interface ===== Total number of available STM32 device in DFU mode: 1 Device Index : USB1 USB Bus Number : 002 USB Address Number : 007 Product ID : DFU in HS Mode @Device ID /0x505, @Revision ID /0x2000 Serial number : 002A00194136500B00363653 Firmware version : 0x0110 Device ID : 0x0505
  8. Download the Emcraft release images from Emcraft site and unpack them into the arbitrary directory. (If you are installing the images built by Yocto, navigate to the builddir/tmp-glibc/deploy/images/stm32mp25-eval directory):

    $ tar xfj stm32mp2-4.3.0.tgz $ cd stm32mp2-4.3.0 $ ls -l total 1287524 drwxr-xr-x 2 psl psl 4096 Oct 7 02:43 arm-trusted-firmware -rw-r--r-- 1 psl psl 1201 Apr 5 2011 build-emcraft-rootfs-openstlinux-weston-stm32mp25-eval -rw-r--r-- 1 psl psl 1066606592 Oct 7 02:39 emcraft-rootfs-openstlinux-weston-stm32mp25-eval.ext4 -rw-r--r-- 1 psl psl 116724 Oct 7 02:38 emcraft-rootfs-openstlinux-weston-stm32mp25-eval.manifest drwxrwxr-x 2 psl psl 4096 Oct 7 02:28 fip drwxr-xr-x 4 psl psl 4096 Oct 7 02:42 flashlayout_emcraft-rootfs drwxr-xr-x 2 psl psl 4096 Sep 23 03:11 scripts -rw-r--r-- 1 psl psl 67108864 Oct 4 01:41 st-image-bootfs-openstlinux-weston-stm32mp25-eval.ext4 -rw-r--r-- 1 psl psl 179 Oct 4 01:41 st-image-bootfs-openstlinux-weston-stm32mp25-eval.manifest -rw-r--r-- 1 psl psl 134217728 Oct 4 01:33 st-image-userfs-openstlinux-weston-stm32mp25-eval.ext4 -rw-r--r-- 1 psl psl 5794 Oct 4 01:33 st-image-userfs-openstlinux-weston-stm32mp25-eval.manifest -rw-r--r-- 1 psl psl 50331648 Oct 4 01:32 st-image-vendorfs-openstlinux-weston-stm32mp25-eval.ext4 -rw-r--r-- 1 psl psl 842 Oct 4 01:32 st-image-vendorfs-openstlinux-weston-stm32mp25-eval.manifest
  9. Use the SD card Flash Layout file for programming the images to SD card:

  10. Disconnect the cables CN21 (for STM32MP2 EV1).

  11. Set the boot mode for booting from SD Card. (Refer to https://voxelbotics.atlassian.net/wiki/spaces/DOC/pages/561709057/Selecting+STM32MP2+EV1+Boot+Device?atl_f=content-tree .)

  12. Connect USB-C cable to connector CN21 for STM32MP2 EV1, this powers the board on.

  13. Connect to the serial console:

  14. Alternatively, a bootable SD Card could be prepared on the host. In the images directory, run the command below:

  15. Insert SD Card to the host and the run command above to program: