[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

AW: [avr-gcc-list] Pgmspace.h Use

From: Haase Bjoern (PT-BEU/EMT) *
Subject: AW: [avr-gcc-list] Pgmspace.h Use
Date: Tue, 9 Aug 2005 13:58:23 +0200


-----Urspr√ľngliche Nachricht-----
Von: address@hidden [mailto:address@hidden Im Auftrag von E. Weddington
Gesendet: Dienstag, 9. August 2005 13:12
An: address@hidden
Cc: address@hidden
Betreff: Re: [avr-gcc-list] Pgmspace.h Use

address@hidden wrote:

>for code portability reasons, I would like to avoid to call explicity the
>function pgm_read_byte() like in the following example :
>const prog_char array[7] = {0x10,0x20,0x30,0x40,0x50,0x60,0x70};
>y = pgm_read_byte(&array[2]);
>// I would like to to keep the syntax y = array[2]; without having the array
>copied in the SRAM
>Is there a way to do it ?
No. The declaration you give above *is* how you put the array in Flash,
and how you access the array in Flash. GCC requires a new feature patch
for it to know that the expression, y = array[2], means that array is in
Flash and to use the correct assembly sequence. There is a person
working on such a feature, however, it is very non-trivial to implement
in GCC. And currently there is not a deadline when this work will be
completed as it being written by a volunteer.

Eric Weddington

IMO, it is not a problem of gcc, it is a problem of the C programming language 
that lacks
support for Harvard architectures. In order to add support, you are forced to 
leave the ANSI standard, IIUC.



AVR-GCC-list mailing list

reply via email to

[Prev in Thread] Current Thread [Next in Thread]