[kernel][version] 采用新的版本宏定义
版本控制规范:https://semver.org/ 目前的版本子号不是很规范,其中RT_VERSION甚至和VS那边造成了冲突 ```c /* RT-Thread version information */ #define RT_VERSION 4L /**< major version number */ #define RT_SUBVERSION 1L /**< minor version number */ #define RT_REVISION 1L /**< revise version number */ ``` 参考ESP32: ```c /** Major version number (X.x.x) */ #define ESP_ARDUINO_VERSION_MAJOR 2 /** Minor version number (x.X.x) */ #define ESP_ARDUINO_VERSION_MINOR 0 /** Patch version number (x.x.X) */ #define ESP_ARDUINO_VERSION_PATCH 3 ``` 建议改成: ```c /* Major version number (X.x.x) */ #define RT_VERSION_MAJOR 4 /* Minor version number (x.X.x) */ #define RT_VERSION_MINOR 2 /* Patch version number (x.x.X) */ #define RT_VERSION_PATCH 0 ```
This commit is contained in:
parent
c75f52ff3a
commit
ce16945cba
|
@ -118,7 +118,7 @@ void slcd_demo_hook(void)
|
|||
/* Show RTT version. */
|
||||
{
|
||||
LCDLIB_SetSymbol(SYMBOL_VERSION, 1);
|
||||
rt_snprintf(au8Str, sizeof(au8Str), "%d%02d%03d", RT_VERSION, RT_SUBVERSION, RT_REVISION);
|
||||
rt_snprintf(au8Str, sizeof(au8Str), "%d%02d%03d", RT_VERSION_MAJOR, RT_VERSION_MINOR, RT_VERSION_PATCH);
|
||||
LCDLIB_Printf(ZONE_VER_DIGIT, &au8Str[0]);
|
||||
LCDLIB_SetSymbol(SYMBOL_VER_DIG_P1, 1);
|
||||
LCDLIB_SetSymbol(SYMBOL_VER_DIG_P2, 1);
|
||||
|
|
|
@ -21,8 +21,6 @@ if rtconfig.CROSS_TOOL == 'msvc':
|
|||
'_CRT_NO_TIME_T',
|
||||
# disable deprecation of unsafe functions, such as strncpy
|
||||
'_CRT_SECURE_NO_WARNINGS',
|
||||
# RT_VESRION conflicts in winuser.h
|
||||
'NORESOURCE',
|
||||
# lean and mean for Windows.h, exclude winsock.h when include Windows.h
|
||||
# avoid conlicts between sys/select.h, time.h, and winsock.h
|
||||
# such as fd_set related, struct timeval...
|
||||
|
|
|
@ -12,10 +12,12 @@
|
|||
#define __RT_LEGACY_H__
|
||||
|
||||
#include <rtconfig.h>
|
||||
#include <rtdef.h>
|
||||
|
||||
/* rtlibc */
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
/* legacy version macros */
|
||||
#define RT_VERSION RT_VERSION_MAJOR /**< major version number */
|
||||
#define RT_SUBVERSION RT_VERSION_MINOR /**< minor version number */
|
||||
#define RT_REVISION RT_VERSION_PATCH /**< revise version number */
|
||||
|
||||
/* IPC */
|
||||
#ifdef RT_USING_DEVICE_IPC
|
||||
|
|
|
@ -238,9 +238,9 @@ static void check_netdev_internet_up_work(struct rt_work *work, void *work_data)
|
|||
{
|
||||
send_data[index + 1] = netdev->hwaddr[index] + moth_num;
|
||||
}
|
||||
send_data[9] = RT_VERSION;
|
||||
send_data[10] = RT_SUBVERSION;
|
||||
send_data[11] = RT_REVISION;
|
||||
send_data[9] = RT_VERSION_MAJOR;
|
||||
send_data[10] = RT_VERSION_MINOR;
|
||||
send_data[11] = RT_VERSION_PATCH;
|
||||
|
||||
skt_ops->sendto(sockfd, send_data, SAL_INTERNET_BUFF_LEN, 0,
|
||||
(struct sockaddr *)&server_addr, sizeof(struct sockaddr));
|
||||
|
|
|
@ -68,15 +68,15 @@ extern "C" {
|
|||
/**@{*/
|
||||
|
||||
/* RT-Thread version information */
|
||||
#define RT_VERSION 5 /**< major version number */
|
||||
#define RT_SUBVERSION 0 /**< minor version number */
|
||||
#define RT_REVISION 0 /**< revise version number */
|
||||
#define RT_VERSION_MAJOR 5 /**< Major version number (X.x.x) */
|
||||
#define RT_VERSION_MINOR 0 /**< Minor version number (x.X.x) */
|
||||
#define RT_VERSION_PATCH 0 /**< Patch version number (x.x.X) */
|
||||
|
||||
/* e.g. #if (RTTHREAD_VERSION >= RT_VERSION_CHECK(4, 1, 0) */
|
||||
#define RT_VERSION_CHECK(major, minor, revise) ((major * 10000) + (minor * 100) + revise)
|
||||
|
||||
/* RT-Thread version */
|
||||
#define RTTHREAD_VERSION RT_VERSION_CHECK(RT_VERSION, RT_SUBVERSION, RT_REVISION)
|
||||
#define RTTHREAD_VERSION RT_VERSION_CHECK(RT_VERSION_MAJOR, RT_VERSION_MINOR, RT_VERSION_PATCH)
|
||||
|
||||
|
||||
/* RT-Thread basic data type definitions */
|
||||
|
|
|
@ -640,7 +640,7 @@ void rt_show_version(void)
|
|||
rt_kprintf("\n \\ | /\n");
|
||||
rt_kprintf("- RT - Thread Operating System\n");
|
||||
rt_kprintf(" / | \\ %d.%d.%d build %s %s\n",
|
||||
(rt_int32_t)RT_VERSION, (rt_int32_t)RT_SUBVERSION, (rt_int32_t)RT_REVISION, __DATE__, __TIME__);
|
||||
(rt_int32_t)RT_VERSION_MAJOR, (rt_int32_t)RT_VERSION_MINOR, (rt_int32_t)RT_VERSION_PATCH, __DATE__, __TIME__);
|
||||
rt_kprintf(" 2006 - 2022 Copyright by RT-Thread team\n");
|
||||
}
|
||||
RTM_EXPORT(rt_show_version);
|
||||
|
|
|
@ -968,11 +968,11 @@ def GetVersion():
|
|||
prepcessor.process_contents(contents)
|
||||
def_ns = prepcessor.cpp_namespace
|
||||
|
||||
version = int([ch for ch in def_ns['RT_VERSION'] if ch in '0123456789.'])
|
||||
subversion = int([ch for ch in def_ns['RT_SUBVERSION'] if ch in '0123456789.'])
|
||||
version = int([ch for ch in def_ns['RT_VERSION_MAJOR'] if ch in '0123456789.'])
|
||||
subversion = int([ch for ch in def_ns['RT_VERSION_MINOR'] if ch in '0123456789.'])
|
||||
|
||||
if 'RT_REVISION' in def_ns:
|
||||
revision = int([ch for ch in def_ns['RT_REVISION'] if ch in '0123456789.'])
|
||||
if 'RT_VERSION_PATCH' in def_ns:
|
||||
revision = int([ch for ch in def_ns['RT_VERSION_PATCH'] if ch in '0123456789.'])
|
||||
return '%d.%d.%d' % (version, subversion, revision)
|
||||
|
||||
return '0.%d.%d' % (version, subversion)
|
||||
|
|
Loading…
Reference in New Issue