Use the procedure documented below to install the U-Boot firmware, Linux kernel and filesystem images to an SD Card the STM32MP1 module will be bootable from. Having completed the installation, the STM32MP1 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 5GB for the Linux kernel and filesystem images to fit on the card.
- Insert SD Card to the board.
- Follow the instructions in the Section 5 of https://wiki.st.com/stm32mpu/wiki/STM32MP15_Discovery_kits_-_Starter_Package#Installing_the_STM32CubeProgrammer_tool to install the STM32CubeProgrammer Tool to your host.
- Add STM32_Programmer_CLI to your PATH:
$ export PATH=$PATH:/bin:
$ STM32_Programmer_CLI
[psl@sergmir programmer]$ STM32_Programmer_CLI
-------------------------------------------------------------------
STM32CubeProgrammer v2.7.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 Selecting Boot Device).
- Attach the miniUSB cable to connector P5 and to the Linux host.
- Power on the board, attaching another miniUSB cable to P3.
- Check that the programming USB port appeared on the host (note the "Device Index" in the output):
-------------------------------------------------------------------
STM32CubeProgrammer v2.7.0
-------------------------------------------------------------------
===== DFU Interface =====
Total number of available STM32 device in DFU mode: 1
Device Index : USB1
USB Bus Number : 001
USB Address Number : 004
Product ID : DFU in HS Mode @Device ID /0x500, @Revision ID
/0x0000
Serial number : 003000193338511534383330
Firmware version : 0x0110
Device ID : 0x0500
- 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/stm32mp15-som directory):
$ $ ls -l
total 203344
-rw-rw-r-- 1 psl psl 208217109 Apr 27 13:52 images-stm32mp15-4.0.0.tar.bz2
$ tar xfj images-stm32mp15-4.0.0.tar.bz2
$ ls -l
total 961696
drwxr-xr-x 3 psl psl 4096 Apr 16 21:53 arm-trusted-firmware
drwxr-xr-x 2 psl psl 4096 Apr 16 20:55 bootloader
-rw-r--r-- 1 psl psl 558419968 Apr 20 20:59 emcraft-rootfs-openstlinux-
weston-stm32mp1-som.ext4
drwxrwxr-x 4 psl psl 4096 Apr 27 14:49 flashlayout_emcraft-rootfs
-rw-rw-r-- 1 psl psl 208217109 Apr 27 13:52 images-stm32mp1-4.0.0.tar.bz2
drwxr-xr-x 2 psl psl 4096 Mar 8 20:46 scripts
-rw-r--r-- 1 psl psl 67108864 Apr 20 20:57 st-image-bootfs-openstlinux-
weston-stm32mp1-som.ext4
-rw-r--r-- 1 psl psl 134217728 Apr 20 18:31 st-image-userfs-openstlinux-
weston-stm32mp15-som.ext4
-rw-r--r-- 1 psl psl 16777216 Apr 20 18:31 st-image-vendorfs-openstlinux-
weston-stm32mp15-som.ext4
$
- 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_stm32mp157a-som-
optee.tsv
-------------------------------------------------------------------
STM32CubeProgrammer v2.7.0
-------------------------------------------------------------------
USB speed : High Speed (480MBit/s)
Manuf. ID : STMicroelectronics
Product ID : DFU in HS Mode @Device ID /0x500, @Revision ID
/0x0000
SN : 003000193338511534383330
FW version : 0x0110
Device ID : 0x0500
Device name : STM32MP1
Device type : MPU
Device CPU : Cortex-A7
Start Embedded Flashing service
Memory Programming ...
Opening and parsing file: tf-a-stm32mp157a-som-usb.stm32
File : tf-a-stm32mp157a-som-usb.stm32
Size : 220,40 KB
Partition ID : 0x01
Download in Progress:
[==================================================] 100%
File download complete
Time elapsed during download operation: 00:00:00.777
RUNNING Program ...
PartID: :0x01
Start operation done successfully at partition 0x01
Flashlayout Programming ...
[==================================================] 100%
Running Flashlayout Partition ...
Flashlayout partition started successfully
Memory Programming ...
Opening and parsing file: tf-a-stm32mp157a-som-usb.stm32
File : fip-stm32mp157a-som-optee.bin
Size : 1,29 MB
Partition ID : 0x03
Download in Progress:
[==================================================] 100%
File download complete
Time elapsed during download operation: 00:00:00.418
...
Download in Progress:
[==================================================] 100%
File download complete
Time elapsed during download operation: 00:00:51.346
RUNNING Program ...
PartID: :0x24
Start operation done successfully at partition 0x24
Flashing service completed successfully
$
- Disconnect the cables from P5 and P3.
- Set S4 for booting from SD Card. (Refer to Selecting Boot Device.)
- Connect with a wire JP3.1 and JP2 (any pin) on the baseboard. This will provide initial 3.3V power to SD Card.
- Connect miniUBS to P3, this powers the board on.
- Connect to the serial console (see Setting Up the STM32MP1 SOM Starter Kit and see the system booting:
NOTICE: CPU: STM32MP157AAA Rev.B
NOTICE: Model: Emcraft STM32MP157 SOM rev 1A, https://emcraft.com
INFO: Reset reason (0x54):
INFO: System reset generated by MPU (MPSYSRST)
INFO: FCONF: Reading TB_FW firmware configuration file from: 0x2ffe2000
INFO: FCONF: Reading firmware configuration information for: stm32mp_io
INFO: INFO: phase ID :3, Manifestation 3 at c7149982
...
- 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_stm32mp157a-som-
optee.tsv
Create Raw empty image: flashlayout_emcraft-rootfs/optee/../..
/FlashLayout_sdcard_stm32mp157a-som-optee.raw of 5120MB.
Create partition table:
[CREATED] part 01: fsbl1 [partition size 256.0 KiB]
[CREATED] part 02: fsbl2 [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 16.0 MiB]
[CREATED] part 10: rootfs [partition size 4.0 GiB]
[CREATED] part 11: userfs [partition size 934.5 MiB]
Partition table from flashlayout_emcraft-rootfs/optee/../..
/FlashLayout_sdcard_stm32mp157a-som-optee.raw
Disk flashlayout_emcraft-rootfs/optee/../../FlashLayout_
sdcard_stm32mp157a-som-optee.raw: 10485760 sectors, 5.0 GiB
Sector size (logical): 512 bytes
Disk identifier (GUID): 84F6502F-7CF8-44AF-9947-83653D9A22D5
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 fsbl1
2 546 1057 256.0 KiB 8301 fsbl2
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 B000 u-boot-env
8 19490 150561 64.0 MiB 8300 bootfs
9 150562 183329 16.0 MiB 8300 vendorfs
10 183330 8571937 4.0 GiB 8300 rootfs
11 8571938 10485726 934.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: 183330 (at 89.5 MiB)
Last sector: 8571937 (at 4.1 GiB)
Partition size: 8388608 sectors (4.0 GiB)
Attribute flags: 0000000000000000
Partition name: 'rootfs'
Populate raw image with image content:
[ FILLED ] part 01: fsbl1, image: arm-trusted-firmware/
tf-a-stm32mp157a-som-sdcard.stm32
[ FILLED ] part 02: fsbl2, image: arm-trusted-firmware/
tf-a-stm32mp157a-som-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-stm32mp157a-som-optee.bin
[ FILLED ] part 08: bootfs, image: st-image-bootfs-openstlinux-
weston-stm32mp15-som.ext4
[ FILLED ] part 09: vendorfs, image: st-image-vendorfs-openstlinux-
weston-stm32mp15-som.ext4
[ FILLED ] part 10: rootfs, image: emcraft-rootfs-openstlinux-
weston-stm32mp15-som.ext4
[ FILLED ] part 11: userfs, image: st-image-userfs-openstlinux-
weston-stm32mp15-som.ext4
###########################################################################
###########################################################################
RAW IMAGE generated: flashlayout_emcraft-rootfs/optee/../..
/FlashLayout_sdcard_stm32mp157a-som-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_stm32mp157a-som-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_stm32mp157a-som-optee.raw of=/dev/ bs=8M conv=
fdatasync status=progress
...