http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49868
Summary: Implement named address space to place/access data in flash memory Product: gcc Version: 4.7.0 Status: UNCONFIRMED Severity: enhancement Priority: P3 Component: target AssignedTo: unassig...@gcc.gnu.org ReportedBy: g...@gcc.gnu.org CC: eric.wedding...@atmel.com Target: avr Created attachment 24841 --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=24841 Sample code to show usage of __pgm address space. AVR is Harvard architecture and it need special instructions to read data from flash (LPM) which are different to the instructions needed to read data from RAM. The address space is not linearized. Linearizing the address space at the compiler level is not really wanted because this would mean gread deal of overhead and incompatibility with current implementation. The current situation is this: To put data in flash storage (section .progmem.data) there is a decl attribute "progmem". To access the data, inline assembly is used, e.g. by means of pgm_read_* functions supplied by avr-libc. A Named Address Space enales to write type-safe code that is not cluttered up with inline assembly access functions all over the place. Moreover, some optimizations like PR49857 (Put constant switch-tables into flash) and PR43745 (Put VTABLES into flash) need named addresses to express the flash-access inside GCC.