[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [avr-gcc-list] Re: Structs in program memory.
From: |
Christian Ludlam |
Subject: |
Re: [avr-gcc-list] Re: Structs in program memory. |
Date: |
Tue, 11 May 2004 23:45:24 +0100 |
User-agent: |
Messenger-Pro/1.00c (MsgServe/1.00a) (RISC-OS/5.05) POPstar/2.05 |
On 11 May Douglas Dotson wrote:
> I guess my concern is how do I declare a pointer to
> something in program memory. Is there any special
> consideration? I have an array of structs but I am
> accessing the individual elements via a pointer
> rather than a subscript.
<avr/pgmspace.h> declares pointer types prog_void, prog_int etc. A pointer
type can be created with
typedef const prog_void *prog_void_p;
See also the PGM_P and PGM_VOID_P types from the same header. It's not too
important, though, since the pointer type is cast to int by the pgm_read_word
functions.
There are issues with the different addressing modes in that one uses byte
addressing, and the other word addressing (so changing between addressing
modes requires division or multiplication by 2). I assume that GCC gets the
address right for variables declared as PROGMEM, so you should be OK. Best
thing to do is try it and see!
--
Christian Ludlam
address@hidden
- [avr-gcc-list] Re: Structs in program memory., Douglas Dotson, 2004/05/10
- Re: [avr-gcc-list] Re: Structs in program memory., Christian Ludlam, 2004/05/11
- Re: [avr-gcc-list] Re: Structs in program memory., Douglas Dotson, 2004/05/11
- Re: [avr-gcc-list] Re: Structs in program memory.,
Christian Ludlam <=
- [avr-gcc-list] Support for ATMega256 and ATMega2560, Geir Tore Olsen, 2004/05/12
- Re: [avr-gcc-list] Support for ATMega256 and ATMega2560, Theodore A. Roth, 2004/05/12
- Re: [avr-gcc-list] Support for ATMega256 and ATMega2560, Joerg Wunsch, 2004/05/13
- Re: [avr-gcc-list] Support for ATMega256 and ATMega2560, Marek Michalkiewicz, 2004/05/13
- RE: [avr-gcc-list] Support for ATMega256 and ATMega2560, Geir Tore Olsen, 2004/05/13
- Re: [avr-gcc-list] Support for ATMega256 and ATMega2560, Theodore A. Roth, 2004/05/13
- Re: [avr-gcc-list] Support for ATMega256 and ATMega2560, Joerg Wunsch, 2004/05/14
- Message not available
- Re: [avr-gcc-list] Support for ATMega256 and ATMega2560, Joerg Wunsch, 2004/05/14