[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: E. Weddington
Subject: Re: [avr-gcc-list] Someting I don"t understand with PGM_P et pgm_read_byte_far()
Date: Tue, 01 Mar 2005 10:09:50 -0700
User-agent: Mozilla Thunderbird 0.7.3 (Windows/20040803)

Bernard Fouché wrote:

Hi there.

I'm trying to compile for ATMEGA128. I sometimes need to use pgm_read_byte(). For instance with:

uint8_t  f(PGM_P p)
   return pgm_read_byte_far(p);

When doing so, the compiler says:
"warning: cast from pointer to integer of different size".

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

That is correct.

How can I tell the compiler that 'p' is a 32 bits address in flash in a proper way?

Use the correct type.

uint8_t  f(uint32_t p)
  return pgm_read_byte_far(p);


reply via email to

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