feat(uavcan): upload firmware to skynode and flash on CAN node#27043
Draft
Phil-Engljaehringer wants to merge 2 commits intoPX4:mainfrom
Draft
feat(uavcan): upload firmware to skynode and flash on CAN node#27043Phil-Engljaehringer wants to merge 2 commits intoPX4:mainfrom
Phil-Engljaehringer wants to merge 2 commits intoPX4:mainfrom
Conversation
8baab7d to
a4a25af
Compare
| #include <px4_platform_common/px4_config.h> | ||
| #include <drivers/drv_hrt.h> | ||
|
|
||
| #include <uavcan/protocol/dynamic_node_id_server/centralized.hpp> |
There was a problem hiding this comment.
[error] clang-diagnostic-error [error]
uavcan/protocol/dynamic_node_id_server/centralized.hpp file not found
| #include <px4_platform_common/px4_config.h> | ||
| #include <drivers/drv_hrt.h> | ||
|
|
||
| #include <uavcan/protocol/dynamic_node_id_server/centralized.hpp> |
There was a problem hiding this comment.
[error] clang-diagnostic-error [error]
uavcan/protocol/dynamic_node_id_server/centralized.hpp file not found
🔎 FLASH Analysispx4_fmu-v5x [Total VM Diff: 984 byte (0.05 %)]px4_fmu-v6x [Total VM Diff: 984 byte (0.05 %)]Updated: 2026-04-10T11:25:34 |
Contributor
|
When/if this goes in, can we have docs? |
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.
Solved Problem
The existing CAN node firmware update mechanism worked, but had limitations:
-> The upload scripts only accepted a single external firmware file, preventing multi-target deployments bundling both FMU and CAN node firmware in one update.
-> After migrating new firmware to the SD card, the UAVCAN subsystem was not automatically notified to re-check and flash connected nodes — requiring a manual trigger or reboot.
Solution
UAVCAN firmware flashing from SD card (uavcan_servers, firmware_version_checker):
When new firmware files are detected on the SD card and migrated to /fs/microsd/ufw/ , checkForNewFirmware() now returns true to signal that node info should be re-invalidated, triggering the UAVCAN firmware upgrade flow immediately without requiring a reboot.
Firmware database (FW.db):
When firmware is migrated from the staging directory to /fs/microsd/ufw, it is renamed to <board_id>.bin — discarding the original filename which typically encodes version and product information (e.g. auterion-canio-v2.1.0.uavcan.bin). FW.db preserves this mapping in a simple [<board_id>.bin=<original_source_filename>] flat-file format.
--> updateFwDatabase(): after each successful firmware migration, appends or updates the corresponding entry in UAVCAN_FIRMWARE_PATH/FW.db
--> validateFwDatabase(): called at UAVCAN server init, reads FW.db and checks that the binary referenced by each entry still exists on disk. Stale entries (e.g. from a manually deleted file) are removed, keeping the database consistent.
The flightstack uploader fetches FW.db from the FMU over MAVLink FTP before uploading CAN firmware files. It compares the original source filenames in the DB against the firmware files bundled in the update tarball, if a filename is already recorded, the upload is skipped. This avoids redundant transfers.
[Flighstack-uploader PR: https://github.com/Auterion/flightstack-uploader/pull/16]
Upload scripts (remote_update_fmu.sh, upload_skynode.sh):
--ext-fw repeatable flag was added, allowing multiple CAN firmware files to be bundled into a single update-dev tarball under ufw/.
Changelog Entry
For release notes:
Alternatives
Test coverage
Manual integration test: place a .uavcan.bin firmware file in the ufw/ staging directory, trigger an update, and verify the CAN node is flashed automatically without reboot.
Verify FW.db is created/updated correctly after migration and stale entries are pruned on next boot.
Upload script: verify upload_skynode.sh --ext-fw= --ext-fw= correctly bundles both files.
Critical bug that needs backporting?
Context
The full pipeline: