Skip to content

newer gcc requries PROGMEM variables to be consts #1448

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions libraries/GSM/GSM3ShieldV1AccessProvider.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
#define __TOUTMODEMCONFIGURATION__ 5000//equivalent to 30000 because of time in interrupt routine.
#define __TOUTAT__ 1000

char _command_AT[] PROGMEM = "AT";
char _command_CGREG[] PROGMEM = "AT+CGREG?";
const char _command_AT[] PROGMEM = "AT";
const char _command_CGREG[] PROGMEM = "AT+CGREG?";


GSM3ShieldV1AccessProvider::GSM3ShieldV1AccessProvider(bool debug)
Expand Down
2 changes: 1 addition & 1 deletion libraries/GSM/GSM3ShieldV1BaseProvider.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ int GSM3ShieldV1BaseProvider::ready()
return theGSM3ShieldV1ModemCore.getCommandError();
};

void GSM3ShieldV1BaseProvider::prepareAuxLocate(PROGMEM prog_char str[], char auxLocate[])
void GSM3ShieldV1BaseProvider::prepareAuxLocate(PROGMEM const prog_char str[], char auxLocate[])
{
int i=0;
char c;
Expand Down
4 changes: 2 additions & 2 deletions libraries/GSM/GSM3ShieldV1BaseProvider.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ class GSM3ShieldV1BaseProvider
@param str PROGMEN
@param auxLocate Buffer where to locate strings
*/
void prepareAuxLocate(PROGMEM prog_char str[], char auxLocate[]);
void prepareAuxLocate(PROGMEM const prog_char str[], char auxLocate[]);

/** Manages modem response
@param from Initial byte of buffer
Expand All @@ -70,4 +70,4 @@ class GSM3ShieldV1BaseProvider

};

#endif
#endif
4 changes: 2 additions & 2 deletions libraries/GSM/GSM3ShieldV1DataNetworkProvider.cpp
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#include <GSM3ShieldV1DataNetworkProvider.h>
#include <Arduino.h>

char _command_CGATT[] PROGMEM = "AT+CGATT=";
char _command_SEPARATOR[] PROGMEM = "\",\"";
const char _command_CGATT[] PROGMEM = "AT+CGATT=";
const char _command_SEPARATOR[] PROGMEM = "\",\"";

//Attach GPRS main function.
GSM3_NetworkStatus_t GSM3ShieldV1DataNetworkProvider::attachGPRS(char* apn, char* user_name, char* password, bool synchronous)
Expand Down
9 changes: 8 additions & 1 deletion libraries/GSM/GSM3ShieldV1ModemCore.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,13 @@ void GSM3ShieldV1ModemCore::genericCommand_rq(PROGMEM prog_char str[], bool addC
writePGM(str, addCR);
}

//Generic command (const string).
void GSM3ShieldV1ModemCore::genericCommand_rq(const char* str, bool addCR)
{
theBuffer().flush();
writePGM(str, addCR);
}

//Generic command (const string).
void GSM3ShieldV1ModemCore::genericCommand_rqc(const char* str, bool addCR)
{
Expand Down Expand Up @@ -157,7 +164,7 @@ void GSM3ShieldV1ModemCore::openCommand(GSM3ShieldV1BaseProvider* provider, GSM3

};

size_t GSM3ShieldV1ModemCore::writePGM(PROGMEM prog_char str[], bool CR)
size_t GSM3ShieldV1ModemCore::writePGM(PROGMEM const prog_char str[], bool CR)
{
int i=0;
char c;
Expand Down
4 changes: 2 additions & 2 deletions libraries/GSM/GSM3ShieldV1ModemCore.h
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ class GSM3ShieldV1ModemCore : public GSM3SoftSerialMgr, public Print
@param CR Carriadge return adding automatically
@return size
*/
virtual size_t writePGM(PROGMEM prog_char str[], bool CR=true);
virtual size_t writePGM(PROGMEM const prog_char str[], bool CR=true);

/** Establish debug mode
@param db Boolean that indicates debug on or off
Expand Down Expand Up @@ -257,4 +257,4 @@ class GSM3ShieldV1ModemCore : public GSM3SoftSerialMgr, public Print

extern GSM3ShieldV1ModemCore theGSM3ShieldV1ModemCore;

#endif
#endif
2 changes: 1 addition & 1 deletion libraries/GSM/GSM3ShieldV1MultiClientProvider.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#include <GSM3ShieldV1MultiClientProvider.h>
#include <GSM3ShieldV1ModemCore.h>

char _command_MultiQISRVC[] PROGMEM = "AT+QISRVC=";
const char _command_MultiQISRVC[] PROGMEM = "AT+QISRVC=";

#define __TOUTFLUSH__ 10000

Expand Down
2 changes: 1 addition & 1 deletion libraries/GSM/GSM3ShieldV1MultiServerProvider.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

#define __NCLIENTS_MAX__ 3

char _command_QILOCIP[] PROGMEM = "AT+QILOCIP";
const char _command_QILOCIP[] PROGMEM = "AT+QILOCIP";

GSM3ShieldV1MultiServerProvider::GSM3ShieldV1MultiServerProvider()
{
Expand Down
6 changes: 3 additions & 3 deletions libraries/Robot_Control/Squawk.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ osc_t osc[4];
uint8_t pcm = 128;

// ProTracker period tables
uint16_t period_tbl[84] PROGMEM = {
const uint16_t period_tbl[84] PROGMEM = {
3424, 3232, 3048, 2880, 2712, 2560, 2416, 2280, 2152, 2032, 1920, 1814,
1712, 1616, 1524, 1440, 1356, 1280, 1208, 1140, 1076, 1016, 960, 907,
856, 808, 762, 720, 678, 640, 604, 570, 538, 508, 480, 453,
Expand All @@ -92,7 +92,7 @@ uint16_t period_tbl[84] PROGMEM = {
};

// ProTracker sine table
int8_t sine_tbl[32] PROGMEM = {
const int8_t sine_tbl[32] PROGMEM = {
0x00, 0x0C, 0x18, 0x25, 0x30, 0x3C, 0x47, 0x51, 0x5A, 0x62, 0x6A, 0x70, 0x76, 0x7A, 0x7D, 0x7F,
0x7F, 0x7F, 0x7D, 0x7A, 0x76, 0x70, 0x6A, 0x62, 0x5A, 0x51, 0x47, 0x3C, 0x30, 0x25, 0x18, 0x0C,
};
Expand Down Expand Up @@ -598,4 +598,4 @@ void squawk_playroutine() {
}

lockout = false;
}
}
4 changes: 2 additions & 2 deletions libraries/Robot_Control/SquawkSD.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class StreamFile : public SquawkStream {

static StreamFile file;

extern uint16_t period_tbl[84] PROGMEM;
const extern uint16_t period_tbl[84] PROGMEM;

void SquawkSynthSD::play(Fat16 melody) {
SquawkSynth::pause();
Expand Down Expand Up @@ -179,4 +179,4 @@ void SquawkSynthSD::convert(Fat16 in, Fat16 out) {
out.write(note[2] | (sample[2] == 0 ? 0x00 : 0x80));
}
}
}*/
}*/
2 changes: 1 addition & 1 deletion libraries/Robot_Control/glcdfont.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

