diff --git a/src/lib/version/version.h b/src/lib/version/version.h index 71ec5a6c89..f744e800d9 100644 --- a/src/lib/version/version.h +++ b/src/lib/version/version.h @@ -47,8 +47,6 @@ #define FREEZE_STR(s) #s #define STRINGIFY(s) FREEZE_STR(s) -#define FW_GIT STRINGIFY(GIT_VERSION) -#define FW_BUILD_URI STRINGIFY(BUILD_URI) /* The preferred method for publishing a board name is to * define it in board_config.h as BOARD_NAME @@ -81,6 +79,14 @@ static inline const char *px4_board_name(void) return BOARD_NAME; } +/** + * get the build URI (used for crash logging) + */ +static inline const char *px4_build_uri(void) +{ + return STRINGIFY(BUILD_URI); +} + /** * get the PX4 Firmware version * @return version in the form 0xAABBCCTT (AA: Major, BB: Minor, CC: Patch, TT Type @see FIRMWARE_TYPE) diff --git a/src/modules/uavcan/uavcan_main.cpp b/src/modules/uavcan/uavcan_main.cpp index fafafda400..58fe68dbd7 100644 --- a/src/modules/uavcan/uavcan_main.cpp +++ b/src/modules/uavcan/uavcan_main.cpp @@ -619,7 +619,7 @@ void UavcanNode::fill_node_info() /* software version */ uavcan::protocol::SoftwareVersion swver; - // Extracting the first 8 hex digits of GIT_VERSION and converting them to int + // Extracting the first 8 hex digits of the git hash and converting them to int char fw_git_short[9] = {}; std::memmove(fw_git_short, px4_firmware_version_string(), 8); assert(fw_git_short[8] == '\0'); diff --git a/src/modules/uavcanesc/uavcanesc_main.cpp b/src/modules/uavcanesc/uavcanesc_main.cpp index 763694fe7f..f7222c168c 100644 --- a/src/modules/uavcanesc/uavcanesc_main.cpp +++ b/src/modules/uavcanesc/uavcanesc_main.cpp @@ -211,9 +211,9 @@ void UavcanEsc::fill_node_info() /* software version */ uavcan::protocol::SoftwareVersion swver; - // Extracting the first 8 hex digits of FW_GIT and converting them to int + // Extracting the first 8 hex digits of the git hash and converting them to int char fw_git_short[9] = {}; - std::memmove(fw_git_short, FW_GIT, 8); + std::memmove(fw_git_short, px4_firmware_version_string(), 8); assert(fw_git_short[8] == '\0'); char *end = nullptr; swver.vcs_commit = std::strtol(fw_git_short, &end, 16); diff --git a/src/modules/uavcannode/uavcannode_main.cpp b/src/modules/uavcannode/uavcannode_main.cpp index a80a4019a7..cb3bc798b8 100644 --- a/src/modules/uavcannode/uavcannode_main.cpp +++ b/src/modules/uavcannode/uavcannode_main.cpp @@ -238,9 +238,9 @@ void UavcanNode::fill_node_info() /* software version */ uavcan::protocol::SoftwareVersion swver; - // Extracting the first 8 hex digits of FW_GIT and converting them to int + // Extracting the first 8 hex digits of the git hash and converting them to int char fw_git_short[9] = {}; - std::memmove(fw_git_short, FW_GIT, 8); + std::memmove(fw_git_short, px4_firmware_version_string(), 8); assert(fw_git_short[8] == '\0'); char *end = nullptr; swver.vcs_commit = std::strtol(fw_git_short, &end, 16); diff --git a/src/systemcmds/hardfault_log/hardfault_log.c b/src/systemcmds/hardfault_log/hardfault_log.c index 795166f552..5be577d1a7 100644 --- a/src/systemcmds/hardfault_log/hardfault_log.c +++ b/src/systemcmds/hardfault_log/hardfault_log.c @@ -483,7 +483,7 @@ static int write_dump_info(int fdout, info_s *info, struct bbsramd_s *desc, return -EIO; } - n = snprintf(buffer, sz, " FW git-hash: %s\n", FW_GIT); + n = snprintf(buffer, sz, " FW git-hash: %s\n", px4_firmware_version_string()); if (n != write(fdout, buffer, n)) { return -EIO; @@ -495,7 +495,7 @@ static int write_dump_info(int fdout, info_s *info, struct bbsramd_s *desc, return -EIO; } - n = snprintf(buffer, sz, " Build url: %s \n", FW_BUILD_URI); + n = snprintf(buffer, sz, " Build url: %s \n", px4_build_uri()); if (n != write(fdout, buffer, n)) { return -EIO; diff --git a/src/systemcmds/ver/ver.c b/src/systemcmds/ver/ver.c index f27537bdb0..8825a16615 100644 --- a/src/systemcmds/ver/ver.c +++ b/src/systemcmds/ver/ver.c @@ -152,7 +152,7 @@ int ver_main(int argc, char *argv[]) } if (show_all || !strncmp(argv[1], sz_ver_buri_str, sizeof(sz_ver_buri_str))) { - printf("Build uri: %s\n", FW_BUILD_URI); + printf("Build uri: %s\n", px4_build_uri()); ret = 0; }