Portenta H7: 8 MB of RAM and 2MB of FLASH... doubt on RAM

Hello everyone,
watching the linker file for H7/M7:

I've a doubt. Among the characteristics I see:
8 MB SDRAM / 16 MB QSPI Flash
But, if we look inside the linker file that ram isn't present:
FLASH (rx) : ORIGIN = 0x8040000, LENGTH = CM4_BINARY_START - 0x8040000
DTCMRAM (rwx) : ORIGIN = 0x20000000 + (((166 * 4) + 7) & 0xFFFFFFF8), LENGTH = 128K - (((166 * 4) + 7) & 0xFFFFFFF8)
RAM (xrw) : ORIGIN = 0x24000000, LENGTH = 0x80000
RAM_D2 (xrw) : ORIGIN = 0x30000000, LENGTH = 288K
RAM_D3 (xrw) : ORIGIN = 0x38000000, LENGTH = 64K
ITCMRAM (xrw) : ORIGIN = 0x00000000, LENGTH = 64K

0x80000 means 512K
Are you sure that in that exact paramente should'n be:
0x800000 ?

Where you found that Portenta has 8Mb RAM?

Here:

Order the default Arduino Portenta H7 (codename H7-15EUNWAD) that comes with:

  • STM32H747 dual-core processor with graphics engine
  • 8MB SDRAM
  • 16MB NOR Flash

See datasheet on Arduino site:

ST STM32H747XI Processor has 512k / 1 Mb internal RAM and 8Mb external SDRAM

1 Like

So the external 8MB isn't an extension of memory. The CPU can't execute on it. Can be used to store/read data but can't be access directly from the CPU as the internal...
OK...

I didn't go into details, sorry

Note: below I am showing stuff from the GIGA, but also applies to the H7... I have one as well, but mostly play with GIGA.

It is in the memory space, so you can access it like internal memory, with some exceptions.
Normally you include:
#include "SDRAM.h"

And somewhere some one calls:
SDRAM.begin();

To allocate memory from it, you would often do something like:

  uint8_t *fb_mem = (uint8_t *)SDRAM.malloc(CAMERA_WIDTH * CAMERA_HEIGHT * 2 + 32);

In much the same way you might for normal unused memory call:
uint8_t *fb_mem = (uint8_t *)malloc(CAMERA_WIDTH * CAMERA_HEIGHT * 2 + 32);

Some details are up at:
Arduino GIGA R1 Cheat Sheet | Arduino Documentation

There are times you may need to invalidate the data cache, typically with DMA operations. Not sure if specific to SDRAM or also the internal memory.

Thank you @KurtE , now it's clear. The External RAM can be used after initialization and malloc.
Probably can be used with DMA or other data storage tasks...
But... can be used as executable RAM?

Sorry, I don't know, but doubt it.

Too be honest, I don't know this processor well enough to know if RAM can be used at all for executing code, or if it typically only runs from the flash storage.

I am more familiar with the Teensy 4.x boards from PJRC. And on them, so of the internal memory can be configured to run code from... The first 512kb can be configured in 32kb chunks to be either DTCM (Data) or ITCM(Code)... And a lot of code is copied down to this memory (Tightly Coupled Memory).

But again don't know if STM has something similar or not. My guess is all of the code is stored and run from the flash.

On manual I see:
64 Kbytes of ITCM-RAM (instruction RAM)
This RAM is connected to ITCM 64-bit interface designed for execution of critical
real-times routines by the Cortex®-M7.
(taken from DS12930 Rev 2 - 3.3.2 Embedded SRAM)
So theoretically M7 can run on RAM...

1 Like

Sorry I have not looked in detail on how the STM32 uses the DTCM or ITCM (Data and Instruction Tightly Coupled Memory). Which appears to be different than the normal memory...

As you found it does have (I think, not sure if potentially it depends on which chip?) a 64kb ITCM. I have no idea if or how STM/Arduino made this memory available. It looks like it is possible and at least one user has experimented with it:

Portenta H7 : using DTCM and ITCM - Portenta / Portenta H7 - Arduino Forum

Good luck