This is the mail archive of the crossgcc@sourceware.cygnus.com mailing list for the crossgcc project.

See the CrossGCC FAQ for lots more infromation.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

possible to have some C variables uninitiialized?


I'm using gcc on a 68000-based embedded system that has some normal RAM
and some battery-backed RAM.  I'd like to know if there is a way to have
the gcc compiler/linker not initialize certain C variables that will be
located in the battery-backed RAM area.

I'd like these global variables to be declared normally, for example,

int IAmANonVolatileInt = 3;

but I don't want them lumped in with the normal global variables that
will get initialized to either 0 or to a certain value on powerup of the
embedded system.

I could cheat and do the following:

#define BATTERY_BACKED_RAM_ADDRESS (0x800000)
#define IAmANonVolatileInt (*(int *)BATTERY_BACKED_RAM_ADDRESS)

but I'd rather not.


Any ideas on how to accomplish this?  An example would be great, too!

------
Want more information?  See the CrossGCC FAQ, http://www.objsw.com/CrossGCC/
Want to unsubscribe? Send a note to crossgcc-unsubscribe@sourceware.cygnus.com


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]