New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Write anywhere #18

Open
wants to merge 3 commits into
base: master
from

Conversation

Projects
None yet
2 participants
@Sjord
Copy link
Contributor

Sjord commented Jan 9, 2017

The flash is addressable as 32-bit words, so we can only write on 32-bit boundaries. If the offset parameter to writeCODE is not divisible by 4 (bytes), we will write to the wrong location. Put 0xff on the front of data so that data is still written to the correct location.

Also, make sure the size of the data is also divisable by 4, as the documentation states: "note that the block size, LEN in configuration data, must be divisible by 4; otherwise, the last word is not written to the flash".

This is not really an ideal solution because we will now also check the 0xff padding when verifying the write. This should not happen.

Sjord added some commits Jan 9, 2017

Don't overwrite values when erasing
When erasing, we would write different values to 0x6271 (flash address) than
are needed to write the data. Move the write after the erase so they don't
interfere with each other.
Pad data to write anywhere
The flash is addressable as 32-bit words, so we can only write on 32-bit boundaries. If the offset parameter to writeCODE is not divisible by 4 (bytes), we will write to the wrong location. Put 0xff on the front of data so that data is still written to the correct location.

Also, make sure the size of the data is also divisable by 4, as the documentation states: "note that the block size, LEN in configuration data, must be divisible by 4; otherwise, the last word is not written to the flash".

This is not really an ideal solution because we will now also check the 0xff padding when verifying the write. This should not happen.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment