系统版本信息从宏定义获取编译环境信息,

编译脚本加入编译信息宏定义
This commit is contained in:
大石头 2017-03-15 01:52:39 +08:00
parent f104249440
commit a093f8d7a0
3 changed files with 39 additions and 13 deletions

View File

@ -6,20 +6,32 @@
TSys Sys;
const TTime Time;
// 系统配置
const SystemConfig g_Config = {
// 操作系统 v3.2.x
(0x03020000 | __BUILD_DATE__),
"SmartOS_CPU",
// 硬件
0x0,
// 应用软件
0x0,
0x0,
"WsLink",
"",
};
#if defined(BOOT) || defined(APP)
struct HandlerRemap StrBoot __attribute__((at(0x2000fff0)));
#endif
#ifndef BIT
#define BIT(x) (1 << (x))
#endif
// 关键性代码,放到开头
INROOT TSys::TSys()
{
Config = nullptr;
Config = &g_Config;
OnInit();
@ -48,11 +60,10 @@ void TSys::Init(void)
void TSys::ShowInfo() const
{
#if DEBUG
//byte* ver = (byte*)&Version;
debug_printf("%s::%s Code:%04X ", Company, Name, Code);
//debug_printf("Ver:%x.%x Build:%s\r\n", *ver++, *ver++, BuildTime);
Version v(0, 0, Ver);
debug_printf("Ver:%s Build:%s\r\n", v.ToString().GetBuffer(), v.Compile().ToString().GetBuffer());
Version v(Config->Ver);
debug_printf("Ver:%s\r\n", v.ToString().GetBuffer());
debug_printf("Build:%s %s\r\n", __BUILD_USER__, __BUILD_COMPILE__);
OnShowInfo();

View File

@ -144,18 +144,17 @@ class SystemConfig
{
public:
// 操作系统
uint Ver; // 系统版本。Version格式
char Name[16]; // 系统名称。如SmartOS-M3-10x
uint Ver; // 系统版本。系统内
// 硬件
uint HardVer; // 硬件版本
// 应用软件
ushort Type; // 产品种类
ushort Code; // 产品种类
uint AppVer; // 产品版本
char Serial[16]; // 授权码
char Product[16];// 产品名称
char Company[16];// 公司
char Product[16];// 产品批次
char DevID[16]; // 设备编码
char Server[32]; // 服务器。重置后先尝试厂商前端,再尝试原服务器
@ -207,6 +206,21 @@ public:
#endif
// 编译信息兼容性处理
#ifndef __BUILD_DATE__
#define __BUILD_DATE__ 0
#endif
#ifndef __BUILD_TIME__
#define __BUILD_TIME__ 0
#endif
#ifndef __BUILD_COMPILE__
#define __BUILD_COMPILE__ ""
#endif
#ifndef __BUILD_USER__
#define __BUILD_USER__ ""
#endif
#endif //_Sys_H_
/*

View File

@ -17,6 +17,7 @@ build.AddFiles("..\\Test");
build.AddFiles("..\\TinyIP", "*.c;*.cpp", false, "HttpClient");
build.AddFiles("..\\TinyNet");
build.AddFiles("..\\TokenNet");
build.AlwaysBuild = "Sys.cpp";
build.Libs.Clear();
//build.Preprocess = true;
build.CompileAll();