From 8a08be6b9e2ea6bd1dce01a9844a954c3e21a26c Mon Sep 17 00:00:00 2001 From: mysterywolf <920369182@qq.com> Date: Sat, 5 Sep 2020 17:41:54 +0800 Subject: [fix bugs]修改armlibc/sys/types.h 该文件中不能用rt_数据类型,否则会引起编译器递归编译 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/libc/compilers/armlibc/sys/types.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'components/libc/compilers') diff --git a/components/libc/compilers/armlibc/sys/types.h b/components/libc/compilers/armlibc/sys/types.h index 001ace4dd2..2aad77c99d 100644 --- a/components/libc/compilers/armlibc/sys/types.h +++ b/components/libc/compilers/armlibc/sys/types.h @@ -5,16 +5,16 @@ * * Change Logs: * Date Author Notes + * 2020-09-05 Meco Man fix bugs */ #ifndef __TYPES_H__ #define __TYPES_H__ #include -#include -typedef rt_int32_t clockid_t; -typedef rt_int32_t key_t; /* Used for interprocess communication. */ -typedef rt_int32_t pid_t; /* Used for process IDs and process group IDs. */ +typedef int32_t clockid_t; +typedef int32_t key_t; /* Used for interprocess communication. */ +typedef int32_t pid_t; /* Used for process IDs and process group IDs. */ #ifndef ARCH_CPU_64BIT typedef signed int ssize_t; /* Used for a count of bytes or an error indication. */ #else -- cgit v1.3.1 From 6eb62a3f9de3e45abe91fec03ff45f1a011f48bd Mon Sep 17 00:00:00 2001 From: mysterywolf <920369182@qq.com> Date: Sat, 5 Sep 2020 17:50:54 +0800 Subject: 将unistd.c不再放在common中,分散到各个库中 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/libc/compilers/armlibc/unistd.c | 29 +++++++++++++++++++++++++++++ components/libc/compilers/common/unistd.c | 25 ------------------------- components/libc/compilers/dlib/unistd.c | 29 +++++++++++++++++++++++++++++ components/libc/compilers/newlib/unistd.c | 29 +++++++++++++++++++++++++++++ 4 files changed, 87 insertions(+), 25 deletions(-) create mode 100644 components/libc/compilers/armlibc/unistd.c delete mode 100644 components/libc/compilers/common/unistd.c create mode 100644 components/libc/compilers/dlib/unistd.c create mode 100644 components/libc/compilers/newlib/unistd.c (limited to 'components/libc/compilers') diff --git a/components/libc/compilers/armlibc/unistd.c b/components/libc/compilers/armlibc/unistd.c new file mode 100644 index 0000000000..e2f2827beb --- /dev/null +++ b/components/libc/compilers/armlibc/unistd.c @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2006-2018, RT-Thread Development Team + * + * SPDX-License-Identifier: Apache-2.0 + * + * Change Logs: + * Date Author Notes + * 2020-09-01 Meco Man First Version + */ + +#include +#include + +#ifdef RT_USING_POSIX + +#ifdef RT_USING_POSIX_TERMIOS +int isatty(int fd) +{ + struct termios ts; + return(tcgetattr(fd,&ts) != -1);/*true if no error (is a tty)*/ +} +#endif + +char *ttyname(int fd) +{ + return "/dev/tty0"; /*TODO: need to add more specific*/ +} + +#endif diff --git a/components/libc/compilers/common/unistd.c b/components/libc/compilers/common/unistd.c deleted file mode 100644 index 04a0886655..0000000000 --- a/components/libc/compilers/common/unistd.c +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Copyright (c) 2006-2018, RT-Thread Development Team - * - * SPDX-License-Identifier: Apache-2.0 - * - * Change Logs: - * Date Author Notes - * 2020-09-01 Meco Man First Version - */ - -#include -#include - -#ifdef RT_USING_POSIX_TERMIOS -int isatty(int fd) -{ - struct termios ts; - return(tcgetattr(fd,&ts) != -1);/*true if no error (is a tty)*/ -} -#endif - -char *ttyname(int fd) -{ - return "/dev/tty0"; /*TODO: need to add more specific*/ -} diff --git a/components/libc/compilers/dlib/unistd.c b/components/libc/compilers/dlib/unistd.c new file mode 100644 index 0000000000..e2f2827beb --- /dev/null +++ b/components/libc/compilers/dlib/unistd.c @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2006-2018, RT-Thread Development Team + * + * SPDX-License-Identifier: Apache-2.0 + * + * Change Logs: + * Date Author Notes + * 2020-09-01 Meco Man First Version + */ + +#include +#include + +#ifdef RT_USING_POSIX + +#ifdef RT_USING_POSIX_TERMIOS +int isatty(int fd) +{ + struct termios ts; + return(tcgetattr(fd,&ts) != -1);/*true if no error (is a tty)*/ +} +#endif + +char *ttyname(int fd) +{ + return "/dev/tty0"; /*TODO: need to add more specific*/ +} + +#endif diff --git a/components/libc/compilers/newlib/unistd.c b/components/libc/compilers/newlib/unistd.c new file mode 100644 index 0000000000..e2f2827beb --- /dev/null +++ b/components/libc/compilers/newlib/unistd.c @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2006-2018, RT-Thread Development Team + * + * SPDX-License-Identifier: Apache-2.0 + * + * Change Logs: + * Date Author Notes + * 2020-09-01 Meco Man First Version + */ + +#include +#include + +#ifdef RT_USING_POSIX + +#ifdef RT_USING_POSIX_TERMIOS +int isatty(int fd) +{ + struct termios ts; + return(tcgetattr(fd,&ts) != -1);/*true if no error (is a tty)*/ +} +#endif + +char *ttyname(int fd) +{ + return "/dev/tty0"; /*TODO: need to add more specific*/ +} + +#endif -- cgit v1.3.1 From f13014526ce81e5aff40f71b1c942dc89bc2322e Mon Sep 17 00:00:00 2001 From: mysterywolf <920369182@qq.com> Date: Sat, 5 Sep 2020 17:52:32 +0800 Subject: [bug fix]对各个libc库的termios.h增加宏定义,以防止在termios函数没有定义时,将posix_termios.h头文件引入导致报错 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/libc/compilers/armlibc/termios.h | 2 ++ components/libc/compilers/dlib/termios.h | 2 ++ components/libc/compilers/newlib/termios.h | 2 ++ 3 files changed, 6 insertions(+) (limited to 'components/libc/compilers') diff --git a/components/libc/compilers/armlibc/termios.h b/components/libc/compilers/armlibc/termios.h index 1956121225..ee2b4d5718 100644 --- a/components/libc/compilers/armlibc/termios.h +++ b/components/libc/compilers/armlibc/termios.h @@ -9,7 +9,9 @@ #ifndef _TERMIOS_H__ #define _TERMIOS_H__ +#ifdef RT_USING_POSIX_TERMIOS #include #include +#endif #endif diff --git a/components/libc/compilers/dlib/termios.h b/components/libc/compilers/dlib/termios.h index 1956121225..ee2b4d5718 100644 --- a/components/libc/compilers/dlib/termios.h +++ b/components/libc/compilers/dlib/termios.h @@ -9,7 +9,9 @@ #ifndef _TERMIOS_H__ #define _TERMIOS_H__ +#ifdef RT_USING_POSIX_TERMIOS #include #include +#endif #endif diff --git a/components/libc/compilers/newlib/termios.h b/components/libc/compilers/newlib/termios.h index 1956121225..ee2b4d5718 100644 --- a/components/libc/compilers/newlib/termios.h +++ b/components/libc/compilers/newlib/termios.h @@ -9,7 +9,9 @@ #ifndef _TERMIOS_H__ #define _TERMIOS_H__ +#ifdef RT_USING_POSIX_TERMIOS #include #include +#endif #endif -- cgit v1.3.1 From 237a71de278b16aa3df3e98f49714ef17cdf0c2b Mon Sep 17 00:00:00 2001 From: mysterywolf <920369182@qq.com> Date: Tue, 8 Sep 2020 10:26:03 +0800 Subject: 修复common文件夹,该文件夹为armlibc/newlib/dlib的共同文件的文件夹 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/libc/compilers/armlibc/termios.h | 17 ------ components/libc/compilers/armlibc/unistd.c | 29 ---------- components/libc/compilers/common/SConscript | 3 +- components/libc/compilers/common/readme.md | 1 + components/libc/compilers/common/sys/time.h | 26 ++++----- components/libc/compilers/common/termios.h | 17 ++++++ components/libc/compilers/common/time.c | 1 + components/libc/compilers/common/unistd.c | 29 ++++++++++ components/libc/compilers/dlib/termios.h | 17 ------ components/libc/compilers/dlib/unistd.c | 29 ---------- components/libc/compilers/newlib/termios.h | 17 ------ components/libc/compilers/newlib/time.c | 82 ----------------------------- components/libc/compilers/newlib/unistd.c | 29 ---------- 13 files changed, 58 insertions(+), 239 deletions(-) delete mode 100644 components/libc/compilers/armlibc/termios.h delete mode 100644 components/libc/compilers/armlibc/unistd.c create mode 100644 components/libc/compilers/common/readme.md create mode 100644 components/libc/compilers/common/termios.h create mode 100644 components/libc/compilers/common/unistd.c delete mode 100644 components/libc/compilers/dlib/termios.h delete mode 100644 components/libc/compilers/dlib/unistd.c delete mode 100644 components/libc/compilers/newlib/termios.h delete mode 100644 components/libc/compilers/newlib/time.c delete mode 100644 components/libc/compilers/newlib/unistd.c (limited to 'components/libc/compilers') diff --git a/components/libc/compilers/armlibc/termios.h b/components/libc/compilers/armlibc/termios.h deleted file mode 100644 index ee2b4d5718..0000000000 --- a/components/libc/compilers/armlibc/termios.h +++ /dev/null @@ -1,17 +0,0 @@ -/* - * Copyright (c) 2006-2018, RT-Thread Development Team - * - * SPDX-License-Identifier: Apache-2.0 - * - * Change Logs: - * Date Author Notes - */ -#ifndef _TERMIOS_H__ -#define _TERMIOS_H__ - -#ifdef RT_USING_POSIX_TERMIOS -#include -#include -#endif - -#endif diff --git a/components/libc/compilers/armlibc/unistd.c b/components/libc/compilers/armlibc/unistd.c deleted file mode 100644 index e2f2827beb..0000000000 --- a/components/libc/compilers/armlibc/unistd.c +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Copyright (c) 2006-2018, RT-Thread Development Team - * - * SPDX-License-Identifier: Apache-2.0 - * - * Change Logs: - * Date Author Notes - * 2020-09-01 Meco Man First Version - */ - -#include -#include - -#ifdef RT_USING_POSIX - -#ifdef RT_USING_POSIX_TERMIOS -int isatty(int fd) -{ - struct termios ts; - return(tcgetattr(fd,&ts) != -1);/*true if no error (is a tty)*/ -} -#endif - -char *ttyname(int fd) -{ - return "/dev/tty0"; /*TODO: need to add more specific*/ -} - -#endif diff --git a/components/libc/compilers/common/SConscript b/components/libc/compilers/common/SConscript index a8d2606820..7979e20944 100644 --- a/components/libc/compilers/common/SConscript +++ b/components/libc/compilers/common/SConscript @@ -13,7 +13,6 @@ else: if GetDepend('RT_LIBC_USING_TIME'): src += ['time.c'] -if (rtconfig.PLATFORM == 'armcc' or rtconfig.PLATFORM == 'iar') and rtconfig.ARCH != 'sim' : - group = DefineGroup('libc', src, depend = [''], CPPPATH = CPPPATH) +group = DefineGroup('libc', src, depend = [''], CPPPATH = CPPPATH) Return('group') diff --git a/components/libc/compilers/common/readme.md b/components/libc/compilers/common/readme.md new file mode 100644 index 0000000000..458b104237 --- /dev/null +++ b/components/libc/compilers/common/readme.md @@ -0,0 +1 @@ +This folder is "common" for armlibc newlibcand dlib. It's not "common" for minilibc. \ No newline at end of file diff --git a/components/libc/compilers/common/sys/time.h b/components/libc/compilers/common/sys/time.h index 1d68eeafa3..22f1c17f5e 100644 --- a/components/libc/compilers/common/sys/time.h +++ b/components/libc/compilers/common/sys/time.h @@ -5,6 +5,7 @@ * * Change Logs: * Date Author Notes + * 2020-09-07 Meco Man combine gcc armcc iccarm */ #ifndef _SYS_TIME_H_ #define _SYS_TIME_H_ @@ -15,6 +16,14 @@ extern "C" { #endif +/* + * Skip define timespec for IAR version over 8.10.1 where __VER__ is 8010001. + */ +#if defined ( __ICCARM__ ) && (__VER__ >= 8010001) +#define _TIMESPEC_DEFINED +#endif + + #ifndef _TIMEVAL_DEFINED #define _TIMEVAL_DEFINED /* @@ -27,23 +36,6 @@ struct timeval { }; #endif /* _TIMEVAL_DEFINED */ -/* - * Skip define timespec for IAR version over 8.10.1 where __VER__ is 8010001. - */ -#if defined ( __ICCARM__ ) && (__VER__ >= 8010001) -#define _TIMESPEC_DEFINED -#endif - -#ifndef _TIMESPEC_DEFINED -#define _TIMESPEC_DEFINED -/* - * Structure defined by POSIX.1b to be like a timeval. - */ -struct timespec { - time_t tv_sec; /* seconds */ - long tv_nsec; /* and nanoseconds */ -}; -#endif /* _TIMESPEC_DEFINED */ struct timezone { int tz_minuteswest; /* minutes west of Greenwich */ diff --git a/components/libc/compilers/common/termios.h b/components/libc/compilers/common/termios.h new file mode 100644 index 0000000000..ee2b4d5718 --- /dev/null +++ b/components/libc/compilers/common/termios.h @@ -0,0 +1,17 @@ +/* + * Copyright (c) 2006-2018, RT-Thread Development Team + * + * SPDX-License-Identifier: Apache-2.0 + * + * Change Logs: + * Date Author Notes + */ +#ifndef _TERMIOS_H__ +#define _TERMIOS_H__ + +#ifdef RT_USING_POSIX_TERMIOS +#include +#include +#endif + +#endif diff --git a/components/libc/compilers/common/time.c b/components/libc/compilers/common/time.c index 50a800b259..99dab71eb4 100644 --- a/components/libc/compilers/common/time.c +++ b/components/libc/compilers/common/time.c @@ -6,6 +6,7 @@ * Change Logs: * Date Author Notes * 2019-08-21 zhangjun copy from minilibc + * 2020-09-07 Meco Man combine gcc armcc iccarm */ #include diff --git a/components/libc/compilers/common/unistd.c b/components/libc/compilers/common/unistd.c new file mode 100644 index 0000000000..e2f2827beb --- /dev/null +++ b/components/libc/compilers/common/unistd.c @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2006-2018, RT-Thread Development Team + * + * SPDX-License-Identifier: Apache-2.0 + * + * Change Logs: + * Date Author Notes + * 2020-09-01 Meco Man First Version + */ + +#include +#include + +#ifdef RT_USING_POSIX + +#ifdef RT_USING_POSIX_TERMIOS +int isatty(int fd) +{ + struct termios ts; + return(tcgetattr(fd,&ts) != -1);/*true if no error (is a tty)*/ +} +#endif + +char *ttyname(int fd) +{ + return "/dev/tty0"; /*TODO: need to add more specific*/ +} + +#endif diff --git a/components/libc/compilers/dlib/termios.h b/components/libc/compilers/dlib/termios.h deleted file mode 100644 index ee2b4d5718..0000000000 --- a/components/libc/compilers/dlib/termios.h +++ /dev/null @@ -1,17 +0,0 @@ -/* - * Copyright (c) 2006-2018, RT-Thread Development Team - * - * SPDX-License-Identifier: Apache-2.0 - * - * Change Logs: - * Date Author Notes - */ -#ifndef _TERMIOS_H__ -#define _TERMIOS_H__ - -#ifdef RT_USING_POSIX_TERMIOS -#include -#include -#endif - -#endif diff --git a/components/libc/compilers/dlib/unistd.c b/components/libc/compilers/dlib/unistd.c deleted file mode 100644 index e2f2827beb..0000000000 --- a/components/libc/compilers/dlib/unistd.c +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Copyright (c) 2006-2018, RT-Thread Development Team - * - * SPDX-License-Identifier: Apache-2.0 - * - * Change Logs: - * Date Author Notes - * 2020-09-01 Meco Man First Version - */ - -#include -#include - -#ifdef RT_USING_POSIX - -#ifdef RT_USING_POSIX_TERMIOS -int isatty(int fd) -{ - struct termios ts; - return(tcgetattr(fd,&ts) != -1);/*true if no error (is a tty)*/ -} -#endif - -char *ttyname(int fd) -{ - return "/dev/tty0"; /*TODO: need to add more specific*/ -} - -#endif diff --git a/components/libc/compilers/newlib/termios.h b/components/libc/compilers/newlib/termios.h deleted file mode 100644 index ee2b4d5718..0000000000 --- a/components/libc/compilers/newlib/termios.h +++ /dev/null @@ -1,17 +0,0 @@ -/* - * Copyright (c) 2006-2018, RT-Thread Development Team - * - * SPDX-License-Identifier: Apache-2.0 - * - * Change Logs: - * Date Author Notes - */ -#ifndef _TERMIOS_H__ -#define _TERMIOS_H__ - -#ifdef RT_USING_POSIX_TERMIOS -#include -#include -#endif - -#endif diff --git a/components/libc/compilers/newlib/time.c b/components/libc/compilers/newlib/time.c deleted file mode 100644 index f099d51330..0000000000 --- a/components/libc/compilers/newlib/time.c +++ /dev/null @@ -1,82 +0,0 @@ -/* - * Copyright (c) 2006-2018, RT-Thread Development Team - * - * SPDX-License-Identifier: Apache-2.0 - * - * Change Logs: - * Date Author Notes - */ -#include -#include - -#ifdef RT_USING_DEVICE -int gettimeofday(struct timeval *tp, void *ignore) -{ - time_t time; - rt_device_t device; - - device = rt_device_find("rtc"); - RT_ASSERT(device != RT_NULL); - - rt_device_control(device, RT_DEVICE_CTRL_RTC_GET_TIME, &time); - if (tp != RT_NULL) - { - tp->tv_sec = time; - tp->tv_usec = 0; - } - - return time; -} -#endif - -/** - * Returns the current time. - * - * @param time_t * t the timestamp pointer, if not used, keep NULL. - * - * @return time_t return timestamp current. - * - */ -/* for IAR 6.2 later Compiler */ -#if defined (__IAR_SYSTEMS_ICC__) && (__VER__) >= 6020000 -#pragma module_name = "?time" -time_t (__time32)(time_t *t) /* Only supports 32-bit timestamp */ -#else -time_t time(time_t *t) -#endif -{ - time_t time_now = 0; - -#ifdef RT_USING_RTC - static rt_device_t device = RT_NULL; - - /* optimization: find rtc device only first. */ - if (device == RT_NULL) - { - device = rt_device_find("rtc"); - } - - /* read timestamp from RTC device. */ - if (device != RT_NULL) - { - if (rt_device_open(device, 0) == RT_EOK) - { - rt_device_control(device, RT_DEVICE_CTRL_RTC_GET_TIME, &time_now); - rt_device_close(device); - } - } -#endif /* RT_USING_RTC */ - - /* if t is not NULL, write timestamp to *t */ - if (t != RT_NULL) - { - *t = time_now; - } - - return time_now; -} - -RT_WEAK clock_t clock(void) -{ - return rt_tick_get(); -} diff --git a/components/libc/compilers/newlib/unistd.c b/components/libc/compilers/newlib/unistd.c deleted file mode 100644 index e2f2827beb..0000000000 --- a/components/libc/compilers/newlib/unistd.c +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Copyright (c) 2006-2018, RT-Thread Development Team - * - * SPDX-License-Identifier: Apache-2.0 - * - * Change Logs: - * Date Author Notes - * 2020-09-01 Meco Man First Version - */ - -#include -#include - -#ifdef RT_USING_POSIX - -#ifdef RT_USING_POSIX_TERMIOS -int isatty(int fd) -{ - struct termios ts; - return(tcgetattr(fd,&ts) != -1);/*true if no error (is a tty)*/ -} -#endif - -char *ttyname(int fd) -{ - return "/dev/tty0"; /*TODO: need to add more specific*/ -} - -#endif -- cgit v1.3.1 From 5eccf51b61aadd6ad6b562d2762f601792a7bb55 Mon Sep 17 00:00:00 2001 From: mysterywolf <920369182@qq.com> Date: Tue, 8 Sep 2020 10:29:17 +0800 Subject: Signed-off-by: mysterywolf --- components/libc/compilers/common/readme.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'components/libc/compilers') diff --git a/components/libc/compilers/common/readme.md b/components/libc/compilers/common/readme.md index 458b104237..cb91d95f45 100644 --- a/components/libc/compilers/common/readme.md +++ b/components/libc/compilers/common/readme.md @@ -1 +1 @@ -This folder is "common" for armlibc newlibcand dlib. It's not "common" for minilibc. \ No newline at end of file +This folder is "common" for armlibc newlibc and dlib. It's not "common" for minilibc. \ No newline at end of file -- cgit v1.3.1 From f021cb982a1add837755af2c513ab17605a55f2d Mon Sep 17 00:00:00 2001 From: mysterywolf <920369182@qq.com> Date: Tue, 8 Sep 2020 10:52:02 +0800 Subject: 修改common下的sconscript脚本文件,增加unistd.c排除条件 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/libc/compilers/common/SConscript | 3 +++ components/libc/compilers/common/unistd.c | 7 ++----- 2 files changed, 5 insertions(+), 5 deletions(-) (limited to 'components/libc/compilers') diff --git a/components/libc/compilers/common/SConscript b/components/libc/compilers/common/SConscript index 7979e20944..deadacb426 100644 --- a/components/libc/compilers/common/SConscript +++ b/components/libc/compilers/common/SConscript @@ -13,6 +13,9 @@ else: if GetDepend('RT_LIBC_USING_TIME'): src += ['time.c'] +if GetDepend('RT_USING_POSIX') == False: + SrcRemove(src, ['unistd.c']) + group = DefineGroup('libc', src, depend = [''], CPPPATH = CPPPATH) Return('group') diff --git a/components/libc/compilers/common/unistd.c b/components/libc/compilers/common/unistd.c index e2f2827beb..4068fc5cf5 100644 --- a/components/libc/compilers/common/unistd.c +++ b/components/libc/compilers/common/unistd.c @@ -8,12 +8,11 @@ * 2020-09-01 Meco Man First Version */ -#include #include -#ifdef RT_USING_POSIX - #ifdef RT_USING_POSIX_TERMIOS +#include + int isatty(int fd) { struct termios ts; @@ -25,5 +24,3 @@ char *ttyname(int fd) { return "/dev/tty0"; /*TODO: need to add more specific*/ } - -#endif -- cgit v1.3.1 From 0607ff84ab4cf9a8b6ed92ce17776bd852d9bc62 Mon Sep 17 00:00:00 2001 From: mysterywolf <920369182@qq.com> Date: Tue, 8 Sep 2020 11:12:56 +0800 Subject: 解决minilibc time.c和newlibc仅定义RT_LIBC_USING_TIME时冲突的问题 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/libc/compilers/common/SConscript | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'components/libc/compilers') diff --git a/components/libc/compilers/common/SConscript b/components/libc/compilers/common/SConscript index deadacb426..718f05743c 100644 --- a/components/libc/compilers/common/SConscript +++ b/components/libc/compilers/common/SConscript @@ -10,7 +10,7 @@ CPPPATH = [cwd] if GetDepend('RT_USING_LIBC'): src += Glob('*.c') else: - if GetDepend('RT_LIBC_USING_TIME'): + if GetDepend('RT_LIBC_USING_TIME') and not GetDepend('RT_USING_MINILIBC'): src += ['time.c'] if GetDepend('RT_USING_POSIX') == False: -- cgit v1.3.1 From ff097f0467fb0041817846f2472343b7b9c098c4 Mon Sep 17 00:00:00 2001 From: mysterywolf <920369182@qq.com> Date: Tue, 8 Sep 2020 13:16:49 +0800 Subject: 增加 __GNUC__宏定义 和sconscript的平台识别以避免重复定义 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/libc/compilers/common/SConscript | 3 ++- components/libc/compilers/minilibc/SConscript | 2 +- include/libc/libc_errno.h | 4 ++-- include/libc/libc_fcntl.h | 2 +- include/libc/libc_fdset.h | 2 +- include/libc/libc_stat.h | 2 +- 6 files changed, 8 insertions(+), 7 deletions(-) (limited to 'components/libc/compilers') diff --git a/components/libc/compilers/common/SConscript b/components/libc/compilers/common/SConscript index 718f05743c..a5f4a3fda6 100644 --- a/components/libc/compilers/common/SConscript +++ b/components/libc/compilers/common/SConscript @@ -16,6 +16,7 @@ else: if GetDepend('RT_USING_POSIX') == False: SrcRemove(src, ['unistd.c']) -group = DefineGroup('libc', src, depend = [''], CPPPATH = CPPPATH) +if not GetDepend('RT_USING_MINILIBC') and GetDepend('RT_USING_LIBC'): + group = DefineGroup('libc', src, depend = [''], CPPPATH = CPPPATH) Return('group') diff --git a/components/libc/compilers/minilibc/SConscript b/components/libc/compilers/minilibc/SConscript index 518d800571..dec657028f 100644 --- a/components/libc/compilers/minilibc/SConscript +++ b/components/libc/compilers/minilibc/SConscript @@ -8,7 +8,7 @@ group = [] CPPPATH = [cwd] CPPDEFINES = ['RT_USING_MINILIBC'] -if rtconfig.PLATFORM == 'gcc' and rtconfig.ARCH != 'sim' and not GetDepend('RT_USING_LIBC'): +if rtconfig.PLATFORM == 'gcc' and rtconfig.ARCH != 'sim' and not GetDepend('RT_USING_LIBC') and GetDepend('RT_USING_MINILIBC'): group = DefineGroup('libc', src, depend = [''], CPPPATH = CPPPATH, CPPDEFINES = CPPDEFINES) diff --git a/include/libc/libc_errno.h b/include/libc/libc_errno.h index 0f3bc7635a..00c1f733d3 100644 --- a/include/libc/libc_errno.h +++ b/include/libc/libc_errno.h @@ -13,7 +13,7 @@ #include -#if defined(RT_USING_NEWLIB) || defined(_WIN32) +#if defined(RT_USING_NEWLIB) || defined(_WIN32) || defined( __GNUC__ ) /* use errno.h file in toolchains */ #include #endif @@ -45,7 +45,7 @@ defined in armcc/errno.h #define ERROR_BASE_NO 0 #endif -#if !defined(RT_USING_NEWLIB) && !defined(_WIN32) +#if !defined(RT_USING_NEWLIB) && !defined(_WIN32) && !defined(__GNUC__ ) #define EPERM (ERROR_BASE_NO + 1) #define ENOENT (ERROR_BASE_NO + 2) diff --git a/include/libc/libc_fcntl.h b/include/libc/libc_fcntl.h index 385ac7cd9f..39740b7d85 100644 --- a/include/libc/libc_fcntl.h +++ b/include/libc/libc_fcntl.h @@ -12,7 +12,7 @@ #ifndef LIBC_FCNTL_H__ #define LIBC_FCNTL_H__ -#if defined(RT_USING_NEWLIB) || defined(_WIN32) +#if defined(RT_USING_NEWLIB) || defined(_WIN32) || defined( __GNUC__ ) #include #ifndef O_NONBLOCK diff --git a/include/libc/libc_fdset.h b/include/libc/libc_fdset.h index b4d2e2189a..4a778b51c1 100644 --- a/include/libc/libc_fdset.h +++ b/include/libc/libc_fdset.h @@ -13,7 +13,7 @@ #include -#if defined(RT_USING_NEWLIB) || defined(_WIN32) +#if defined(RT_USING_NEWLIB) || defined(_WIN32) || defined( __GNUC__ ) #include #if defined(HAVE_SYS_SELECT_H) #include diff --git a/include/libc/libc_stat.h b/include/libc/libc_stat.h index 9079d1ef15..9388688572 100644 --- a/include/libc/libc_stat.h +++ b/include/libc/libc_stat.h @@ -9,7 +9,7 @@ #include -#if defined(RT_USING_NEWLIB) +#if defined(RT_USING_NEWLIB) || defined( __GNUC__ ) /* use header file of newlib */ #include -- cgit v1.3.1 From 4305a678a38d65712d739f0d79bf55dc05e33073 Mon Sep 17 00:00:00 2001 From: mysterywolf <920369182@qq.com> Date: Tue, 8 Sep 2020 16:29:47 +0800 Subject: 修改common文件夹的sconscript 并 取消并恢复上一个commit的提交内容 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bsp/lpc408x/.config | 9 ++------- bsp/lpc408x/rtconfig.h | 3 +-- components/libc/compilers/common/SConscript | 2 +- 3 files changed, 4 insertions(+), 10 deletions(-) (limited to 'components/libc/compilers') diff --git a/bsp/lpc408x/.config b/bsp/lpc408x/.config index c57e7eb755..b07e256c26 100644 --- a/bsp/lpc408x/.config +++ b/bsp/lpc408x/.config @@ -176,14 +176,9 @@ CONFIG_RT_USING_PIN=y # # POSIX layer and C standard library # -CONFIG_RT_USING_LIBC=y +# CONFIG_RT_USING_LIBC is not set # CONFIG_RT_USING_PTHREADS is not set -CONFIG_RT_USING_POSIX=y -# CONFIG_RT_USING_POSIX_MMAP is not set -# CONFIG_RT_USING_POSIX_TERMIOS is not set -# CONFIG_RT_USING_POSIX_GETLINE is not set -# CONFIG_RT_USING_POSIX_AIO is not set -# CONFIG_RT_USING_MODULE is not set +CONFIG_RT_LIBC_USING_TIME=y # # Network diff --git a/bsp/lpc408x/rtconfig.h b/bsp/lpc408x/rtconfig.h index d5e0c160be..25bba085a6 100644 --- a/bsp/lpc408x/rtconfig.h +++ b/bsp/lpc408x/rtconfig.h @@ -107,8 +107,7 @@ /* POSIX layer and C standard library */ -#define RT_USING_LIBC -#define RT_USING_POSIX +#define RT_LIBC_USING_TIME /* Network */ diff --git a/components/libc/compilers/common/SConscript b/components/libc/compilers/common/SConscript index a5f4a3fda6..18ff51d027 100644 --- a/components/libc/compilers/common/SConscript +++ b/components/libc/compilers/common/SConscript @@ -16,7 +16,7 @@ else: if GetDepend('RT_USING_POSIX') == False: SrcRemove(src, ['unistd.c']) -if not GetDepend('RT_USING_MINILIBC') and GetDepend('RT_USING_LIBC'): +if not GetDepend('RT_USING_MINILIBC') and (GetDepend('RT_USING_LIBC') or GetDepend('RT_LIBC_USING_TIME')): group = DefineGroup('libc', src, depend = [''], CPPPATH = CPPPATH) Return('group') -- cgit v1.3.1 From 28e0c99d0032111add7fadee7834043c332feb79 Mon Sep 17 00:00:00 2001 From: mysterywolf <920369182@qq.com> Date: Wed, 9 Sep 2020 00:53:53 +0800 Subject: Signed-off-by: mysterywolf --- components/libc/compilers/common/SConscript | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'components/libc/compilers') diff --git a/components/libc/compilers/common/SConscript b/components/libc/compilers/common/SConscript index 18ff51d027..6c14b4e881 100644 --- a/components/libc/compilers/common/SConscript +++ b/components/libc/compilers/common/SConscript @@ -8,13 +8,13 @@ group = [] CPPPATH = [cwd] if GetDepend('RT_USING_LIBC'): - src += Glob('*.c') + src += Glob('*.c') + if GetDepend('RT_USING_POSIX') == False: + SrcRemove(src, ['unistd.c']) else: if GetDepend('RT_LIBC_USING_TIME') and not GetDepend('RT_USING_MINILIBC'): src += ['time.c'] -if GetDepend('RT_USING_POSIX') == False: - SrcRemove(src, ['unistd.c']) if not GetDepend('RT_USING_MINILIBC') and (GetDepend('RT_USING_LIBC') or GetDepend('RT_LIBC_USING_TIME')): group = DefineGroup('libc', src, depend = [''], CPPPATH = CPPPATH) -- cgit v1.3.1 From b3ab8a99e10f68042a3f2cba11e130004aa124e4 Mon Sep 17 00:00:00 2001 From: mysterywolf <920369182@qq.com> Date: Wed, 9 Sep 2020 08:59:39 +0800 Subject: Signed-off-by: mysterywolf --- components/libc/compilers/common/SConscript | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'components/libc/compilers') diff --git a/components/libc/compilers/common/SConscript b/components/libc/compilers/common/SConscript index 6c14b4e881..2407301405 100644 --- a/components/libc/compilers/common/SConscript +++ b/components/libc/compilers/common/SConscript @@ -9,12 +9,12 @@ CPPPATH = [cwd] if GetDepend('RT_USING_LIBC'): src += Glob('*.c') - if GetDepend('RT_USING_POSIX') == False: - SrcRemove(src, ['unistd.c']) else: if GetDepend('RT_LIBC_USING_TIME') and not GetDepend('RT_USING_MINILIBC'): src += ['time.c'] +if GetDepend('RT_USING_POSIX') == False: + SrcRemove(src, ['unistd.c']) if not GetDepend('RT_USING_MINILIBC') and (GetDepend('RT_USING_LIBC') or GetDepend('RT_LIBC_USING_TIME')): group = DefineGroup('libc', src, depend = [''], CPPPATH = CPPPATH) -- cgit v1.3.1