updates the bootloader for 0.7.0 firmware on photon/p1 [ch15177] #418
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Problem
When running
particle update
for Device OS firmware 0.7.0 on a Photon or P1 that does not already have Wi-Fi credentials or possibly doesn't have an internet connection available, the bootloader does not get updated. This normally happens when it connects to the Cloud in Safe Mode and the dependency requirement is fulfilled by the Safe Mode Healer.Solution
Change the
particle update
process for Photon / P1 only to use a special 0.7.0 system firmware that lowers bootloader dependency to v7, backs up the current user app, and applies a special "ascender" app that updates the bootloader and restores the backed up user app.The process looks like this:
Enter DFU Mode
Run
particle udpate
as usual, but in the background:There is one known corner cases which still exists:
In the ascender app, we use a retained variable to keep track of when we’ve updated the bootloader. That way if the app loops for some reason the ascender will not constantly be trying to write the bootloader. A power removal during that would be fatal. The ascender app could loop if the user runs particle update with no user app, and then runs update again with the ascender app loaded. The ascender app would constantly be applying itself in a loop.
Corner Case: If you upgrade with the new method, then downgrading the bootloader and system firmware to 0.6.3, and don’t remove power before trying to upgrade again it will still have the retained memory that says it updated the bootloader already, and it won’t update it. Also to note, if it doesn’t update the bootloader, and it gets online… since it has the new system firmware that says the bootloader >= v7 is ok, the Safe Mode Healer won’t update it either.
particle update
should be run on a device that was just powered up, or if downgrading and upgrading again, be sure to remove power for 30 seconds first.Steps to test
npm install -g https://github.com/particle-iot/particle-cli/releases/download/v1.30.0-rc.1/particle-cli-1.30.0-rc.1.tgz
particle serial inspect
particle-cli $ PARTICLE_CLI_DEVELOPMENT=1 node bin/particle.js update
particle serial inspect