Donal Morrissey

Copy Values from ROM to RAM at startup

Discussion created by Donal Morrissey on Dec 18, 2006
Latest reply on Dec 18, 2006 by Daniel Lundin
Hello All,
I have a problem where I need to copy calibrations from ROM to RAM upon startup, but I wish to keep the same variable name throughout the application code.

For example, a calibration variable initialization is as follows:

#pragma CONST_SEG EEPROM_CALS
extern const U32 Sb10_Constant8 = 0x0023;

Now, this variable is used throughout the application. And there are certain situations when I will want to modify this value, to test the behaviour of the application to this new value. I may also want to flash this new value back into EEPROM.

There can't be a second RAM variable for this, as part of the application is auto generated.
So the following simple solution would not suffice:
Sb10_Constant8_RAM = Sb10_Constant8_ROM;

Is there any method to allow the variable initialization to occur but upon start-up the value is copied into RAM with the variable name Sb10_Constant8 always residing in RAM?


Cheers,
Donal

Outcomes