Questions tagged [progmem]
PROGMEM is a keyword used when declaring a variable that keeps the data in flash instead of copying it into SRAM. It is part of the `pgmspace.h` library. Use this tag for discussions about using this attribute.
13
questions
5
votes
2
answers
11k
views
Using PROGMEM to store array of structs
I am hitting the limits of my arduino's SRAM and found that SRAM usage can be reduced by storing static stuff in flash memory instead of SRAM.
My project can (optionally) be built with an included ...
0
votes
3
answers
5k
views
Storing array in PROGMEM
I have an array of a lot of numbers (1 and 0) but i can't store them since arduino does not have enough space. How can i save an array of example 00110 in PROGMEM, then read from PROGMEM and set x to ...
9
votes
3
answers
10k
views
PROGMEM: do I have to copy data from flash to RAM for reading?
I have got some difficulties understanding the memory management.
Arduino documentation says, it is possible to keep constants like strings or whatever I don't want to change during runtime in ...
6
votes
1
answer
3k
views
What are the benfits of global variables over static class members?
On an embedded system we use global variables often to keep dynamic memory consumption on heap and stack low. But global variables are also considered bad programming practice if they aren't used in a ...
2
votes
3
answers
578
views
How do I upload sketch (and parameters) through a user interface
I'm pretty new to Arduino and I'm developing my first real-world project.
I have a Arduino Mega with a full working sketch in it which is going to be placed in several distant places and I have a ...
2
votes
1
answer
1k
views
Better method for PROGMEM data access with multiple indirection?
-edit-
This is a simplified recreation of personal learning project I have ongoing. My issue is in accessing data in flash, the path to which includes multiple layers of indirection. When the data ...
2
votes
4
answers
5k
views
How to pass a static const (progmem) array to a function
I'm implementing a voice synthesizer chip. To build a phrase, I create a list of phonemes like this:
static const uint8_t PROGMEM heybuddy[] = {
pPA5, pHH1, pEY, pPA5,
pBB2, pAX, pDD2, pIY, pPA5,...
1
vote
2
answers
361
views
Is there a good reference for Arduino Due memory architecture and usage?
It's been harder than I expected to find a reference source or usage guide.
There's a number of sources I've looked at along the road to this question:
The Due is listed here and here as having 512KB ...
1
vote
1
answer
2k
views
PROGMEM on Arduino Due (ARM Cortex M3)
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 ...
1
vote
1
answer
606
views
Reading a 10-byte buffer out of a PROGMEM string stored in a string table
I'm storing a large snippet of text in three separate PROGMEM char arrays:
const char script1[] PROGMEM = "....";
const char script2[] PROGMEM = "....";
const char script3[] PROGMEM = "....";
The ...
0
votes
1
answer
817
views
How to create large progmem arrays and not annoy the linker
I have a rather complex project (PlatformIO, but I've also had this happen in the vanilla IDE) with several nested includes.
Let's say that there are three files and a main sketch.
The main sketch ...
0
votes
2
answers
586
views
Accessing 2 dimensional array in PROGMEM inside loop
I am unable to access elements of a 2D PROGMEM array from inside a loop. Please see the following example:
const byte a1[] PROGMEM = {'a', 'b', 'c', 'd'};
const byte a2[] PROGMEM = {'e', 'f', 'g', 'h'...
0
votes
1
answer
712
views
Read nested array item from PROGMEM
I have a 2D array of uint16_t arrays (IR Remote Codes). Due to the size of this data in RAM I'm having all kinds of trouble when my array is larger than one code. Thus, I have been trying to move this ...