2021-01-27 01:46 AM
I’m having some trouble getting u-boot to boot from eMMC. I’ve evaluated my system using the DK2(using SDCARD) and i’m now porting to a custom board. The custom board contains a STM32MP157CAB and a eMCC connected at sdmmc2.
My u-boot devicetree(stm32mp157c-cau-mx-u-boot.dtsi) contains the following:
aliases {
usb0 = &usbotg_hs;
mmc0 = &sdmmc2;
};
The first problem is the eMMC flashlayout file created by the distribution package, it is configured to use MMC1 by default. Is there a way to edit something that the file is created with MCC0 as default?
The second problem is with u-boot, it stills want to boot from MMC1:
NOTICE: CPU: STM32MP157CAB Rev.B
NOTICE: Model: <product name>
INFO: Reset reason (0x15):
INFO: Power-on Reset (rst_por)
INFO: Using EMMC
INFO: Instance 2
INFO: Boot used partition fsbl1
NOTICE: BL2: v2.2-r1.0(debug):v2.2-dirty
NOTICE: BL2: Built : 13:36:23, Oct 22 2019
INFO: Using crypto library 'stm32_crypto_lib'
INFO: BL2: Doing platform setup
INFO: RAM: DDR3-DDR3L 16bits 533000Khz
INFO: Memory size = 0x20000000 (512 MB)
INFO: BL2 runs SP_MIN setup
INFO: BL2: Loading image id 4
INFO: Loading image id=4 at address 0x2ffed000
INFO: Image id=4 loaded: 0x2ffed000 - 0x2ffff000
INFO: BL2: Loading image id 5
INFO: Loading image id=5 at address 0xc0100000
INFO: STM32 Image size : 848860
INFO: Image id=5 loaded: 0xc0100000 - 0xc01cf3dc
WARNING: Skip signature check (header option)
NOTICE: ROTPK is not deployed on platform. Skipping ROTPK verification.
NOTICE: BL2: Booting BL32
INFO: Entry point address = 0x2ffed000
INFO: SPSR = 0x1d3
INFO: Cannot find st,stpmic1 node in DT
NOTICE: SP_MIN: v2.2-r1.0(debug):v2.2-dirty
NOTICE: SP_MIN: Built : 13:36:23, Oct 22 2019
INFO: ARM GICv2 driver initialized
INFO: ETZPC: UART1 (3) could be non secure
INFO: ETZPC: SPI6 (4) could be non secure
INFO: ETZPC: I2C4 (5) could be non secure
INFO: SP_MIN: Initializing runtime services
INFO: SP_MIN: Preparing exit to normal world
U-Boot 2020.01-stm32mp-r1 (Jan 27 2021 - 09:28:31 +0000)
CPU: STM32MP157CAB Rev.B
Model: <product name>
Board: stm32mp1 in trusted mode (st,stm32mp157c-cau-mx)
DRAM: 512 MiB
Clocks:
- MPU : 650 MHz
- MCU : 200 MHz
- AXI : 266.500 MHz
- PER : 0 MHz
- DDR : 533 MHz
WDT: Started with servicing (32s timeout)
NAND: 0 MiB
MMC: STM32 SD/MMC: 0
Loading Environment from MMC... *** Warning - bad CRC, using default environment
In: serial
Out: serial
Err: serial
Net: eth0: ethernet@5800a000
Hit any key to stop autoboot: 0
Boot over mmc1!
Saving Environment to MMC... Writing to redundant MMC(0)... OK
MMC Device 1 not found
no mmc device at slot 1
STM32MP>
When I change the alias to mmc1 = &sdmcc2 u-boot stills throws the
MMC Device 1 not found
no mmc device at slot 1
error. The MMC is still reported with:
MMC: STM32 SD/MMC: 0
Also the orginal eMMC flashlayout file should work now, as I changed to MMC1, but it doesn’t, it causes the device to boot-loop.
What am I doing wrong?
I've found this topic, but i'm not sure if it is related.
Solved! Go to Solution.
2021-01-29 01:51 AM
Managed to fix this, for anyone coming across the same problem:
The file to be edited is include/configs/stm32mp.h, change the define STM32MP_BOOTCMD to the following:
#define STM32MP_BOOTCMD "bootcmd_stm32mp=" \
"echo \"Boot over ${boot_device}${boot_instance}!\";" \
"if test ${boot_device} = serial || test ${boot_device} = usb;" \
"then stm32prog ${boot_device} ${boot_instance}; " \
"else " \
"run env_check;" \
"if test ${boot_device} = mmc;" \
"then env set boot_targets mmc0; fi;" \
"if test ${boot_device} = nand ||" \
" test ${boot_device} = spi-nand ;" \
"then env set boot_targets ubifs0; fi;" \
"if test ${boot_device} = nor;" \
"then env set boot_targets mmc0; fi;" \
"run distro_bootcmd;" \
"fi;\0"
Not sure if this is the correct way to do this, but it works.
2021-01-29 01:51 AM
Managed to fix this, for anyone coming across the same problem:
The file to be edited is include/configs/stm32mp.h, change the define STM32MP_BOOTCMD to the following:
#define STM32MP_BOOTCMD "bootcmd_stm32mp=" \
"echo \"Boot over ${boot_device}${boot_instance}!\";" \
"if test ${boot_device} = serial || test ${boot_device} = usb;" \
"then stm32prog ${boot_device} ${boot_instance}; " \
"else " \
"run env_check;" \
"if test ${boot_device} = mmc;" \
"then env set boot_targets mmc0; fi;" \
"if test ${boot_device} = nand ||" \
" test ${boot_device} = spi-nand ;" \
"then env set boot_targets ubifs0; fi;" \
"if test ${boot_device} = nor;" \
"then env set boot_targets mmc0; fi;" \
"run distro_bootcmd;" \
"fi;\0"
Not sure if this is the correct way to do this, but it works.