Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Write anywhere #18
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.