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:
Insert SD Card to the board.
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.
Add
STM32_Programmer_CLI
to yourPATH
:$ 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]...] ...
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 ).
Attach USB-C (for STM32MP2 EV) cable to connector CN15 and to the Linux host.
Power on the board, attaching another USB-C cable to connector CN15.
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
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
Use the SD card Flash Layout file for programming the images to SD card:
[psl@sergmir 3.0.0]$ STM32_Programmer_CLI -c port=usb1 -w flashlayout_emcraft-rootfs/optee/FlashLayout_sdcard_stm32mp257f-ev1-optee.tsv ------------------------------------------------------------------- STM32CubeProgrammer v2.17.0 ------------------------------------------------------------------- USB speed : High Speed (480MBit/s) Manuf. ID : STMicroelectronics Product ID : DFU in HS Mode @Device ID /0x505, @Revision ID /0x2000 SN : 002A00194136500B00363653 DFU protocol: 1.1 Board : -- Device ID : 0x0505 Device name : STM32MP25xx Device type : MPU Revision ID : -- Device CPU : Cortex-A7 Start Embedded Flashing service Memory Programming ... Opening and parsing file: tf-a-stm32mp257f-ev1-usb.stm32 File : tf-a-stm32mp257f-ev1-usb.stm32 Size : 198.86 KB Partition ID : 0x01 Download in Progress: [==================================================] 100% File download complete Time elapsed during download operation: 00:00:02.225 RUNNING Program ... PartID: :0x01 Reconnecting the device ... USB speed : High Speed (480MBit/s) Manuf. ID : STMicroelectronics Product ID : DFU @Device ID /0x505, @Revision ID /0x0011, @Name /STM32MP257FAI Rev.Y, SN : 002A00194136500B00363653 DFU protocol: 1.1 Board : -- Device ID : 0x0505 Device name : STM32MP257FAI Rev.Y Device type : MPU Device CPU : Cortex-A7 Start operation done successfully at partition 0x01 Memory Programming ... Opening and parsing file: fip-stm32mp257f-ev1-ddr-optee-sdcard.bin File : fip-stm32mp257f-ev1-ddr-optee-sdcard.bin Size : 29.38 KB Partition ID : 0x02 Download in Progress: [==================================================] 100% File download complete Time elapsed during download operation: 00:00:00.026 RUNNING Program ... PartID: :0x02 Reconnecting the device ... USB speed : High Speed (480MBit/s) Manuf. ID : STMicroelectronics Product ID : DFU @Device ID /0x505, @Revision ID /0x0011, @Name /STM32MP257FAI Rev.Y, SN : 002A00194136500B00363653 DFU protocol: 1.1 Board : -- Device ID : 0x0505 Device name : STM32MP257FAI Rev.Y Device type : MPU Device CPU : Cortex-A7 Start operation done successfully at partition 0x02 Memory Programming ... Opening and parsing file: fip-stm32mp257f-ev1-optee-sdcard.bin File : fip-stm32mp257f-ev1-optee-sdcard.bin Size : 2.65 MB Partition ID : 0x03 Download in Progress: [==================================================] 100% File download complete Time elapsed during download operation: 00:00:02.363 RUNNING Program ... PartID: :0x03 Reconnecting the device ... USB speed : High Speed (480MBit/s) Manuf. ID : STMicroelectronics Product ID : USB download gadget@Device ID /0x505, @Revision ID /0x0011, @Name /STM32MP257FAI Rev.Y, SN : 002A00194136500B00363653 DFU protocol: 1.1 Board : -- Device ID : 0x0505 Device name : STM32MP257FAI Rev.Y Device type : MPU Device CPU : Cortex-A7 Start operation done successfully at partition 0x03 Flashlayout Programming ... [==================================================] 100% Running Flashlayout Partition ... Reconnecting the device ... USB speed : High Speed (480MBit/s) Manuf. ID : STMicroelectronics Product ID : USB download gadget@Device ID /0x505, @Revision ID /0x0011, @Name /STM32MP257FAI Rev.Y, SN : 002A00194136500B00363653 DFU protocol: 1.1 Board : -- Device ID : 0x0505 Device name : STM32MP257FAI Rev.Y Device type : MPU Device CPU : Cortex-A7 Flashlayout partition started successfully Memory Programming ... Opening and parsing file: tf-a-stm32mp257f-ev1-optee-sdcard.stm32 File : tf-a-stm32mp257f-ev1-optee-sdcard.stm32 Size : 202.91 KB Partition ID : 0x04 Download in Progress: [==================================================] 100% File download complete Time elapsed during download operation: 00:00:00.059 RUNNING Program ... PartID: :0x04 Start operation done successfully at partition 0x04 Memory Programming ... Opening and parsing file: tf-a-stm32mp257f-ev1-optee-sdcard.stm32 File : tf-a-stm32mp257f-ev1-optee-sdcard.stm32 Size : 202.91 KB Partition ID : 0x05 Download in Progress: [==================================================] 100% File download complete Time elapsed during download operation: 00:00:00.058 RUNNING Program ... PartID: :0x05 Start operation done successfully at partition 0x05 Memory Programming ... Opening and parsing file: metadata.bin File : metadata.bin Size : 120.00 B Partition ID : 0x06 Download in Progress: [==================================================] 100% File download complete Time elapsed during download operation: 00:00:00.006 RUNNING Program ... PartID: :0x06 Start operation done successfully at partition 0x06 Memory Programming ... Opening and parsing file: metadata.bin File : metadata.bin Size : 120.00 B Partition ID : 0x07 Download in Progress: [==================================================] 100% File download complete Time elapsed during download operation: 00:00:00.006 RUNNING Program ... PartID: :0x07 Start operation done successfully at partition 0x07 Memory Programming ... Opening and parsing file: fip-stm32mp257f-ev1-optee-sdcard.bin File : fip-stm32mp257f-ev1-optee-sdcard.bin Size : 2.65 MB Partition ID : 0x08 Download in Progress: [==================================================] 100% File download complete Time elapsed during download operation: 00:00:00.748 RUNNING Program ... PartID: :0x08 Start operation done successfully at partition 0x08 Memory Programming ... Opening and parsing file: st-image-bootfs-openstlinux-weston-stm32mp25-eval.ext4 File : st-image-bootfs-openstlinux-weston-stm32mp25-eval.ext4 Size : 64.00 MB Partition ID : 0x10 Download in Progress: [==================================================] 100% File download complete Time elapsed during download operation: 00:00:22.067 RUNNING Program ... PartID: :0x10 Start operation done successfully at partition 0x10 Memory Programming ... Opening and parsing file: st-image-vendorfs-openstlinux-weston-stm32mp25-eval.ext4 File : st-image-vendorfs-openstlinux-weston-stm32mp25-eval.ext4 Size : 48.00 MB Partition ID : 0x11 Download in Progress: [==================================================] 100% File download complete Time elapsed during download operation: 00:00:16.231 RUNNING Program ... PartID: :0x11 Start operation done successfully at partition 0x11 Memory Programming ... Opening and parsing file: emcraft-rootfs-openstlinux-weston-stm32mp25-eval.ext4 File : emcraft-rootfs-openstlinux-weston-stm32mp25-eval.ext4 Size : 1017.20 MB Partition ID : 0x12 Download in Progress: [==================================================] 100% File download complete Time elapsed during download operation: 00:05:56.591 RUNNING Program ... PartID: :0x12 Start operation done successfully at partition 0x12 Memory Programming ... Opening and parsing file: st-image-userfs-openstlinux-weston-stm32mp25-eval.ext4 File : st-image-userfs-openstlinux-weston-stm32mp25-eval.ext4 Size : 128.00 MB Partition ID : 0x13 Download in Progress: [==================================================] 100% File download complete Time elapsed during download operation: 00:00:43.629 RUNNING Program ... PartID: :0x13 Start operation done successfully at partition 0x13 Flashing service completed successfully $
Disconnect the cables CN21 (for STM32MP2 EV1).
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 .)
Connect USB-C cable to connector CN21 for STM32MP2 EV1, this powers the board on.
Connect to the serial console:
NOTICE: CPU: STM32MP257FAI Rev.Y NOTICE: Model: STMicroelectronics STM32MP257F-EV1 Evaluation Board NOTICE: Board: MB1936 Var1.0 Rev.D-01 INFO: Reset reason (0x2074): INFO: System reset (SYSRST) by A35 INFO: PMIC2 version = 0x11 INFO: PMIC2 product ID = 0x20 INFO: FCONF: Reading TB_FW firmware configuration file from: 0xe011000 INFO: FCONF: Reading firmware configuration information for: stm32mp_io INFO: FCONF: Reading firmware configuration information for: stm32mp_fuse INFO: Using SDMMC INFO: Instance 1 ...
Alternatively, a bootable SD Card could be prepared on the host. In the images directory, run the command below:
$ ./scripts/create_sdcard_from_flashlayout.sh flashlayout_emcraft-rootfs/optee/FlashLayout_sdcard_stm32mp257f-ev1-optee.tsv Create Raw empty image: flashlayout_emcraft-rootfs/optee/../../FlashLayout_sdcard_stm32mp257f-ev1-optee.raw of 5120MB Create partition table: [CREATED] part 01: fsbla1 [partition size 256.0 KiB] [CREATED] part 02: fsbla2 [partition size 256.0 KiB] [CREATED] part 03: metadata1 [partition size 256.0 KiB] [CREATED] part 04: metadata2 [partition size 256.0 KiB] [CREATED] part 05: fip-a [partition size 4.0 MiB] [CREATED] part 06: fip-b [partition size 4.0 MiB] [CREATED] part 07: u-boot-env [partition size 512.0 KiB] [CREATED] part 08: bootfs [partition size 64.0 MiB] [CREATED] part 09: vendorfs [partition size 183.0 MiB] [CREATED] part 10: rootfs [partition size 4.0 GiB] [CREATED] part 11: userfs [partition size 767.5 MiB] Partition table from flashlayout_emcraft-rootfs/optee/../../FlashLayout_sdcard_stm32mp257f-ev1-optee.raw Disk flashlayout_emcraft-rootfs/optee/../../FlashLayout_sdcard_stm32mp257f-ev1-optee.raw: 10485760 sectors, 5.0 GiB Sector size (logical): 512 bytes Disk identifier (GUID): A5D05764-F429-409B-A9CD-8662ECCF952E Partition table holds up to 128 entries Main partition table begins at sector 2 and ends at sector 33 First usable sector is 34, last usable sector is 10485726 Partitions will be aligned on 2-sector boundaries Total free space is 0 sectors (0 bytes) Number Start (sector) End (sector) Size Code Name 1 34 545 256.0 KiB 8301 fsbla1 2 546 1057 256.0 KiB 8301 fsbla2 3 1058 1569 256.0 KiB FFFF metadata1 4 1570 2081 256.0 KiB FFFF metadata2 5 2082 10273 4.0 MiB FFFF fip-a 6 10274 18465 4.0 MiB FFFF fip-b 7 18466 19489 512.0 KiB FFFF u-boot-env 8 19490 150561 64.0 MiB 8300 bootfs 9 150562 525345 183.0 MiB 8300 vendorfs 10 525346 8913953 4.0 GiB 8300 rootfs 11 8913954 10485726 767.5 MiB 8300 userfs Partition GUID code: 19D5DF83-11B0-457B-BE2C-7559C13142A5 (Unknown) Partition unique GUID: 4FD84C93-54EF-463F-A7EF-AE25FF887087 First sector: 2082 (at 1.0 MiB) Last sector: 10273 (at 5.0 MiB) Partition size: 8192 sectors (4.0 MiB) Attribute flags: 0000000000000000 Partition name: 'fip-a' Partition GUID code: 19D5DF83-11B0-457B-BE2C-7559C13142A5 (Unknown) Partition unique GUID: 09C54952-D5BF-45AF-ACEE-335303766FB3 First sector: 10274 (at 5.0 MiB) Last sector: 18465 (at 9.0 MiB) Partition size: 8192 sectors (4.0 MiB) Attribute flags: 0000000000000000 Partition name: 'fip-b' Partition GUID code: 0FC63DAF-8483-4772-8E79-3D69D8477DE4 (Linux filesystem) Partition unique GUID: E91C4E10-16E6-4C0E-BD0E-77BECF4A3582 First sector: 525346 (at 256.5 MiB) Last sector: 8913953 (at 4.3 GiB) Partition size: 8388608 sectors (4.0 GiB) Attribute flags: 0000000000000000 Partition name: 'rootfs' Populate raw image with image content: [ FILLED ] part 01: fsbla1, image: arm-trusted-firmware/tf-a-stm32mp257f-ev1-optee-sdcard.stm32 [ FILLED ] part 02: fsbla2, image: arm-trusted-firmware/tf-a-stm32mp257f-ev1-optee-sdcard.stm32 [ FILLED ] part 03: metadata1, image: arm-trusted-firmware/metadata.bin [ FILLED ] part 04: metadata2, image: arm-trusted-firmware/metadata.bin [ FILLED ] part 05: fip-a, image: fip/fip-stm32mp257f-ev1-optee-sdcard.bin [ FILLED ] part 08: bootfs, image: st-image-bootfs-openstlinux-weston-stm32mp25-eval.ext4 [ FILLED ] part 09: vendorfs, image: st-image-vendorfs-openstlinux-weston-stm32mp25-eval.ext4 [ FILLED ] part 10: rootfs, image: emcraft-rootfs-openstlinux-weston-stm32mp25-eval.ext4 [ FILLED ] part 11: userfs, image: st-image-userfs-openstlinux-weston-stm32mp25-eval.ext4 ########################################################################### ########################################################################### RAW IMAGE generated: flashlayout_emcraft-rootfs/optee/../../FlashLayout_sdcard_stm32mp257f-ev1-optee.raw WARNING: before to use the command dd, please umount all the partitions associated to SDCARD. sudo umount `lsblk --list | grep mmcblk0 | grep part | gawk '{ print $7 }' | tr '\n' ' '` To put this raw image on sdcard: sudo dd if=flashlayout_emcraft-rootfs/optee/../../FlashLayout_sdcard_stm32mp257f-ev1-optee.raw of=/dev/mmcblk0 bs=8M conv=fdatasync status=progress (mmcblk0 can be replaced by: sdX if it's a device dedicated to receive the raw image (where X can be a, b, c, d, e) To mount bootfs partition: udisksctl mount -b /dev/disk/by-partlabel/bootfs After the dd command you can verify if copy are correctly done and partitions take into account sgdisk /dev/mmcblk0 -p sgdisk /dev/mmcblk0 -v if '-v' command indicate a problem, please execute the following command: sgdisk /dev/mmcblk0 -e ########################################################################### ########################################################################### [psl@sergmir 3.0.0]$
Insert SD Card to the host and the run command above to program:
$ sudo dd if=flashlayout_emcraft-rootfs/optee/../../FlashLayout_sdcard_stm32mp257d-ev1-optee.raw of=/dev/ bs=8M conv=fdatasync status=progress ...