Repository navigation
Flash a swarm by broadcast where the bootloaders take it - #53
Merged
Merged
Conversation
swarm bootload flash now restarts every Crazyflie with STM32 or nRF51 firmware to flash into its bootloader (2 at a time per Crazyradio, as for swarm bootload info), and sends each image once to all the Crazyflies of a platform whose bootloaders both take broadcast (protocol 0x11). Each one is then checked by CRC and the pages that didn't make it are flashed again over unicast. The others are flashed one at a time from their bootloader, checked by CRC where the bootloader can. Every Crazyflie sent back into its firmware is checked to have left its bootloader, and restarted again if not. Deck firmware is flashed last, one Crazyflie at a time. A broadcast is only used for 2 or more Crazyflies, and every broadcast group gets its own broadcast address, so a Crazyflie left armed in its bootloader after a failure can't receive another platform's images. --unicast keeps the old one-after-another flashing. The engine follows Swarmkeeper's. bootloader.rs gets enter_bootloader_for_cfloader(), left_bootloader(), start_address() and flash_decks() for it.
swarm bootload flash flashed the decks one Crazyflie after another. They now run one Crazyflie per Crazyradio at a time, with the Crazyflies spread over the Crazyradios as for the other swarm commands, so Crazyflies on one channel still share one Crazyradio. Several Crazyflies printing progress bars at the same time would garble the output, so flash_decks takes a DeckOutput: progress bars as before for one Crazyflie, or a line per step with the Crazyflie's name in front for a swarm. The "flashed successfully" line now names the deck.
The decks of several Crazyflies now share an indicatif MultiProgress: each deck gets its own bar labelled with the Crazyflie's name, and lines are printed above the bars. Checking the Crazyflies after a broadcast gets a bar counting them, which stays like the bars of the images.
evoggy
marked this pull request as ready for review
October 15, 2026 20:46
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
swarm bootload flashnow sends the STM32 and nRF51 firmware by broadcast to the Crazyflies whose bootloaders take it (bootloader protocol 0x11 on both chips, seeswarm bootload info). They all receive each image at the same time, so flashing a swarm takes about as long as one broadcast instead of about 20 s per Crazyflie.How it runs
swarm bootload infosince Restart Crazyflies back into firmware after reading bootloader info #51).DeckOutputinbootloader.rs). Each bar is labelled with the Crazyflie's name, and lines are printed above the bars with the name in front. Single-Crazyfliebootload flashis unchanged.Details:
--unicastkeeps the old way: every Crazyflie one after another, the same ascfcli bootload flash.flashed (broadcast),flashed (broadcast, 2 pages flashed again),flashed (unicast)), followed by how long the whole command took.The engine follows the one in Swarmkeeper, on cfloader 0.2.
bootloader.rsgetsenter_bootloader_for_cfloader(),left_bootloader(),start_address()andflash_decks()split out offlash(), andRunner::each_of()runs on some of the targets.docs/swarm.mddescribes it, and the README now lists swarms, including broadcast flashing, among the features.Testing
On 3 Crazyflie 2.1 Brushless (both bootloaders 0x11) and one Crazyradio:
--release 2026.08: all 3 flashed by broadcast, then the Color LED decks one at a time, in 1:27. With the 3 Crazyflies moved to channels 90, 80 and 70, and 2 Crazyradios, the decks of CF-02 and CF-03 were flashed at the same time, and CF-04 after CF-02 on the same radio: 23 s for the decks, 1:15 in all. The release's nRF51 bootloader (2024.10) was correctly left alone, since these bootloaders report 2024.10.0.--release 2026.08 --targets stm32-fw,nrf51-fw: broadcast took 0:45 (STM32 34 s, nRF51 10 s, then CRC checks). The same flash with--unicasttook 1:06. A second round gave the same times.swarm bootload inforead them fine.Not tested yet:
During the timing runs a
--unicastrun once hung before printing anything; that is filed as #52 and is not specific to this PR.