crownstone / bluenet

Bluenet is the in-house firmware on Crownstone hardware. Functions: switching, dimming, energy monitoring, presence detection, indoor localization, switchcraft.
https://crownstone.rocks
91 stars 62 forks source link

Add "new app" info in bootloader -> microapp data #180

Closed mrquincle closed 2 years ago

mrquincle commented 2 years ago

Across reboots it might be useful for certain parts of our code to know if it is booted with a new firmware for the first time.

Consider this concern about the MicroappManager using part of RAM to store information across reboots:

If these structs change with a firmware upgrade, things might be interpreted wrong.
Maybe move this to the protocol dir or so?

_Originally posted by @vliedel in https://github.com/crownstone/bluenet/pull/178#discussion_r944516970_

One of the ways this can be fixed is by adding more information into that RAM data. In this case versioning. That however needlessly adds version information and raises the question when the version has to be bumped and by whom.

This can be fixed by the bootloader wiping this part of RAM when new firmware is starting for the first time. However, that adds again functionality to the bootloader.

This can also be fixed by the bootloader better informing the app. There's already an IPC ram section defined for it. Also other code can benefit from this, for example for migration purposes.

mrquincle commented 2 years ago

This has been implemented in https://github.com/crownstone/bluenet/pull/182