This works on the 1284P:
#include <avr/pgmspace.h> //To store arrays into flash rather then SRAM
// Simple sketch to create large sketch sizes for testing purposes
/*
Blink
Turns on an LED on for one second, then off for one second, repeatedly.
This example code is in the public domain.
*/
// Pin 13 has an LED connected on most Arduino boards.
// give it a name:
int led = 13;
/*
Make arraysize = to 1500 for 328P chip, 4000 for 1280P chip?,
3600 for 644P chip, xxxx for 1284P, etc.
*/
const int arraysize= 4000; // value to mostly fill avalible flash capacity
long myInts0[arraysize] PROGMEM = {}; //Store initilized array into flash memory
long myInts1[arraysize] PROGMEM = {};
long myInts2[arraysize] PROGMEM = {};
long myInts3[arraysize] PROGMEM = {};
// the setup routine runs once when you press reset:
void setup() {
// initialize the digital pin as an output.
pinMode(led, OUTPUT);
Serial.begin(115200);
digitalWrite(led, HIGH); // turn the LED on (HIGH is the voltage level)
delay(1000); // wait for a second
digitalWrite(led, LOW); // turn the LED off by making the voltage LOW
delay(1000);
int i = random(0,arraysize); // Work around any optimization for constant values
Serial.print(myInts0[i]); // Access some random element so the array can't be optimized away.
Serial.print(myInts1[i]); // Access some random element so the array can't be optimized away.
Serial.print(myInts2[i]); // Access some random element so the array can't be optimized away.
Serial.print(myInts3[i]); // Access some random element so the array can't be optimized away.
}
// the loop routine runs over and over again forever:
void loop() {
digitalWrite(led, HIGH); // turn the LED on (HIGH is the voltage level)
delay(1000); // wait for a second
digitalWrite(led, LOW); // turn the LED off by making the voltage LOW
delay(1000); // wait for a second
}
Binary sketch size: 67,994 bytes (of a 130,048 byte maximum)
Estimated used SRAM memory: 365 bytes
This code with a bigger array, loads OK but, does not run:
#include <avr/pgmspace.h> //To store arrays into flash rather then SRAM
// Simple sketch to create large sketch sizes for testing purposes
/*
Blink
Turns on an LED on for one second, then off for one second, repeatedly.
This example code is in the public domain.
*/
// Pin 13 has an LED connected on most Arduino boards.
// give it a name:
int led = 13;
/*
Make arraysize = to 1500 for 328P chip, 4000 for 1280P chip?,
3600 for 644P chip, xxxx for 1284P, etc.
*/
const int arraysize= 5000; // value to mostly fill avalible flash capacity
long myInts0[arraysize] PROGMEM = {}; //Store initilized array into flash memory
long myInts1[arraysize] PROGMEM = {};
long myInts2[arraysize] PROGMEM = {};
long myInts3[arraysize] PROGMEM = {};
// the setup routine runs once when you press reset:
void setup() {
// initialize the digital pin as an output.
pinMode(led, OUTPUT);
Serial.begin(115200);
digitalWrite(led, HIGH); // turn the LED on (HIGH is the voltage level)
delay(1000); // wait for a second
digitalWrite(led, LOW); // turn the LED off by making the voltage LOW
delay(1000);
int i = random(0,arraysize); // Work around any optimization for constant values
Serial.print(myInts0[i]); // Access some random element so the array can't be optimized away.
Serial.print(myInts1[i]); // Access some random element so the array can't be optimized away.
Serial.print(myInts2[i]); // Access some random element so the array can't be optimized away.
Serial.print(myInts3[i]); // Access some random element so the array can't be optimized away.
}
// the loop routine runs over and over again forever:
void loop() {
digitalWrite(led, HIGH); // turn the LED on (HIGH is the voltage level)
delay(1000); // wait for a second
digitalWrite(led, LOW); // turn the LED off by making the voltage LOW
delay(1000); // wait for a second
}
Binary sketch size: 83,994 bytes (of a 130,048 byte maximum)
Estimated used SRAM memory: 365 bytes