Flash writes
Posted: Tue Dec 04, 2012 2:36 am
>from the help line
>I am trying to store one persistant integer variable for my GPS
>control program. Simple test programs work but not in my full
>program. The compiler reports my code occupying 13K or $3400 words.
>This should put the top of my code at ~$6400 according to the help
>file memory map. I am not quite clear from the help for "Write"
>whether I have to have a clear 4K ($1000) block free or whether
>alignment has to be on $1000 hex boundaries. I have no Data
>allocations and minimal String Constants. Wherever I put the start
>of my subblock I either am obviously overwriting my code (below
>$6400) or I get a Data Abort error at run time. I use the minimum
>subblock size (256) as I only have one integer to store.
The User Manual lays out the memory map for the Flash. Blocks have to
be erased and "prepared" on $1000 hex boundaries.
So in your case it would probably be easier to copy the String
contents back into the block after you erase $7000. You can not use a
string function to do it, as the individual strings will be seperated
by 0's. So declare a String Array, but copy elements by--
DIM SaveStrings(128)
For i=0 to 127 by 4
SaveStrings(i) = *($7e00 + i*4)
next i
' write your value
Write ($7e00, SaveStrings, 512)
I haven't tried this, let us know how it works
PS remember the Flash is only rated for 100K writes, so don't be doing
it all the time.
>I am trying to store one persistant integer variable for my GPS
>control program. Simple test programs work but not in my full
>program. The compiler reports my code occupying 13K or $3400 words.
>This should put the top of my code at ~$6400 according to the help
>file memory map. I am not quite clear from the help for "Write"
>whether I have to have a clear 4K ($1000) block free or whether
>alignment has to be on $1000 hex boundaries. I have no Data
>allocations and minimal String Constants. Wherever I put the start
>of my subblock I either am obviously overwriting my code (below
>$6400) or I get a Data Abort error at run time. I use the minimum
>subblock size (256) as I only have one integer to store.
The User Manual lays out the memory map for the Flash. Blocks have to
be erased and "prepared" on $1000 hex boundaries.
So in your case it would probably be easier to copy the String
contents back into the block after you erase $7000. You can not use a
string function to do it, as the individual strings will be seperated
by 0's. So declare a String Array, but copy elements by--
DIM SaveStrings(128)
For i=0 to 127 by 4
SaveStrings(i) = *($7e00 + i*4)
next i
' write your value
Write ($7e00, SaveStrings, 512)
I haven't tried this, let us know how it works
PS remember the Flash is only rated for 100K writes, so don't be doing
it all the time.