PX4 Firmware
PX4 Autopilot Software http://px4.io
version.c File Reference
#include "version.h"
#include "build_git_version.h"
#include <string.h>
Include dependency graph for version.c:

Go to the source code of this file.

Macros

#define CONFIG_CDCACM_PRODUCTID   0
 

Enumerations

enum  FIRMWARE_TYPE {
  FIRMWARE_TYPE_DEV = 0, FIRMWARE_TYPE_ALPHA = 64, FIRMWARE_TYPE_BETA = 128, FIRMWARE_TYPE_RC = 192,
  FIRMWARE_TYPE_RELEASE = 255
}
 

Functions

const char * px4_build_uri (void)
 get the build URI (used for crash logging) More...
 
uint32_t version_tag_to_number (const char *tag)
 Convert a version tag string to a number. More...
 
uint32_t px4_firmware_version (void)
 get the PX4 Firmware version More...
 
uint32_t version_tag_to_vendor_version_number (const char *tag)
 Convert a version tag string to a vendor version number. More...
 
uint32_t px4_firmware_vendor_version (void)
 get the PX4 Firmware vendor version More...
 
const char * px4_firmware_git_branch (void)
 get the git branch name (can be empty, for example if HEAD points to a tag) More...
 
uint32_t px4_board_version (void)
 get the board version (last 8 bytes should be silicon ID, if any) More...
 
uint32_t px4_os_version (void)
 operating system version More...
 
const char * px4_os_version_string (void)
 Operating system version as human readable string (git tag) More...
 
const char * px4_os_name (void)
 name of the operating system More...
 
const char * px4_toolchain_name (void)
 Toolchain name used to compile PX4. More...
 
const char * px4_toolchain_version (void)
 Toolchain version used to compile PX4 (no particular format) More...
 
const char * px4_firmware_version_string (void)
 Firmware version as human readable string (git tag) More...
 
uint64_t px4_firmware_version_binary (void)
 Firmware version in binary form (first part of the git tag) More...
 
const char * px4_ecl_lib_version_string (void)
 ECL lib version as human readable string (git tag) More...
 
uint64_t px4_os_version_binary (void)
 Operating system version in binary form (first part of the git tag) More...
 

Macro Definition Documentation

◆ CONFIG_CDCACM_PRODUCTID

#define CONFIG_CDCACM_PRODUCTID   0

Definition at line 41 of file version.c.

Referenced by px4_board_version(), and Mavlink::send_autopilot_capabilites().

Enumeration Type Documentation

◆ FIRMWARE_TYPE

Enumerator
FIRMWARE_TYPE_DEV 
FIRMWARE_TYPE_ALPHA 
FIRMWARE_TYPE_BETA 
FIRMWARE_TYPE_RC 
FIRMWARE_TYPE_RELEASE 

Definition at line 53 of file version.c.

Function Documentation

◆ px4_board_version()

uint32_t px4_board_version ( void  )

get the board version (last 8 bytes should be silicon ID, if any)

Definition at line 250 of file version.c.

References CONFIG_CDCACM_PRODUCTID.

Referenced by px4_board_hw_revision(), and Mavlink::send_autopilot_capabilites().

Here is the caller graph for this function:

◆ px4_build_uri()

const char* px4_build_uri ( void  )

get the build URI (used for crash logging)

Definition at line 61 of file version.c.

References STRINGIFY.

Referenced by px4_board_hw_revision(), ver_main(), and write_dump_info().

Here is the caller graph for this function:

◆ px4_ecl_lib_version_string()

const char* px4_ecl_lib_version_string ( void  )

ECL lib version as human readable string (git tag)

Definition at line 348 of file version.c.

References px4_mavlink_lib_version_binary().

Referenced by px4_board_hw_revision(), and px4::logger::Logger::write_version().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ px4_firmware_git_branch()

const char* px4_firmware_git_branch ( void  )

get the git branch name (can be empty, for example if HEAD points to a tag)

Definition at line 245 of file version.c.

Referenced by px4_board_hw_revision(), ver_main(), and px4::logger::Logger::write_version().

Here is the caller graph for this function:

◆ px4_firmware_vendor_version()

uint32_t px4_firmware_vendor_version ( void  )

get the PX4 Firmware vendor version

Returns
version in the form 0xAABBCCTT (AA: Major, BB: Minor, CC: Patch, TT Type
See also
FIRMWARE_TYPE)

Definition at line 240 of file version.c.

References version_tag_to_vendor_version_number().

Referenced by px4_board_hw_revision(), Mavlink::send_autopilot_capabilites(), and px4::logger::Logger::write_version().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ px4_firmware_version()

uint32_t px4_firmware_version ( void  )

get the PX4 Firmware version

Returns
version in the form 0xAABBCCTT (AA: Major, BB: Minor, CC: Patch, TT Type
See also
FIRMWARE_TYPE)

Definition at line 149 of file version.c.

