[Top][All Lists]

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

[avr-gcc-list] read Access to all of the Atmega 128 flash memory

From: Roland Zitzke
Subject: [avr-gcc-list] read Access to all of the Atmega 128 flash memory
Date: Sun, 2 Jun 2002 10:21:17 +0200

I am developing a project on an atmega128 with about 16k of code and a lot of (80 k) audio sample data which will reside in flash memory.
I would preferably convert this data to C compatible code and let gcc and the linker decide on the actual location of these variables.
Code will look like:
#include <progmem.h>
unsigned char PROGMEM audio1 [] =
0x80, 0x95, 0x3f, ..., 0x4c
I will get about 15 variables like this each containing about 5 k of data.
The compiler has no choice but to put samples in both lower and upper memory where lower memory is below 64k.
Now, how do I access bytes from these variables correctly in gcc?
I see in pgmspace.h (which gets included by progmem.h):

#if 0

#define PRG_RDB(addr) __lpm_inline((unsigned short)(addr))


#define PRG_RDB(addr) _LPM((unsigned short)(addr))


but to my understanding the LPM instruction can only handle lower memory? (or am I wrong?)

There is the ELPM instruction but it requires of cause an address to be longer than 16 bit. How do I obtain this address from within my gcc code for one of my variables?

Any hints?

Thanks and regards


reply via email to

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