[Propgcc] Memory Mapping Calibration Constants from EEPROM into RAM.
TomUdale
Posts: 75
Greetings,
I am making a device that has some associated analog circuitry. We want to be able to access device specific calibration constants in our C code.
We have written a small spin program that allows our techs to run a calibration with the help of the terminal. The program takes the data points and calculates a series of parameters that we want to write into EEPROM.
We have a second EEPROM that we could write them to and then simply read them back explicitly with a routine.
It occurs to me however that I could have our spin program write them to a known address in the EEPROM used by the boot loader. Then (somehow) we would define variables in C that would be linked to that "known" location but which would not be part of the image so that the values written by the spin program would not get overwritten by the programmer.
The hopeful end result is that my C routines would then simply be able to directly read from some variables that magically have the values written by the spin program.
It is kind of like a merge of bss and data - you want the variables to not be part of the image you write (like bss), but you want them to be filled from the image when it is read (like data).
Any ideas if this is possible and if so, how to do this? Maybe something like declare them as uninitialized, but then use some linker script to force the address of those variables to be past the end of the image and then update the length of the image as it is written out to the propeller?
All the best,
Tom
I am making a device that has some associated analog circuitry. We want to be able to access device specific calibration constants in our C code.
We have written a small spin program that allows our techs to run a calibration with the help of the terminal. The program takes the data points and calculates a series of parameters that we want to write into EEPROM.
We have a second EEPROM that we could write them to and then simply read them back explicitly with a routine.
It occurs to me however that I could have our spin program write them to a known address in the EEPROM used by the boot loader. Then (somehow) we would define variables in C that would be linked to that "known" location but which would not be part of the image so that the values written by the spin program would not get overwritten by the programmer.
The hopeful end result is that my C routines would then simply be able to directly read from some variables that magically have the values written by the spin program.
It is kind of like a merge of bss and data - you want the variables to not be part of the image you write (like bss), but you want them to be filled from the image when it is read (like data).
Any ideas if this is possible and if so, how to do this? Maybe something like declare them as uninitialized, but then use some linker script to force the address of those variables to be past the end of the image and then update the length of the image as it is written out to the propeller?
All the best,
Tom
Comments
At least this is the way it works with Spin. I'm not so sure about C.
All the best,
Tom