References version_tag_to_number().

Referenced by px4_board_hw_revision(), Mavlink::send_autopilot_capabilites(), ver_main(), and px4::logger::Logger::write_version().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ px4_firmware_version_binary()

uint64_t px4_firmware_version_binary ( void  )

Firmware version in binary form (first part of the git tag)

Definition at line 343 of file version.c.

Referenced by px4_board_hw_revision(), and Mavlink::send_autopilot_capabilites().

Here is the caller graph for this function:

◆ px4_firmware_version_string()

const char* px4_firmware_version_string ( void  )

Firmware version as human readable string (git tag)

Definition at line 338 of file version.c.

Referenced by UavcanEsc::fill_node_info(), UavcanNode::fill_node_info(), px4_board_hw_revision(), ver_main(), write_dump_info(), and px4::logger::Logger::write_version().

Here is the caller graph for this function:

◆ px4_os_name()

const char* px4_os_name ( void  )

name of the operating system

Returns
human readable string

Definition at line 297 of file version.c.

Referenced by px4_board_hw_revision(), ver_main(), and px4::logger::Logger::write_version().

Here is the caller graph for this function:

◆ px4_os_version()

uint32_t px4_os_version ( void  )

operating system version

Returns
version in the form 0xAABBCCTT (AA: Major, BB: Minor, CC: Patch, TT Type
See also
FIRMWARE_TYPE)

Definition at line 259 of file version.c.

References version_tag_to_number().

Referenced by px4_board_hw_revision(), Mavlink::send_autopilot_capabilites(), ver_main(), and px4::logger::Logger::write_version().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ px4_os_version_binary()

uint64_t px4_os_version_binary ( void  )

Operating system version in binary form (first part of the git tag)

Returns
this is not available on all OSes and can return 0

Definition at line 364 of file version.c.

Referenced by px4_board_hw_revision(), and Mavlink::send_autopilot_capabilites().

Here is the caller graph for this function:

◆ px4_os_version_string()

const char* px4_os_version_string ( void  )

Operating system version as human readable string (git tag)

Returns
string or NULL if not defined

Definition at line 288 of file version.c.

Referenced by px4_board_hw_revision(), ver_main(), and px4::logger::Logger::write_version().

Here is the caller graph for this function:

◆ px4_toolchain_name()

const char* px4_toolchain_name ( void  )

Toolchain name used to compile PX4.

Definition at line 314 of file version.c.

Referenced by px4_board_hw_revision(), ver_main(), and px4::logger::Logger::write_version().

Here is the caller graph for this function:

◆ px4_toolchain_version()

const char* px4_toolchain_version ( void  )

Toolchain version used to compile PX4 (no particular format)

Definition at line 329 of file version.c.

Referenced by px4_board_hw_revision(), ver_main(), and px4::logger::Logger::write_version().

Here is the caller graph for this function:

◆ version_tag_to_number()

uint32_t version_tag_to_number ( const char *  tag)

Convert a version tag string to a number.

Parameters
tagversion tag in one of the following forms:
  • vendor: v1.4.0-0.2.0
  • dev: v1.4.0-rc3-7-g7e282f57
  • rc: v1.4.0-rc4
  • beta: v1.4.0-beta1
  • release: v1.4.0
  • linux: 7.9.3
Returns
version in the form 0xAABBCCTT (AA: Major, BB: Minor, CC: Patch, TT Type
See also
FIRMWARE_TYPE)

Definition at line 66 of file version.c.

References FIRMWARE_TYPE_ALPHA, FIRMWARE_TYPE_BETA, FIRMWARE_TYPE_DEV, FIRMWARE_TYPE_RC, and FIRMWARE_TYPE_RELEASE.

Referenced by VersioningTest::_test_tag_to_version_number(), px4_board_hw_revision(), px4_firmware_version(), and px4_os_version().

Here is the caller graph for this function:

◆ version_tag_to_vendor_version_number()

uint32_t version_tag_to_vendor_version_number ( const char *  tag)

Convert a version tag string to a vendor version number.

Parameters
tagversion tag in one of the following forms:
  • vendor: v1.4.0-0.2.0
  • dev: v1.4.0-rc3-7-g7e282f57
  • rc: v1.4.0-rc4
  • beta: v1.4.0-beta1
  • release: v1.4.0
  • linux: 7.9.3
Returns
version in the form 0xAABBCCTT (AA: Major, BB: Minor, CC: Patch, TT Type
See also
FIRMWARE_TYPE)

Definition at line 154 of file version.c.

References FIRMWARE_TYPE_ALPHA, FIRMWARE_TYPE_BETA, FIRMWARE_TYPE_DEV, FIRMWARE_TYPE_RC, and FIRMWARE_TYPE_RELEASE.

Referenced by VersioningTest::_test_tag_to_version_number(), px4_board_hw_revision(), and px4_firmware_vendor_version().

Here is the caller graph for this function: