avr-gcc-list
[Top][All Lists]
Advanced

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

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


From: E. Weddington
Subject: Re: [avr-gcc-list] Pgmspace.h Use
Date: Tue, 09 Aug 2005 05:11:34 -0600
User-agent: Mozilla Thunderbird 1.0 (Windows/20041206)

address@hidden wrote:

Hello,

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






reply via email to

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