[Top][All Lists]

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

Re: [avr-gcc-list] Someting I don"t understand with PGM_P et pgm_read_by

From: Bernard Fouché
Subject: Re: [avr-gcc-list] Someting I don"t understand with PGM_P et pgm_read_byte_far()
Date: Tue, 01 Mar 2005 18:49:31 +0100
User-agent: Mozilla Thunderbird 1.0 (Windows/20041206)

E. Weddington a écrit :

Bernard Fouché wrote:

So it appears that, even for an ATMEGA128, a PGM_P data type is a 16 bits pointer.

That is correct.

IMHO PGM_P and PROGMEM should adapt to the flash space size of the target. I'm writing code that has to work for atmega64 & 128, and I have to redefine my own set of macros to have such a fonctionnality (I don't like to patch 'system' file like pgmspace.h). I don't see yet how to do so for PROGMEM since it is just a rewrite of __attribute__((__progmem__)).

For instance, how not to have a compiler warning for:

uint8_t Xy[3] PROGMEM = { 1,2,3 } ;

uint8_t f(uint32_t x)
   return pgm_read_byte_far(Xy+x);

when compiling for atmega128 ??

Is there a chance that sometimes such macros will change of data type according to the target in a future release?

reply via email to

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