[libc] remove RT_USING_LIBC

This commit is contained in:
Meco Man
2021-12-26 09:41:24 -05:00
committed by Bernard Xiong
parent 5925abce3e
commit ed09f38012
59 changed files with 178 additions and 190 deletions

View File

@@ -10,12 +10,9 @@ CPPDEFINES = []
if rtconfig.CROSS_TOOL == 'keil':
CPPDEFINES += ['__CLK_TCK=RT_TICK_PER_SECOND']
if GetDepend('RT_USING_LIBC'):
src += Glob('*.c')
elif GetDepend('RT_LIBC_USING_TIME'):
src += ['time.c']
src += Glob('*.c')
group = DefineGroup('libc', src, depend = [], CPPPATH = CPPPATH, CPPDEFINES = CPPDEFINES)
group = DefineGroup('compiler-libc', src, depend = [], CPPPATH = CPPPATH, CPPDEFINES = CPPDEFINES)
list = os.listdir(cwd)
for item in list:

View File

@@ -0,0 +1,13 @@
/*
* Copyright (c) 2006-2021, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
* Change Logs:
* Date Author Notes
* 2021-12-26 Meco Man First Version
*/
#include "compiler_private.h"
const char *warning_without_fs = "Please enable RT_USING_POSIX_FS";
const char *warning_without_devio = "Please enable RT_USING_POSIX_FS and RT_USING_POSIX_DEVIO";

View File

@@ -0,0 +1,18 @@
/*
* Copyright (c) 2006-2021, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
* Change Logs:
* Date Author Notes
* 2021-12-26 Meco Man First Version
*/
#ifndef __COMPILER_PRIVATE_H__
#define __COMPILER_PRIVATE_H__
#include <rtconfig.h>
extern const char *warning_without_fs;
extern const char *warning_without_devio;
#endif /* __COMPILER_PRIVATE_H__ */

View File

@@ -7,9 +7,8 @@ cwd = GetCurrentDir()
CPPPATH = [cwd]
group = []
if GetDepend('RT_USING_LIBC'):
src += Glob('*.c')
src += Glob('*.c')
if rtconfig.PLATFORM != 'gcc' or rtconfig.ARCH == 'sim':
group = DefineGroup('libc', src, depend = [], CPPPATH = CPPPATH)
group = DefineGroup('compiler-libc', src, depend = [], CPPPATH = CPPPATH)
Return('group')

View File

@@ -25,7 +25,7 @@
#include <sys/errno.h>
#include <rtthread.h>
#include <rthw.h>
#ifdef RT_USING_DEVICE
#ifdef RT_USING_RTC
#include <rtdevice.h>
#endif
@@ -33,6 +33,8 @@
#define DBG_LVL DBG_INFO
#include <rtdbg.h>
#define WARNING_NO_RTC "Cannot find a RTC device!"
/* seconds per day */
#define SPD 24*60*60
@@ -108,7 +110,7 @@ static rt_err_t get_timeval(struct timeval *tv)
else
{
/* LOG_W will cause a recursive printing if ulog timestamp function is enabled */
rt_kprintf("Cannot find a RTC device to provide time!\r\n");
rt_kprintf(WARNING_NO_RTC);
return -RT_ENOSYS;
}
@@ -116,7 +118,7 @@ static rt_err_t get_timeval(struct timeval *tv)
#else
/* LOG_W will cause a recursive printing if ulog timestamp function is enabled */
rt_kprintf("Cannot find a RTC device to provide time!\r\n");
rt_kprintf(WARNING_NO_RTC);
return -RT_ENOSYS;
#endif /* RT_USING_RTC */
}
@@ -153,14 +155,14 @@ static int set_timeval(struct timeval *tv)
}
else
{
LOG_W("Cannot find a RTC device to provide time!");
LOG_W(WARNING_NO_RTC);
return -RT_ENOSYS;
}
return rst;
#else
LOG_W("Cannot find a RTC device to provide time!");
LOG_W(WARNING_NO_RTC);
return -RT_ENOSYS;
#endif /* RT_USING_RTC */
}
@@ -525,7 +527,7 @@ INIT_COMPONENT_EXPORT(_rt_clock_time_system_init);
int clock_getres(clockid_t clockid, struct timespec *res)
{
#ifndef RT_USING_RTC
LOG_W("Cannot find a RTC device to save time!");
LOG_W(WARNING_NO_RTC);
return -1;
#else
int ret = 0;
@@ -564,7 +566,7 @@ RTM_EXPORT(clock_getres);
int clock_gettime(clockid_t clockid, struct timespec *tp)
{
#ifndef RT_USING_RTC
LOG_W("Cannot find a RTC device to save time!");
LOG_W(WARNING_NO_RTC);
return -1;
#else
int ret = 0;
@@ -628,7 +630,7 @@ int clock_nanosleep(clockid_t clockid, int flags, const struct timespec *rqtp, s
int clock_settime(clockid_t clockid, const struct timespec *tp)
{
#ifndef RT_USING_RTC
LOG_W("Cannot find a RTC device to save time!");
LOG_W(WARNING_NO_RTC);
return -1;
#else
register rt_base_t level;