cancel
Showing results for 
Search instead for 
Did you mean: 

STM32MP1 Boot from eMMC and switch boot source after OTP

DBaes.1
Associate III

Currently I am trying to set up the emmc boot on a stm32mp157. I have mirrored the partitions of a working SD card to the emmc with:

sgdisk -e /dev/mmcblk1
sgdisk -R=/dev/mmcblk2 /dev/mmcblk1
sgdisk -G /dev/mmcblk2
 
dd if=/dev/mmcblk1p1 of=/dev/mmcblk2p1 bs=512 conv=fdatasync
dd if=/dev/mmcblk1p2 of=/dev/mmcblk2p2 bs=512 conv=fdatasync
dd if=/dev/mmcblk1p3 of=/dev/mmcblk2p3 bs=512 conv=fdatasync
dd if=/dev/mmcblk1p4 of=/dev/mmcblk2p4 bs=512 conv=fdatasync
dd if=/dev/mmcblk1p5 of=/dev/mmcblk2p5 bs=512 conv=fdatasync
dd if=/dev/mmcblk1p6 of=/dev/mmcblk2p6 bs=512 conv=fdatasync
 
echo 0 > /sys/block/mmcblk2boot0/force_ro
dd if=/dev/mmcblk1p1 of=/dev/mmcblk2boot0 bs=512 conv=fdatasync
echo 1 > /sys/block/mmcblk2boot0/force_ro
 
echo 0 > /sys/block/mmcblk2boot1/force_ro
dd if=/dev/mmcblk1p2 of=/dev/mmcblk2boot1 bs=512 conv=fdatasync
echo 1 > /sys/block/mmcblk2boot1/force_ro

partition is fsbl1, fsbl2, ssbl, boot, rootfs1, rootfs2.

Then i used the OTP boot device config to set the primary and secondary boot option (because i have only acces to boot pin 2) with:

fuse prog 0 3 0x1c000000

=> This should be primary = eMMc and secondary = SD

Finally a set the boot partition with:

mmc partconf 1 1 1 0

After reboot i get the following output from First Stage Bootloade (FSBL):

U-Boot SPL 2020.01-stm32mp-r1-dirty (May 29 2020 - 12:00:46 +0000)
Model: hp00164
RAM: DDR3-DDR3L 16bits 533000Khz
WDT:   Not found!
Trying to boot from MMC2
spl: could not initialize mmc. error: -19
SPL: failed to boot from all boot devices
### ERROR ### Please RESET the board ###

the emmc was already working. I previously put my uboot variables there so I could edit and read them from linux side.

Questions:

  • How can i clear my emmc now, respectively how can i boot from sd card again?
  • What have I missed that the mmc can not be initialized?
1 ACCEPTED SOLUTION

Accepted Solutions
DBaes.1
Associate III

I checked the spl device tree:

dtc -I dtb spl/u-boot-spl.dtb

and notice that the emmc was missing.

After i added the entry for the spl device tree the boot is working:

&sdmmc2 {
	u-boot,dm-spl;
};

View solution in original post

3 REPLIES 3
PatrickF
ST Employee

Hi @DBaes.1​ ,

when you talk about "the emmc was already working", does it mean you already boot from eMMC with virgin OTP or just access it from uBoot (which is quite different) ?

Did you have a chance to set BOOT pins to 0b000 to connect an host using USB and populate eMMC partitions from Flashloader ?

Maybe try to get access to the target using a debugger and write 0xFF in TAMP_REG[20] and issue a NRST pulse (I'm not sure debug is allowed in uBoot default context).

Otherwise, as you did not anticipate any FSBL buggy SW, I fear you have put your board in a dead end state.

Btw, did you notice that uBoot SPL (aka Basic Boot) is not anymore supported and now should only be used for DDR tests. See OpenSTLinux.

"Warning Basic boot has been removed since STM32MP15-ecosystem-v2.0.0, if using basic boot with U-BOOT-SPL to load U-BOOT and the Kernel, use now the ST reference boot scheme replacing U-BOOT-SPL by TF-A as FSBL as explained in Boot chain overview."

Regards.

In order to give better visibility on the answered topics, please click on 'Accept as Solution' on the reply which solved your issue or answered your question.
DBaes.1
Associate III

Hello PatrickF,

> when you talk about "the emmc was already working", does it mean you already boot from eMMC with virgin OTP or just access it from uBoot (which is quite different) ?

Nope only that I read and write from emmc e.g. so I could boot the linux kernel from emmc but FSBL and SSBL are on SD card. (you are right that is of course something diffrent)

> Did you have a chance to set BOOT pins to 0b000 to connect an host using USB and populate eMMC partitions from Flashloader ?

I have no possibility to change the bootpins 0 and 1 (boot0 = 1, boot1 = 0).

> Maybe try to get access to the target using a debugger and write 0xFF in TAMP_REG[20] and issue a NRST pulse.

I have not tried this method yet but thanks for the suggestion.

> Btw, did you notice that uBoot SPL (aka Basic Boot) is not anymore supported and now should only be used for DDR tests.

Thanks for the advice i will try it out.

Maybe i can produce some read error from eMMC to get my secondary boot (SD) working again. For now i use a new board. This time i will set SD = primary and eMMC to secondary. I hope this will work.

DBaes.1
Associate III

I checked the spl device tree:

dtc -I dtb spl/u-boot-spl.dtb

and notice that the emmc was missing.

After i added the entry for the spl device tree the boot is working:

&sdmmc2 {
	u-boot,dm-spl;
};