0

I've been working with the PROGMEM function on my Arduino Uno and I'm thinking about changing to the bigger Arduino Due which is based on a ARM Cortex M3 processor instead of the AVR processor on the Uno.

The Arduino Reference now says:

PROGMEM is part of the pgmspace.h library that is available in the AVR architecture only.

My question now is: Is it possible to store constants in program memory instead of flash on the Due?

If found this post on the Arduino forums, suggesting that this is done automatically. Does anyone know something about that?

EDIT: Arduino IDE doesn't give stats about RAM usage after compiling, so I can't just try.

  • I guess you have already looked at the source code for the Arduno-SAM core. There is a port of the AVR program memory functions (pgmspace.h); github.com/arduino/ArduinoCore-sam/blob/master/cores/arduino/…. The actual answer is that const data is stored in the program flash and loaded to RAM by the program startup code. – Mikael Patel Nov 1 '17 at 17:26
  • Thank you @MikaelPatel. But doesn't that dissent from what Majenko wrote in his answer? – tr01 Nov 1 '17 at 18:16
  • @MikaelPatel That's not a port of them - that's creating aliases for them for backwards compatibility. It just removes all _P suffixes and ignores all PROGMEM, etc. – Majenko Nov 1 '17 at 18:44
  • @Majenko "port" ;) – Mikael Patel Nov 1 '17 at 19:01
1

There is no PROGMEM required on ARM. There is no memory bus separation between Flash and RAM, so it doesn't copy constants from flash to RAM which PROGMEM is used to prevent.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.