allow the bootloader to be flashed over DFU #1788
Merged
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.
This PR will be cherry-picked into another PR based on
release/1.2.1
(for 1.2.1-rc.3).Problem
When preparing a new firmware release for Gen2 and Gen3 platforms that don't contain the bootloader, we currently prepare an Ascender app that allows updating the bootloader of the device. This causes unnecessary delay in the release process.
Solution
This PR allows the bootloader (and other DeviceOS images) to be flashed via DFU.
The image is flashed to the OTA update region, and a flag set in the DCT. When the system reboots, the image is applied just as if it were sent OTA or OTW. This enables the bootloader to be flashed via DFU (such as by the CLI.)
Steps to Test
particle serial inspect
to retrieve the bootloader version of the current bootloaderBOOTLOADER_VERSION
to higher than the bootloader version in the previous step. Build the bootloader for your device.echo -e "\xA3" > A3
echo -e "\xA5" > A5
dfu-util -d 2b04:d006 -a 0 -s 0x80C0000 -D bootloader.bin
particle serial inspect
and verify that the bootloader version has NOT changeddfu-util -d 2b04:d006 -a 1 -s 1753:leave -D A3
. (deliberately the incorrect flag value.)particle serial inspect
and verify that the bootloader version has NOT changeddfu-util -d 2b04:d006 -a 1 -s 1753:leave -D A5
. (correct flag value.)particle serial inspect
and verify that the bootloader version has changed to matchBOOTLOADER_VERSION
.dfu-util -d 2b04:d006 -a 1 -s 1753:1 -U ota_flag
Example App
References
Completeness