I would use the absolute addressing to place it at the very last block of the flash memory, so that it is completely separate from your code space.  For example, if it's a 16k flash, store your variables from 0x3E00-0x3FFF.
While it would be convenient for SDCC to handle this automatically, it would add quite a bit of programming complexity.  Basically, there would need to be a way to have user-defined data segments, and then a way for the C-code to specifiy in which segment the variable should go.
Josh Stone
-----Original Message-----
From: sdcc-user-admin@lists.sourceforge.net [mailto:sdcc-user-admin@lists.sourceforge.net]On Behalf Of Adam Braun
Sent: Monday, September 22, 2003 12:27 AM
To: sdcc-user@lists.sourceforge.net
Subject: [Sdcc-user] Anyway to specify addsolute location for ROM/flash variables?

I’m working with a flash based part and the project requires some configuration variables to be stored in the device flash memory.  Ideally these values can be changed at runtime, but there’s an issue with their locations.  The flash is organized in 512 byte blocks that must be completely erased and reprogrammed to change a single byte value.  However, if the code builds so that the memory aligns the configuration block such it contains any code, it seems pretty dangerous to erasing and reprogramming the code segment.  This would be an especially SIGNIFICANT issue if code to reprogram the flash memory happens to align with the block that contains the actual data…


I was wondering if there is any way to configure a build with SDCC to handle this situation automatically.  I found the information about absolute addressing, but this doesn’t sound as this would help unless I exclude a segment of the code memory and handle the allocation of this block myself.