version.c 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. #include "version.h"
  2. /* This header is autogenerated by build system */
  3. #include "version.inc.h"
  4. struct Version {
  5. const char* git_hash;
  6. const char* git_branch;
  7. const char* git_branch_num;
  8. const char* build_date;
  9. const char* version;
  10. const uint8_t target;
  11. const bool build_is_dirty;
  12. };
  13. /* version of current running firmware (bootloader/flipper) */
  14. static const Version version = {
  15. .git_hash = GIT_COMMIT,
  16. .git_branch = GIT_BRANCH,
  17. .git_branch_num = GIT_BRANCH_NUM,
  18. .build_date = BUILD_DATE,
  19. .version = VERSION
  20. #ifdef FURI_RAM_EXEC
  21. " (RAM)"
  22. #endif
  23. ,
  24. .target = TARGET,
  25. .build_is_dirty = BUILD_DIRTY,
  26. };
  27. const Version* version_get(void) {
  28. return &version;
  29. }
  30. const char* version_get_githash(const Version* v) {
  31. return v ? v->git_hash : version.git_hash;
  32. }
  33. const char* version_get_gitbranch(const Version* v) {
  34. return v ? v->git_branch : version.git_branch;
  35. }
  36. const char* version_get_gitbranchnum(const Version* v) {
  37. return v ? v->git_branch_num : version.git_branch_num;
  38. }
  39. const char* version_get_builddate(const Version* v) {
  40. return v ? v->build_date : version.build_date;
  41. }
  42. const char* version_get_version(const Version* v) {
  43. return v ? v->version : version.version;
  44. }
  45. uint8_t version_get_target(const Version* v) {
  46. return v ? v->target : version.target;
  47. }
  48. bool version_get_dirty_flag(const Version* v) {
  49. return v ? v->build_is_dirty : version.build_is_dirty;
  50. }