-
Notifications
You must be signed in to change notification settings - Fork 513
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature/electron/factory reset #975
Conversation
TL,DR;
After digging... it appears that in
Electron's Memory Map is defined as:
Likely done this way for future expansion of USER to 256KB (while foregoing FACTORY functionality). It doesn't appear that OTA updates are overwriting the FACTORY binary, and likely because the OTA address is defined separately again in: |
…he correct address.) This allows potentially a 256k user firmware image to be used instead of a factory reset image. (And a 256k OTA image starting at 0x80C0000).
…efore it can be used (or the length field is 0, despite being a constant.) It's called from HAL_Core_Config to set up the location of the factory firmware, which is the key trigger for a factory reset in the bootloader. However, since the DCD wasn't initialized any attempts to write to the DCD before it was constructed would fail - the write offset was checked against the length (which is 0.) The fix is to create a static function instance so that it's constructed on first use, independent from global object construction.
bf3d52d
to
2d8f3d6
Compare
|
Fixes the bootloader not recognising when a valid bootloader image is present.
During startup,
FLASH_AddToFactoryResetModuleSlot
is called by the system firmware to set the location of the factory reset image (since this changes between mono and modular firmware.) On the electron, this persists the factory firmware location to DCD.The DCD implementation is a C++ object, and needs to be constructed b…
…efore it can be used (or the length field is 0, despite being a constant.) It's called from HAL_Core_Config to set up the location of the factory firmware, which is the key part factory reset to be available in the bootloader. However, since the DCD wasn't initialized any attempts to write to the DCD before it was constructed would fail - the write offset was checked against the length (which is 0.)
The fix is to create a static function instance so that it's constructed on first use, independent from global object construction.
Doneness: