[Bug target/49868] New: Implement named address space to place/access data in flash memory

gjl at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Wed Jul 27 12:45:00 GMT 2011


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: unassigned@gcc.gnu.org
        ReportedBy: gjl@gcc.gnu.org
                CC: eric.weddington@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.



More information about the Gcc-bugs mailing list