‎2019-12-03 12:44 AM
Hi there, I am working with a customized STM32MP153A board and trying to boot from eMMC.
​
I had prepared my eMMC following the steps that I found in <u-boot-stm32mp-2018.11-r0 source code directory>/board/st/stm32mp1/README file:
​
8. Prepare eMMC
===============
You can use U-Boot to copy binary in eMMC.
​
In the next example, you need to boot from SDCARD and the images (u-boot-spl.stm32, u-boot.img)
are presents on SDCARD (mmc 0) in ext4 partition 4 (bootfs).
​
To boot from SDCard, select BootPinMode = 1 0 1 and reset.
​
Then you update the eMMC with the next U-Boot command :
​
a) prepare GPT on eMMC,
example with 2 partitions, bootfs and roots:
​
# setenv emmc_part "name=ssbl,size=2MiB;name=bootfs,type=linux,bootable,size=64MiB;name=rootfs,type=linux,size=512"
# gpt write mmc 1 ${emmc_part}
​
b) copy SPL on eMMC on firts boot partition
(SPL max size is 256kB, with LBA 512, 0x200)
​
# ext4load mmc 0:4 0xC0000000 u-boot-spl.stm32
# mmc dev 1
# mmc partconf 1 1 1 1
# mmc write ${fileaddr} 0 200
# mmc partconf 1 1 1 0
​
b) copy U-Boot in first GPT partition of eMMC
​
# ext4load mmc 0:4 0xC0000000 u-boot.img
# mmc dev 1
# part start mmc 1 1 partstart
# part size mmc 1 1 partsize
# mmc write ${fileaddr} ${partstart} ${partsize}
​
To boot from eMMC, select BootPinMode = 0 1 0 and reset.
​
Unfortunately, it didn't work. After powering on, the LED controlled by PA13 blinking and nothing was printed on UART port. It seems that FSBL code not running.
​
The u-boot-spl.stm32 and u-boot.img work well when booting from SD card. eMMC is correctly connected to SDMMC2 and can be read/write with u-boot and linux OS. For some reason, this board can't be programed with STM32CubeProgrammer. ​
​
I think maybe there is something wrong with my steps of eMMC preparing/partition but don't know how to fix it. Could someone help me?
Thanks in advance.
Solved! Go to Solution.
‎2019-12-03 01:16 AM
Hello,
there is a know bug on eMMC which avoid some reference to boot correctly, this will be solved in next silicon revision.
Meanwhile, as an indication, Toshiba THGBMNG5D1LBAIL, THGBMDG5D1LBAIL, and Kingston EMMC04G-M627-X03U have shown to operate correctly on the STM32MP157C-EV1 board.
See ES0438: STM32MP151x/3x/7x device limitations
‎2019-12-03 01:16 AM
Hello,
there is a know bug on eMMC which avoid some reference to boot correctly, this will be solved in next silicon revision.
Meanwhile, as an indication, Toshiba THGBMNG5D1LBAIL, THGBMDG5D1LBAIL, and Kingston EMMC04G-M627-X03U have shown to operate correctly on the STM32MP157C-EV1 board.
See ES0438: STM32MP151x/3x/7x device limitations
‎2019-12-03 01:57 AM
Hi , Thanks for your anwer.:grinning_face: About the steps of preparing eMMC in <u-boot-stm32mp-2018.11-r0 source code directory>/board/st/stm32mp1/README, can it work on EV1 with the recommend eMMC types?
‎2019-12-03 02:05 AM
Yes, should work on EV1, but I recommend to use CubeProgrammer.
as I understand you want to use basic boot (although we recommend trusted boot), you could start from starter kit file FlashLayout_emmc_stm32mp157c-ev1-basic.tsv and customize it (but keep the first two lines as is, as trusted uBoot is used to program the eMMC with your content).
‎2019-12-03 02:27 AM
Oh, both basic boot and trusted boot are OK for me. The reason why I don't want to use CubeProgrammer is that it's needs much time to produce thousands products. If those u-boot steps work, maybe I can make these operations automatical with a few u-boot code changing. Do you have any other advice for the fast and automatical eMMC preparing?
‎2019-12-04 06:55 AM
Hello Bryan,
I did the process on ST EV1 board with the latest release (V1.1.0/tag stm32mp1-openstlinux-4.19-thud-mp1-19-10-09) of the starter package and it works fine.
Here is what I did in details. You may have missed something ......
8. Prepare eMMC
===============
You can use U-Boot to copy binary in eMMC.
In the next example, you need to boot from SDCARD and the images (tf-a-stm32mp157c-ev1-trusted.stm32, u-boot-stm32mp157c-ev1-trusted.stm32)
are presents on SDCARD (mmc 0) in ext4 partition 4 (bootfs). From the starter package of EV1, you can simply copy the 2 binaries in “/boot�? directory of your board.
To boot from SDCard, select BootPinMode = 1 0 1 and reset.
Then you update the eMMC with the next U-Boot command :
a) prepare GPT on eMMC,
example with 4 partitions, bootfs, rootfs, userfs and vendorfs:
# setenv emmc_part "name=ssbl,size=2MiB;name=bootfs,type=linux,bootable,size=64MiB;name=vendorfs,type=linux,size=16MiB;name=rootfs,type=linux,size=640MiB;name=userfs,type=linux,size=64MiB "
# gpt write mmc 1 ${emmc_part}
b) copy SPL on eMMC on first boot partition
(SPL max size is 256kB, with LBA 512, 0x200)
# ext4load mmc 0:4 0xC0000000 tf-a-stm32mp157c-ev1-trusted.stm32
# mmc dev 1
# mmc partconf 1 1 1 1
# mmc write ${fileaddr} 0 200
# mmc partconf 1 1 1 0
c) copy U-Boot in first GPT partition of eMMC
# ext4load mmc 0:4 0xC0000000 u-boot-stm32mp157c-ev1-trusted.stm32
# mmc dev 1
# part start mmc 1 1 partstart
# part size mmc 1 1 partsize
# mmc write ${fileaddr} ${partstart} ${filesize}
To boot from eMMC, select BootPinMode = 0 1 0 and reset.
Here is the boot result (I started from an empty emmc):
NOTICE: CPU: STM32MP157CAA Rev.B
NOTICE: Model: STMicroelectronics STM32MP157C eval daughter on eval mother
NOTICE: Board: MB1263 Var1 Rev.C-01
INFO: Reset reason (0x14):
INFO: Pad Reset from NRST
INFO: Using EMMC
INFO: Instance 2
INFO: Boot used partition fsbl1
INFO: BootROM: 252928 (0x3dc00) bytes copied from eMMC
NOTICE: BL2: v2.0-r1.5(debug):
NOTICE: BL2: Built : 13:13:37, Oct 2 2018
INFO: BL2: Doing platform setup
INFO: PMIC version = 0x10
INFO: RAM: DDR3-1066/888 bin G 2x4Gb 533MHz v1.45
INFO: Memory size = 0x40000000 (1024 MB)
INFO: BL2 runs SP_MIN setup
INFO: BL2: Loading image id 4
INFO: Loading image id=4 at address 0x2fff0000
INFO: Image id=4 loaded: 0x2fff0000 - 0x30000000
INFO: BL2: Loading image id 5
INFO: Loading image id=5 at address 0xc0100000
INFO: STM32 Image size : 810110
WARNING: Skip signature check (header option)
INFO: Image id=5 loaded: 0xc0100000 - 0xc01c5c7e
INFO: read version 0 current version 0
NOTICE: BL2: Booting BL32
INFO: Entry point address = 0x2fff0000
INFO: SPSR = 0x1d3
INFO: PMIC version = 0x10
NOTICE: SP_MIN: v2.0-r1.5(debug):
NOTICE: SP_MIN: Built : 13:13:37, Oct 2 2018
INFO: ARM GICv2 driver initialized
INFO: stm32mp HSI (18): Secure only
INFO: stm32mp HSE (20): Secure only
INFO: stm32mp PLL2 (27): Secure only
INFO: stm32mp PLL2_R (30): Secure only
INFO: SP_MIN: Initializing runtime services
INFO: SP_MIN: Preparing exit to normal world
U-Boot 2018.11-stm32mp-r3 (Nov 14 2018 - 16:10:06 +0000)
CPU: STM32MP157CAA Rev.B
Model: STMicroelectronics STM32MP157C eval daughter on eval mother
Board: stm32mp1 in trusted mode (st,stm32mp157c-ev1)
Board: MB1263 Var1 Rev.C-01
DRAM: 1 GiB
Clocks:
- MPU : 650 MHz
- MCU : 208.878 MHz
- AXI : 266.500 MHz
- PER : 24 MHz
- DDR : 533 MHz
NAND: 1024 MiB
MMC: STM32 SDMMC2: 0, STM32 SDMMC2: 1
Loading Environment from EXT4...
** Unable to use mmc 1:auto for loading the env **
In: serial
Out: serial
Err: serial
Net: eth0: ethernet@5800a000
Hit any key to stop autoboot: 0
Boot over mmc1!
Saving Environment to EXT4...
** Unable to use mmc 1:auto for saveenv **
Failed (1)
switch to partitions #0, OK
mmc1(part 0) is current device
** Unrecognized filesystem type **
STM32MP>
‎2019-12-04 04:58 PM
Hello Bernard,
Thanks for your answer. I think there are two main differences between our tests. I am using the baisc boot while you using trusted boot, and my eMMC is from Samsung, not Toshiba or Kingston which have been verified by ST.
​
What's more, after preparing eMMC, did you try to power off and power on the EV1 board again to boot from eMMC rather than just reset uboot?
c) copy U-Boot in first GPT partition of eMMC
# ext4load mmc 0:4 0xC0000000 u-boot-stm32mp157c-ev1-trusted.stm32
# mmc dev 1
# part start mmc 1 1 partstart
# part size mmc 1 1 partsize
# mmc write ${fileaddr} ${partstart} ${filesize}
To boot from eMMC, select BootPinMode = 0 1 0 and reset(Power off and then Power on).
​
After preparing eMMC steps, I did three tests on my board(not EV1), and got different results:
(1) When I boot from SD card, run "mmc dev 1" command, change BOOT[2:0] to 010, then run "reset" command, everything goes well and the FSBL and SSBL from eMMC can be run correctly.
(2) When I boot from SD card, don't run "mmc dev 1" command, change BOOT[2:0] to 010, then run "reset" command, issue appears. The LED of PA13 blinking and nothing printed from UART.
(3) Changing BOOT[2:0] to 010, just power off and power on, issue appears. The LED of PA13 blinking and nothing printed from UART.
From the result of the first test, I think my FSBL and SSBL in eMMC are both OK to be run, but I am quite confused on the other two tests' results. Do you have any idea about this?
‎2019-12-05 12:11 AM
Hello Bryan,
yes HW reset did the same behavior on my EV1 board.
As commented by Patrick on the first answer, the problem comes from bootrom sequence only compatible with few emmc (see the errata sheet link). This will be corrected on the next revision of the stm32mp1.
As soon as you activated (power on) the emmc with "mmc dev "1, the SW reset will not do the same boot sequence as for a HW reset. This is why it is working in these cases.
‎2019-12-05 12:26 AM
OK, got it. Thanks a lot for your help. You and Patrick really help a lot. :grinning_face: