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)
|
|
|
|
#define VERSION_MINOR (0x0u)
|
|
|
|
|
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-14 17:19:47 +00:00
|
|
|
const char* custom_flipper_name;
|
2021-04-19 16:30:25 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
/* version of current running firmware (bootloader/flipper) */
|
2023-05-14 02:38:00 +00:00
|
|
|
static 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-14 17:19:47 +00:00
|
|
|
.custom_flipper_name = NULL,
|
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-08-14 02:34:54 +00:00
|
|
|
const char* version_get_custom_name(const Version* v) {
|
|
|
|
return v ? v->custom_flipper_name : version.custom_flipper_name;
|
|
|
|
}
|
|
|
|
|
2023-05-14 02:38:00 +00:00
|
|
|
void version_set_custom_name(Version* v, const char* name) {
|
|
|
|
Version* ver = v ? v : &version;
|
|
|
|
ver->custom_flipper_name = name;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
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
|
|
|
}
|