
On 09/23/2015 09:44 AM, Fabio Estevam wrote:
On Wed, Sep 23, 2015 at 12:36 PM, Fabio Estevam festevam@gmail.com wrote:
On Wed, Sep 23, 2015 at 12:22 PM, Stephen Warren swarren@wwwdotorg.org wrote:
This feels wrong. The entries in the DFU list must already be sector-aligned, so there's no need for the code to round them. If the entries are not already aligned, then the aligned erase operations will erase other data, which will cause corruption.
The start address does not need to be sector-aligned.
In my case the SPL image needs to be placed at 0x400.
Also, just to clarify: in this patch we make sure that the erase operation are always sector-aligned.
Only the write operations can be 'shifted' due to the start address passed via dfu_alt_info.
So it's OK to erase the data between 0..0x400 and not replace it? Even if that's true in your case, it seems quite unlikely in general.
Instead, the DFU region should start and end at sector-aligned locations so that erasing the region doesn't negatively affect other data. If logical objects in your flash aren't sector aligned, then that simply means you need to construct a complete flash image and write the whole thing at once. I don't thin there's any other way to avoid corruption.