particle-iot / particle-cli

Command Line Interface for Particle Cloud and devices
Apache License 2.0
212 stars 92 forks source link

Automate Protected Devices to run `particle flash` commands #757

Closed keeramis closed 1 month ago

keeramis commented 1 month ago

Description

Support Protected Devices while running particle flash xxx commands

How to Test

Use particle flash --local with devices in DFU mode and normal mode. Test with any platform / any device / any firmware.

As of this PR: develop-6.x is this commit

  1. If testing Open Devices - please test anything and everything 🙏 (normal mode, dfu mode, any platform, any device-os version)
  2. If testing Protected Devices, note that normal mode should work fine. But Protected Devices in DFU mode will pose trouble if using device-os < 6.2.0 (which is the latest develop-6.x branch at the time of this PR). Make sure to use develop-6.x if you are testing Protected Devices starting in DFU mode.

❗ Important: Do not run particle.js update when your device is on develop-6.x branch. This will brick your device. particle update obtains the 6.1.1 binary since the reported firmware version from the device is 6.1.1 with the latest develop-6.x and once the bootloader-6.1.1 is flashed on the device with a more advanced system part (develop-6.x system part), it becomes an invalid order and the device will be bricked❗. For a device with develop-6.x, the way around this is to flash the 6.1.1 system part first, and then bootloader-6.1.1 To sumarize:

  1. If you are on 6.1.1 released firmware and want to go to develop-6.x (6.1.1 --> develop-6.x)
    1. First, flash the develop-6.x bootloader
    2. Then, flash the develop-6.x system part1
    3. Then, flash the user part
  2. If you are on develop-6.x firmware and want to go to 6.1.1 (develop-6.x --> 6.1.1)
    1. First, flash the 6.1.1 system part1
    2. Then, flash the 6.1.1 bootloader
    3. Then, flash the user part

Link to binaries for the latest develop-6x branch

Related Issues / Discussions

https://app.shortcut.com/particle/story/129652/automate-protected-devices-to-run-particle-flash-command-e2e-tests https://app.shortcut.com/particle/story/129651/automate-protected-devices-to-run-particle-flash-command

Completeness