You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Arduino IDE 1.6.8
Arduino AVR Boards 1.6.10
Arduino SAM Boards 1.6.9
On Mega2560, the following sketch compiles OK:
void setup() {
// put your setup code here, to run once:
char str_debug_1[] PROGMEM = "ECHO";
Serial.print((char*)pgm_read_ptr(&str_debug_1));
}
void loop() {
// put your main code here, to run repeatedly:
}
On Due, the same sketch has a compile error :
In file included from C:\Users\bob\AppData\Local\Arduino15\packages\arduino\hardware\sam\1.6.9\cores\arduino/Arduino.h:31:0,
from C:\Users\bob\AppData\Local\Temp\build3a01f77cc023d803352a39f55ca441db.tmp\sketch\sketch_pgm_read_test.ino.cpp:1:
C:\Users\bob\Documents\Arduino\sketch_pgm_read_test\sketch_pgm_read_test.ino: In function 'void setup()':
C:\Users\bob\AppData\Local\Arduino15\packages\arduino\hardware\sam\1.6.9\cores\arduino/avr/pgmspace.h:106:49: error: 'const void*' is not a pointer-to-object type
#define pgm_read_ptr(addr) (*(const void *)(addr))
^
C:\Users\bob\Documents\Arduino\sketch_pgm_read_test\sketch_pgm_read_test.ino:6:23: note: in expansion of macro 'pgm_read_ptr'
Serial.print((char*)pgm_read_ptr(&str_debug_1));
^
exit status 1
Error compiling for board Arduino Due (Programming Port).
Inspection of pgm_read_ptr (in avr/pgmspace.h) for Due shows : - #define pgm_read_ptr(addr) (*(const void *)(addr))
This macro casts the argument void *, then tries to dereference a void *, which is guaranteed to never work.
Probably, the cast to (void *) is not needed.
The text was updated successfully, but these errors were encountered:
Arduino IDE 1.6.8
Arduino AVR Boards 1.6.10
Arduino SAM Boards 1.6.9
On Mega2560, the following sketch compiles OK:
On Due, the same sketch has a compile error :
Inspection of pgm_read_ptr (in avr/pgmspace.h) for Due shows : -
#define pgm_read_ptr(addr) (*(const void *)(addr))
This macro casts the argument void *, then tries to dereference a void *, which is guaranteed to never work.
Probably, the cast to (void *) is not needed.
The text was updated successfully, but these errors were encountered: