Closed danbev closed 1 year ago
I think that's because the bootloader allows to update the config over the air while keeping the old version in case something goes wrong. So the preprovision make sure both are populated. I think @lulf will confirm or correct me on this :)
I think that's because the bootloader allows to update the config over the air while keeping the old version in case something goes wrong. So the preprovision make sure both are populated.
Ah that makes sense, thanks for that!
There is no bootloader involved in this firmware, but the firmware keeps the provisioning config in two places, to prevent configuration to be lost during a erase + write cycle of the configuration, which happens every 10 seconds by default (this is to ensure sequence counter is persisted). If power is lost during the erase+write, the configuration is gone. By keeping the configuration in two flash pages, writing it twice, we ensure that we have at least one configuration that is not wiped.
@lulf Thanks for the detailed explanation!
This commit updates the provision command to include the
--device-key
option. It also adds a second execution of this command with the only difference being the value of theflash-address
. I noticed that this is done in../preprovision.sh
, but I don't understand why this is required , but I was not able to get the firmware to work without doing this.I'm mainly opening this PR as question as I'm curious as to the "double" writing, can anyone help me understand that part?
Signed-off-by: Daniel Bevenius daniel.bevenius@gmail.com