Memory on Arduino Due


I am a little bit confused about the memory on the due. Maybe someone of you could explain me this behavior.

The Arduino Due has amongst others two memories: Data and Program.
As described here, there is a Flash and SRAM memory.

Flash: 512 KB
SRAM: 96 KB (two banks: 64KB and 32KB)

When uploading a application with PlatformIO the memory usage is shown:
Memory Usage → Redirecting...
DATA: [==== ] 35.3% (used 11580 bytes from 32768 bytes)
PROGRAM: [======= ] 73.6% (used 385844 bytes from 524288 bytes)

I have understood, that the program section contains the application itself - so the code that I’ve written.
In the data section, the running application (the values of variables, etc) are saved.

I was expecting, that the Data portion is bigger?
It has about 32KB, but the SRAM has a total size of 96KB. Are the other 64KB used for other things? Why are they not shown in the memory usage diagram?

You can run pio run -v to see details about memory usage.

See the source code how do we calculate memory usage:

Thanks for your reply, Ivan.
I ran pio run -v, but I am afraid this is not answering my question (or I don’t get it).

Basically my question is, why are only ~32KB shown as Data memory, when I would have expected 96KB (as this is the size of the SRAM).

As far as I understand the output of pio run -v it only shows a detailed list which section of the program uses how much memory, right?

Ah… This is our bug and I’ve just fixed it in

You can switch to the latest upstream version via Atmel SAM — PlatformIO latest documentation

Thanks for the report!

Thanks, Ivan :slight_smile: