2025-05-07 2:32 PM
Following the instructions here: https://wiki.st.com/stm32mpu/index.php/How_to_create_your_own_machine
And then making a trivial devicetree modification (enabling I2C5 output) fails to build on a fresh yocto install (via the "distribution package"). I'm beginning to port code from a DK2 to a custom board, and creating a transitional package.
The build slams right into the `flavorlist` mess in the optee make confs (specifically workspace/sources/optee-os-stm32mp/core/arch/arm/plat-stm32mp1/conf.mk) , ignoring the `CUBEMX_BOARD_DDR_SIZE = "512"` variables or anything else..
Very frustrating to see all these hardcoded filenames when yocto is very aware of the actual device tree in use at buildtime... looks like maybe the intended `CFG_EXT_DTS` escape hatch is broken?
Lots of previous posts have hit this problem, but on custom hardware, and with more significant DT changes. I didn't touch the RAM or anything else other than have a default DK2 template MX project and then enable/"okay" I2C5.
2025-05-08 1:37 AM
Hello @0xedbea4
I had similar issue:
1. I used STM32MP135F-DK board, opened it's project in CubeMX (via Board Selector) and generated Device Tree.
2. Then, during Yocto build, there was this CFG_DRAM_SIZE bug (missmatch).
As far as I understand it, optee sets CFG_DRAM_SIZE basing on DT name. And for unknown DT names (like mine, because it was generated from CubeMX) its sets default CFG_DRAM_SIZE to 1 GB. STM32MP135F-DK uses 512 MB and that value is defined in it's DT. So there is a missmatch and CFG_DRAM_SIZE bug occurs.
3. To fix it, I created a patch for optee, to set default CFG_DRAM_SIZE to 512 MB instead of 1 GB for unknown DT names. The patch is:
diff --git a/conf.mk.orginal b/conf.mk
index 2600f51..ec1e0e6 100644
--- a/core/arch/arm/plat-stm32mp1/conf.mk
+++ b/core/arch/arm/plat-stm32mp1/conf.mk
@@ -291,7 +291,7 @@ CFG_DRAM_SIZE ?= 0x20000000
endif
CFG_DRAM_BASE ?= 0xc0000000
-CFG_DRAM_SIZE ?= 0x40000000
+CFG_DRAM_SIZE ?= 0x20000000
ifeq ($(CFG_STM32MP15)-$(CFG_WITH_PAGER),y-y)
CFG_TZSRAM_START ?= 0x2ffc0000
CFG_TZSRAM_SIZE ?= 0x00040000
To apply it, I simply created a
recipes-bsp/optee-os-stm32mp/optee-os-stm32mp_%.bbappend file like this:
FILESEXTRAPATHS:prepend := "${THISDIR}/${PN}:"
SRC_URI:append := " \
file://0001-fixed-CFG_DRAM_SIZE-in-conf-mk.patch \
"