// standard ascii 5x7 font

static unsigned char font[] PROGMEM = {
static const unsigned char font[] PROGMEM = {
0x00, 0x00, 0x00, 0x00, 0x00,
0x3E, 0x5B, 0x4F, 0x5B, 0x3E,
0x3E, 0x6B, 0x4F, 0x6B, 0x3E,
Expand Down
26 changes: 13 additions & 13 deletions libraries/Robot_Control/utility/scripts_Hello_User.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,20 @@
//as the ram of Arduino is very tiny, keeping too many string in it
//can kill the program

prog_char hello_user_script1[] PROGMEM="What's your name?";
prog_char hello_user_script2[] PROGMEM="Give me a name!";
prog_char hello_user_script3[] PROGMEM="And the country?";
prog_char hello_user_script4[] PROGMEM="The city you're in?";
prog_char hello_user_script5[] PROGMEM=" Plug me to\n\n your computer\n\n and start coding!";
const prog_char hello_user_script1[] PROGMEM="What's your name?";
const prog_char hello_user_script2[] PROGMEM="Give me a name!";
const prog_char hello_user_script3[] PROGMEM="And the country?";
const prog_char hello_user_script4[] PROGMEM="The city you're in?";
const prog_char hello_user_script5[] PROGMEM=" Plug me to\n\n your computer\n\n and start coding!";

prog_char hello_user_script6[] PROGMEM=" Hello User!\n\n It's me, your robot\n\n I'm alive! <3";
prog_char hello_user_script7[] PROGMEM=" First I need some\n\n input from you!";
prog_char hello_user_script8[] PROGMEM=" Use the knob\n\n to select letters";
prog_char hello_user_script9[] PROGMEM=" Use L/R button\n\n to move the cursor,\n\n middle to confirm";
prog_char hello_user_script10[] PROGMEM=" Press middle key\n to continue...";
prog_char hello_user_script11[] PROGMEM=" Choose \"enter\" to\n\n finish the input";
const prog_char hello_user_script6[] PROGMEM=" Hello User!\n\n It's me, your robot\n\n I'm alive! <3";
const prog_char hello_user_script7[] PROGMEM=" First I need some\n\n input from you!";
const prog_char hello_user_script8[] PROGMEM=" Use the knob\n\n to select letters";
const prog_char hello_user_script9[] PROGMEM=" Use L/R button\n\n to move the cursor,\n\n middle to confirm";
const prog_char hello_user_script10[] PROGMEM=" Press middle key\n to continue...";
const prog_char hello_user_script11[] PROGMEM=" Choose \"enter\" to\n\n finish the input";

PROGMEM const char *scripts_Hello_User[]={
const char *scripts_Hello_User[]={
hello_user_script1,
hello_user_script2,
hello_user_script3,
Expand Down Expand Up @@ -48,4 +48,4 @@ void writeScript(int seq, int line, int col){
textManager.writeText(line,col,buffer);
}

*/
*/
6 changes: 3 additions & 3 deletions libraries/TFT/utility/Adafruit_ST7735.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ void Adafruit_ST7735::writedata(uint8_t c) {
// formatting -- storage-wise this is hundreds of bytes more compact
// than the equivalent code. Companion function follows.
#define DELAY 0x80
PROGMEM static prog_uchar
PROGMEM static const prog_uchar
Bcmd[] = { // Initialization commands for 7735B screens
18, // 18 commands in list:
ST7735_SWRESET, DELAY, // 1: Software reset, no args, w/delay
Expand Down Expand Up @@ -231,7 +231,7 @@ PROGMEM static prog_uchar

// Companion code to the above tables. Reads and issues
// a series of LCD commands stored in PROGMEM byte array.
void Adafruit_ST7735::commandList(uint8_t *addr) {
void Adafruit_ST7735::commandList(const uint8_t *addr) {

uint8_t numCommands, numArgs;
uint16_t ms;
Expand All @@ -256,7 +256,7 @@ void Adafruit_ST7735::commandList(uint8_t *addr) {


// Initialization code common to both 'B' and 'R' type displays
void Adafruit_ST7735::commonInit(uint8_t *cmdList) {
void Adafruit_ST7735::commonInit(const uint8_t *cmdList) {

constructor(ST7735_TFTWIDTH, ST7735_TFTHEIGHT);
colstart = rowstart = 0; // May be overridden in init func
Expand Down
4 changes: 2 additions & 2 deletions libraries/TFT/utility/Adafruit_ST7735.h
Original file line number Diff line number Diff line change
Expand Up @@ -129,8 +129,8 @@ class Adafruit_ST7735 : public Adafruit_GFX {
void spiwrite(uint8_t),
writecommand(uint8_t c),
writedata(uint8_t d),
commandList(uint8_t *addr),
commonInit(uint8_t *cmdList);
commandList(const uint8_t *addr),
commonInit(const uint8_t *cmdList);
//uint8_t spiread(void);

boolean hwSPI;
Expand Down
2 changes: 1 addition & 1 deletion libraries/TFT/utility/glcdfont.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

// standard ascii 5x7 font

static unsigned char font[] PROGMEM = {
static const unsigned char font[] PROGMEM = {
0x00, 0x00, 0x00, 0x00, 0x00,
0x3E, 0x5B, 0x4F, 0x5B, 0x3E,
0x3E, 0x6B, 0x4F, 0x6B, 0x3E,
Expand Down