Forum Discussion
Altera_Forum
Honored Contributor
12 years agoActually, I think I now understand one difference. You only need to call alt_erase_flash_block() once to erase a block, but can then call alt_write_flash_block() multiple times to write to this block (as long as you don't overwrite the same addresses). If you had a function that writes (e.g.) a buffer of 50 bytes, and wanted to call this 5 times with consecutive addresses), you would only need to do the erase if the block changes. So if all the buffers were being written to the same block, you would only do the erase once.
If you were doing this with the simple functions you would have to either write them all to a buffer in memory, then just write this buffer once with a single alt_write_flash() call, or do the whole read+modify+erase/write routine five times. I found this sentence confusing: "alt_write_flash_block() writes to a single block in the flash memory." as I thought this meant "writes a complete block". I think I understand now that you can just write a single byte without affecting the rest of the block, which you can't do with the simple functions. Is this correct?