Skip to main content
Associate II
April 1, 2026
Solved

STM32MP2: "stm32_sdmmc2_mmc_init: DT error" after build of custom board with emmc booting

I'm working on adding a custom STM32MP257 board based on the openstlinux distribution package, and I'm currently using the STM32MP257F-EV1 board. I'm having problems with booting on eMMC with a stm32cubemx-generated device tree. What I've done:

* Created a STM32MP257F-EV1 project in CubeMX. I've only changed the project name, no pinning etc (based on instructions from https://wiki.st.com/stm32mpu/wiki/How_to_create_STM32MPU_projects_with_STM32CubeMX#Create_an_STM32MP2_series_project)

* Copied the generated output into layers/meta-st/meta-st-stm32mp-addons/mx

* Copied stm32mp25-mx.conf to a custom one and edited (per
https://wiki.st.com/stm32mpu/wiki/How_to_create_your_own_machine)

BOOTSCHEME_LABELS += "optee"
[...]
BOOTDEVICE_LABELS += "sdcard"
BOOTDEVICE_LABELS += "emmc"
 

* Built the image using

DISTRO=openstlinux-weston MACHINE=stm32mp257f-simon source layers/meta-st/scripts/envsetup.sh
bitbake st-image-weston

which finishes successfully (CUBEMX_DTB, CUBEMX_PROJECT etc being set in the conf. I had them wrong first, and then the build fails).

* Flashed using

STM32_Programmer_CLI -c port=usb1 -w flashlayout_st-image-weston/optee/FlashLayout_emmc_stm32mp257f-stm32mp257f-simon-mx-optee.tsv

and started with the boot switches set to emmc booting.


However, it doesn't boot. On the serial terminal, I see

PANIC at PC : 0x000000000e0276ac
NOTICE: CPU: STM32MP257FAI Rev.Y
NOTICE: Model: STMicroelectronics STM32MP257F-EV1 STM32CubeMX board - openstlinux-6.6-yocto-scarthgap-mpu-v26.02.18
NOTICE: Board: MB1936 Var1.0 Rev.D-01
NOTICE: Reset reason: Power-on reset (por_rstn) (0x2035)
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_fuse
INFO: FCONF: Reading firmware configuration information for: stm32mp_io
INFO: Using EMMC
INFO: Instance 2
INFO: Boot used partition fsbl1
ERROR: stm32_sdmmc2_mmc_init: DT error
ERROR: SDMMC2 init failed
BACKTRACE: START: boot_mmc
0: EL3: 0xe017bac
1: EL3: 0xe0276a4
2: EL3: 0xe0170dc
BACKTRACE: END: boot_mmc
PANIC at PC : 0x000000000e0276ac

 
So how do I get booting via emmc working? What works:

* Flashing on the sdcard from the same build (with the boot switches set to sdcard boot).
* Building with

DISTRO=openstlinux-weston MACHINE=stm32mp2 source layers/meta-st/scripts/envsetup.sh

instead, and flashing the -ev1 board for emmc, i.e., without my cubemx stuff and custom conf.



What I want is basically to prepare for pinning changes via CubeMX, and setup an environment where I can modify u-boot, the kernel, device trees etc for my custom design. I need to boot on emmc, which is all I'll have. Any clues to what to do to get this running?

SimonKagstromBest answer
Associate II
April 1, 2026

After talking to the AI, I found out the problem myself. The mx/.../tf-a/...-simon-mx.dts needs to have it enabled. Adding this makes the board boot:

/* USER CODE BEGIN addons */

&sdmmc2 {
	pinctrl-names = "default";
	pinctrl-0 = <&sdmmc2_b4_pins_a &sdmmc2_d47_pins_a>;
	non-removable;
	no-sd;
	no-sdio;
	st,neg-edge;
	bus-width = <8>;
	vmmc-supply = <&vdd_emmc>;
	vqmmc-supply = <&vddio2>;
	status = "okay";
};

/* USER CODE END addons */

 
now on to other issues...

1 reply

SimonKagstromAuthorBest answer
Associate II
April 1, 2026

After talking to the AI, I found out the problem myself. The mx/.../tf-a/...-simon-mx.dts needs to have it enabled. Adding this makes the board boot:

/* USER CODE BEGIN addons */

&sdmmc2 {
	pinctrl-names = "default";
	pinctrl-0 = <&sdmmc2_b4_pins_a &sdmmc2_d47_pins_a>;
	non-removable;
	no-sd;
	no-sdio;
	st,neg-edge;
	bus-width = <8>;
	vmmc-supply = <&vdd_emmc>;
	vqmmc-supply = <&vddio2>;
	status = "okay";
};

/* USER CODE END addons */

 
now on to other issues...