CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutSign UpSign In
Ardupilot

Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place. Commercial Alternative to JupyterHub.

GitHub Repository: Ardupilot/ardupilot
Path: blob/master/libraries/AP_Common/AP_FWVersionDefine.h
Views: 1798
1
/*
2
* This file is free software: you can redistribute it and/or modify it
3
* under the terms of the GNU General Public License as published by the
4
* Free Software Foundation, either version 3 of the License, or
5
* (at your option) any later version.
6
*
7
* This file is distributed in the hope that it will be useful, but
8
* WITHOUT ANY WARRANTY; without even the implied warranty of
9
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
10
* See the GNU General Public License for more details.
11
*
12
* You should have received a copy of the GNU General Public License along
13
* with this program. If not, see <http://www.gnu.org/licenses/>.
14
*/
15
16
// this include file *defines* the structure holding the version information for the ArduPilot binary. It must only be
17
// included in a single place, thus the following protection:
18
19
#ifndef FORCE_VERSION_H_INCLUDE
20
#error AP_FWVersionDefine.h should never be included directly. You probably want to include AP_Common/AP_FWVersion.h
21
#endif
22
23
#include <AP_Common/AP_FWVersion.h>
24
#include <AP_Vehicle/AP_Vehicle_Type.h>
25
26
/*
27
allow vendors to set AP_CUSTOM_FIRMWARE_STRING in hwdef.dat
28
*/
29
#ifdef AP_CUSTOM_FIRMWARE_STRING
30
#define ACTIVE_FWSTR AP_CUSTOM_FIRMWARE_STRING
31
#define ORIGINAL_FWSTR THISFIRMWARE
32
#else
33
#define ACTIVE_FWSTR THISFIRMWARE
34
#define ORIGINAL_FWSTR nullptr
35
#endif
36
37
/**
38
* The version number should be used when the structure is updated
39
* Major: For breaking changes of the structure
40
* Minor: For new fields that does not brake the structure or corrections
41
*/
42
const AP_FWVersion AP_FWVersion::fwver{
43
// Version header struct
44
.header = 0x61706677766572fb, // First 7 MSBs: "apfwver", LSB is the checksum of the previous string: 0xfb
45
.header_version = 0x0200U, // Major and minor version
46
.pointer_size = static_cast<uint8_t>(sizeof(void*)),
47
.reserved = 0,
48
.vehicle_type = static_cast<uint8_t>(APM_BUILD_DIRECTORY),
49
.board_type = static_cast<uint8_t>(CONFIG_HAL_BOARD),
50
.board_subtype = static_cast<uint16_t>(CONFIG_HAL_BOARD_SUBTYPE),
51
.major = FW_MAJOR,
52
.minor = FW_MINOR,
53
.patch = FW_PATCH,
54
.fw_type = FW_TYPE,
55
#ifdef BUILD_DATE_YEAR
56
// encode build date in os_sw_version
57
.os_sw_version = (BUILD_DATE_YEAR*100*100) + (BUILD_DATE_MONTH*100) + BUILD_DATE_DAY,
58
#else
59
.os_sw_version = 0,
60
#endif
61
#ifndef GIT_VERSION
62
.fw_string = ACTIVE_FWSTR,
63
.fw_hash_str = "",
64
#else
65
.fw_string = ACTIVE_FWSTR " (" GIT_VERSION ")",
66
.fw_hash_str = GIT_VERSION,
67
#endif
68
#ifndef GIT_VERSION_INT
69
.fw_hash = 0,
70
#else
71
.fw_hash = GIT_VERSION_INT,
72
#endif
73
.fw_string_original = ORIGINAL_FWSTR,
74
.fw_short_string = ACTIVE_FWSTR,
75
.middleware_name = nullptr,
76
.middleware_hash_str = nullptr,
77
#ifdef CHIBIOS_GIT_VERSION
78
.os_name = "ChibiOS",
79
.os_hash_str = CHIBIOS_GIT_VERSION,
80
#else
81
.os_name = nullptr,
82
.os_hash_str = nullptr,
83
#endif
84
};
85
86