Pages: [1]   Go Down
Author Topic: Help me Understand Memory Allocation (Analogous to PROGMEM)  (Read 581 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Jr. Member
**
Karma: 0
Posts: 58
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Can I read/write data to flash in the Arduino DUE? Since the Due is a Von Neumann architecture, I find it hard to believe that this isn't supported in the IDE. I've seen some conflicting answers regarding this question, though. A couple of people said that it is not possible and a couple others have said that using "const" will automatically put the variable in the program memory.

I tried declaring a large array as a constant and the sketch size didn't increase. I would have expected that that the sketch size would increase.
e.g.
Code:
const byte Array[500] = {stuff}

should increase the "sketch size" by 500 bytes - but it doesn't. So does the compiler actually put these in ROM and the IDE just doesn't figure their size into the "sketch size" or ... ?

Thanks!
Logged

Offline Offline
God Member
*****
Karma: 32
Posts: 507
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Be sure to reference your array somewhere in your code - otherwise the linker will remove it.
Logged


Offline Offline
Jr. Member
**
Karma: 0
Posts: 58
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Be sure to reference your array somewhere in your code - otherwise the linker will remove it.

Ah! Ok - that's probably why my simple "test" didn't change the sketch size. I just included it as a declaration and never used it.

Thanks!
Logged

Pages: [1]   Go Up
Jump to: