[fpc-pascal] Place of elements in record

Mark Morgan Lloyd markMLl.fpc-pascal at telemetry.co.uk
Thu Feb 28 09:41:00 CET 2013


Koenraad Lelong wrote:
> Hi,
> 
> I'm developping a arm-embedded project. I need to store some variables 
> to EEPROM. What I'm doing now is manually give each variable an address 
> and then I use that address to store the variable in EEPROM. 
> Unfortunately, that's not easy. Yesterday I spent some hours trying to 
> see why the code I wrote does not work. This morning I thought of a 
> possible reason, and I think I'm right : I was overlapping some variables.
> 
> So I'm trying to find a simpler way to have the relative position of 
> variables to use as an address in an EEPROM.
> I'm tinking about using a record. Is there a way to get the relative 
> position of a record-element ?
..
> Mmm, writing things out clears the mind. I think it would be better to 
> write the whole record.

I'd suggest that this depends in part on the semiconductor technology. 
You might be best transferring individual fields for old-fashioned 
EEPROMs, or defining a larger block with a magic number for more 
"RAM-like" devices particularly if they have load-levelling.

I've had to deal with the mess left by a contractor who was 
pathologically incapable of keeping NVR layout consistent across 
versions, and it wasn't pleasant.

-- 
Mark Morgan Lloyd
markMLl .AT. telemetry.co .DOT. uk

[Opinions above are the author's, not those of his employers or colleagues]



More information about the fpc-pascal mailing list