Britton Kerin <[email protected]> wrote: > But this doesn't (prints garbage): > > PGM_P hello_string = "hello\n"; > printf_P (hello_string);
Because it produces a string in SRAM, which you then try to re-interpret as a flash string. (Of course, it also produces the initial data for the SRAM string in flash, to be copied over by the startup code.) > Which doesn't mention PROGMEM at all? Before Johann's implementation of named address spaces, the compiler simply could not know at all whether the data were in flash or RAM; everything was up to the developer. The developer had to place the string manually into flash using PSTR(), and it manually had to take care the correct (LPM-based) retrieval macros/functions were used. With named address spaces, and the __flash type qualifier, things are different. The compiler then can keep track of the type qualifier, and it knows it has to use LPM to access the data. -- cheers, Joerg .-.-. --... ...-- -.. . DL8DTL http://www.sax.de/~joerg/ Never trust an operating system you don't have sources for. ;-) _______________________________________________ AVR-chat mailing list [email protected] https://lists.nongnu.org/mailman/listinfo/avr-chat
