Skip to content
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

version: Expose PX4 git tag string #11676

Closed
wants to merge 6 commits into from

Conversation

sfalexrog
Copy link
Contributor

@sfalexrog sfalexrog commented Mar 18, 2019

Currently the version module and ver command don't expose the git tag against which the firmware is built. Additionally, the comments in
version/version.h are somewhat misleading (some functions return git hash instead of git tag).

This pull request:

  • Adds a way to get the tag for the firmware (px4_firmware_git_tag_string)
  • Fixes some of the comments in version/version.h
  • Exposes ECL version properly
  • Adds firmware tag and ECL commit hash to the output of ver all

Currently the `version` module and `ver` command don't expose the git tag against which the firmware is built. Additionally, the comments in
`version.h` are somewhat misleading (some functions return git hash instead of git tag). This commit aims to fix that.

Signed-off-by: sfalexrog <[email protected]>
@dagar
Copy link
Member

dagar commented Mar 18, 2019

Looks good. Could you share the ver all output from actual hardware?

@sfalexrog
Copy link
Contributor Author

sfalexrog commented Mar 18, 2019

Sure!

nsh> ver all
HW arch: PX4_FMU_V4
FW git-hash: fa2b1aeedd697f92448ac0cbde99940d19e98939
FW version: 1.9.0 80 (17367168)
FW git-branch: WIP/expose_tag_str
FW git tag: v1.9.0-beta1-376-gfa2b1aeedd
ECL git hash: a892ececf8490b21aa8917bc243b2bc441af6a87
OS: NuttX
OS version: Release 7.28.0 (119275775)
OS git-hash: 1f2f6d8cbe7c85f30fd75ec53c20566e91b14f21
Build datetime: Mar 18 2019 14:58:15
Build uri: localhost
Toolchain: GNU GCC, 7.2.1 20170904 (release) [ARM/embedded-7-branch revision 255204]
PX4GUID: 00010000000037353832333751110047002f
MCU: STM32F42x, rev. 3

Looks like git tag is not filled correctly for non-tagged commits, though - it's more of a git description than a tag.

@dagar
Copy link
Member

dagar commented Mar 20, 2019

This should be fine to merge, but really what we'll probably need to do is make sure all the desired information is included in the log. https://github.com/PX4/Firmware/blob/master/src/modules/logger/logger.cpp#L2013

@sfalexrog
Copy link
Contributor Author

I've attempted to put git description into the ver_git_tag field, though I guess log analysis tools will have to be updated to show it.

@dagar
Copy link
Member

dagar commented Jun 16, 2019

@@ -2146,6 +2148,10 @@ void Logger::write_version(LogType type)
write_info(type, "sys_os_ver", os_version);
}

if (git_tag && git_tag[0]) {
write_info(type, "ver_sw_tag", git_tag);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see why we need the tag, as we already have it through px4_firmware_version(), https://github.com/PX4/Firmware/pull/11676/files#diff-64b21add574f1f3f059c2abc18eae7d6R2121.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As far as I understand, the px4_firmware_version() does not, in fact, return a tag, but rather a version number. That's fine for mainline firmwares, but we have modified firmware builds with additional information in the tag (our tags look like v1.8.2-clever.5). We'd like to see the whole tag to not guess which exact firmware we're using.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have custom version tags for this: https://dev.px4.io/en/setup/building_px4.html#firmware_version. Does that work for you?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's an interesting feature, but unfortunately I don't think it does. We use different firmwares for different models of drones, and it'd be more convenient to just use the full tag name (which contains the target drone name) instead of trying to differentiate by numbers.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Having different firmwares for different models does not sound great either. Why not distinguish by using different SYS_AUTOSTART id's?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The branch name is already in the log, did you see that?

Copy link
Contributor

@dvornikov-aa dvornikov-aa Jul 9, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We usually look through the log after the flight. Git tag string (and the branch name inside) is important before the flight, e.g. during the manual vehicle inspection.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That does not give me a reason why the branch is not enough.
What I want to avoid here is to have redundant information in different formats in the log. That is very confusing for anyone looking at the data.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The possibility of getting tag and branch name BEFORE flight as a pre-flight check would be very useful because we often have to test different features (e. g. precision landing and different camera modules) on one prototype at a close periods of time.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The possibility of getting tag and branch name BEFORE flight as a pre-flight check would be very useful because we often have to test different features (e. g. precision landing and different camera modules) on one prototype at a close periods of time.

Which you do with ver all.

@stale
Copy link

stale bot commented Oct 8, 2019

This issue has been automatically marked as stale because it has not had recent activity. Thank you for your contributions.

@LorenzMeier
Copy link
Member

Closing this as stale.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants