[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[avr-gcc-list] ordering of EEPROM variables
From: |
Wolfgang Wegner |
Subject: |
[avr-gcc-list] ordering of EEPROM variables |
Date: |
Tue, 06 Sep 2005 16:46:11 +0100 |
Hello list,
I am porting a project from IAR to gcc because the latest IAR version
broke it anyways, and am having some problems with my EEPROM
variables.
The declaration is as follows:
#ifdef GENERATE_STATIC_VARS
#ifdef __GNU__
#define PREFIX
#define EEVAR(vdecl, ...) vdecl __attribute__ ((section (".eeprom")))
__VA_ARGS__
#else
#define PREFIX __root
#define EEVAR(vdecl, ...) __root __eeprom vdecl __VA_ARGS__
#endif
#else
#define PREFIX extern
#ifdef __GNU__
#define EEVAR(vdecl, ...) extern vdecl __attribute__ ((section
(".eeprom")))
#else
#define EEVAR(vdecl, ...) extern __root __eeprom vdecl
#endif
#endif
[...]
EEVAR( unsigned char EE_PID_ALaenge, = 0x09);
EEVAR( unsigned char EE_PID_A[], = { 0x00,0x01, 0x00,0x10, 0x09,0x98,
0x09,0x99,0x10,0x00, 0x10,0x01, 0x15,0x00, 0x15,0x01,0x0C,0x92 });
EEVAR( unsigned char eFILL_3[MAX_NUMBER_OF_PID_FILTERS * 2 - 18], );
Sorry for the "unreadable" defines, I wanted to leave in the part for
IAR because this is known to work. The macro EEVAR is needed because
I want to share the declaration between all files where these are
referenced, and of course only one file can actually implement the
variables.
The problem is that the variables are sorted "top-down" by gcc (or
the linker), so my placeholders do not work. I can of course manually
fill these, but I think there has to be a better way.
Sorry in case this is an FAQ (I think it has to be?!), but I did not
find any comments to this, and also did not find anything in the
linker script that could explain it.
Any hints on what I am doing wrong or how to solve it are greatly
appreciated! :-)
Thank you,
Wolfgang
- [avr-gcc-list] ordering of EEPROM variables,
Wolfgang Wegner <=