mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-01-19 00:37:25 +01:00
[ion] Add software version, patch level and serial number
Change-Id: I011eeb2d8596f63e0c2fdedf353d544dc8a8a202
This commit is contained in:
2
Makefile
2
Makefile
@@ -1,5 +1,7 @@
|
||||
include build/config.mak
|
||||
|
||||
VERSION ?= 1.0.0
|
||||
|
||||
ifndef USE_LIBA
|
||||
$(error platform.mak should define USE_LIBA)
|
||||
endif
|
||||
|
||||
10
ion/Makefile
10
ion/Makefile
@@ -1,8 +1,18 @@
|
||||
GIT := $(shell command -v git 2> /dev/null)
|
||||
PATCH_LEVEL = NONE
|
||||
ifdef GIT
|
||||
PATCH_LEVEL = `git rev-parse HEAD`
|
||||
endif
|
||||
|
||||
|
||||
|
||||
SFLAGS += -Iion/include -DKD_CONFIG_H=1
|
||||
ion/src/shared/software_version.o: SFLAGS += -DPATCH_LEVEL=$(PATCH_LEVEL) -DVERSION=$(VERSION)
|
||||
include ion/src/$(PLATFORM)/Makefile
|
||||
|
||||
objs += $(addprefix ion/src/shared/, \
|
||||
events.o \
|
||||
software_version.o \
|
||||
)
|
||||
|
||||
tests += $(addprefix ion/test/,\
|
||||
|
||||
@@ -27,6 +27,8 @@ void msleep(long ms);
|
||||
void usleep(long us);
|
||||
|
||||
const char * serialNumber();
|
||||
const char * softwareVersion();
|
||||
const char * patchLevel();
|
||||
|
||||
/* CAUTION: This is a complete reset! */
|
||||
void reset();
|
||||
|
||||
@@ -74,7 +74,7 @@ const char * Ion::serialNumber() {
|
||||
static char serialNumber[25] = {0};
|
||||
if (serialNumber[0] == 0) {
|
||||
uint8_t * rawUniqueID = (uint8_t *)0x1FFF7A10;
|
||||
for (int i=0; i<24; i++) {
|
||||
for (int i=0; i<12; i++) {
|
||||
uint8_t d = *rawUniqueID++;
|
||||
serialNumber[2*i] = hex(d & 0xF);
|
||||
serialNumber[2*i+1] = hex(d >> 4);
|
||||
|
||||
20
ion/src/shared/software_version.cpp
Normal file
20
ion/src/shared/software_version.cpp
Normal file
@@ -0,0 +1,20 @@
|
||||
#include <ion.h>
|
||||
|
||||
#define STR_EXPAND(arg) #arg
|
||||
#define STR(arg) STR_EXPAND(arg)
|
||||
|
||||
#ifndef PATCH_LEVEL
|
||||
#error This file expects PATCH_LEVEL to be defined
|
||||
#endif
|
||||
|
||||
const char * Ion::softwareVersion() {
|
||||
return STR(VERSION);
|
||||
}
|
||||
|
||||
const char * Ion::patchLevel() {
|
||||
static char patchLevel[20] = {0};
|
||||
if (patchLevel[0] == 0) {
|
||||
strlcpy(patchLevel, STR(PATCH_LEVEL), 6+1);
|
||||
}
|
||||
return patchLevel;
|
||||
}
|
||||
@@ -81,3 +81,7 @@ void Ion::msleep(long ms) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const char * Ion::serialNumber() {
|
||||
return "Simulator";
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user