diff options
| author | Man, Jianting (Meco) <[email protected]> | 2022-01-10 14:25:46 -0500 |
|---|---|---|
| committer | GitHub <[email protected]> | 2022-01-10 14:25:46 -0500 |
| commit | c6852aa306d07932bc1a62118029ac332acc3fc9 (patch) | |
| tree | 035cae3629b0a8a63686ffd5212162a334bfeeff /components/libc | |
| parent | 1f2e93f1a39590af9a71ecc31b12045696ca6055 (diff) | |
| parent | 982ad7bcbcbdc31305883803fadf63bad72dbc73 (diff) | |
Merge branch 'master' into removeinit
Diffstat (limited to 'components/libc')
69 files changed, 309 insertions, 413 deletions
diff --git a/components/libc/Kconfig b/components/libc/Kconfig index 69f8e1ae36..0556cf6183 100644 --- a/components/libc/Kconfig +++ b/components/libc/Kconfig @@ -1,38 +1,16 @@ menu "POSIX layer and C standard library" -config RT_USING_LIBC - bool "Enable libc APIs from the toolchain" +config RT_USING_MODULE + bool "Enable dynamic module with dlopen/dlsym/dlclose feature" default n -if RT_USING_LIBC - config RT_LIBC_USING_TIME - default y - - config RT_LIBC_USING_FILEIO - bool "Enable libc with file operation, eg.fopen/fwrite/fread/getchar/STDIO" - select RT_USING_POSIX_FS - select RT_USING_POSIX_DEVIO - default n - - config RT_USING_MODULE - bool "Enable dynamic module with dlopen/dlsym/dlclose feature" +if RT_USING_MODULE + config RT_USING_CUSTOM_DLMODULE + bool "Enable load dynamic module by custom" default n - - if RT_USING_MODULE - config RT_USING_CUSTOM_DLMODULE - bool "Enable load dynamic module by custom" - default n - endif -endif - -if RT_USING_LIBC != y - config RT_LIBC_USING_TIME - bool "Enable time functions without compiler's libc" - default y endif config RT_LIBC_DEFAULT_TIMEZONE - depends on (RT_LIBC_USING_TIME || RT_USING_LIBC) int "Set the default time zone (UTC+)" range -12 12 default 8 diff --git a/components/libc/compilers/armlibc/README.md b/components/libc/compilers/armlibc/README.md index 4d2a73b6be..fc0d750234 100644 --- a/components/libc/compilers/armlibc/README.md +++ b/components/libc/compilers/armlibc/README.md @@ -1,9 +1,3 @@ # ARMLIB (Keil-MDK) porting for RT-Thread -Please define RT_USING_LIBC and compile RT-Thread with Keil-MDK compiler. - - - -## More Information - https://www.keil.com/support/man/docs/armlib/
\ No newline at end of file diff --git a/components/libc/compilers/armlibc/SConscript b/components/libc/compilers/armlibc/SConscript index bf1a299304..bd3ac8dffc 100644 --- a/components/libc/compilers/armlibc/SConscript +++ b/components/libc/compilers/armlibc/SConscript @@ -7,6 +7,6 @@ group = [] CPPDEFINES = ['RT_USING_ARM_LIBC'] if rtconfig.PLATFORM == 'armcc' or rtconfig.PLATFORM == 'armclang': - group = DefineGroup('libc', src, depend = ['RT_USING_LIBC'], CPPDEFINES = CPPDEFINES) + group = DefineGroup('Compiler', src, depend = [''], CPPDEFINES = CPPDEFINES) Return('group') diff --git a/components/libc/compilers/armlibc/libc_syms.c b/components/libc/compilers/armlibc/libc_syms.c index 829d57b559..2b370a25a6 100644 --- a/components/libc/compilers/armlibc/libc_syms.c +++ b/components/libc/compilers/armlibc/libc_syms.c @@ -6,6 +6,7 @@ * Change Logs: * Date Author Notes */ + #include <stdio.h> #include <stdlib.h> #include <string.h> diff --git a/components/libc/compilers/armlibc/mem_std.c b/components/libc/compilers/armlibc/syscall_mem.c index f8a81c7873..b5403dfaf3 100644 --- a/components/libc/compilers/armlibc/mem_std.c +++ b/components/libc/compilers/armlibc/syscall_mem.c @@ -13,7 +13,7 @@ #include <stddef.h> #ifndef RT_USING_HEAP -#define DBG_TAG "armlibc.mem" +#define DBG_TAG "armlibc.syscall.mem" #define DBG_LVL DBG_INFO #include <rtdbg.h> diff --git a/components/libc/compilers/armlibc/syscalls.c b/components/libc/compilers/armlibc/syscalls.c index 0e965d62af..82c0f38b4f 100644 --- a/components/libc/compilers/armlibc/syscalls.c +++ b/components/libc/compilers/armlibc/syscalls.c @@ -21,19 +21,20 @@ #include <fcntl.h> #include <unistd.h> #include <sys/stat.h> -#ifdef RT_USING_POSIX_DEVIO +#include <compiler_private.h> +#ifdef RT_USING_POSIX_STDIO #include "libc.h" -#endif /* RT_USING_POSIX_DEVIO */ +#endif /* RT_USING_POSIX_STDIO */ #define DBG_TAG "armlibc.syscalls" #define DBG_LVL DBG_INFO #include <rtdbg.h> -#ifdef __CLANG_ARM +#ifdef __clang__ __asm(".global __use_no_semihosting\n\t"); #else #pragma import(__use_no_semihosting_swi) -#endif /* __CLANG_ARM */ +#endif /* Standard IO device handles. */ #define STDIN 0 @@ -69,6 +70,7 @@ FILEHANDLE _sys_open(const char *name, int openmode) return (STDERR); #ifndef DFS_USING_POSIX + LOG_W("%s: %s", __func__, _WARNING_WITHOUT_FS); return 0; /* error */ #else /* Correct openmode from fopen to open */ @@ -113,6 +115,7 @@ int _sys_close(FILEHANDLE fh) return close(fh); #else + LOG_W("%s: %s", __func__, _WARNING_WITHOUT_FS); return 0; #endif /* DFS_USING_POSIX */ } @@ -149,17 +152,18 @@ int _sys_read(FILEHANDLE fh, unsigned char *buf, unsigned len, int mode) if (fh == STDIN) { -#ifdef RT_USING_POSIX_DEVIO +#ifdef RT_USING_POSIX_STDIO if (libc_stdio_get_console() < 0) { - LOG_W("Do not invoke standard output before initializing libc"); + LOG_W("Do not invoke standard output before initializing Compiler"); return 0; /* error, but keep going */ } size = read(STDIN_FILENO, buf, len); return len - size; /* success */ #else + LOG_W("%s: %s", __func__, _WARNING_WITHOUT_STDIO); return 0; /* error */ -#endif /* RT_USING_POSIX_DEVIO */ +#endif /* RT_USING_POSIX_STDIO */ } else if (fh == STDOUT || fh == STDERR) { @@ -178,6 +182,7 @@ int _sys_read(FILEHANDLE fh, unsigned char *buf, unsigned len, int mode) } } #else + LOG_W("%s: %s", __func__, _WARNING_WITHOUT_FS); return 0; /* error */ #endif /* DFS_USING_POSIX */ } @@ -199,7 +204,7 @@ int _sys_write(FILEHANDLE fh, const unsigned char *buf, unsigned len, int mode) if (fh == STDOUT || fh == STDERR) { -#ifdef RT_USING_CONSOLE +#if defined(RT_USING_CONSOLE) && defined(RT_USING_DEVICE) rt_device_t console; console = rt_console_get_device(); if (console) @@ -209,7 +214,7 @@ int _sys_write(FILEHANDLE fh, const unsigned char *buf, unsigned len, int mode) return 0; /* success */ #else return 0; /* error */ -#endif /* RT_USING_CONSOLE */ +#endif /* defined(RT_USING_CONSOLE) && defined(RT_USING_DEVICE) */ } else if (fh == STDIN) { @@ -228,6 +233,7 @@ int _sys_write(FILEHANDLE fh, const unsigned char *buf, unsigned len, int mode) return 0; /* error */ } #else + LOG_W("%s: %s", __func__, _WARNING_WITHOUT_FS); return 0; /* error */ #endif /* DFS_USING_POSIX */ } @@ -246,6 +252,7 @@ int _sys_seek(FILEHANDLE fh, long pos) /* position is relative to the start of file fh */ return lseek(fh, pos, 0); #else + LOG_W("%s: %s", __func__, _WARNING_WITHOUT_FS); return 0; /* error */ #endif /* DFS_USING_POSIX */ } @@ -269,10 +276,7 @@ char *_sys_command_string(char *cmd, int len) void _ttywrch(int ch) { #ifdef RT_USING_CONSOLE - char c; - - c = (char)ch; - rt_kprintf(&c); + rt_kprintf("%c", (char)ch); #endif /* RT_USING_CONSOLE */ } @@ -301,6 +305,7 @@ long _sys_flen(FILEHANDLE fh) fstat(fh, &stat); return stat.st_size; #else + LOG_W("%s: %s", __func__, _WARNING_WITHOUT_FS); return 0; #endif /* DFS_USING_POSIX */ } @@ -318,6 +323,7 @@ int remove(const char *filename) #ifdef DFS_USING_POSIX return unlink(filename); #else + LOG_W("%s: %s", __func__, _WARNING_WITHOUT_FS); return 0; /* error */ #endif /* DFS_USING_POSIX */ } @@ -328,10 +334,7 @@ int remove(const char *filename) int fputc(int c, FILE *f) { #ifdef RT_USING_CONSOLE - char ch[2] = {0}; - - ch[0] = c; - rt_kprintf(&ch[0]); + rt_kprintf("%c", (char)c); return 1; #else return 0; /* error */ @@ -340,18 +343,19 @@ int fputc(int c, FILE *f) int fgetc(FILE *f) { -#ifdef RT_USING_POSIX_DEVIO +#ifdef RT_USING_POSIX_STDIO char ch; if (libc_stdio_get_console() < 0) { - LOG_W("Do not invoke standard output before initializing libc"); + LOG_W("Do not invoke standard output before initializing Compiler"); return 0; } if(read(STDIN_FILENO, &ch, 1) == 1) return ch; -#endif /* RT_USING_POSIX_DEVIO */ +#endif /* RT_USING_POSIX_STDIO */ + LOG_W("%s: %s", __func__, _WARNING_WITHOUT_STDIO); return 0; /* error */ } diff --git a/components/libc/compilers/common/SConscript b/components/libc/compilers/common/SConscript index 504bf84e56..8db8f2c94a 100644 --- a/components/libc/compilers/common/SConscript +++ b/components/libc/compilers/common/SConscript @@ -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', src, depend = [''], CPPPATH = CPPPATH, CPPDEFINES = CPPDEFINES) list = os.listdir(cwd) for item in list: diff --git a/components/libc/compilers/common/compiler_private.h b/components/libc/compilers/common/compiler_private.h new file mode 100644 index 0000000000..7f6b42e837 --- /dev/null +++ b/components/libc/compilers/common/compiler_private.h @@ -0,0 +1,17 @@ +/* + * 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__ + +#define _WARNING_WITHOUT_FS "Please enable RT_USING_POSIX_FS" +#define _WARNING_WITHOUT_STDIO "Please enable RT_USING_POSIX_FS and RT_USING_POSIX_STDIO" + +#endif /* __COMPILER_PRIVATE_H__ */ diff --git a/components/libc/compilers/common/dirent.h b/components/libc/compilers/common/dirent.h index a6353fd6f8..a9c7ef856d 100644 --- a/components/libc/compilers/common/dirent.h +++ b/components/libc/compilers/common/dirent.h @@ -6,6 +6,7 @@ * Change Logs: * Date Author Notes */ + #ifndef __DIRENT_H__ #define __DIRENT_H__ diff --git a/components/libc/compilers/common/nogcc/SConscript b/components/libc/compilers/common/nogcc/SConscript index c766c8f82d..dbc26ac177 100644 --- a/components/libc/compilers/common/nogcc/SConscript +++ b/components/libc/compilers/common/nogcc/SConscript @@ -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', src, depend = [''], CPPPATH = CPPPATH) Return('group') diff --git a/components/libc/compilers/common/nogcc/fcntl.h b/components/libc/compilers/common/nogcc/fcntl.h index 51ee1024a8..83c3ec0b6b 100644 --- a/components/libc/compilers/common/nogcc/fcntl.h +++ b/components/libc/compilers/common/nogcc/fcntl.h @@ -7,6 +7,7 @@ * Date Author Notes * 2021-09-02 Meco Man First version */ + #ifndef __FCNTL_H__ #define __FCNTL_H__ diff --git a/components/libc/compilers/common/nogcc/sys/errno.h b/components/libc/compilers/common/nogcc/sys/errno.h index 0452fe93a1..d53ce4b386 100644 --- a/components/libc/compilers/common/nogcc/sys/errno.h +++ b/components/libc/compilers/common/nogcc/sys/errno.h @@ -7,6 +7,7 @@ * Date Author Notes * 2021-05-22 Meco Man The first version. */ + #ifndef __SYS_ERRNO_H__ #define __SYS_ERRNO_H__ @@ -575,6 +576,10 @@ defined in armcc/errno.h #ifndef EHWPOISON #define EHWPOISON (ERROR_BASE_NO + 133) #endif -#endif -#endif +#elif defined(_WIN32) +#include <errno.h> + +#endif /* defined(__ARMCC_VERSION) || defined(__IAR_SYSTEMS_ICC__) */ + +#endif /* __SYS_ERRNO_H__ */ diff --git a/components/libc/compilers/common/nogcc/sys/select.h b/components/libc/compilers/common/nogcc/sys/select.h index 02fb77dd89..44f9b4ed91 100644 --- a/components/libc/compilers/common/nogcc/sys/select.h +++ b/components/libc/compilers/common/nogcc/sys/select.h @@ -6,6 +6,7 @@ * Change Logs: * Date Author Notes * 2021-07-21 Meco Man The first version + * 2021-12-25 Meco Man Handle newlib 2.2.0 or lower version */ #ifndef __SYS_SELECT_H__ @@ -33,13 +34,12 @@ typedef long fd_mask; #ifndef _WIN32 -#ifndef _SYS_TYPES_FD_SET /* MIPS */ - +#ifndef _SYS_TYPES_FD_SET /* Newlib 2.2.0 or lower version */ #define NBBY 8 /* number of bits in a byte */ #define NFDBITS (sizeof (fd_mask) * NBBY) /* bits per mask */ #ifndef howmany #define howmany(x,y) (((x)+((y)-1))/(y)) -#endif +#endif /* howmany */ typedef struct _types_fd_set { fd_mask fds_bits[howmany(FD_SETSIZE, NFDBITS)]; diff --git a/components/libc/compilers/common/nogcc/sys/types.h b/components/libc/compilers/common/nogcc/sys/types.h index 5672f54a4d..32b2493c95 100644 --- a/components/libc/compilers/common/nogcc/sys/types.h +++ b/components/libc/compilers/common/nogcc/sys/types.h @@ -8,6 +8,7 @@ * 2020-09-05 Meco Man fix bugs * 2020-12-16 Meco Man add useconds_t */ + #ifndef __SYS_TYPES_H__ #define __SYS_TYPES_H__ diff --git a/components/libc/compilers/common/nogcc/sys/unistd.h b/components/libc/compilers/common/nogcc/sys/unistd.h index 6195c4c2aa..650c87dc18 100644 --- a/components/libc/compilers/common/nogcc/sys/unistd.h +++ b/components/libc/compilers/common/nogcc/sys/unistd.h @@ -8,6 +8,7 @@ * 2020-12-16 Meco Man add usleep * 2021-09-11 Meco Man move functions from dfs_posix.h to unistd.h */ + #ifndef __SYS_UNISTD_H__ #define __SYS_UNISTD_H__ diff --git a/components/libc/compilers/common/nogcc/unistd.h b/components/libc/compilers/common/nogcc/unistd.h index 9b96d45adb..4dd71c842e 100644 --- a/components/libc/compilers/common/nogcc/unistd.h +++ b/components/libc/compilers/common/nogcc/unistd.h @@ -6,4 +6,5 @@ * Change Logs: * Date Author Notes */ + #include "sys/unistd.h" diff --git a/components/libc/compilers/common/sys/ioctl.h b/components/libc/compilers/common/sys/ioctl.h index a1642199b1..d93c79115a 100644 --- a/components/libc/compilers/common/sys/ioctl.h +++ b/components/libc/compilers/common/sys/ioctl.h @@ -7,6 +7,7 @@ * Date Author Notes * 2020-09-01 Meco Man First Version */ + #ifndef __SYS_IOCTL_H__ #define __SYS_IOCTL_H__ diff --git a/components/libc/compilers/common/sys/statfs.h b/components/libc/compilers/common/sys/statfs.h index 0c6dc44df3..a86a789475 100644 --- a/components/libc/compilers/common/sys/statfs.h +++ b/components/libc/compilers/common/sys/statfs.h @@ -6,6 +6,7 @@ * Change Logs: * Date Author Notes */ + #ifndef __SYS_STATFS_H__ #define __SYS_STATFS_H__ diff --git a/components/libc/compilers/common/sys/time.h b/components/libc/compilers/common/sys/time.h index a285139649..758333796d 100644 --- a/components/libc/compilers/common/sys/time.h +++ b/components/libc/compilers/common/sys/time.h @@ -8,6 +8,7 @@ * 2020-09-07 Meco Man combine gcc armcc iccarm * 2021-02-12 Meco Man move all definitions located in <clock_time.h> to this file */ + #ifndef __SYS_TIME_H__ #define __SYS_TIME_H__ @@ -15,6 +16,9 @@ #include <sys/types.h> #include <stdint.h> #include <time.h> +#ifdef _WIN32 +#include <winsock.h> /* for struct timeval */ +#endif #ifdef __cplusplus extern "C" { @@ -39,20 +43,14 @@ struct timezone int tz_dsttime; /* type of dst correction */ }; -/* - * Structure returned by gettimeofday(2) system call, - * and used in other calls. - */ -#ifndef _TIMEVAL_DEFINED +#if !defined(_TIMEVAL_DEFINED) && !defined(_WIN32) #define _TIMEVAL_DEFINED -#if !defined(_WIN32) struct timeval { time_t tv_sec; /* seconds */ suseconds_t tv_usec; /* and microseconds */ }; #endif -#endif /* _TIMEVAL_DEFINED */ #if !(defined(__GNUC__) && !defined(__ARMCC_VERSION)/*GCC*/) && \ !(defined(__ICCARM__) && (__VER__ >= 8010001)) && \ @@ -70,8 +68,22 @@ int gettimeofday(struct timeval *tv, struct timezone *tz); int settimeofday(const struct timeval *tv, const struct timezone *tz); #if defined(__ARMCC_VERSION) || defined (__ICCARM__) struct tm *gmtime_r(const time_t *timep, struct tm *r); +#elif defined(_WIN32) +struct tm* gmtime_r(const time_t* timep, struct tm* r); +struct tm* gmtime(const time_t* t); +struct tm* localtime_r(const time_t* t, struct tm* r); +struct tm* localtime(const time_t* t); +time_t mktime(struct tm* const t); +char* asctime_r(const struct tm* t, char* buf); +char* ctime_r(const time_t* tim_p, char* result); +char* ctime(const time_t* tim_p); +time_t time(time_t* t); #endif +#ifdef RT_USING_POSIX_DELAY +int nanosleep(const struct timespec *rqtp, struct timespec *rmtp); +#endif /* RT_USING_POSIX_DELAY */ + #ifdef RT_USING_POSIX_CLOCK /* POSIX clock and timer */ #define MILLISECOND_PER_SECOND 1000UL @@ -103,7 +115,6 @@ int clock_getres (clockid_t clockid, struct timespec *res); int clock_gettime (clockid_t clockid, struct timespec *tp); int clock_settime (clockid_t clockid, const struct timespec *tp); int clock_nanosleep(clockid_t clockid, int flags, const struct timespec *rqtp, struct timespec *rmtp); -int nanosleep(const struct timespec *rqtp, struct timespec *rmtp); int rt_timespec_to_tick(const struct timespec *time); #endif /* RT_USING_POSIX_CLOCK */ diff --git a/components/libc/compilers/common/sys/vfs.h b/components/libc/compilers/common/sys/vfs.h index 00739ab1c6..a9330df002 100644 --- a/components/libc/compilers/common/sys/vfs.h +++ b/components/libc/compilers/common/sys/vfs.h @@ -7,6 +7,7 @@ * Date Author Notes * 2021-09-11 Meco Man First version */ + #ifndef __SYS_VFS_H__ #define __SYS_VFS_H__ diff --git a/components/libc/compilers/common/time.c b/components/libc/compilers/common/time.c index 4d204a0c00..46bb0c1355 100644 --- a/components/libc/compilers/common/time.c +++ b/components/libc/compilers/common/time.c @@ -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 @@ -54,8 +56,8 @@ static const short __spm[13] = (31 + 28 + 31 + 30 + 31 + 30 + 31 + 31 + 30 + 31 + 30 + 31), }; -ALIGN(4) static const char days[] = "Sun Mon Tue Wed Thu Fri Sat "; -ALIGN(4) static const char months[] = "Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec "; +ALIGN(4) static const char *days = "Sun Mon Tue Wed Thu Fri Sat "; +ALIGN(4) static const char *months = "Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec "; static int __isleap(int year) { @@ -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 */ } @@ -215,7 +217,7 @@ struct tm* localtime_r(const time_t* t, struct tm* r) { time_t local_tz; - local_tz = *t + tz_get() * 3600; + local_tz = *t + (time_t)tz_get() * 3600; return gmtime_r(&local_tz, r); } RTM_EXPORT(localtime_r); @@ -232,7 +234,7 @@ time_t mktime(struct tm * const t) time_t timestamp; timestamp = timegm(t); - timestamp = timestamp - 3600 * tz_get(); + timestamp = timestamp - 3600 * (time_t)tz_get(); return timestamp; } RTM_EXPORT(mktime); @@ -365,7 +367,7 @@ time_t timegm(struct tm * const t) { register time_t day; register time_t i; - register time_t years = t->tm_year - 70; + register time_t years = (time_t)t->tm_year - 70; if (t->tm_sec > 60) { @@ -486,8 +488,18 @@ RTM_EXPORT(settimeofday); RTM_EXPORT(difftime); RTM_EXPORT(strftime); -#ifdef RT_USING_POSIX_CLOCK +#ifdef RT_USING_POSIX_DELAY #include <delay.h> +int nanosleep(const struct timespec *rqtp, struct timespec *rmtp) +{ + sleep(rqtp->tv_sec); + ndelay(rqtp->tv_nsec); + return 0; +} +RTM_EXPORT(nanosleep); +#endif /* RT_USING_POSIX_DELAY */ + +#ifdef RT_USING_POSIX_CLOCK #ifdef RT_USING_RTC static volatile struct timeval _timevalue; static int _rt_clock_time_system_init() @@ -525,7 +537,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 +576,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 +640,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; @@ -668,33 +680,6 @@ int clock_settime(clockid_t clockid, const struct timespec *tp) } RTM_EXPORT(clock_settime); -int nanosleep(const struct timespec *rqtp, struct timespec *rmtp) -{ - uint32_t time_ms = rqtp->tv_sec * 1000; - uint32_t time_us = rqtp->tv_nsec / 1000; - - time_ms += time_us / 1000 ; - time_us = time_us % 1000; - - if (rt_thread_self() != RT_NULL) - { - rt_thread_mdelay(time_ms); - } - else /* scheduler has not run yet */ - { - while(time_ms > 0) - { - udelay(1000u); - time_ms -= 1; - } - } - - udelay(time_us); - - return 0; -} -RTM_EXPORT(nanosleep); - int rt_timespec_to_tick(const struct timespec *time) { int tick; diff --git a/components/libc/compilers/dlib/README.md b/components/libc/compilers/dlib/README.md index acd08f9074..e4d70e8135 100644 --- a/components/libc/compilers/dlib/README.md +++ b/components/libc/compilers/dlib/README.md @@ -1,9 +1,3 @@ # DLIB (IAR) porting for RT-Thread -Please define RT_USING_LIBC and compile RT-Thread with IAR compiler. - - - -## More Information - http://www.iarsys.co.jp/download/LMS2/arm/7502/ewarm7502doc/arm/doc/EWARM_DevelopmentGuide.ENU.pdf P.130
\ No newline at end of file diff --git a/components/libc/compilers/dlib/SConscript b/components/libc/compilers/dlib/SConscript index f685873e16..e11ea65b97 100644 --- a/components/libc/compilers/dlib/SConscript +++ b/components/libc/compilers/dlib/SConscript @@ -15,6 +15,6 @@ if rtconfig.PLATFORM == 'iar': if LooseVersion(IARVersion()) < LooseVersion("8.20.1"): CPPDEFINES = CPPDEFINES + ['_DLIB_THREAD_SUPPORT'] - group = DefineGroup('libc', src, depend = ['RT_USING_LIBC'], CPPDEFINES = CPPDEFINES) + group = DefineGroup('Compiler', src, depend = [''], CPPDEFINES = CPPDEFINES) Return('group') diff --git a/components/libc/compilers/dlib/syscall_close.c b/components/libc/compilers/dlib/syscall_close.c index 30ee6f2388..736023023d 100644 --- a/components/libc/compilers/dlib/syscall_close.c +++ b/components/libc/compilers/dlib/syscall_close.c @@ -7,9 +7,14 @@ * Date Author Notes * 2015-01-28 Bernard first version */ + #include <rtthread.h> #include <LowLevelIOInterface.h> #include <unistd.h> +#include <compiler_private.h> +#define DBG_TAG "dlib.syscall.close" +#define DBG_LVL DBG_INFO +#include <rtdbg.h> /* * The "__close" function should close the file corresponding to @@ -27,6 +32,7 @@ int __close(int handle) #ifdef DFS_USING_POSIX return close(handle); #else + LOG_W(_WARNING_WITHOUT_FS); return _LLIO_ERROR; #endif /* DFS_USING_POSIX */ } diff --git a/components/libc/compilers/dlib/syscall_lseek.c b/components/libc/compilers/dlib/syscall_lseek.c index 622f613c51..b2c47e71c9 100644 --- a/components/libc/compilers/dlib/syscall_lseek.c +++ b/components/libc/compilers/dlib/syscall_lseek.c @@ -7,9 +7,14 @@ * Date Author Notes * 2015-01-28 Bernard first version */ + #include <rtthread.h> #include <LowLevelIOInterface.h> #include <unistd.h> +#include <compiler_private.h> +#define DBG_TAG "dlib.syscall.lseek" +#define DBG_LVL DBG_INFO +#include <rtdbg.h> /* * The "__lseek" function makes the next file operation (__read or @@ -36,6 +41,7 @@ long __lseek(int handle, long offset, int whence) #ifdef DFS_USING_POSIX return lseek(handle, offset, whence); #else + LOG_W(_WARNING_WITHOUT_FS); return _LLIO_ERROR; #endif /* DFS_USING_POSIX */ } diff --git a/components/libc/compilers/dlib/syscall_mem.c b/components/libc/compilers/dlib/syscall_mem.c index 74b960f0b9..2de0974e4e 100644 --- a/components/libc/compilers/dlib/syscall_mem.c +++ b/components/libc/compilers/dlib/syscall_mem.c @@ -8,11 +8,12 @@ * 2015-01-28 Bernard first version * 2021-11-13 Meco Man implement no-heap warning */ + #include <rtthread.h> #include <stddef.h> #ifndef RT_USING_HEAP -#define DBG_TAG "dlib.syscall_mem" +#define DBG_TAG "dlib.syscall.mem" #define DBG_LVL DBG_INFO #include <rtdbg.h> #define _NO_HEAP_ERROR() do{LOG_E("Please enable RT_USING_HEAP");\ diff --git a/components/libc/compilers/dlib/syscall_open.c b/components/libc/compilers/dlib/syscall_open.c index 66cddc83c1..4d557db4b0 100644 --- a/components/libc/compilers/dlib/syscall_open.c +++ b/components/libc/compilers/dlib/syscall_open.c @@ -11,6 +11,10 @@ #include <rtthread.h> #include <LowLevelIOInterface.h> #include <fcntl.h> +#include <compiler_private.h> +#define DBG_TAG "dlib.syscall.open" +#define DBG_LVL DBG_INFO +#include <rtdbg.h> /* * The "__open" function opens the file named "filename" as specified @@ -22,56 +26,58 @@ int __open(const char *filename, int mode) { #ifdef DFS_USING_POSIX - int handle; - int open_mode = O_RDONLY; + int handle; + int open_mode = O_RDONLY; - if (mode & _LLIO_CREAT) - { - open_mode |= O_CREAT; - - /* Check what we should do with it if it exists. */ - if (mode & _LLIO_APPEND) + if (mode & _LLIO_CREAT) { - /* Append to the existing file. */ - open_mode |= O_APPEND; + open_mode |= O_CREAT; + + /* Check what we should do with it if it exists. */ + if (mode & _LLIO_APPEND) + { + /* Append to the existing file. */ + open_mode |= O_APPEND; + } + + if (mode & _LLIO_TRUNC) + { + /* Truncate the existsing file. */ + open_mode |= O_TRUNC; + } } - if (mode & _LLIO_TRUNC) + if (mode & _LLIO_TEXT) { - /* Truncate the existsing file. */ - open_mode |= O_TRUNC; + /* we didn't support text mode */ } - } - if (mode & _LLIO_TEXT) - { - /* we didn't support text mode */ - } - - switch (mode & _LLIO_RDWRMASK) - { - case _LLIO_RDONLY: - break; - - case _LLIO_WRONLY: - open_mode |= O_WRONLY; - break; + switch (mode & _LLIO_RDWRMASK) + { + case _LLIO_RDONLY: + break; - case _LLIO_RDWR: - /* The file should be opened for both reads and writes. */ - open_mode |= O_RDWR; - break; + case _LLIO_WRONLY: + open_mode |= O_WRONLY; + break; - default: - return _LLIO_ERROR; - } + case _LLIO_RDWR: + /* The file should be opened for both reads and writes. */ + open_mode |= O_RDWR; + break; - handle = open(filename, open_mode, 0); - if (handle < 0) - return _LLIO_ERROR; + default: + return _LLIO_ERROR; + } - return handle; + handle = open(filename, open_mode, 0); + if (handle < 0) + { + return _LLIO_ERROR; + } + return handle; #else - return _LLIO_ERROR; + LOG_W(_WARNING_WITHOUT_FS); + return _LLIO_ERROR; #endif /* DFS_USING_POSIX */ } diff --git a/components/libc/compilers/dlib/syscall_read.c b/components/libc/compilers/dlib/syscall_read.c index 62bc05d243..a276a3e401 100644 --- a/components/libc/compilers/dlib/syscall_read.c +++ b/components/libc/compilers/dlib/syscall_read.c @@ -11,11 +11,11 @@ #include <rtthread.h> #include <LowLevelIOInterface.h> #include <unistd.h> -#ifdef RT_USING_POSIX_DEVIO +#ifdef RT_USING_POSIX_STDIO #include "libc.h" -#endif /* RT_USING_POSIX_DEVIO */ - -#define DBG_TAG "dlib.syscall_read" +#endif /* RT_USING_POSIX_STDIO */ +#include <compiler_private.h> +#define DBG_TAG "dlib.syscall.read" #define DBG_LVL DBG_INFO #include <rtdbg.h> @@ -39,16 +39,17 @@ size_t __read(int handle, unsigned char *buf, size_t len) if (handle == _LLIO_STDIN) { -#ifdef RT_USING_POSIX_DEVIO +#ifdef RT_USING_POSIX_STDIO if (libc_stdio_get_console() < 0) { - LOG_W("Do not invoke standard input before initializing libc"); + LOG_W("Do not invoke standard input before initializing Compiler"); return 0; /* error, but keep going */ } return read(STDIN_FILENO, buf, len); /* return the length of the data read */ #else + LOG_W(_WARNING_WITHOUT_STDIO); return _LLIO_ERROR; -#endif /* RT_USING_POSIX_DEVIO */ +#endif /* RT_USING_POSIX_STDIO */ } else if ((handle == _LLIO_STDOUT) || (handle == _LLIO_STDERR)) { @@ -58,6 +59,7 @@ size_t __read(int handle, unsigned char *buf, size_t len) size = read(handle, buf, len); return size; /* return the length of the data read */ #else + LOG_W(_WARNING_WITHOUT_FS); return _LLIO_ERROR; #endif /* DFS_USING_POSIX */ } diff --git a/components/libc/compilers/dlib/syscall_remove.c b/components/libc/compilers/dlib/syscall_remove.c index 870f91b8c1..04230544da 100644 --- a/components/libc/compilers/dlib/syscall_remove.c +++ b/components/libc/compilers/dlib/syscall_remove.c @@ -7,9 +7,14 @@ * Date Author Notes * 2015-01-28 Bernard first version */ + #include <rtthread.h> #include <LowLevelIOInterface.h> #include <unistd.h> +#include <compiler_private.h> +#define DBG_TAG "dlib.syscall.remove" +#define DBG_LVL DBG_INFO +#include <rtdbg.h> /* * The "remove" function should remove the file named "filename". It @@ -23,6 +28,7 @@ int remove(const char *filename) #ifdef DFS_USING_POSIX return unlink(filename); #else + LOG_W(_WARNING_WITHOUT_FS); return _LLIO_ERROR; #endif /* DFS_USING_POSIX */ } diff --git a/components/libc/compilers/dlib/syscall_write.c b/components/libc/compilers/dlib/syscall_write.c index 2bc5863d8a..4eead9aa38 100644 --- a/components/libc/compilers/dlib/syscall_write.c +++ b/components/libc/compilers/dlib/syscall_write.c @@ -11,7 +11,8 @@ #include <rtthread.h> #include <LowLevelIOInterface.h> #include <unistd.h> -#define DBG_TAG "dlib.syscall_write" +#include <compiler_private.h> +#define DBG_TAG "dlib.syscall.write" #define DBG_LVL DBG_INFO #include <rtdbg.h> @@ -39,7 +40,7 @@ size_t __write(int handle, const unsigned char *buf, size_t len) if ((handle == _LLIO_STDOUT) || (handle == _LLIO_STDERR)) { -#ifdef RT_USING_CONSOLE +#if defined(RT_USING_CONSOLE) && defined(RT_USING_DEVICE) rt_device_t console_device; console_device = rt_console_get_device(); @@ -51,7 +52,7 @@ size_t __write(int handle, const unsigned char *buf, size_t len) return len; /* return the length of the data written */ #else return _LLIO_ERROR; -#endif /* RT_USING_CONSOLE */ +#endif /* defined(RT_USING_CONSOLE) && defined(RT_USING_DEVICE) */ } else if (handle == _LLIO_STDIN) { @@ -63,6 +64,7 @@ size_t __write(int handle, const unsigned char *buf, size_t len) size = write(handle, buf, len); return size; /* return the length of the data written */ #else + LOG_W(_WARNING_WITHOUT_FS); return _LLIO_ERROR; #endif /* DFS_USING_POSIX */ } diff --git a/components/libc/compilers/dlib/syscalls.c b/components/libc/compilers/dlib/syscalls.c index 1ee6a3bc12..391cbcac8a 100644 --- a/components/libc/compilers/dlib/syscalls.c +++ b/components/libc/compilers/dlib/syscalls.c @@ -7,6 +7,7 @@ * Date Author Notes * 2021-02-13 Meco Man implement exit() and abort() */ + #include <rtthread.h> /* for exit() and abort() */ diff --git a/components/libc/compilers/gcc/newlib/README.md b/components/libc/compilers/gcc/newlib/README.md index 62172e6a55..4614375b45 100644 --- a/components/libc/compilers/gcc/newlib/README.md +++ b/components/libc/compilers/gcc/newlib/README.md @@ -1,10 +1,4 @@ # NEWLIB (GCC) porting for RT-Thread -Please define RT_USING_LIBC and compile RT-Thread with GCC compiler. - - - -## More Information - https://sourceware.org/newlib/libc.html#Reentrancy diff --git a/components/libc/compilers/gcc/newlib/SConscript b/components/libc/compilers/gcc/newlib/SConscript index 58672a0255..8076a73727 100644 --- a/components/libc/compilers/gcc/newlib/SConscript +++ b/components/libc/compilers/gcc/newlib/SConscript @@ -1,4 +1,6 @@ +import os from building import * +from gcc import * Import('rtconfig') src = [] @@ -8,15 +10,22 @@ LIBS = ['m'] # link libm CPPPATH = [cwd] if rtconfig.PLATFORM == 'gcc': - if GetDepend('RT_USING_LIBC'): - LIBS += ['c'] # link libc - src += Glob('*.c') - else: - src += ['syscalls.c'] + LIBS += ['c'] # link libc + src += Glob('*.c') + + #report newlib version + print('Newlib version:' + GetNewLibVersion(rtconfig)) # identify this is Newlib, and only enable POSIX.1-1990 CPPDEFINES = ['RT_USING_NEWLIB', '_POSIX_C_SOURCE=1'] - group = DefineGroup('libc', src, depend = [], CPPPATH = CPPPATH, CPPDEFINES = CPPDEFINES, LIBS = LIBS) + group = DefineGroup('Compiler', src, depend = [''], CPPPATH = CPPPATH, CPPDEFINES = CPPDEFINES, LIBS = LIBS) + + +list = os.listdir(cwd) +for d in list: + path = os.path.join(cwd, d) + if os.path.isfile(os.path.join(path, 'SConscript')): + group = group + SConscript(os.path.join(d, 'SConscript')) Return('group') diff --git a/components/libc/compilers/gcc/newlib/fcntl.h b/components/libc/compilers/gcc/newlib/fcntl.h index 239eaaef0d..847ae3d35b 100644 --- a/components/libc/compilers/gcc/newlib/fcntl.h +++ b/components/libc/compilers/gcc/newlib/fcntl.h @@ -7,6 +7,7 @@ * Date Author Notes * 2021-09-02 Meco Man First version */ + #ifndef __FCNTL_H__ #define __FCNTL_H__ diff --git a/components/libc/compilers/gcc/partial/SConscript b/components/libc/compilers/gcc/newlib/legacy/SConscript index 4c815c49b8..4c815c49b8 100644 --- a/components/libc/compilers/gcc/partial/SConscript +++ b/components/libc/compilers/gcc/newlib/legacy/SConscript diff --git a/components/libc/compilers/gcc/newlib/legacy/_select/SConscript b/components/libc/compilers/gcc/newlib/legacy/_select/SConscript new file mode 100644 index 0000000000..b7bd86a36c --- /dev/null +++ b/components/libc/compilers/gcc/newlib/legacy/_select/SConscript @@ -0,0 +1,20 @@ +from shutil import copy +from building import * +from gcc import * +Import('rtconfig') + +src = [] +cwd = GetCurrentDir() +CPPPATH = [cwd] +group = [] + +# sys/select.h does not exist in newlib 2.1.0 or lower version +if rtconfig.PLATFORM == 'gcc' and (CheckHeader(rtconfig, 'sys/select.h') == False): + try: + copy("../../../../common/nogcc/sys/select.h", "./sys/select.h") # copy from 'nogcc/sys/select.h' + except: + pass + + group = DefineGroup('Compiler', src, depend = [''], CPPPATH = CPPPATH) + +Return('group') diff --git a/components/libc/compilers/gcc/newlib/legacy/_select/readme.md b/components/libc/compilers/gcc/newlib/legacy/_select/readme.md new file mode 100644 index 0000000000..4ad9f21923 --- /dev/null +++ b/components/libc/compilers/gcc/newlib/legacy/_select/readme.md @@ -0,0 +1,2 @@ +Newlib 2.2.0 or lower version does not provide `sys/select.h`, and `fd_set` is defined in `sys/types.h`. It will be generated by scons automatically, and **DO NOT** change it. + diff --git a/components/libc/compilers/gcc/partial/mips/sys/select.h b/components/libc/compilers/gcc/newlib/legacy/_select/sys/select.h index 575ad3a1b5..02fb77dd89 100644 --- a/components/libc/compilers/gcc/partial/mips/sys/select.h +++ b/components/libc/compilers/gcc/newlib/legacy/_select/sys/select.h @@ -15,6 +15,10 @@ #include <sys/types.h> #include <sys/time.h> +#ifdef _WIN32 +#include <winsock.h> +#endif + #ifndef FD_SETSIZE #define FD_SETSIZE 32 #endif @@ -26,16 +30,17 @@ #define FD_SETSIZE DFS_FD_MAX #endif /* SAL_USING_POSIX */ -#define NBBY 8 /* number of bits in a byte */ - typedef long fd_mask; +#ifndef _WIN32 +#ifndef _SYS_TYPES_FD_SET /* MIPS */ + +#define NBBY 8 /* number of bits in a byte */ #define NFDBITS (sizeof (fd_mask) * NBBY) /* bits per mask */ #ifndef howmany #define howmany(x,y) (((x)+((y)-1))/(y)) #endif -#ifndef _SYS_TYPES_FD_SET /* MIPS */ typedef struct _types_fd_set { fd_mask fds_bits[howmany(FD_SETSIZE, NFDBITS)]; } _types_fd_set; @@ -48,5 +53,6 @@ typedef struct _types_fd_set { #endif /* _SYS_TYPES_FD_SET */ int select(int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, struct timeval *timeout); +#endif /* _WIN32 */ #endif /* __SYS_SELECT_H__ */ diff --git a/components/libc/compilers/gcc/newlib/libc_syms.c b/components/libc/compilers/gcc/newlib/libc_syms.c index aaf6980d6b..e6ca23b393 100644 --- a/components/libc/compilers/gcc/newlib/libc_syms.c +++ b/components/libc/compilers/gcc/newlib/libc_syms.c @@ -7,6 +7,7 @@ * Date Author Notes * 2017/10/15 bernard the first version */ + #include <rtthread.h> #include <rtm.h> diff --git a/components/libc/compilers/gcc/newlib/machine/time.h b/components/libc/compilers/gcc/newlib/machine/time.h index 9ef838f892..805b061aea 100644 --- a/components/libc/compilers/gcc/newlib/machine/time.h +++ b/components/libc/compilers/gcc/newlib/machine/time.h @@ -1,3 +1,13 @@ +/* + * Copyright (c) 2006-2021, RT-Thread Development Team + * + * SPDX-License-Identifier: Apache-2.0 + * + * Change Logs: + * Date Author Notes + * 2021-02-16 Meco Man The first version + */ + #ifndef _MACHTIME_H_ #define _MACHTIME_H_ diff --git a/components/libc/compilers/gcc/newlib/syscalls.c b/components/libc/compilers/gcc/newlib/syscalls.c index 8fe8c5be4b..dcf26ccfb7 100644 --- a/components/libc/compilers/gcc/newlib/syscalls.c +++ b/components/libc/compilers/gcc/newlib/syscalls.c @@ -20,13 +20,13 @@ #include <unistd.h> #include <sys/errno.h> #include <sys/stat.h> -#ifdef RT_USING_POSIX_DEVIO +#ifdef RT_USING_POSIX_STDIO #include "libc.h" -#endif /* RT_USING_POSIX_DEVIO */ +#endif /* RT_USING_POSIX_STDIO */ #ifdef RT_USING_MODULE #include <dlmodule.h> #endif /* RT_USING_MODULE */ - +#include <compiler_private.h> #define DBG_TAG "newlib.syscalls" #define DBG_LVL DBG_INFO #include <rtdbg.h> @@ -92,8 +92,6 @@ void __libc_init_array(void) /* __libc_init_array is ARM code, not Thumb; it will cause a hardfault. */ } -#ifdef RT_USING_LIBC - /* Reentrant versions of system calls. */ #ifndef _REENT_ONLY int *__errno () @@ -112,6 +110,7 @@ int _close_r(struct _reent *ptr, int fd) #ifdef DFS_USING_POSIX return close(fd); #else + LOG_W("%s: %s", __func__, _WARNING_WITHOUT_FS); ptr->_errno = ENOTSUP; return -1; #endif /* DFS_USING_POSIX */ @@ -185,10 +184,10 @@ _off_t _lseek_r(struct _reent *ptr, int fd, _off_t pos, int whence) { #ifdef DFS_USING_POSIX _off_t rc; - rc = lseek(fd, pos, whence); return rc; #else + LOG_W("%s: %s", __func__, _WARNING_WITHOUT_FS); ptr->_errno = ENOTSUP; return -1; #endif /* DFS_USING_POSIX */ @@ -198,10 +197,10 @@ int _mkdir_r(struct _reent *ptr, const char *name, int mode) { #ifdef DFS_USING_POSIX int rc; - rc = mkdir(name, mode); return rc; #else + LOG_W("%s: %s", __func__, _WARNING_WITHOUT_FS); ptr->_errno = ENOTSUP; return -1; #endif /* DFS_USING_POSIX */ @@ -214,6 +213,7 @@ int _open_r(struct _reent *ptr, const char *file, int flags, int mode) rc = open(file, flags, mode); return rc; #else + LOG_W("%s: %s", __func__, _WARNING_WITHOUT_FS); ptr->_errno = ENOTSUP; return -1; #endif /* DFS_USING_POSIX */ @@ -225,16 +225,17 @@ _ssize_t _read_r(struct _reent *ptr, int fd, void *buf, size_t nbytes) _ssize_t rc; if (fd == STDIN_FILENO) { -#ifdef RT_USING_POSIX_DEVIO +#ifdef RT_USING_POSIX_STDIO if (libc_stdio_get_console() < 0) { - LOG_W("Do not invoke standard input before initializing libc"); + LOG_W("Do not invoke standard input before initializing Compiler"); return 0; } #else + LOG_W("%s: %s", __func__, _WARNING_WITHOUT_STDIO); ptr->_errno = ENOTSUP; return -1; -#endif /* RT_USING_POSIX_DEVIO */ +#endif /* RT_USING_POSIX_STDIO */ } else if (fd == STDOUT_FILENO || fd == STDERR_FILENO) { @@ -245,6 +246,7 @@ _ssize_t _read_r(struct _reent *ptr, int fd, void *buf, size_t nbytes) rc = read(fd, buf, nbytes); return rc; #else + LOG_W("%s: %s", __func__, _WARNING_WITHOUT_FS); ptr->_errno = ENOTSUP; return -1; #endif /* DFS_USING_POSIX */ @@ -254,10 +256,10 @@ int _rename_r(struct _reent *ptr, const char *old, const char *new) { #ifdef DFS_USING_POSIX int rc; - rc = rename(old, new); return rc; #else + LOG_W("%s: %s", __func__, _WARNING_WITHOUT_FS); ptr->_errno = ENOTSUP; return -1; #endif /* DFS_USING_POSIX */ @@ -267,10 +269,10 @@ int _stat_r(struct _reent *ptr, const char *file, struct stat *pstat) { #ifdef DFS_USING_POSIX int rc; - rc = stat(file, pstat); return rc; #else + LOG_W("%s: %s", __func__, _WARNING_WITHOUT_FS); ptr->_errno = ENOTSUP; return -1; #endif /* DFS_USING_POSIX */ @@ -281,6 +283,7 @@ int _unlink_r(struct _reent *ptr, const char *file) #ifdef DFS_USING_POSIX return unlink(file); #else + LOG_W("%s: %s", __func__, _WARNING_WITHOUT_FS); ptr->_errno = ENOTSUP; return -1; #endif /* DFS_USING_POSIX */ @@ -294,7 +297,7 @@ _ssize_t _write_r(struct _reent *ptr, int fd, const void *buf, size_t nbytes) if (fd == STDOUT_FILENO || fd == STDERR_FILENO) { -#ifdef RT_USING_CONSOLE +#if defined(RT_USING_CONSOLE) && defined(RT_USING_DEVICE) rt_device_t console; console = rt_console_get_device(); @@ -303,7 +306,7 @@ _ssize_t _write_r(struct _reent *ptr, int fd, const void *buf, size_t nbytes) #else ptr->_errno = ENOTSUP; return -1; -#endif /* RT_USING_CONSOLE */ +#endif /* defined(RT_USING_CONSOLE) && defined(RT_USING_DEVICE) */ } else if (fd == STDIN_FILENO) { @@ -315,6 +318,7 @@ _ssize_t _write_r(struct _reent *ptr, int fd, const void *buf, size_t nbytes) rc = write(fd, buf, nbytes); return rc; #else + LOG_W("%s: %s", __func__, _WARNING_WITHOUT_FS); ptr->_errno = ENOTSUP; return -1; #endif /* DFS_USING_POSIX */ @@ -333,5 +337,3 @@ These functions are implemented and replaced by the 'common/time.c' file int _gettimeofday_r(struct _reent *ptr, struct timeval *__tp, void *__tzp); _CLOCK_T_ _times_r(struct _reent *ptr, struct tms *ptms); */ - -#endif /* RT_USING_LIBC */ diff --git a/components/libc/compilers/gcc/partial/mips/SConscript b/components/libc/compilers/gcc/partial/mips/SConscript deleted file mode 100644 index 7651233d46..0000000000 --- a/components/libc/compilers/gcc/partial/mips/SConscript +++ /dev/null @@ -1,20 +0,0 @@ -from shutil import copy -from building import * - -Import('rtconfig') - -src = [] -cwd = GetCurrentDir() -CPPPATH = [cwd] -group = [] - -if rtconfig.PLATFORM == 'gcc' and ('mips' in rtconfig.PREFIX): # identify mips gcc tool chain - try: - # There is no 'sys/select.h' in tthe mips gcc toolchain; it will be copied from 'nogcc/sys/select.h' - copy("../../../common/nogcc/sys/select.h", "./sys/select.h") - except: - pass - - group = DefineGroup('libc', src, depend = [], CPPPATH = CPPPATH) - -Return('group') diff --git a/components/libc/compilers/gcc/partial/mips/readme.md b/components/libc/compilers/gcc/partial/mips/readme.md deleted file mode 100644 index a3eeb06c5d..0000000000 --- a/components/libc/compilers/gcc/partial/mips/readme.md +++ /dev/null @@ -1,4 +0,0 @@ -These files don't exist in the mips gcc toolchain. They will be generated by scons automatically , and **DO NOT** change them: - -- sys/select.h - diff --git a/components/libc/compilers/gcc/partial/readme.md b/components/libc/compilers/gcc/partial/readme.md deleted file mode 100644 index 959fc29f35..0000000000 --- a/components/libc/compilers/gcc/partial/readme.md +++ /dev/null @@ -1,2 +0,0 @@ -This folder is for some particular targets. - diff --git a/components/libc/libdl/arch/riscv.c b/components/libc/libdl/arch/riscv.c index 33cae28d16..c7c454e168 100644 --- a/components/libc/libdl/arch/riscv.c +++ b/components/libc/libdl/arch/riscv.c @@ -1,12 +1,12 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 - * + * * Change Logs: * Date Author Notes * 2021/04/23 chunyexixiaoyu first version - + */ #include "../dlmodule.h" @@ -31,7 +31,7 @@ int dlmodule_relocate(struct rt_dlmodule *module, Elf_Rel *rel, Elf_Addr sym_val Elf64_Addr *where, tmp; Elf64_Sword addend, offset; rt_uint64_t upper, lower, sign, j1, j2; - + where = (Elf64_Addr *)((rt_uint8_t *)module->mem_space + rel->r_offset - module->vstart_addr); @@ -50,7 +50,7 @@ int dlmodule_relocate(struct rt_dlmodule *module, Elf_Rel *rel, Elf_Addr sym_val case R_RISCV_JUMP_SLOT: *where = (Elf64_Addr)sym_val; RT_DEBUG_LOG(RT_DEBUG_MODULE, ("R_RISCV_JUMP_SLOT: %x -> %x\n",where, *where)); - break; + break; default: RT_DEBUG_LOG(RT_DEBUG_MODULE, ("__riscv__ELF: invalid relocate TYPE %d\n", ELF64_R_TYPE(rel->r_info))); return -1; diff --git a/components/libc/posix/Kconfig b/components/libc/posix/Kconfig index ef1389f9c3..76dabc2734 100644 --- a/components/libc/posix/Kconfig +++ b/components/libc/posix/Kconfig @@ -12,6 +12,11 @@ if RT_USING_POSIX_FS select RT_USING_DFS_DEVFS default n + config RT_USING_POSIX_STDIO + bool "Enable standard I/O devices, e.g. STDOUT_FILENO" + select RT_USING_POSIX_DEVIO + default n + config RT_USING_POSIX_POLL bool "Enable I/O Multiplexing poll() <poll.h>" default n @@ -23,7 +28,7 @@ if RT_USING_POSIX_FS config RT_USING_POSIX_TERMIOS bool "Enable Terminal I/O <termios.h>" - select RT_USING_POSIX_DEVIO + select RT_USING_POSIX_STDIO default n config RT_USING_POSIX_AIO @@ -41,16 +46,9 @@ config RT_USING_POSIX_DELAY config RT_USING_POSIX_CLOCK bool "Enable clock/time functions, clock_gettime()/clock_settime()/clock_getres() etc" - select RT_LIBC_USING_TIME if !RT_USING_LIBC select RT_USING_POSIX_DELAY default n -config RT_USING_POSIX_GETLINE - bool "Enable getline()/getdelim()" - select RT_USING_LIBC - select RT_LIBC_USING_FILEIO - default n - config RT_USING_PTHREADS bool "Enable pthreads APIs" select RT_USING_POSIX_CLOCK diff --git a/components/libc/posix/delay/delay.c b/components/libc/posix/delay/delay.c index c8564dc54e..753ca48526 100644 --- a/components/libc/posix/delay/delay.c +++ b/components/libc/posix/delay/delay.c @@ -7,6 +7,7 @@ * Date Author Notes * 2021-05-07 Meco Man first Version */ + #include <sys/types.h> #include <rtthread.h> #include <rthw.h> diff --git a/components/libc/posix/delay/delay.h b/components/libc/posix/delay/delay.h index f32708af55..19492bdb45 100644 --- a/components/libc/posix/delay/delay.h +++ b/components/libc/posix/delay/delay.h @@ -7,6 +7,7 @@ * Date Author Notes * 2021-05-07 Meco Man first Version */ + #ifndef __DELAY_H__ #define __DELAY_H__ diff --git a/components/libc/posix/getline/README.md b/components/libc/posix/getline/README.md deleted file mode 100644 index ef3c19deae..0000000000 --- a/components/libc/posix/getline/README.md +++ /dev/null @@ -1,20 +0,0 @@ -# getline/getdelim for RT-Thread POSIX(IEEE Std 1003.1-2008) - -[](https://travis-ci.org/ivanrad/getline) - -https://github.com/ivanrad/getline - -Read a delimited record from stream. - -Yet another (hopefully portable C) implementation of getline/getdelim. -These are ersatz functions, a drop-in replacement, to be used on those occasions when your C library does not already support them. - -For more details, see [Open Group Base Specification for getdelim/getline][opengroup-spec]. - - - -## License - -This code is unlicensed -- free and released into the public domain. See `UNLICENSE` file for more information. - -[opengroup-spec]: http://pubs.opengroup.org/onlinepubs/9699919799/functions/getline.html diff --git a/components/libc/posix/getline/SConscript b/components/libc/posix/getline/SConscript deleted file mode 100644 index a0077b0ce9..0000000000 --- a/components/libc/posix/getline/SConscript +++ /dev/null @@ -1,11 +0,0 @@ -# RT-Thread building script for component - -from building import * - -cwd = GetCurrentDir() -src = Glob('*.c') -CPPPATH = [cwd] - -group = DefineGroup('POSIX', src, depend = ['RT_USING_POSIX_GETLINE'], CPPPATH = CPPPATH) - -Return('group') diff --git a/components/libc/posix/getline/UNLICENSE b/components/libc/posix/getline/UNLICENSE deleted file mode 100644 index 68a49daad8..0000000000 --- a/components/libc/posix/getline/UNLICENSE +++ /dev/null @@ -1,24 +0,0 @@ -This is free and unencumbered software released into the public domain. - -Anyone is free to copy, modify, publish, use, compile, sell, or -distribute this software, either in source code form or as a compiled -binary, for any purpose, commercial or non-commercial, and by any -means. - -In jurisdictions that recognize copyright laws, the author or authors -of this software dedicate any and all copyright interest in the -software to the public domain. We make this dedication for the benefit -of the public at large and to the detriment of our heirs and -successors. We intend this dedication to be an overt act of -relinquishment in perpetuity of all present and future rights to this -software under copyright law. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR -OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -OTHER DEALINGS IN THE SOFTWARE. - -For more information, please refer to <http://unlicense.org/> diff --git a/components/libc/posix/getline/posix_getline.c b/components/libc/posix/getline/posix_getline.c deleted file mode 100644 index 63fa33ea42..0000000000 --- a/components/libc/posix/getline/posix_getline.c +++ /dev/null @@ -1,77 +0,0 @@ -/* posix_getline.c - * RT-Thread POSIX - * getdelim(), getline() - read a delimited record from stream, ersatz implementation - * This code is unlicensed -- free and released into the public domain. - * https://man7.org/linux/man-pages/man3/getline.3.html - * Authors: - * https://github.com/ivanrad/getline - * - * Meco Man 2020-09-03 porting to RT-Thread - */ - -#include "posix_getline.h" -#include <stdlib.h> -#include <limits.h> -#include <sys/errno.h> - -ssize_t getdelim(char **lineptr, size_t *n, int delim, FILE *stream) { - char *cur_pos, *new_lineptr; - size_t new_lineptr_len; - int c; - - if (lineptr == NULL || n == NULL || stream == NULL) { - errno = EINVAL; - return -1; - } - - if (*lineptr == NULL) { - *n = 128; /* init len */ - if ((*lineptr = (char *)malloc(*n)) == NULL) { - errno = ENOMEM; - return -1; - } - } - - cur_pos = *lineptr; - for (;;) { - c = getc(stream); - - if (ferror(stream) || (c == EOF && cur_pos == *lineptr)) - return -1; - - if (c == EOF) - break; - - if ((*lineptr + *n - cur_pos) < 2) { - if (LONG_MAX / 2 < *n) { -#ifdef EOVERFLOW - errno = EOVERFLOW; -#else - errno = ERANGE; /* no EOVERFLOW defined */ -#endif - return -1; - } - new_lineptr_len = *n * 2; - - if ((new_lineptr = (char *)realloc(*lineptr, new_lineptr_len)) == NULL) { - errno = ENOMEM; - return -1; - } - cur_pos = new_lineptr + (cur_pos - *lineptr); - *lineptr = new_lineptr; - *n = new_lineptr_len; - } - - *cur_pos++ = (char)c; - - if (c == delim) - break; - } - - *cur_pos = '\0'; - return (ssize_t)(cur_pos - *lineptr); -} - -ssize_t getline(char **lineptr, size_t *n, FILE *stream) { - return getdelim(lineptr, n, '\n', stream); -} diff --git a/components/libc/posix/getline/posix_getline.h b/components/libc/posix/getline/posix_getline.h deleted file mode 100644 index 13a4487d7f..0000000000 --- a/components/libc/posix/getline/posix_getline.h +++ /dev/null @@ -1,23 +0,0 @@ -/* posix_getline.h - * RT-Thread POSIX - * getdelim(), getline() - read a delimited record from stream, ersatz implementation - * This code is unlicensed -- free and released into the public domain. - * https://man7.org/linux/man-pages/man3/getline.3.html - * Authors: - * https://github.com/ivanrad/getline - * - * Meco Man 2020-09-03 porting to RT-Thread - */ - - -#ifndef POSIX_GETLINE_H -#define POSIX_GETLINE_H - -#include <stdio.h> -#include <sys/types.h> - -ssize_t getdelim(char **lineptr, size_t *n, int delim, FILE *stream); -ssize_t getline(char **lineptr, size_t *n, FILE *stream); - -#endif /* POSIX_GETLINE_H */ - diff --git a/components/libc/posix/io/SConscript b/components/libc/posix/io/SConscript index 32654674e8..bb45211ec0 100644 --- a/components/libc/posix/io/SConscript +++ b/components/libc/posix/io/SConscript @@ -10,7 +10,7 @@ group = [] flag = False -if GetDepend('RT_USING_POSIX_DEVIO'): +if GetDepend('RT_USING_POSIX_STDIO'): src += ['libc.c'] flag = True @@ -19,7 +19,7 @@ if GetDepend('RT_USING_POSIX_SELECT'): flag = True if flag == True: - group = DefineGroup('POSIX', src, depend = [], CPPPATH = CPPPATH) + group = DefineGroup('POSIX', src, depend = [''], CPPPATH = CPPPATH) list = os.listdir(cwd) for d in list: diff --git a/components/libc/posix/io/libc.c b/components/libc/posix/io/libc.c index 0107f3a58b..e57749f1da 100644 --- a/components/libc/posix/io/libc.c +++ b/components/libc/posix/io/libc.c @@ -7,6 +7,7 @@ * Date Author Notes * 2017/10/15 bernard the first version */ + #include <rtthread.h> #include <stdio.h> #include <stdlib.h> @@ -20,7 +21,7 @@ int libc_system_init(void) { -#ifdef RT_USING_POSIX_DEVIO +#ifdef RT_USING_POSIX_STDIO rt_device_t dev_console; dev_console = rt_console_get_device(); @@ -28,13 +29,12 @@ int libc_system_init(void) { libc_stdio_set_console(dev_console->parent.name, O_RDWR); } -#endif /* RT_USING_POSIX_DEVIO */ +#endif /* RT_USING_POSIX_STDIO */ return 0; } INIT_COMPONENT_EXPORT(libc_system_init); -#ifdef RT_USING_POSIX_DEVIO -#if defined(RT_USING_LIBC) && defined(RT_USING_NEWLIB) +#if defined(RT_USING_POSIX_STDIO) && defined(RT_USING_NEWLIB) #define STDIO_DEVICE_NAME_MAX 32 static FILE* std_console = NULL; int libc_stdio_set_console(const char* device_name, int mode) @@ -135,5 +135,4 @@ int libc_stdio_set_console(const char* device_name, int mode) int libc_stdio_get_console(void) { return std_fd; } -#endif /* defined(RT_USING_LIBC) && defined(RT_USING_NEWLIB) */ -#endif /* RT_USING_POSIX_DEVIO */ +#endif /* defined(RT_USING_POSIX_STDIO) && defined(RT_USING_NEWLIB) */ diff --git a/components/libc/posix/io/libc.h b/components/libc/posix/io/libc.h index b019267926..6b5dfd1fcc 100644 --- a/components/libc/posix/io/libc.h +++ b/components/libc/posix/io/libc.h @@ -7,6 +7,7 @@ * Date Author Notes * 2017/10/15 bernard the first version */ + #ifndef __RTT_LIBC_H__ #define __RTT_LIBC_H__ @@ -17,10 +18,10 @@ extern "C" { #endif int libc_system_init(void); -#ifdef RT_USING_POSIX_DEVIO +#ifdef RT_USING_POSIX_STDIO int libc_stdio_get_console(void); int libc_stdio_set_console(const char* device_name, int mode); -#endif /* RT_USING_POSIX_DEVIO */ +#endif /* RT_USING_POSIX_STDIO */ #ifdef __cplusplus } diff --git a/components/libc/posix/io/poll/SConscript b/components/libc/posix/io/poll/SConscript index 7d82ade035..39b321b6c5 100644 --- a/components/libc/posix/io/poll/SConscript +++ b/components/libc/posix/io/poll/SConscript @@ -9,6 +9,6 @@ CPPPATH = [cwd] if GetDepend('RT_USING_POSIX_POLL'): src += ['poll.c'] -group = DefineGroup('POSIX', src, depend = [], CPPPATH = CPPPATH) +group = DefineGroup('POSIX', src, depend = [''], CPPPATH = CPPPATH) Return('group') diff --git a/components/libc/posix/io/poll/poll.c b/components/libc/posix/io/poll/poll.c index a1500ba109..3c5940b8d3 100644 --- a/components/libc/posix/io/poll/poll.c +++ b/components/libc/posix/io/poll/poll.c @@ -8,6 +8,7 @@ * 2016-12-28 Bernard first version * 2018-03-09 Bernard Add protection for pt->triggered. */ + #include <stdint.h> #include <rthw.h> #include <rtthread.h> diff --git a/components/libc/posix/io/poll/poll.h b/components/libc/posix/io/poll/poll.h index aea73d6eaf..0fccd48b0d 100644 --- a/components/libc/posix/io/poll/poll.h +++ b/components/libc/posix/io/poll/poll.h @@ -7,6 +7,7 @@ * Date Author Notes * 2021-09-11 Meco Man First version */ + #ifndef __POLL_H__ #define __POLL_H__ diff --git a/components/libc/posix/io/select.c b/components/libc/posix/io/select.c index 55d320e921..bac63258a5 100644 --- a/components/libc/posix/io/select.c +++ b/components/libc/posix/io/select.c @@ -7,6 +7,7 @@ * Date Author Notes * 2016-12-28 Bernard first version */ + #include <rtthread.h> #include <poll.h> #include <sys/select.h> diff --git a/components/libc/posix/io/termios/termios.c b/components/libc/posix/io/termios/termios.c index d7d869d67f..44e0e80853 100644 --- a/components/libc/posix/io/termios/termios.c +++ b/components/libc/posix/io/termios/termios.c @@ -7,6 +7,7 @@ * Date Author Notes * 2017/08/30 Bernard The first version */ + #include <stdlib.h> #include <string.h> #include <dfs_posix.h> diff --git a/components/libc/posix/io/termios/termios.h b/components/libc/posix/io/termios/termios.h index b647fa0728..27f2db85b0 100644 --- a/components/libc/posix/io/termios/termios.h +++ b/components/libc/posix/io/termios/termios.h @@ -7,6 +7,7 @@ * Date Author Notes * 2017/08/30 Bernard The first version */ + #ifndef __TERMIOS_H__ #define __TERMIOS_H__ diff --git a/components/libc/posix/ipc/SConscript b/components/libc/posix/ipc/SConscript index 5a78955f1d..5ea9dea355 100644 --- a/components/libc/posix/ipc/SConscript +++ b/components/libc/posix/ipc/SConscript @@ -15,6 +15,6 @@ if GetDepend('RT_USING_POSIX_MESSAGE_QUEUE'): if GetDepend('RT_USING_POSIX_MESSAGE_SEMAPHORE'): src += ['semaphore.c'] -group = DefineGroup('POSIX', src, depend = [], CPPPATH = inc) +group = DefineGroup('POSIX', src, depend = [''], CPPPATH = inc) Return('group') diff --git a/components/libc/posix/ipc/system-v/sys/ipc.h b/components/libc/posix/ipc/system-v/sys/ipc.h index 03b5458d51..f4ac50a1e9 100644 --- a/components/libc/posix/ipc/system-v/sys/ipc.h +++ b/components/libc/posix/ipc/system-v/sys/ipc.h @@ -7,6 +7,7 @@ * Date Author Notes * 2021-12-07 Meco Man First version */ + #ifndef __SYS_IPC_H__ #define __SYS_IPC_H__ diff --git a/components/libc/posix/ipc/system-v/sys/msg.h b/components/libc/posix/ipc/system-v/sys/msg.h index c030c9e8cb..1489586a32 100644 --- a/components/libc/posix/ipc/system-v/sys/msg.h +++ b/components/libc/posix/ipc/system-v/sys/msg.h @@ -7,6 +7,7 @@ * Date Author Notes * 2021-12-07 Meco Man First version */ + #ifndef __SYS_MSG_H__ #define __SYS_MSG_H__ diff --git a/components/libc/posix/ipc/system-v/sys/sem.h b/components/libc/posix/ipc/system-v/sys/sem.h index fdb70496d8..4a32c91204 100644 --- a/components/libc/posix/ipc/system-v/sys/sem.h +++ b/components/libc/posix/ipc/system-v/sys/sem.h @@ -7,6 +7,7 @@ * Date Author Notes * 2021-12-07 Meco Man First version */ + #ifndef __SYS_SEM_H__ #define __SYS_SEM_H__ diff --git a/components/libc/posix/ipc/system-v/sys/shm.h b/components/libc/posix/ipc/system-v/sys/shm.h index 762d68891a..5b536067fc 100644 --- a/components/libc/posix/ipc/system-v/sys/shm.h +++ b/components/libc/posix/ipc/system-v/sys/shm.h @@ -7,6 +7,7 @@ * Date Author Notes * 2021-12-07 Meco Man First version */ + #ifndef __SYS_SHM_H__ #define __SYS_SHM_H__ diff --git a/components/libc/posix/signal/SConscript b/components/libc/posix/signal/SConscript index 07cd98cbe0..9c712fa694 100644 --- a/components/libc/posix/signal/SConscript +++ b/components/libc/posix/signal/SConscript @@ -7,7 +7,7 @@ src = Glob('*.c') + Glob('*.cpp') CPPPATH = [cwd] group = DefineGroup('POSIX', src, - depend = ['RT_USING_SIGNALS', 'RT_USING_PTHREADS', 'RT_USING_LIBC'], + depend = ['RT_USING_SIGNALS', 'RT_USING_PTHREADS'], CPPPATH = CPPPATH) Return('group') diff --git a/components/libc/posix/src/SConscript b/components/libc/posix/src/SConscript index 2ff916ff08..93bb93b0ad 100644 --- a/components/libc/posix/src/SConscript +++ b/components/libc/posix/src/SConscript @@ -11,6 +11,6 @@ flag = False src += ['unistd.c'] #TODO if flag == True: - group = DefineGroup('POSIX', src, depend = [], CPPPATH = CPPPATH) + group = DefineGroup('POSIX', src, depend = [''], CPPPATH = CPPPATH) Return('group') |
