Chris Belsky

Variable initialization in EEPROM at Compile Time

Discussion created by Chris Belsky on Feb 5, 2010
Latest reply on Feb 6, 2010 by CompilerGuru

Hello,

 

I'm a user of the 8-bit HCS08 microprocessors (in this project I'm using the HCS08DZ60A).  Does anyone know of a technique where I can initialize a variable that's declared in EEPROM at compile time?  In other words, I'd like to do something like the following:

 

#pragma DATA_SEG    _EEPROM
// Variable initialized during compile. 
volatile unsigned char eeprom_byte = 0xAB;

 

So that after programming the microprocessor, the variable eeprom_byte is initialized to value 0xAB. 

 

What I'm trying to accomplish is a method for detecting a 'virgin load' of the firmware into the micro, and store the status in this byte. 

 

Thanks much,

~Chris

Outcomes