Skip to content
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

allow the bootloader to be flashed over DFU #1788

merged 1 commit into from Jun 14, 2019


Copy link

commented May 22, 2019

This PR will be cherry-picked into another PR based on release/1.2.1 (for 1.2.1-rc.3).


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.


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

  1. Flash the Device OS from this PR to your target device
  2. Use particle serial inspect to retrieve the bootloader version of the current bootloader
  3. edit modules/shared/, and change BOOTLOADER_VERSION to higher than the bootloader version in the previous step. Build the bootloader for your device.
  4. echo -e "\xA3" > A3
  5. echo -e "\xA5" > A5
  6. flash the bootloader to your device via dfu using the address of the OTA region. E.g. 0x80C0000 on Gen2 platforms. dfu-util -d 2b04:d006 -a 0 -s 0x80C0000 -D bootloader.bin
  7. Restart the device
  8. Use particle serial inspect and verify that the bootloader version has NOT changed
  9. dfu-util -d 2b04:d006 -a 1 -s 1753:leave -D A3 . (deliberately the incorrect flag value.)
  10. Use particle serial inspect and verify that the bootloader version has NOT changed
  11. dfu-util -d 2b04:d006 -a 1 -s 1753:leave -D A5 . (correct flag value.)
  12. Use particle serial inspect and verify that the bootloader version has changed to match BOOTLOADER_VERSION.
  13. Verify that the OTA flag has been cleared:
  14. dfu-util -d 2b04:d006 -a 1 -s 1753:1 -U ota_flag
  15. xxd ota_flag
00000000: ff                         

Example App



  • User is totes amazing for contributing!
  • Contributor has signed CLA (Info here)
  • Problem and Solution clearly stated
  • Run unit/integration/application tests on device
  • Added documentation
  • Added to after merging (add links to docs and issues)

  • [enhancement] allow the bootloader to be flashed over DFU #1788

@m-mcgowan m-mcgowan requested a review from sergeuz May 22, 2019

@technobly technobly modified the milestones: 1.2.1, 1.3.0-rc.1 Jun 10, 2019

Copy link

left a comment

Looks good 👍. Please fix the build for gcc and core platforms.

platform/MCU/nRF52840/inc/dct.h Outdated Show resolved Hide resolved

@technobly technobly force-pushed the feature/ch32507 branch from b5fe62b to 51e5b7d Jun 14, 2019

allows the system to flash modules, particularly the bootloader by fl…
…ashing them to the OTA backup region and then having them applied by the system firmware as a regular OTA. [CH32507]

gcc and core builds fixed, and comments updated.

@technobly technobly merged commit 55fdc11 into develop Jun 14, 2019

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed

@technobly technobly deleted the feature/ch32507 branch Jun 14, 2019


This comment has been minimized.

Copy link

commented Jul 15, 2019

I think there are issues with particle-cli 1.43 and this new DFU bootloader.

Simply, it fails half the time to complete particle update. Info at

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
4 participants
You can’t perform that action at this time.