2021-04-19 16:30:25 +00:00
|
|
|
#include "version.h"
|
2023-05-08 22:31:39 +00:00
|
|
|
#include <furi.h>
|
2022-06-26 12:00:03 +00:00
|
|
|
/* This header is autogenerated by build system */
|
|
|
|
#include "version.inc.h"
|
|
|
|
|
2023-05-08 22:31:39 +00:00
|
|
|
#define VERSION_MAGIC (0xBE40u)
|
|
|
|
#define VERSION_MAJOR (0x1u)
|
2023-05-29 16:40:56 +00:00
|
|
|
#define VERSION_MINOR (0x1u)
|
2023-05-08 22:31:39 +00:00
|
|
|
|
2021-04-19 16:30:25 +00:00
|
|
|
struct Version {
|
2023-05-08 22:31:39 +00:00
|
|
|
// Header
|
|
|
|
const uint16_t magic;
|
|
|
|
const uint8_t major;
|
|
|
|
const uint8_t minor;
|
|
|
|
// Payload
|
2022-01-05 16:10:18 +00:00
|
|
|
const char* git_hash;
|
|
|
|
const char* git_branch;
|
|
|
|
const char* build_date;
|
|
|
|
const char* version;
|
2023-05-08 22:31:39 +00:00
|
|
|
// Payload bits and pieces
|
2021-10-16 11:25:32 +00:00
|
|
|
const uint8_t target;
|
2022-04-13 20:50:25 +00:00
|
|
|
const bool build_is_dirty;
|
2023-05-29 16:40:56 +00:00
|
|
|
// v 1.1
|
|
|
|
const char* firmware_origin;
|
|
|
|
const char* git_origin;
|
2021-04-19 16:30:25 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
/* version of current running firmware (bootloader/flipper) */
|
|
|
|
static const Version version = {
|
2023-05-08 22:31:39 +00:00
|
|
|
.magic = VERSION_MAGIC,
|
|
|
|
.major = VERSION_MAJOR,
|
|
|
|
.minor = VERSION_MINOR,
|
2022-01-05 16:10:18 +00:00
|
|
|
.git_hash = GIT_COMMIT,
|
|
|
|
.git_branch = GIT_BRANCH,
|
|
|
|
.build_date = BUILD_DATE,
|
2022-04-13 20:50:25 +00:00
|
|
|
.version = VERSION
|
|
|
|
#ifdef FURI_RAM_EXEC
|
|
|
|
" (RAM)"
|
|
|
|
#endif
|
|
|
|
,
|
2022-01-05 16:10:18 +00:00
|
|
|
.target = TARGET,
|
2022-04-13 20:50:25 +00:00
|
|
|
.build_is_dirty = BUILD_DIRTY,
|
2023-05-29 16:40:56 +00:00
|
|
|
.firmware_origin = FIRMWARE_ORIGIN,
|
|
|
|
.git_origin = GIT_ORIGIN,
|
2021-04-19 16:30:25 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
const Version* version_get(void) {
|
|
|
|
return &version;
|
|
|
|
}
|
|
|
|
|
|
|
|
const char* version_get_githash(const Version* v) {
|
|
|
|
return v ? v->git_hash : version.git_hash;
|
|
|
|
}
|
|
|
|
|
|
|
|
const char* version_get_gitbranch(const Version* v) {
|
|
|
|
return v ? v->git_branch : version.git_branch;
|
|
|
|
}
|
|
|
|
|
|
|
|
const char* version_get_gitbranchnum(const Version* v) {
|
2023-05-08 22:31:39 +00:00
|
|
|
UNUSED(v);
|
|
|
|
return "0";
|
2021-04-19 16:30:25 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
const char* version_get_builddate(const Version* v) {
|
|
|
|
return v ? v->build_date : version.build_date;
|
|
|
|
}
|
|
|
|
|
|
|
|
const char* version_get_version(const Version* v) {
|
|
|
|
return v ? v->version : version.version;
|
|
|
|
}
|
|
|
|
|
2022-04-13 20:50:25 +00:00
|
|
|
uint8_t version_get_target(const Version* v) {
|
2021-04-19 16:30:25 +00:00
|
|
|
return v ? v->target : version.target;
|
|
|
|
}
|
2022-04-13 20:50:25 +00:00
|
|
|
|
|
|
|
bool version_get_dirty_flag(const Version* v) {
|
|
|
|
return v ? v->build_is_dirty : version.build_is_dirty;
|
2022-05-06 13:37:10 +00:00
|
|
|
}
|
2023-05-29 16:40:56 +00:00
|
|
|
|
|
|
|
const char* version_get_firmware_origin(const Version* v) {
|
|
|
|
return v ? v->firmware_origin : version.firmware_origin;
|
|
|
|
}
|
|
|
|
|
|
|
|
const char* version_get_git_origin(const Version* v) {
|
|
|
|
return v ? v->git_origin : version.git_origin;
|
|
|
|
}
|