-
Notifications
You must be signed in to change notification settings - Fork 20.2k
AP_Vehicle: store currently running firmware version into a parameter #32141
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
base: master
Are you sure you want to change the base?
AP_Vehicle: store currently running firmware version into a parameter #32141
Conversation
save the currently running firmware version into a parameter. Into the future we may use this number to prevent a user from attempting to upgrade from a truly ancient version of the firmware to a more modern one where we may have removed parameter upgrade code.
| @@ -290,6 +290,13 @@ const AP_Param::GroupInfo AP_Vehicle::var_info[] = { | |||
| AP_SUBGROUPINFO(rpm_sensor, "RPM", 32, AP_Vehicle, AP_RPM), | |||
| #endif | |||
|
|
|||
| // @Param: FW_VER_LAST | |||
| // @DisplayName: Last firmware version | |||
| // @Description: Firmware version that last ran on this board, encoded as major*65536+minor*256+patch. Automatically updated on boot. | |||
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.
Need to describe what happens if it never ran.
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 can add words. But whatever I add will really only be useful for devs.
| @@ -290,6 +290,13 @@ const AP_Param::GroupInfo AP_Vehicle::var_info[] = { | |||
| AP_SUBGROUPINFO(rpm_sensor, "RPM", 32, AP_Vehicle, AP_RPM), | |||
| #endif | |||
|
|
|||
| // @Param: FW_VER_LAST | |||
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.
Not sure I like the name, quite cryptic. Why not FIRMWARE_VERSION as a corrollory to FORMAT_VERSION?
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.
Not sure I like the name, quite cryptic. Why not FIRMWARE_VERSION as a corrollory to FORMAT_VERSION?
I'm trying to make it clear that the important thing here is that at boot time it's the version that was previously running.
I think I failed, and the fact that the majority of the time it's the current firmware version probably means we can simplify this.
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 agree with @andyp1per FIRMWARE_VERSION is clear and simple.
|
Thank you for this PR. This is a very useful addition for GCS-based version management. I would like to suggest adding an additional parameter for a Custom Firmware Version. Many of us in the community build custom forks for specific hardware or projects, and we need to track our own versioning (e.g., Base: 4.7.0, Custom: 1.1.0). Following your 32-bit logic, we could represent it like this: 0x04070000 : V4.7.0-DEV MEJOR<<24+MINOR<<16+PATCH<<8+FW TYPE By having a SYS_FW_CUST_VER parameter, manufacturers can easily report their internal build versions via MAVLink without overriding the base ArduPilot version info. What do you think? Copter mavlink: FIRMWARE_VERSION_TYPE |
I'm afraid this wasn't intended to help GCSs out, and we were intending to hide this parameter from the GCS. In general a GCS should not be caring about the firmware version on the autopilot - you have pointed out problems when they do care as then someone running their own custom firmware won't see the behaviour they're expecting! Better to look for the specific feature you are interested in then assuming certain firmwares have certain features. If you want the currently-running firmware version number - well, there's |
Being able to have some sort of custom version number available in the mavlink stream without overriding the ArduPilot version numbers would be nice - maybe as extension fields to Not really what this PR is about, 'though. |
That's just not the reality. The GCS does need to care about the version and it doesn't help to pretend that's not true.
It's not just about that. A feature might be there (or not), but the way it works can be different version by version, the parameters and their names can change (e.g. SR vs MAV). Trying to guess based on some combination of which parameter names or values are what is a hack not an answer. |
| @@ -320,6 +320,7 @@ class AP_Vehicle : public AP_HAL::HAL::Callbacks { | |||
| virtual void init_ardupilot() = 0; | |||
| virtual void load_parameters() = 0; | |||
| void load_parameters(AP_Int16 &format_version, const uint16_t expected_format_version); | |||
| void check_firmware_version(); | |||
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.
It's not actually a "check" - maybe "save_firmware_version()"?
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.
You're correct with the stuff as it currently is.
As soon as we add actual gating on the version it becomes check_firmware_version.
This is an excellent idea and is going to become more important for regulatory compliance. Regulators (Canada for example), are asking for configuration management plans that document how different versions of firmware running on vehicles are tracked. Yes it will be important to have: ArduPilot "Base" version - this is what the user will get if they download directly via GCS from our servers. We probably need a way to represent a build from the custom build server. Customer/Vendor "Fork" version - what you are calling "CUST" might also be a company that runs its own fork for internal use. The fork will be based on a specific version of AP, so we need that, then we need the fork/local version major/minor version information. I know Partners do this and keeping track of what is running on the vehicle is difficult. I'm not sure about the name though. |
For example?
For the latter - SR vs MAV is relatively easy to work out from a GCS perspective. Here's an example of MAVProxy magically using Please give an example of the former. It might inform the way we change the way things behave in ArduPilot. Also. Moot point as the firmware version is already available in the message specifically to convey that information. |
|
Personally, I don't think this extra parameter is worth it. Better to reallocate 4 bytes (int or 4 uint8's?) into the flash storage page and don't make it visible.. like the missions and DNA list Let's sneak it in here: downside of using the Bak is it's only for larger chips and downside of touching StorageParam is we run the risk of corrupting the whole flash space, and that chance goes up the lower (and thus small memory requirement) we go. note: once we boot with an old-to-new param value and we do whatever param migrations that are needed then we replace that param with the current version, which is the new default, which then will consume zero storage space I dunno.. adding a param here just feels like it goes against the don't-add-a-param-unless-you-reaaaaally-need-to methos which we have in place for good reasons. |
save the currently running firmware version into a parameter. Into the future we may use this number to prevent a user from attempting to upgrade from a truly ancient version of the firmware to a more modern one where we may have removed parameter upgrade code.
Replaces #32071