Skip to content

[kernel][version] 采用新的版本宏定义 #6340

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 7, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion bsp/nuvoton/libraries/nu_packages/Demo/slcd_show_tick.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 0 additions & 2 deletions bsp/simulator/drivers/SConscript
Original file line number Diff line number Diff line change
Expand Up @@ -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...
Expand Down
8 changes: 5 additions & 3 deletions components/legacy/rtlegacy.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions components/net/sal/src/sal_socket.c
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down
8 changes: 4 additions & 4 deletions include/rtdef.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down
2 changes: 1 addition & 1 deletion src/kservice.c
Original file line number Diff line number Diff line change
Expand Up @@ -639,7 +639,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);
Expand Down
8 changes: 4 additions & 4 deletions tools/building.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down