So Ill duplicate the upload command to an erase command. Is there a bit of metadata I could check to see if a slot was filled and erase was necessary? If so I could conditionally erase in the upload command still, for backwards compat reasons.
On Fri, May 5, 2017 at 6:10 PM, Christopher Collins <[email protected]> wrote: > On Fri, May 05, 2017 at 05:58:52PM -0700, Jacob Rosenthal wrote: > > Thats basically what Im saying. Though if you just do #2 I wont need a > > separate erase command. It'll erase and disconnect the first time, but > not > > the second time. Ill get an erase command for free. > > I don't think that will work without some more intelligence in the image > upload command handler. Here is the typical sequence of events: > > 1. Image upload (offset=0) command received. > 2. Command handler erases second image slot. > 3. BLE connection drops during erase. > 4. Command handler writes first part of image to beginning of second > slot. > > If you try to reconnect and upload again, the firmware will need to > erase the second slot once again, as the first image part has already > been written. By separating the flash erase from the write, you can > ensure the slot is empty before starting the upload. > > The extra "intelligence" I mentioned would be the command handler > comparing the flash contents against the data contained in the upload > request. If the contents are identical, the firmware could skip the > erase and act like it just wrote the image segment (or indicate to the > client that it should resume the upgrade at a particular offset). > > Chris >
