This works to fill 32254 of the 32256 bytes available on the UNO:
#include <avr/pgmspace.h>
// make size = to xxxx for 328 chip, yyyy for 1280 chip, zzzz for 2560 chip, etc.
const int arraysize= 7733; // value to fill avalible flash capacity
volatile long myInts[arraysize] PROGMEM;
void setup() {
}
// the loop routine runs over and over again forever:
void loop() {
int i = random(0,arraysize); // Work around any optimization for constant values
use(myInts[i]); // Access some random element so the array can't be optimized away.
delay(1000); // wait for a second
}
long use(long x) {
return x;
}