-
Notifications
You must be signed in to change notification settings - Fork 17.9k
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
Bootloader: Add Reading of Git SHA to bootloader #28492
base: master
Are you sure you want to change the base?
Conversation
This is helpful for users building their own bootloaders, and allowing the user to identify what commit the build was built at. Feedback welcome. |
da23530
to
29788c9
Compare
Tools/AP_Bootloader/bl_protocol.cpp
Outdated
@@ -128,6 +128,7 @@ | |||
#define PROTO_DEVICE_FW_SIZE 4 // size of flashable area | |||
#define PROTO_DEVICE_VEC_AREA 5 // contents of reserved vectors 7-10 | |||
#define PROTO_DEVICE_EXTF_SIZE 6 // size of available external flash | |||
#define PROTO_DEVICE_BL_GIT_HASH 7 // git hash of bootloader build |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've also got changes that add reading off the Application Git SHA if AP_CHECK_FIRMWARE_ENABLED
is enabled in the bootloader (and application).
We certainly would find these handy, just a question of if this is desirable in the bootloader.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
great idea, that would prevent to always have to update the bootloader when you do custom one's !
29788c9
to
ddfcf85
Compare
ddfcf85
to
8b6bb5c
Compare
if we can get away without a protocol change, by checking for a NACK then that would be less risky, otherwise we need to be sure existing bootloader clients are OK |
Wrote this about 4 years ago - glad someone's pushing through with it (https://github.com/ArduPilot/ardupilot/pull/14768/files) |
f78e3c6
to
a2b09d6
Compare
If this implementation stands, probably need to include an update to the comments above, here: ardupilot/Tools/AP_Bootloader/bl_protocol.cpp Lines 549 to 557 in f0900bd
|
@peterbarker - Your implementation was adding a new command. This implementation makes use of the Do you have a feeling either way? I'm less inclined to burn a full command index unnecessarily. |
@peterbarker @tridge - given this is based off PX4-Bootloader, what requirement is there to keep it in sync? would that be a sufficient reason to burn a command index, rather than reading additional device info? |
Tools/AP_Bootloader/bl_protocol.cpp
Outdated
|
||
default: | ||
goto cmd_bad; | ||
} | ||
done_get_device_flags |= (1<<(arg-1)); // set the flags for use when resetting timeout | ||
done_get_device_flags |= DEVICE_INFO_MASK(arg); // set the flags for use when resetting timeout |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we should probably bump the size of device flags to uint16
or uint32
given done_get_device_flags
is a bitmask, and this PR adds device info fields 7, 8 and 9.
- Pending outcome of this comment: Bootloader: Add Reading of Git SHA to bootloader #28492 (comment)
a2b09d6
to
5f3be59
Compare
doesn't need to be completely in sync, but we do need to ensure that flashing ArduPilot when px4 bootloader is used works and vice-versa |
We should probably PR into the PX4 bootloader the additional "info" IDs so as not to cause collisions down the road. Would require a chunk of documentation of the shape of the relevant data... |
5f3be59
to
1863c6a
Compare
88f799e
to
85e9698
Compare
Documented size and shape of data for Build SHAs - both BL and App SHAs are 64 bits each (16 hex characters each). Also pushed a PR to PX4 to reserve and maintain compatability with PX4 bootloader. Only catch at this stage is |
Tested flashing AP to PX4 and back to AP works as expected. The display of the SHAs and bootloader options only occurs when using |
Apparently PX4 might have added an equivalent feature into their bootloader. Might be worth checking how they worked it into the protocol and whether we can be compatible. |
Supports both ArduPilot and PX4 implementation of reading bootloader software version.
85e9698
to
1d1e8e6
Compare
Yeah, I had noticed that late yesterday too. grumble grumble. I'm reducing the scope of this PR to solely implement the bootloader version reporting using the same command as PX4. Works as is, ArduPilot reports the 16 char sha (eg: Should we prefix the sha to look something like the following: |
Allows the bootloader build to be identified with
uploader.py