Skip to main content
Associate
August 21, 2026
Solved

Is it possible to have a BIOS like program detect DDR memory size on runtime & pass it to Linux in STM32MP1?

  • August 21, 2026
  • 4 replies
  • 31 views

Greetings,

I’m working on a STM32MP13X based development board as a learning project. One of the things I’m trying to achieve is a BIOS-like program stored in a NOR flash from which the MPU will boot from every time.

After that, the program will load details of any relevant peripherals, Like size & configuration of the installed DDR3 memory & any bootable media like USB drive or SD card. After which the program will boot the bootable media (if any).

The aim is to keep the system flexible like a general purpose computer, i.e. no fixed DTS configurations like DDR size, etc in U-Boot or Linux, So that any Linux distro with kernel support for STM32MP1 can be booted off the media.

Is this possible? If so, then can you give me an overview of how this may be achieved? I understand this is alot of work which I am willing to do if someone can point me in the right direction.

Regards,
Aditya M.

Best answer by zeyan1213

Yes, this is doable using U-Boot's standard runtime DDR size detection.

Initialize DDR PHY/training for your maximum supported size (via the CubeMX-generated stm32mp1_ddr.c), assuming all variants share the same timings/speed grade.
In your board's dram_init(), call U-Boot's get_ram_size() (from common/memsize.c) — it does an address wrap-around test to detect the actual populated size and sets gd->ram_size.
No manual DT editing needed: U-Boot automatically fixes up the /memory node via fdt_fixup_memory_banks before booting Linux, so the kernel sees the correct size automatically.

4 replies

Bernard PUEL
ST Technical Moderator
September 10, 2026

Hello, A study was done few years ago on DDR size, here are the outcome:

if the customer want to change the DDR size:

--> TF-A: update a device tree
--> OP-TEE: update a device tree + config flags
--> u-boot: nothing it is automatic
--> linux: nothing (should inherit from u-boot config)

So DDR is part of the board and the device tree describes this board. It is not a complex thing to change it. Furthermore, the DDR size is taken as a compile flag to build OP-TEE so can't be managed at runtime for OP-TEE.

See wiki = https://wiki.st.com/stm32mpu/wiki/How_to_setup_the_DDR_configuration

pegvinAuthor
Associate
September 10, 2026

Yeah I’m aware of this process & was wondering if there’s a way around. Unfortunately doesn’t seem like there’s a documented way around this from ST atleast. So I’ll have to figure out something myself. Will update this thread if I’m able to achieve this.

zeyan1213Best answer
Visitor
September 10, 2026

Yes, this is doable using U-Boot's standard runtime DDR size detection.

Initialize DDR PHY/training for your maximum supported size (via the CubeMX-generated stm32mp1_ddr.c), assuming all variants share the same timings/speed grade.
In your board's dram_init(), call U-Boot's get_ram_size() (from common/memsize.c) — it does an address wrap-around test to detect the actual populated size and sets gd->ram_size.
No manual DT editing needed: U-Boot automatically fixes up the /memory node via fdt_fixup_memory_banks before booting Linux, so the kernel sees the correct size automatically.

pegvinAuthor
Associate
September 10, 2026

Thank you, This is very interesting & helpful! I’ll figure out if there’s some way to load timings, etc on boot from an external EEPROM.