Closed tomaskovacik closed 6 years ago
patch:
--- ./ProgramPIC.pde 2012-10-07 06:21:00.000000000 +0200
+++ ProgramPIC.ino 2013-05-05 19:08:36.329252309 +0200
@@ -103,17 +103,17 @@
// been tested by the author. Patches welcome to improve the list.
struct deviceInfo
{
- const prog_char *name; // User-readable name of the device.
- prog_int16_t deviceId; // Device ID for the PIC (-1 if no id).
- prog_uint32_t programSize; // Size of program memory (words).
- prog_uint32_t configStart; // Flat address start of configuration memory.
- prog_uint32_t dataStart; // Flat address start of EEPROM data memory.
- prog_uint16_t configSize; // Number of configuration words.
- prog_uint16_t dataSize; // Size of EEPROM data memory (bytes).
- prog_uint16_t reservedWords;// Reserved program words (e.g. for OSCCAL).
- prog_uint16_t configSave; // Bits in config word to be saved.
- prog_uint8_t progFlashType; // Type of flash for program memory.
- prog_uint8_t dataFlashType; // Type of flash for data memory.
+ const char PROGMEM *name; // User-readable name of the device.
+ int16_t PROGMEM deviceId; // Device ID for the PIC (-1 if no id).
+ uint32_t PROGMEM programSize; // Size of program memory (words).
+ uint32_t PROGMEM configStart; // Flat address start of configuration memory.
+ uint32_t PROGMEM dataStart; // Flat address start of EEPROM data memory.
+ uint16_t PROGMEM configSize; // Number of configuration words.
+ uint16_t PROGMEM dataSize; // Size of EEPROM data memory (bytes).
+ uint16_t PROGMEM reservedWords;// Reserved program words (e.g. for OSCCAL).
+ uint16_t PROGMEM configSave; // Bits in config word to be saved.
+ uint8_t PROGMEM progFlashType; // Type of flash for program memory.
+ uint8_t PROGMEM dataFlashType; // Type of flash for data memory.
};
struct deviceInfo const devices[] PROGMEM = {
@@ -230,7 +230,7 @@
printHex4((unsigned int)word);
}
-void printProgString(const prog_char *str)
+void printProgString(const char PROGMEM *str)
{
for (;;) {
char ch = (char)(pgm_read_byte(str));
@@ -265,7 +265,7 @@
// Print the extra device information.
Serial.print("DeviceName: ");
- printProgString((const prog_char *)(pgm_read_word(&(dev->name))));
+ printProgString((const char PROGMEM *)(pgm_read_word(&(dev->name))));
Serial.println();
Serial.print("ProgramRange: 0000-");
printHex8(programEnd);
@@ -352,7 +352,7 @@
// Find the device in the built-in list if we have details for it.
int index = 0;
for (;;) {
- const prog_char *name = (const prog_char *)
+ const char PROGMEM *name = (const char PROGMEM *)
(pgm_read_word(&(devices[index].name)));
if (!name) {
index = -1;
@@ -396,7 +396,7 @@
Serial.println("OK");
int index = 0;
for (;;) {
- const prog_char *name = (const prog_char *)
+ const char PROGMEM *name = (const char PROGMEM *)
(pgm_read_word(&(devices[index].name)));
if (!name)
break;
@@ -432,7 +432,7 @@
// Look for the name in the devices list.
int index = 0;
for (;;) {
- const prog_char *name = (const prog_char *)
+ const char PROGMEM *name = (const char PROGMEM *)
(pgm_read_word(&(devices[index].name)));
if (!name)
break;
@@ -906,10 +906,10 @@
typedef void (*commandFunc)(const char *args);
typedef struct
{
- const prog_char *name;
+ const char PROGMEM *name;
commandFunc func;
- const prog_char *desc;
- const prog_char *args;
+ const char PROGMEM *desc;
+ const char PROGMEM *args;
} command_t;
const char s_cmdRead[] PROGMEM = "READ";
const char s_cmdReadDesc[] PROGMEM =
@@ -969,13 +969,13 @@
Serial.println("OK");
int index = 0;
for (;;) {
- const prog_char *name = (const prog_char *)
+ const char PROGMEM *name = (const char PROGMEM *)
(pgm_read_word(&(commands[index].name)));
if (!name)
break;
- const prog_char *desc = (const prog_char *)
+ const char PROGMEM *desc = (const char PROGMEM *)
(pgm_read_word(&(commands[index].desc)));
- const prog_char *args = (const prog_char *)
+ const char PROGMEM *args = (const char PROGMEM *)
(pgm_read_word(&(commands[index].args)));
printProgString(name);
if (args) {
@@ -992,7 +992,7 @@
}
// Match a data-space string where the name comes from PROGMEM.
-bool matchString(const prog_char *name, const char *str, int len)
+bool matchString(const char PROGMEM *name, const char *str, int len)
{
for (;;) {
char ch1 = (char)(pgm_read_byte(name));
@@ -1041,7 +1041,7 @@
// Find the command and execute it.
int index = 0;
for (;;) {
- const prog_char *name = (const prog_char *)
+ const char PROGMEM *name = (const char PROGMEM *)
(pgm_read_word(&(commands[index].name)));
if (!name)
break;
ardpicprog.cpp:69:28: error: ‘prog_char’ does not name a type ardpicprog.cpp:69:39: error: ISO C++ forbids declaration of ‘str’ with no type [-fpermissive] ardpicprog.cpp:86:24: error: ‘prog_char’ does not name a type ardpicprog.cpp:86:35: error: ISO C++ forbids declaration of ‘name’ with no type [-fpermissive] ardpicprog.cpp:144:11: error: ‘prog_char’ does not name a type ardpicprog.cpp:145:5: error: ‘prog_int16_t’ does not name a type ardpicprog.cpp:146:5: error: ‘prog_uint32_t’ does not name a type ardpicprog.cpp:147:5: error: ‘prog_uint32_t’ does not name a type ardpicprog.cpp:148:5: error: ‘prog_uint32_t’ does not name a type ardpicprog.cpp:149:5: error: ‘prog_uint16_t’ does not name a type ardpicprog.cpp:150:5: error: ‘prog_uint16_t’ does not name a type ardpicprog.cpp:151:5: error: ‘prog_uint16_t’ does not name a type ardpicprog.cpp:152:5: error: ‘prog_uint16_t’ does not name a type ardpicprog.cpp:153:5: error: ‘prog_uint8_t’ does not name a type ardpicprog.cpp:154:5: error: ‘prog_uint8_t’ does not name a type ardpicprog.cpp:181:1: error: too many initializers for ‘const deviceInfo’ ardpicprog.cpp:181:1: error: too many initializers for ‘const deviceInfo’ ardpicprog.cpp:181:1: error: too many initializers for ‘const deviceInfo’ ardpicprog.cpp:181:1: error: too many initializers for ‘const deviceInfo’ ardpicprog.cpp:181:1: error: too many initializers for ‘const deviceInfo’ ardpicprog.cpp:181:1: error: too many initializers for ‘const deviceInfo’ ardpicprog.cpp:181:1: error: too many initializers for ‘const deviceInfo’ ardpicprog.cpp:181:1: error: too many initializers for ‘const deviceInfo’ ardpicprog.cpp:181:1: error: too many initializers for ‘const deviceInfo’ ardpicprog.cpp:181:1: error: too many initializers for ‘const deviceInfo’ ardpicprog.cpp:181:1: error: too many initializers for ‘const deviceInfo’ ardpicprog.cpp:181:1: error: too many initializers for ‘const deviceInfo’ ardpicprog.cpp:181:1: error: too many initializers for ‘const deviceInfo’ ardpicprog.cpp:181:1: error: too many initializers for ‘const deviceInfo’ ardpicprog.cpp:271:28: error: ‘progchar’ does not name a type ardpicprog.cpp:271:39: error: ISO C++ forbids declaration of ‘str’ with no type [-fpermissive] ardpicprog.cpp: In function ‘void initDevice(const deviceInfo)’: ardpicprog.cpp:293:18: error: ‘const struct deviceInfo’ has no member named ‘programSize’ ardpicprog.cpp:294:19: error: ‘const struct deviceInfo’ has no member named ‘configStart’ ardpicprog.cpp:295:31: error: ‘const struct deviceInfo’ has no member named ‘configSize’ ardpicprog.cpp:296:17: error: ‘const struct deviceInfo’ has no member named ‘dataStart’ ardpicprog.cpp:297:27: error: ‘const struct deviceInfo’ has no member named ‘dataSize’ ardpicprog.cpp:298:34: error: ‘const struct deviceInfo’ has no member named ‘reservedWords’ ardpicprog.cpp:300:18: error: ‘const struct deviceInfo’ has no member named ‘configSave’ ardpicprog.cpp:301:21: error: ‘const struct deviceInfo’ has no member named ‘progFlashType’ ardpicprog.cpp:302:21: error: ‘const struct deviceInfo’ has no member named ‘dataFlashType’ ardpicprog.cpp:306:28: error: ISO C++ forbids declaration of ‘type name’ with no type [-fpermissive] ardpicprog.cpp:306:28: error: ISO C++ forbids declaration of ‘type name’ with no type [-fpermissive] ardpicprog.cpp:306:22: error: expected primary-expression before ‘const’ ardpicprog.cpp:306:22: error: expected ‘)’ before ‘const’ ardpicprog.cpp:306:41: error: expected ‘;’ before ‘)’ token ardpicprog.cpp: In function ‘void cmdDevice(const char_)’: ardpicprog.cpp:393:15: error: ‘progchar’ does not name a type ardpicprog.cpp:394:14: error: expected primary-expression before ‘)’ token ardpicprog.cpp:394:14: error: expected ‘;’ before ‘)’ token ardpicprog.cpp:395:14: error: ‘name’ was not declared in this scope ardpicprog.cpp:399:18: error: ‘const struct deviceInfo’ has no member named ‘deviceId’ ardpicprog.cpp: In function ‘void cmdDevices(const char)’: ardpicprog.cpp:437:15: error: ‘progchar’ does not name a type ardpicprog.cpp:438:14: error: expected primary-expression before ‘)’ token ardpicprog.cpp:438:14: error: expected ‘;’ before ‘)’ token ardpicprog.cpp:439:14: error: ‘name’ was not declared in this scope ardpicprog.cpp:448:25: error: ‘name’ was not declared in this scope ardpicprog.cpp:449:24: error: ‘const struct deviceInfo’ has no member named ‘deviceId’ ardpicprog.cpp: In function ‘void cmdSetDevice(const char)’: ardpicprog.cpp:473:15: error: ‘progchar’ does not name a type ardpicprog.cpp:474:14: error: expected primary-expression before ‘)’ token ardpicprog.cpp:474:14: error: expected ‘;’ before ‘)’ token ardpicprog.cpp:475:14: error: ‘name’ was not declared in this scope ardpicprog.cpp:477:25: error: ‘name’ was not declared in this scope ardpicprog.cpp: In function ‘void cmdWrite(const char)’: ardpicprog.cpp:648:48: error: cannot convert ‘const char’ to ‘const int’ for argument ‘1’ to ‘bool matchString(const int, const char, int)’ ardpicprog.cpp: In function ‘void cmdWriteBinary(const char)’: ardpicprog.cpp:736:48: error: cannot convert ‘const char’ to ‘const int’ for argument ‘1’ to ‘bool matchString(const int, const char, int)’ ardpicprog.cpp: In function ‘void cmdErase(const char)’: ardpicprog.cpp:837:57: error: cannot convert ‘const char’ to ‘const int’ for argument ‘1’ to ‘bool matchString(const int, const char, int)’ ardpicprog.cpp: At global scope: ardpicprog.cpp:947:11: error: ‘prog_char’ does not name a type ardpicprog.cpp:949:11: error: ‘prog_char’ does not name a type ardpicprog.cpp:950:11: error: ‘prog_char’ does not name a type ardpicprog.cpp:1002:1: error: too many initializers for ‘const command_t’ ardpicprog.cpp:1002:1: error: too many initializers for ‘const command_t’ ardpicprog.cpp:1002:1: error: too many initializers for ‘const command_t’ ardpicprog.cpp:1002:1: error: too many initializers for ‘const command_t’ ardpicprog.cpp:1002:1: error: too many initializers for ‘const command_t’ ardpicprog.cpp:1002:1: error: too many initializers for ‘const command_t’ ardpicprog.cpp:1002:1: error: too many initializers for ‘const command_t’ ardpicprog.cpp:1002:1: error: too many initializers for ‘const command_t’ ardpicprog.cpp:1002:1: error: too many initializers for ‘const command_t’ ardpicprog.cpp:1002:1: error: too many initializers for ‘const command_t’ ardpicprog.cpp:1002:1: error: too many initializers for ‘const command_t’ ardpicprog.cpp:1002:1: error: too many initializers for ‘const commandt’ ardpicprog.cpp:1002:1: error: cannot convert ‘const char’ to ‘commandFunc {aka void ()(const char)}’ in initialization ardpicprog.cpp:1002:1: error: cannot convert ‘const char’ to ‘commandFunc {aka void ()(const char)}’ in initialization ardpicprog.cpp:1002:1: error: cannot convert ‘const char’ to ‘commandFunc {aka void ()(const char)}’ in initialization ardpicprog.cpp:1002:1: error: cannot convert ‘const char’ to ‘commandFunc {aka void ()(const char)}’ in initialization ardpicprog.cpp:1002:1: error: cannot convert ‘const char’ to ‘commandFunc {aka void ()(const char)}’ in initialization ardpicprog.cpp:1002:1: error: cannot convert ‘const char’ to ‘commandFunc {aka void ()(const char)}’ in initialization ardpicprog.cpp:1002:1: error: cannot convert ‘const char’ to ‘commandFunc {aka void ()(const char)}’ in initialization ardpicprog.cpp:1002:1: error: cannot convert ‘const char’ to ‘commandFunc {aka void ()(const char)}’ in initialization ardpicprog.cpp:1002:1: error: cannot convert ‘const char’ to ‘commandFunc {aka void ()(const char)}’ in initialization ardpicprog.cpp:1002:1: error: cannot convert ‘const char’ to ‘commandFunc {aka void ()(const char)}’ in initialization ardpicprog.cpp:1002:1: error: cannot convert ‘const char’ to ‘commandFunc {aka void ()(const char)}’ in initialization ardpicprog.cpp: In function ‘void cmdHelp(const char_)’: ardpicprog.cpp:1010:15: error: ‘prog_char’ does not name a type ardpicprog.cpp:1011:14: error: expected primary-expression before ‘)’ token ardpicprog.cpp:1011:14: error: expected ‘;’ before ‘)’ token ardpicprog.cpp:1012:14: error: ‘name’ was not declared in this scope ardpicprog.cpp:1014:15: error: ‘prog_char’ does not name a type ardpicprog.cpp:1015:14: error: expected primary-expression before ‘)’ token ardpicprog.cpp:1015:14: error: expected ‘;’ before ‘)’ token ardpicprog.cpp:1016:15: error: ‘progchar’ does not name a type ardpicprog.cpp:1017:14: error: expected primary-expression before ‘)’ token ardpicprog.cpp:1017:14: error: expected ‘;’ before ‘)’ token ardpicprog.cpp:1018:25: error: ‘name’ was not declared in this scope ardpicprog.cpp:1021:33: error: cannot convert ‘const char’ to ‘const int’ for argument ‘1’ to ‘void printProgString(const int)’ ardpicprog.cpp:1025:25: error: ‘desc’ was not declared in this scope ardpicprog.cpp: At global scope: ardpicprog.cpp:1033:24: error: ‘prog_char’ does not name a type ardpicprog.cpp:1033:35: error: ISO C++ forbids declaration of ‘name’ with no type [-fpermissive] ardpicprog.cpp: In function ‘void processCommand(const char*)’: ardpicprog.cpp:1082:15: error: ‘prog_char’ does not name a type ardpicprog.cpp:1083:14: error: expected primary-expression before ‘)’ token ardpicprog.cpp:1083:14: error: expected ‘;’ before ‘)’ token ardpicprog.cpp:1084:14: error: ‘name’ was not declared in this scope ardpicprog.cpp:1086:25: error: ‘name’ was not declared in this scope