janjongboom/janpatch

min flash size for patch

Closed this issue · 1 comments

Hi,
it seems the mcu's flashsize shoud require min with: old file size+ patch file size +new file size?
is it possiable direct patch in the flash addr of the old file,that will only require fewer flash size with old file size+ new file size.

Hi @iot-lorawan, sorry for the late reply - was not checking my GH activity tab. Your assumption on flash size is correct. We can't write directly to the old file as we do things like backtracking and keeping some state which depends on the content of the old file. Also, that would mean you don't have a failsafe.

My initial idea was to use FlashIAP APIs to read the current content of internal flash and patch that (doesn't require you to hold the current firmware somewhere), but I learned that you can't use FlashIAP to read code that's currently running reliably on a lot of MCUs.