From a41ebbb69778af8d160fe9207d6d353dc9c141d1 Mon Sep 17 00:00:00 2001
From: mysterywolf <920369182@qq.com>
Date: Sat, 5 Sep 2020 15:42:03 +0800
Subject: add posix functions getline/getdelim
---
components/libc/getline/README.md | 30 +++++++++++++
components/libc/getline/SConscript | 13 ++++++
components/libc/getline/UNLICENSE | 24 ++++++++++
components/libc/getline/posix_getline.c | 78 +++++++++++++++++++++++++++++++++
components/libc/getline/posix_getline.h | 22 ++++++++++
5 files changed, 167 insertions(+)
create mode 100644 components/libc/getline/README.md
create mode 100644 components/libc/getline/SConscript
create mode 100644 components/libc/getline/UNLICENSE
create mode 100644 components/libc/getline/posix_getline.c
create mode 100644 components/libc/getline/posix_getline.h
(limited to 'components')
diff --git a/components/libc/getline/README.md b/components/libc/getline/README.md
new file mode 100644
index 0000000000..8f52898c82
--- /dev/null
+++ b/components/libc/getline/README.md
@@ -0,0 +1,30 @@
+# getline/getdelim for RT-Thread POSIX
+
+[](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].
+
+## Building the project
+
+Just run `make`.
+
+## 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
+
+
+## 联系&维护
+Meco Man
+
+jiantingman@foxmail.com
+
+https://github.com/mysterywolf/getline
diff --git a/components/libc/getline/SConscript b/components/libc/getline/SConscript
new file mode 100644
index 0000000000..7bede9f31b
--- /dev/null
+++ b/components/libc/getline/SConscript
@@ -0,0 +1,13 @@
+# RT-Thread building script for component
+
+from building import *
+
+cwd = GetCurrentDir()
+src = Glob('*.c') + Glob('*.cpp')
+CPPPATH = [cwd]
+
+group = DefineGroup('libc', src,
+ depend = ['RT_USING_LIBC', 'RT_USING_POSIX'],
+ CPPPATH = CPPPATH)
+
+Return('group')
diff --git a/components/libc/getline/UNLICENSE b/components/libc/getline/UNLICENSE
new file mode 100644
index 0000000000..68a49daad8
--- /dev/null
+++ b/components/libc/getline/UNLICENSE
@@ -0,0 +1,24 @@
+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
diff --git a/components/libc/getline/posix_getline.c b/components/libc/getline/posix_getline.c
new file mode 100644
index 0000000000..d4a7d3fce6
--- /dev/null
+++ b/components/libc/getline/posix_getline.c
@@ -0,0 +1,78 @@
+/* posix_getline.c
+ * RT-Thread POSIX
+ * getdelim(), getline() - read a delimited record from stream, ersatz implementation
+ * https://man7.org/linux/man-pages/man3/getline.3.html
+ * Authors:
+ * https://github.com/ivanrad/getline
+ * https://github.com/mysterywolf/getline/
+ *
+ * Meco Man 2020-09-03 First Version
+ */
+
+#include
+#include
+#include
+#include
+
+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 (SSIZE_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/getline/posix_getline.h b/components/libc/getline/posix_getline.h
new file mode 100644
index 0000000000..1b3e43da1e
--- /dev/null
+++ b/components/libc/getline/posix_getline.h
@@ -0,0 +1,22 @@
+/* posix_getline.h
+ * RT-Thread POSIX
+ * getdelim(), getline() - read a delimited record from stream, ersatz implementation
+ * https://man7.org/linux/man-pages/man3/getline.3.html
+ * Authors:
+ * https://github.com/ivanrad/getline
+ * https://github.com/mysterywolf/getline/
+ *
+ * Meco Man 2020-09-03 First Version
+ */
+
+
+#ifndef POSIX_GETLINE_H
+#define POSIX_GETLINE_H
+
+#include
+
+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 */
+
--
cgit v1.3.1
From 74ab1551fd030e4950ae4f773cb19240c7a7a6d3 Mon Sep 17 00:00:00 2001
From: mysterywolf <920369182@qq.com>
Date: Sat, 5 Sep 2020 16:14:21 +0800
Subject: add posix 2008 limit.h
---
components/libc/getline/README.md | 2 +-
components/libc/getline/posix_getline.c | 2 +-
include/libc/libc_limits.h | 24 ++++++++++++++++++++++++
include/rtlibc.h | 1 +
4 files changed, 27 insertions(+), 2 deletions(-)
create mode 100644 include/libc/libc_limits.h
(limited to 'components')
diff --git a/components/libc/getline/README.md b/components/libc/getline/README.md
index 8f52898c82..3ba5a96b3d 100644
--- a/components/libc/getline/README.md
+++ b/components/libc/getline/README.md
@@ -1,4 +1,4 @@
-# getline/getdelim for RT-Thread POSIX
+# getline/getdelim for RT-Thread POSIX(IEEE Std 1003.1-2008)
[](https://travis-ci.org/ivanrad/getline)
diff --git a/components/libc/getline/posix_getline.c b/components/libc/getline/posix_getline.c
index d4a7d3fce6..9853d09439 100644
--- a/components/libc/getline/posix_getline.c
+++ b/components/libc/getline/posix_getline.c
@@ -12,7 +12,7 @@
#include
#include
#include
-#include
+#include
ssize_t getdelim(char **lineptr, size_t *n, int delim, FILE *stream) {
char *cur_pos, *new_lineptr;
diff --git a/include/libc/libc_limits.h b/include/libc/libc_limits.h
new file mode 100644
index 0000000000..c2129e5343
--- /dev/null
+++ b/include/libc/libc_limits.h
@@ -0,0 +1,24 @@
+/*
+ * Copyright (c) 2006-2018, RT-Thread Development Team
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ */
+
+/*
+ * File : libc_limits.h
+ *
+ * Change Logs:
+ * Date Author Notes
+ * 2020-09-05 Meco Manthe first version
+ */
+
+#ifndef __LIBC_LIMITS_H__
+#define __LIBC_LIMITS_H__
+
+#include
+
+#ifndef SSIZE_MAX
+# define SSIZE_MAX LONG_MAX
+#endif
+
+#endif
diff --git a/include/rtlibc.h b/include/rtlibc.h
index b3a548beb1..73d735250f 100644
--- a/include/rtlibc.h
+++ b/include/rtlibc.h
@@ -20,6 +20,7 @@
#include "libc/libc_dirent.h"
#include "libc/libc_signal.h"
#include "libc/libc_fdset.h"
+#include "libc/libc_limits.h"
#if defined(__CC_ARM) || defined(__CLANG_ARM) || defined(__IAR_SYSTEMS_ICC__)
typedef signed long off_t;
--
cgit v1.3.1
From d5d8b345f4d9caacfd4dabce0d8ce374f7e7b81e Mon Sep 17 00:00:00 2001
From: mysterywolf <920369182@qq.com>
Date: Sat, 5 Sep 2020 16:59:53 +0800
Subject: 修改libc_signal.h 该文件中不能用rt_数据类型,否则会引起编译器递归编译
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
components/libc/getline/posix_getline.h | 1 +
include/libc/libc_signal.h | 5 +++--
2 files changed, 4 insertions(+), 2 deletions(-)
(limited to 'components')
diff --git a/components/libc/getline/posix_getline.h b/components/libc/getline/posix_getline.h
index 1b3e43da1e..3de84cdfe6 100644
--- a/components/libc/getline/posix_getline.h
+++ b/components/libc/getline/posix_getline.h
@@ -14,6 +14,7 @@
#define POSIX_GETLINE_H
#include
+#include
ssize_t getdelim(char **lineptr, size_t *n, int delim, FILE *stream);
ssize_t getline(char **lineptr, size_t *n, FILE *stream);
diff --git a/include/libc/libc_signal.h b/include/libc/libc_signal.h
index 898fe13f43..539685de3e 100644
--- a/include/libc/libc_signal.h
+++ b/include/libc/libc_signal.h
@@ -15,6 +15,7 @@
extern "C" {
#endif
+#include
#ifdef HAVE_CCONFIG_H
#include
#endif
@@ -46,8 +47,8 @@ struct sigevent
#ifndef HAVE_SIGINFO
struct siginfo
{
- rt_uint16_t si_signo;
- rt_uint16_t si_code;
+ uint16_t si_signo;
+ uint16_t si_code;
union sigval si_value;
};
--
cgit v1.3.1
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')
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')
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')
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 443978eb784e68c33b469e04f4105e87fdf2fa55 Mon Sep 17 00:00:00 2001
From: mysterywolf <920369182@qq.com>
Date: Sat, 5 Sep 2020 19:47:34 +0800
Subject:
增加RT_USING_POSIX_GETLINE用于单独控制是否启用getline函数,并修改Kconfig增加对应选项
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
components/libc/Kconfig | 8 ++++++--
components/libc/getline/SConscript | 2 +-
include/libc/libc_stdio.h | 2 +-
3 files changed, 8 insertions(+), 4 deletions(-)
(limited to 'components')
diff --git a/components/libc/Kconfig b/components/libc/Kconfig
index 26e156522b..65c8d44225 100644
--- a/components/libc/Kconfig
+++ b/components/libc/Kconfig
@@ -22,11 +22,15 @@ if RT_USING_LIBC && RT_USING_DFS
if RT_USING_POSIX
config RT_USING_POSIX_MMAP
- bool "Enable mmap() api"
+ bool "Enable mmap() API"
default n
config RT_USING_POSIX_TERMIOS
- bool "Enable termios feature"
+ bool "Enable termios APIs"
+ default n
+
+ config RT_USING_POSIX_GETLINE
+ bool "Enable getline()/getdelim() APIs"
default n
config RT_USING_POSIX_AIO
diff --git a/components/libc/getline/SConscript b/components/libc/getline/SConscript
index 7bede9f31b..fa4c8618c1 100644
--- a/components/libc/getline/SConscript
+++ b/components/libc/getline/SConscript
@@ -7,7 +7,7 @@ src = Glob('*.c') + Glob('*.cpp')
CPPPATH = [cwd]
group = DefineGroup('libc', src,
- depend = ['RT_USING_LIBC', 'RT_USING_POSIX'],
+ depend = ['RT_USING_LIBC', 'RT_USING_POSIX','RT_USING_POSIX_GETLINE'],
CPPPATH = CPPPATH)
Return('group')
diff --git a/include/libc/libc_stdio.h b/include/libc/libc_stdio.h
index 6201b85ea4..4a09f5c3d7 100644
--- a/include/libc/libc_stdio.h
+++ b/include/libc/libc_stdio.h
@@ -15,7 +15,7 @@
#ifndef LIBC_STDIO_H__
#define LIBC_STDIO_H__
-#ifdef RT_USING_POSIX
+#ifdef RT_USING_POSIX_GETLINE
#include
--
cgit v1.3.1
From 05190990b49f10d31a1dce31fcb2d90e013dac4a Mon Sep 17 00:00:00 2001
From: mysterywolf <920369182@qq.com>
Date: Sat, 5 Sep 2020 22:09:22 +0800
Subject: 增加posix_getline.c/.h版权信息
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
components/libc/getline/posix_getline.c | 1 +
components/libc/getline/posix_getline.h | 1 +
2 files changed, 2 insertions(+)
(limited to 'components')
diff --git a/components/libc/getline/posix_getline.c b/components/libc/getline/posix_getline.c
index 9853d09439..2c60ca7647 100644
--- a/components/libc/getline/posix_getline.c
+++ b/components/libc/getline/posix_getline.c
@@ -1,6 +1,7 @@
/* 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
diff --git a/components/libc/getline/posix_getline.h b/components/libc/getline/posix_getline.h
index 3de84cdfe6..c7d6021af3 100644
--- a/components/libc/getline/posix_getline.h
+++ b/components/libc/getline/posix_getline.h
@@ -1,6 +1,7 @@
/* 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
--
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')
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')
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')
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')
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')
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 a890c67fb4ef9e15d8f0e83e76cee12163c7e0c9 Mon Sep 17 00:00:00 2001
From: mysterywolf <920369182@qq.com>
Date: Tue, 8 Sep 2020 13:39:40 +0800
Subject: 增加lwip/cc.h LWIP_TIMEVAL_PRIVATE是能与否的平台判断条件
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
components/net/lwip-1.4.1/src/arch/include/arch/cc.h | 2 +-
components/net/lwip-2.0.2/src/arch/include/arch/cc.h | 2 +-
components/net/lwip-2.1.2/src/arch/include/arch/cc.h | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)
(limited to 'components')
diff --git a/components/net/lwip-1.4.1/src/arch/include/arch/cc.h b/components/net/lwip-1.4.1/src/arch/include/arch/cc.h
index 5304091755..604477dab8 100644
--- a/components/net/lwip-1.4.1/src/arch/include/arch/cc.h
+++ b/components/net/lwip-1.4.1/src/arch/include/arch/cc.h
@@ -66,7 +66,7 @@ typedef uintptr_t mem_ptr_t;
#endif /* __CC_ARM/__IAR_SYSTEMS_ICC__ */
#endif
-#if defined(RT_USING_LIBC) || defined(RT_USING_MINILIBC) || defined(RT_LIBC_USING_TIME)
+#if defined(RT_USING_LIBC) || defined(RT_USING_MINILIBC) || defined(RT_LIBC_USING_TIME) || defined ( __GNUC__)
#include
#define LWIP_TIMEVAL_PRIVATE 0
#else
diff --git a/components/net/lwip-2.0.2/src/arch/include/arch/cc.h b/components/net/lwip-2.0.2/src/arch/include/arch/cc.h
index 491cab6b5f..00536a8419 100644
--- a/components/net/lwip-2.0.2/src/arch/include/arch/cc.h
+++ b/components/net/lwip-2.0.2/src/arch/include/arch/cc.h
@@ -45,7 +45,7 @@
#define S32_F "ld"
#define X32_F "lx"
-#if defined(RT_USING_LIBC) || defined(RT_USING_MINILIBC) || defined(RT_LIBC_USING_TIME)
+#if defined(RT_USING_LIBC) || defined(RT_USING_MINILIBC) || defined(RT_LIBC_USING_TIME) || defined ( __GNUC__)
#include
#define LWIP_TIMEVAL_PRIVATE 0
#else
diff --git a/components/net/lwip-2.1.2/src/arch/include/arch/cc.h b/components/net/lwip-2.1.2/src/arch/include/arch/cc.h
index c1b4cf7d29..6905ecd442 100644
--- a/components/net/lwip-2.1.2/src/arch/include/arch/cc.h
+++ b/components/net/lwip-2.1.2/src/arch/include/arch/cc.h
@@ -59,7 +59,7 @@
#endif /* __CC_ARM/__IAR_SYSTEMS_ICC__ */
#endif /* RT_USING_LIBC */
-#if defined(RT_USING_LIBC) || defined(RT_USING_MINILIBC) || defined(RT_LIBC_USING_TIME)
+#if defined(RT_USING_LIBC) || defined(RT_USING_MINILIBC) || defined(RT_LIBC_USING_TIME) || defined ( __GNUC__)
#include
#define LWIP_TIMEVAL_PRIVATE 0
#else
--
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')
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')
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')
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