I have a MAX10 / NIOS II system with "Single Uncompressed image with memory initialization" configuration. During run time the system stores some data (512 bytes) that are needed at the next boot up (power up).
I tried storing this info in the UFM space at different addresses. The store/read from flash routine is working(tested) during normal run time. The problem is that when I try to read the data after power up it seems that all the UFM space not used for NIOS program is set to "0" and my stored data is not available anymore. How can I solve this problem?
Are there any settings that prevent the unused UFM to be set to "0" on power up?
Are there any flash locations where I can store my data for the next power up?
Thank you for your help!
Do you mean you want to retain the data value of a variable in UFM flash when you power up again ? Normally the data value will be initialized to its initial value when you do power up again. The previous data will be gone.
Have you tried command alt_write_flash_block() when you are writing to MAX10 UFM ?
alt_write_flash() erase any affected pages of UFM then write to memory, this may erase your old data. To ensure that data isn’t destroyed when using the alt_write_flash() function, it’s recommended to perform a read-modify-write operation on the flash memory. Meaning, you read the entire page of memory into a buffer in RAM, modify the buffer with the data you want to include, erase the entire page, and write the buffer back to flash.