i want to create an array in flash
flash
create buffer 1024 allot ram
then i want to insert data inside, with cmove, accept etc..
it works well in my code but, after a reset, the data is lost. what is the way to do it and don't lost the data?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
There is a small trick to get 1536 ($600) bytes of extra ram on the Scamp. You can use the flash buffer in ram to store data as long as you do not attempt to write anything to flash. Just be sure to empty the flash buffer with IFLUSH before using the buffer.
With the latest Scamp version the buffer starts at $84a.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
When writing data to flash, the data is gathered in a aligned 1 Kbyte ram buffer (Scamp). That buffer is written to flash if it gets full, or if 300 milliseconds has passed after the last write to flash. The timeout is handled inside PAUSE by calling IFLUSH. So if you call PAUSE often like the normal interpreter does, the data should find it's way into flash.
Just now I tried it on a Scamp2e and it works just fine.
flashcreatearray100allotram1234array!\ Wait for 300 ms before disconnecting the power.\ Reconnect the powerarray@.1234ok
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
By the way. If you write your code so that the ram buffer will flush to flash for each cell or byte, it will quickly wear out the flash, since for each char/cell the whole 1 kbyte block is erased and rewritten..
A buffer in flash sounds suspect to me. Flash data should really contain just static or almost static data.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
yes, i know. mi idea was
flash create buffer 4096 allot
ram create array 1024 allot
array buffer u cmove \ maybe to much wear?
i only use it time by time. i want to use for saving data to external memory system.
but maybe is not good idea.
what do you think about:
buffer r| variable x : test 1 1 + . ; : test2 2 2 * . ; | ; \ r| parse multiline and have my data in text file.
\ r| ( text -- addr u )
then i have my data in the flash word buffer.
buffer array place \ my data in ram
or
buffer ext-memory save! \ save! is a user word and i can save until 4K
array c@+ evaluate \ to compile my data
why i need in flash? because some files are about 4 K and i have not space in ram
but i will save files to external memory onlyfew times.
Last edit: Pere font vilanova 4 days ago
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
i want to create an array in flash
flash
create buffer 1024 allot ram
then i want to insert data inside, with cmove, accept etc..
it works well in my code but, after a reset, the data is lost. what is the way to do it and don't lost the data?
There is a small trick to get 1536 ($600) bytes of extra ram on the Scamp. You can use the flash buffer in ram to store data as long as you do not attempt to write anything to flash. Just be sure to empty the flash buffer with IFLUSH before using the buffer.
With the latest Scamp version the buffer starts at $84a.
When writing data to flash, the data is gathered in a aligned 1 Kbyte ram buffer (Scamp). That buffer is written to flash if it gets full, or if 300 milliseconds has passed after the last write to flash. The timeout is handled inside PAUSE by calling IFLUSH. So if you call PAUSE often like the normal interpreter does, the data should find it's way into flash.
Just now I tried it on a Scamp2e and it works just fine.
By the way. If you write your code so that the ram buffer will flush to flash for each cell or byte, it will quickly wear out the flash, since for each char/cell the whole 1 kbyte block is erased and rewritten..
A buffer in flash sounds suspect to me. Flash data should really contain just static or almost static data.
yes, i know. mi idea was
flash create buffer 4096 allot
ram create array 1024 allot
array buffer u cmove \ maybe to much wear?
i only use it time by time. i want to use for saving data to external memory system.
but maybe is not good idea.
\ r| ( text -- addr u )
then i have my data in the flash word buffer.
buffer array place \ my data in ram
or
buffer ext-memory save! \ save! is a user word and i can save until 4K
array c@+ evaluate \ to compile my data
why i need in flash? because some files are about 4 K and i have not space in ram
but i will save files to external memory onlyfew times.
Last edit: Pere font vilanova 4 days ago
That kind of use looks fine to me. Mileage may vary.
Do you mean that "array buffer u cmove" does not keep the data in flash after a power cycle ?
Last edit: Mikael Nordman 4 days ago