What's the maximum RAM size on STM32H743VITx?

https://docs.platformio.org/en/latest/boards/ststm32/weact_mini_h743vitx.html

Currently Platformio says the RAM size for the STM32H743VITx is 512KB, but that should be 1024KB, right?

https://www.digikey.com/en/products/detail/stmicroelectronics/STM32H743VIT6/7809237

Sadly this is more complicated.

This microcontroller physically has the 1MB of RAM, but the memory address space is fragmented, and some RAM can only be accessed by certain parts of the microcontroller or processor.

So e.g., the RAM starting at 0x20000000 with length of 128K has an address range of

RAM 0x20000000 to 0x20020000

Which is discontinuous with where the next block of RAM starts, that is, 0x24000000.

So, what the Arduino framework here does (and other projects similiarly), is that it points the “main chunk of RAM” to the biggest block, which is the D1 512K SRAM block. (more about that in the product manual). Specifically, the ARM Cortex processor wants to know where the stack starts. Typically, the initial stack pointer is setup at “the end of RAM”, but since it’s discontinious here, we must narrow the view to the “end of the biggest block of RAM”.

Some frameworks would like to know, as a variable, what the start address and the length of the RAM. Then they compute the initial SP as “the end of RAM” as START(RAM) + LENGTH(RAM). If PlatformIO would say “start of RAM is 0x20000000 and length is 1 MB”, the resulting address would be 0x20100000 – no memory is mapped there, the processor would instantly crash when trying to do anything with the stack.

And thus, the PlatformIO board info in this special case says "we only have 512K of RAM and it starts at 0x24000000.

Physically, your microcontroller still has 1MByte of RAM. You just have to be a little bit fancy on how to put objects into these different RAM regions, e.g., allocating a heap on the RAM_D2 part, etc. Not sure if the Arduino framework even implements this or leaves it as “it has 512K of RAM.”

1 Like

Actually, we discussed a very similiar case in here.