From a41ebbb69778af8d160fe9207d6d353dc9c141d1 Mon Sep 17 00:00:00 2001 From: mysterywolf <920369182@qq.com> Date: Sat, 5 Sep 2020 15:42:03 +0800 Subject: [PATCH 01/23] 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 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 + +[![Build Status](https://travis-ci.org/ivanrad/getline.svg?branch=master)](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 */ + From 74ab1551fd030e4950ae4f773cb19240c7a7a6d3 Mon Sep 17 00:00:00 2001 From: mysterywolf <920369182@qq.com> Date: Sat, 5 Sep 2020 16:14:21 +0800 Subject: [PATCH 02/23] 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 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) [![Build Status](https://travis-ci.org/ivanrad/getline.svg?branch=master)](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; From 6fa049ee3dedb7fe1ca321ef5f367fdb4a498181 Mon Sep 17 00:00:00 2001 From: mysterywolf <920369182@qq.com> Date: Sat, 5 Sep 2020 16:21:00 +0800 Subject: [PATCH 03/23] add libc_stdio.h --- include/libc/libc_limits.h | 4 ++-- include/libc/libc_stdio.h | 20 ++++++++++++++++++++ include/rtlibc.h | 1 + 3 files changed, 23 insertions(+), 2 deletions(-) create mode 100644 include/libc/libc_stdio.h diff --git a/include/libc/libc_limits.h b/include/libc/libc_limits.h index c2129e5343..c2aa429229 100644 --- a/include/libc/libc_limits.h +++ b/include/libc/libc_limits.h @@ -12,8 +12,8 @@ * 2020-09-05 Meco Manthe first version */ -#ifndef __LIBC_LIMITS_H__ -#define __LIBC_LIMITS_H__ +#ifndef LIBC_LIMITS_H__ +#define LIBC_LIMITS_H__ #include diff --git a/include/libc/libc_stdio.h b/include/libc/libc_stdio.h new file mode 100644 index 0000000000..19d5fd4cc5 --- /dev/null +++ b/include/libc/libc_stdio.h @@ -0,0 +1,20 @@ +/* + * Copyright (c) 2006-2018, RT-Thread Development Team + * + * SPDX-License-Identifier: Apache-2.0 + */ + +/* + * File : libc_stdio.h + * + * Change Logs: + * Date Author Notes + * 2020-09-05 Meco Manthe first version + */ + +#ifndef LIBC_STDIO_H__ +#define LIBC_STDIO_H__ + +#include + +#endif diff --git a/include/rtlibc.h b/include/rtlibc.h index 73d735250f..fb8c782095 100644 --- a/include/rtlibc.h +++ b/include/rtlibc.h @@ -21,6 +21,7 @@ #include "libc/libc_signal.h" #include "libc/libc_fdset.h" #include "libc/libc_limits.h" +#include "libc/libc_stdio.h" #if defined(__CC_ARM) || defined(__CLANG_ARM) || defined(__IAR_SYSTEMS_ICC__) typedef signed long off_t; From d5d8b345f4d9caacfd4dabce0d8ce374f7e7b81e Mon Sep 17 00:00:00 2001 From: mysterywolf <920369182@qq.com> Date: Sat, 5 Sep 2020 16:59:53 +0800 Subject: [PATCH 04/23] =?UTF-8?q?=E4=BF=AE=E6=94=B9libc=5Fsignal.h=20?= =?UTF-8?q?=E8=AF=A5=E6=96=87=E4=BB=B6=E4=B8=AD=E4=B8=8D=E8=83=BD=E7=94=A8?= =?UTF-8?q?rt=5F=E6=95=B0=E6=8D=AE=E7=B1=BB=E5=9E=8B=EF=BC=8C=E5=90=A6?= =?UTF-8?q?=E5=88=99=E4=BC=9A=E5=BC=95=E8=B5=B7=E7=BC=96=E8=AF=91=E5=99=A8?= =?UTF-8?q?=E9=80=92=E5=BD=92=E7=BC=96=E8=AF=91?= 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(-) 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; }; From 8a08be6b9e2ea6bd1dce01a9844a954c3e21a26c Mon Sep 17 00:00:00 2001 From: mysterywolf <920369182@qq.com> Date: Sat, 5 Sep 2020 17:41:54 +0800 Subject: [PATCH 05/23] =?UTF-8?q?[fix=20bugs]=E4=BF=AE=E6=94=B9armlibc/sys?= =?UTF-8?q?/types.h=20=E8=AF=A5=E6=96=87=E4=BB=B6=E4=B8=AD=E4=B8=8D?= =?UTF-8?q?=E8=83=BD=E7=94=A8rt=5F=E6=95=B0=E6=8D=AE=E7=B1=BB=E5=9E=8B?= =?UTF-8?q?=EF=BC=8C=E5=90=A6=E5=88=99=E4=BC=9A=E5=BC=95=E8=B5=B7=E7=BC=96?= =?UTF-8?q?=E8=AF=91=E5=99=A8=E9=80=92=E5=BD=92=E7=BC=96=E8=AF=91?= 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(-) 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 From 6eb62a3f9de3e45abe91fec03ff45f1a011f48bd Mon Sep 17 00:00:00 2001 From: mysterywolf <920369182@qq.com> Date: Sat, 5 Sep 2020 17:50:54 +0800 Subject: [PATCH 06/23] =?UTF-8?q?=E5=B0=86unistd.c=E4=B8=8D=E5=86=8D?= =?UTF-8?q?=E6=94=BE=E5=9C=A8common=E4=B8=AD=EF=BC=8C=E5=88=86=E6=95=A3?= =?UTF-8?q?=E5=88=B0=E5=90=84=E4=B8=AA=E5=BA=93=E4=B8=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../compilers/{common => armlibc}/unistd.c | 4 +++ components/libc/compilers/dlib/unistd.c | 29 +++++++++++++++++++ components/libc/compilers/newlib/unistd.c | 29 +++++++++++++++++++ 3 files changed, 62 insertions(+) rename components/libc/compilers/{common => armlibc}/unistd.c (94%) create mode 100644 components/libc/compilers/dlib/unistd.c create mode 100644 components/libc/compilers/newlib/unistd.c diff --git a/components/libc/compilers/common/unistd.c b/components/libc/compilers/armlibc/unistd.c similarity index 94% rename from components/libc/compilers/common/unistd.c rename to components/libc/compilers/armlibc/unistd.c index 04a0886655..e2f2827beb 100644 --- a/components/libc/compilers/common/unistd.c +++ b/components/libc/compilers/armlibc/unistd.c @@ -11,6 +11,8 @@ #include #include +#ifdef RT_USING_POSIX + #ifdef RT_USING_POSIX_TERMIOS int isatty(int fd) { @@ -23,3 +25,5 @@ char *ttyname(int fd) { return "/dev/tty0"; /*TODO: need to add more specific*/ } + +#endif 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 From f13014526ce81e5aff40f71b1c942dc89bc2322e Mon Sep 17 00:00:00 2001 From: mysterywolf <920369182@qq.com> Date: Sat, 5 Sep 2020 17:52:32 +0800 Subject: [PATCH 07/23] =?UTF-8?q?[bug=20fix]=E5=AF=B9=E5=90=84=E4=B8=AAlib?= =?UTF-8?q?c=E5=BA=93=E7=9A=84termios.h=E5=A2=9E=E5=8A=A0=E5=AE=8F?= =?UTF-8?q?=E5=AE=9A=E4=B9=89=EF=BC=8C=E4=BB=A5=E9=98=B2=E6=AD=A2=E5=9C=A8?= =?UTF-8?q?termios=E5=87=BD=E6=95=B0=E6=B2=A1=E6=9C=89=E5=AE=9A=E4=B9=89?= =?UTF-8?q?=E6=97=B6=EF=BC=8C=E5=B0=86posix=5Ftermios.h=E5=A4=B4=E6=96=87?= =?UTF-8?q?=E4=BB=B6=E5=BC=95=E5=85=A5=E5=AF=BC=E8=87=B4=E6=8A=A5=E9=94=99?= 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(+) 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 From cf00e7f0a1c5d76fd990f37e72f165391ff2d595 Mon Sep 17 00:00:00 2001 From: mysterywolf <920369182@qq.com> Date: Sat, 5 Sep 2020 18:10:30 +0800 Subject: [PATCH 08/23] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=20RT=5FUSING=5FPOSIX?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- include/libc/libc_limits.h | 4 ++++ include/libc/libc_stdio.h | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/include/libc/libc_limits.h b/include/libc/libc_limits.h index c2aa429229..32f7df1b1a 100644 --- a/include/libc/libc_limits.h +++ b/include/libc/libc_limits.h @@ -17,8 +17,12 @@ #include +#ifdef RT_USING_POSIX + #ifndef SSIZE_MAX # define SSIZE_MAX LONG_MAX #endif #endif + +#endif diff --git a/include/libc/libc_stdio.h b/include/libc/libc_stdio.h index 19d5fd4cc5..6201b85ea4 100644 --- a/include/libc/libc_stdio.h +++ b/include/libc/libc_stdio.h @@ -15,6 +15,10 @@ #ifndef LIBC_STDIO_H__ #define LIBC_STDIO_H__ +#ifdef RT_USING_POSIX + #include #endif + +#endif From 443978eb784e68c33b469e04f4105e87fdf2fa55 Mon Sep 17 00:00:00 2001 From: mysterywolf <920369182@qq.com> Date: Sat, 5 Sep 2020 19:47:34 +0800 Subject: [PATCH 09/23] =?UTF-8?q?=E5=A2=9E=E5=8A=A0RT=5FUSING=5FPOSIX=5FGE?= =?UTF-8?q?TLINE=E7=94=A8=E4=BA=8E=E5=8D=95=E7=8B=AC=E6=8E=A7=E5=88=B6?= =?UTF-8?q?=E6=98=AF=E5=90=A6=E5=90=AF=E7=94=A8getline=E5=87=BD=E6=95=B0?= =?UTF-8?q?=EF=BC=8C=E5=B9=B6=E4=BF=AE=E6=94=B9Kconfig=E5=A2=9E=E5=8A=A0?= =?UTF-8?q?=E5=AF=B9=E5=BA=94=E9=80=89=E9=A1=B9?= 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(-) 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 From 0d7d1fbbf78d5b6f75b28781d3c8c326da6b713b Mon Sep 17 00:00:00 2001 From: mysterywolf <920369182@qq.com> Date: Sat, 5 Sep 2020 22:05:16 +0800 Subject: [PATCH 10/23] =?UTF-8?q?=E4=BF=AE=E6=94=B9include/libc=E5=A4=B4?= =?UTF-8?q?=E6=96=87=E4=BB=B6=E7=89=88=E6=9D=83=E4=BF=A1=E6=81=AF=E6=A0=BC?= =?UTF-8?q?=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- include/libc/libc_fcntl.h | 4 ---- include/libc/libc_fdset.h | 4 ---- include/libc/libc_ioctl.h | 4 ---- include/libc/libc_limits.h | 4 ---- include/libc/libc_stdio.h | 4 ---- 5 files changed, 20 deletions(-) diff --git a/include/libc/libc_fcntl.h b/include/libc/libc_fcntl.h index 1b7c69b1f4..385ac7cd9f 100644 --- a/include/libc/libc_fcntl.h +++ b/include/libc/libc_fcntl.h @@ -2,10 +2,6 @@ * Copyright (c) 2006-2018, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 - */ - -/* - * File : libc_fcntl.h * * Change Logs: * Date Author Notes diff --git a/include/libc/libc_fdset.h b/include/libc/libc_fdset.h index ecd965cd22..b4d2e2189a 100644 --- a/include/libc/libc_fdset.h +++ b/include/libc/libc_fdset.h @@ -2,10 +2,6 @@ * Copyright (c) 2006-2018, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 - */ - -/* - * File : libc_errno.h * * Change Logs: * Date Author Notes diff --git a/include/libc/libc_ioctl.h b/include/libc/libc_ioctl.h index ef5a5257a8..42a21a2cea 100644 --- a/include/libc/libc_ioctl.h +++ b/include/libc/libc_ioctl.h @@ -2,10 +2,6 @@ * Copyright (c) 2006-2018, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 - */ - -/* - * File : libc_ioctl.h * * Change Logs: * Date Author Notes diff --git a/include/libc/libc_limits.h b/include/libc/libc_limits.h index 32f7df1b1a..2b49db97d9 100644 --- a/include/libc/libc_limits.h +++ b/include/libc/libc_limits.h @@ -2,10 +2,6 @@ * Copyright (c) 2006-2018, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 - */ - -/* - * File : libc_limits.h * * Change Logs: * Date Author Notes diff --git a/include/libc/libc_stdio.h b/include/libc/libc_stdio.h index 4a09f5c3d7..0550583630 100644 --- a/include/libc/libc_stdio.h +++ b/include/libc/libc_stdio.h @@ -2,10 +2,6 @@ * Copyright (c) 2006-2018, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 - */ - -/* - * File : libc_stdio.h * * Change Logs: * Date Author Notes From 05190990b49f10d31a1dce31fcb2d90e013dac4a Mon Sep 17 00:00:00 2001 From: mysterywolf <920369182@qq.com> Date: Sat, 5 Sep 2020 22:09:22 +0800 Subject: [PATCH 11/23] =?UTF-8?q?=E5=A2=9E=E5=8A=A0posix=5Fgetline.c/.h?= =?UTF-8?q?=E7=89=88=E6=9D=83=E4=BF=A1=E6=81=AF?= 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(+) 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 From 0eadf69f81b2f77eed0cf7a35acdf50c03cc48a4 Mon Sep 17 00:00:00 2001 From: mysterywolf <920369182@qq.com> Date: Sun, 6 Sep 2020 12:31:42 +0800 Subject: [PATCH 12/23] =?UTF-8?q?=E5=A2=9E=E5=8A=A0rtconfig.h=E5=A4=B4?= =?UTF-8?q?=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- include/libc/libc_limits.h | 1 + include/libc/libc_stdio.h | 2 ++ 2 files changed, 3 insertions(+) diff --git a/include/libc/libc_limits.h b/include/libc/libc_limits.h index 2b49db97d9..b8368160df 100644 --- a/include/libc/libc_limits.h +++ b/include/libc/libc_limits.h @@ -12,6 +12,7 @@ #define LIBC_LIMITS_H__ #include +#include #ifdef RT_USING_POSIX diff --git a/include/libc/libc_stdio.h b/include/libc/libc_stdio.h index 0550583630..85ba509852 100644 --- a/include/libc/libc_stdio.h +++ b/include/libc/libc_stdio.h @@ -11,6 +11,8 @@ #ifndef LIBC_STDIO_H__ #define LIBC_STDIO_H__ +#include + #ifdef RT_USING_POSIX_GETLINE #include From 237a71de278b16aa3df3e98f49714ef17cdf0c2b Mon Sep 17 00:00:00 2001 From: mysterywolf <920369182@qq.com> Date: Tue, 8 Sep 2020 10:26:03 +0800 Subject: [PATCH 13/23] =?UTF-8?q?=E4=BF=AE=E5=A4=8Dcommon=E6=96=87?= =?UTF-8?q?=E4=BB=B6=E5=A4=B9=EF=BC=8C=E8=AF=A5=E6=96=87=E4=BB=B6=E5=A4=B9?= =?UTF-8?q?=E4=B8=BAarmlibc/newlib/dlib=E7=9A=84=E5=85=B1=E5=90=8C?= =?UTF-8?q?=E6=96=87=E4=BB=B6=E7=9A=84=E6=96=87=E4=BB=B6=E5=A4=B9?= 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/readme.md | 1 + components/libc/compilers/common/sys/time.h | 26 ++---- .../compilers/{armlibc => common}/termios.h | 0 components/libc/compilers/common/time.c | 1 + .../compilers/{armlibc => common}/unistd.c | 0 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 ------- 11 files changed, 12 insertions(+), 193 deletions(-) create mode 100644 components/libc/compilers/common/readme.md rename components/libc/compilers/{armlibc => common}/termios.h (100%) rename components/libc/compilers/{armlibc => common}/unistd.c (100%) 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 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/armlibc/termios.h b/components/libc/compilers/common/termios.h similarity index 100% rename from components/libc/compilers/armlibc/termios.h rename to components/libc/compilers/common/termios.h 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/armlibc/unistd.c b/components/libc/compilers/common/unistd.c similarity index 100% rename from components/libc/compilers/armlibc/unistd.c rename to components/libc/compilers/common/unistd.c 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 From 5eccf51b61aadd6ad6b562d2762f601792a7bb55 Mon Sep 17 00:00:00 2001 From: mysterywolf <920369182@qq.com> Date: Tue, 8 Sep 2020 10:29:17 +0800 Subject: [PATCH 14/23] Signed-off-by: mysterywolf --- components/libc/compilers/common/readme.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 From f021cb982a1add837755af2c513ab17605a55f2d Mon Sep 17 00:00:00 2001 From: mysterywolf <920369182@qq.com> Date: Tue, 8 Sep 2020 10:52:02 +0800 Subject: [PATCH 15/23] =?UTF-8?q?=E4=BF=AE=E6=94=B9common=E4=B8=8B?= =?UTF-8?q?=E7=9A=84sconscript=E8=84=9A=E6=9C=AC=E6=96=87=E4=BB=B6?= =?UTF-8?q?=EF=BC=8C=E5=A2=9E=E5=8A=A0unistd.c=E6=8E=92=E9=99=A4=E6=9D=A1?= =?UTF-8?q?=E4=BB=B6?= 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(-) 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 From 0607ff84ab4cf9a8b6ed92ce17776bd852d9bc62 Mon Sep 17 00:00:00 2001 From: mysterywolf <920369182@qq.com> Date: Tue, 8 Sep 2020 11:12:56 +0800 Subject: [PATCH 16/23] =?UTF-8?q?=E8=A7=A3=E5=86=B3minilibc=20time.c?= =?UTF-8?q?=E5=92=8Cnewlibc=E4=BB=85=E5=AE=9A=E4=B9=89RT=5FLIBC=5FUSING=5F?= =?UTF-8?q?TIME=E6=97=B6=E5=86=B2=E7=AA=81=E7=9A=84=E9=97=AE=E9=A2=98?= 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(-) 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: From ff097f0467fb0041817846f2472343b7b9c098c4 Mon Sep 17 00:00:00 2001 From: mysterywolf <920369182@qq.com> Date: Tue, 8 Sep 2020 13:16:49 +0800 Subject: [PATCH 17/23] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=20=5F=5FGNUC=5F=5F?= =?UTF-8?q?=E5=AE=8F=E5=AE=9A=E4=B9=89=20=E5=92=8Csconscript=E7=9A=84?= =?UTF-8?q?=E5=B9=B3=E5=8F=B0=E8=AF=86=E5=88=AB=E4=BB=A5=E9=81=BF=E5=85=8D?= =?UTF-8?q?=E9=87=8D=E5=A4=8D=E5=AE=9A=E4=B9=89?= 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(-) 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 From a890c67fb4ef9e15d8f0e83e76cee12163c7e0c9 Mon Sep 17 00:00:00 2001 From: mysterywolf <920369182@qq.com> Date: Tue, 8 Sep 2020 13:39:40 +0800 Subject: [PATCH 18/23] =?UTF-8?q?=E5=A2=9E=E5=8A=A0lwip/cc.h=20LWIP=5FTIME?= =?UTF-8?q?VAL=5FPRIVATE=E6=98=AF=E8=83=BD=E4=B8=8E=E5=90=A6=E7=9A=84?= =?UTF-8?q?=E5=B9=B3=E5=8F=B0=E5=88=A4=E6=96=AD=E6=9D=A1=E4=BB=B6?= 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(-) 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 From 4e58b995df732861a1d7a43fd575d737433721bf Mon Sep 17 00:00:00 2001 From: mysterywolf <920369182@qq.com> Date: Tue, 8 Sep 2020 15:25:37 +0800 Subject: [PATCH 19/23] =?UTF-8?q?[bsp]=20=E4=BF=AE=E6=94=B9bsp/lpc408x?= =?UTF-8?q?=E9=BB=98=E8=AE=A4=E9=85=8D=E7=BD=AE=E6=96=87=E4=BB=B6=EF=BC=8C?= =?UTF-8?q?=E4=BD=BF=E8=83=BDlibc?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bsp/lpc408x/.config | 158 ++++++++++++++++++++++++++++++++++------- bsp/lpc408x/rtconfig.h | 17 ++--- 2 files changed, 139 insertions(+), 36 deletions(-) diff --git a/bsp/lpc408x/.config b/bsp/lpc408x/.config index 5c079205e1..c57e7eb755 100644 --- a/bsp/lpc408x/.config +++ b/bsp/lpc408x/.config @@ -7,6 +7,7 @@ # RT-Thread Kernel # CONFIG_RT_NAME_MAX=8 +# CONFIG_RT_USING_ARCH_DATA_TYPE is not set # CONFIG_RT_USING_SMP is not set CONFIG_RT_ALIGN_SIZE=4 # CONFIG_RT_THREAD_PRIORITY_8 is not set @@ -63,8 +64,9 @@ CONFIG_RT_USING_DEVICE=y CONFIG_RT_USING_CONSOLE=y CONFIG_RT_CONSOLEBUF_SIZE=128 CONFIG_RT_CONSOLE_DEVICE_NAME="uart0" -CONFIG_RT_VER_NUM=0x40001 +CONFIG_RT_VER_NUM=0x40003 CONFIG_ARCH_ARM=y +CONFIG_RT_USING_CPU_FFS=y CONFIG_ARCH_ARM_CORTEX_M=y CONFIG_ARCH_ARM_CORTEX_M4=y # CONFIG_ARCH_CPU_STACK_GROWS_UPWARD is not set @@ -138,6 +140,7 @@ CONFIG_RT_USING_DFS_DEVFS=y # CONFIG_RT_USING_DEVICE_IPC=y CONFIG_RT_PIPE_BUFSZ=512 +# CONFIG_RT_USING_SYSTEM_WORKQUEUE is not set CONFIG_RT_USING_SERIAL=y CONFIG_RT_SERIAL_USING_DMA=y CONFIG_RT_SERIAL_RB_BUFSZ=64 @@ -147,10 +150,10 @@ CONFIG_RT_SERIAL_RB_BUFSZ=64 # CONFIG_RT_USING_I2C is not set CONFIG_RT_USING_PIN=y # CONFIG_RT_USING_ADC is not set +# CONFIG_RT_USING_DAC is not set # CONFIG_RT_USING_PWM is not set # CONFIG_RT_USING_MTD_NOR is not set # CONFIG_RT_USING_MTD_NAND is not set -# CONFIG_RT_USING_MTD is not set # CONFIG_RT_USING_PM is not set # CONFIG_RT_USING_RTC is not set # CONFIG_RT_USING_SDIO is not set @@ -158,10 +161,10 @@ CONFIG_RT_USING_PIN=y # CONFIG_RT_USING_WDT is not set # CONFIG_RT_USING_AUDIO is not set # CONFIG_RT_USING_SENSOR is not set - -# -# Using WiFi -# +# CONFIG_RT_USING_TOUCH is not set +# CONFIG_RT_USING_HWCRYPTO is not set +# CONFIG_RT_USING_PULSE_ENCODER is not set +# CONFIG_RT_USING_INPUT_CAPTURE is not set # CONFIG_RT_USING_WIFI is not set # @@ -173,8 +176,14 @@ CONFIG_RT_USING_PIN=y # # POSIX layer and C standard library # -# CONFIG_RT_USING_LIBC is not set +CONFIG_RT_USING_LIBC=y # 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 # # Network @@ -185,18 +194,15 @@ CONFIG_RT_USING_PIN=y # # CONFIG_RT_USING_SAL is not set +# +# Network interface device +# +# CONFIG_RT_USING_NETDEV is not set + # # light weight TCP/IP stack # # CONFIG_RT_USING_LWIP is not set -# CONFIG_RT_USING_LWIP141 is not set -# CONFIG_RT_USING_LWIP202 is not set -# CONFIG_RT_USING_LWIP210 is not set - -# -# Modbus master and slave stack -# -# CONFIG_RT_USING_MODBUS is not set # # AT commands @@ -211,16 +217,9 @@ CONFIG_RT_USING_PIN=y # # Utilities # -# CONFIG_RT_USING_LOGTRACE is not set # CONFIG_RT_USING_RYM is not set # CONFIG_RT_USING_ULOG is not set # CONFIG_RT_USING_UTEST is not set - -# -# ARM CMSIS -# -# CONFIG_RT_USING_CMSIS_OS is not set -# CONFIG_RT_USING_RTT_CMSIS is not set # CONFIG_RT_USING_LWP is not set # @@ -230,13 +229,20 @@ CONFIG_RT_USING_PIN=y # # IoT - internet of things # +# CONFIG_PKG_USING_LORAWAN_DRIVER is not set # CONFIG_PKG_USING_PAHOMQTT is not set +# CONFIG_PKG_USING_UMQTT is not set # CONFIG_PKG_USING_WEBCLIENT is not set # CONFIG_PKG_USING_WEBNET is not set # CONFIG_PKG_USING_MONGOOSE is not set +# CONFIG_PKG_USING_MYMQTT is not set +# CONFIG_PKG_USING_KAWAII_MQTT is not set +# CONFIG_PKG_USING_BC28_MQTT is not set # CONFIG_PKG_USING_WEBTERMINAL is not set # CONFIG_PKG_USING_CJSON is not set # CONFIG_PKG_USING_JSMN is not set +# CONFIG_PKG_USING_LIBMODBUS is not set +# CONFIG_PKG_USING_FREEMODBUS is not set # CONFIG_PKG_USING_LJSON is not set # CONFIG_PKG_USING_EZXML is not set # CONFIG_PKG_USING_NANOPB is not set @@ -254,10 +260,14 @@ CONFIG_RT_USING_PIN=y # Wiced WiFi # # CONFIG_PKG_USING_WLAN_WICED is not set +# CONFIG_PKG_USING_RW007 is not set # CONFIG_PKG_USING_COAP is not set # CONFIG_PKG_USING_NOPOLL is not set # CONFIG_PKG_USING_NETUTILS is not set +# CONFIG_PKG_USING_CMUX is not set +# CONFIG_PKG_USING_PPP_DEVICE is not set # CONFIG_PKG_USING_AT_DEVICE is not set +# CONFIG_PKG_USING_ATSRV_SOCKET is not set # CONFIG_PKG_USING_WIZNET is not set # @@ -267,7 +277,29 @@ CONFIG_RT_USING_PIN=y # CONFIG_PKG_USING_GAGENT_CLOUD is not set # CONFIG_PKG_USING_ALI_IOTKIT is not set # CONFIG_PKG_USING_AZURE is not set -# CONFIG_PKG_USING_TENCENT_IOTKIT is not set +# CONFIG_PKG_USING_TENCENT_IOT_EXPLORER is not set +# CONFIG_PKG_USING_JIOT-C-SDK is not set +# CONFIG_PKG_USING_UCLOUD_IOT_SDK is not set +# CONFIG_PKG_USING_JOYLINK is not set +# CONFIG_PKG_USING_NIMBLE is not set +# CONFIG_PKG_USING_OTA_DOWNLOADER is not set +# CONFIG_PKG_USING_IPMSG is not set +# CONFIG_PKG_USING_LSSDP is not set +# CONFIG_PKG_USING_AIRKISS_OPEN is not set +# CONFIG_PKG_USING_LIBRWS is not set +# CONFIG_PKG_USING_TCPSERVER is not set +# CONFIG_PKG_USING_PROTOBUF_C is not set +# CONFIG_PKG_USING_ONNX_PARSER is not set +# CONFIG_PKG_USING_ONNX_BACKEND is not set +# CONFIG_PKG_USING_DLT645 is not set +# CONFIG_PKG_USING_QXWZ is not set +# CONFIG_PKG_USING_SMTP_CLIENT is not set +# CONFIG_PKG_USING_ABUP_FOTA is not set +# CONFIG_PKG_USING_LIBCURL2RTT is not set +# CONFIG_PKG_USING_CAPNP is not set +# CONFIG_PKG_USING_RT_CJSON_TOOLS is not set +# CONFIG_PKG_USING_AGILE_TELNET is not set +# CONFIG_PKG_USING_NMEALIB is not set # # security packages @@ -275,6 +307,8 @@ CONFIG_RT_USING_PIN=y # CONFIG_PKG_USING_MBEDTLS is not set # CONFIG_PKG_USING_libsodium is not set # CONFIG_PKG_USING_TINYCRYPT is not set +# CONFIG_PKG_USING_TFM is not set +# CONFIG_PKG_USING_YD_CRYPTO is not set # # language packages @@ -288,6 +322,9 @@ CONFIG_RT_USING_PIN=y # # CONFIG_PKG_USING_OPENMV is not set # CONFIG_PKG_USING_MUPDF is not set +# CONFIG_PKG_USING_STEMWIN is not set +# CONFIG_PKG_USING_WAVPLAYER is not set +# CONFIG_PKG_USING_TJPGD is not set # # tools packages @@ -299,6 +336,15 @@ CONFIG_RT_USING_PIN=y # CONFIG_PKG_USING_RDB is not set # CONFIG_PKG_USING_QRCODE is not set # CONFIG_PKG_USING_ULOG_EASYFLASH is not set +# CONFIG_PKG_USING_ADBD is not set +# CONFIG_PKG_USING_COREMARK is not set +# CONFIG_PKG_USING_DHRYSTONE is not set +# CONFIG_PKG_USING_NR_MICRO_SHELL is not set +# CONFIG_PKG_USING_CHINESE_FONT_LIBRARY is not set +# CONFIG_PKG_USING_LUNAR_CALENDAR is not set +# CONFIG_PKG_USING_BS8116A is not set +# CONFIG_PKG_USING_GPS_RMC is not set +# CONFIG_PKG_USING_URLENCODE is not set # # system packages @@ -310,27 +356,74 @@ CONFIG_RT_USING_PIN=y # CONFIG_PKG_USING_LWEXT4 is not set # CONFIG_PKG_USING_PARTITION is not set # CONFIG_PKG_USING_FAL is not set +# CONFIG_PKG_USING_FLASHDB is not set # CONFIG_PKG_USING_SQLITE is not set # CONFIG_PKG_USING_RTI is not set # CONFIG_PKG_USING_LITTLEVGL2RTT is not set # CONFIG_PKG_USING_CMSIS is not set # CONFIG_PKG_USING_DFS_YAFFS is not set # CONFIG_PKG_USING_LITTLEFS is not set +# CONFIG_PKG_USING_THREAD_POOL is not set +# CONFIG_PKG_USING_ROBOTS is not set +# CONFIG_PKG_USING_EV is not set +# CONFIG_PKG_USING_SYSWATCH is not set +# CONFIG_PKG_USING_SYS_LOAD_MONITOR is not set +# CONFIG_PKG_USING_PLCCORE is not set +# CONFIG_PKG_USING_RAMDISK is not set +# CONFIG_PKG_USING_MININI is not set +# CONFIG_PKG_USING_QBOOT is not set +# CONFIG_PKG_USING_UCOSIII_WRAPPER is not set # # peripheral libraries and drivers # +# CONFIG_PKG_USING_SENSORS_DRIVERS is not set # CONFIG_PKG_USING_REALTEK_AMEBA is not set # CONFIG_PKG_USING_SHT2X is not set -# CONFIG_PKG_USING_AHT10 is not set -# CONFIG_PKG_USING_AP3216C is not set +# CONFIG_PKG_USING_SHT3X is not set # CONFIG_PKG_USING_STM32_SDIO is not set # CONFIG_PKG_USING_ICM20608 is not set # CONFIG_PKG_USING_U8G2 is not set # CONFIG_PKG_USING_BUTTON is not set -# CONFIG_PKG_USING_MPU6XXX is not set # CONFIG_PKG_USING_PCF8574 is not set +# CONFIG_PKG_USING_SX12XX is not set +# CONFIG_PKG_USING_SIGNAL_LED is not set +# CONFIG_PKG_USING_LEDBLINK is not set +# CONFIG_PKG_USING_LITTLED is not set +# CONFIG_PKG_USING_LKDGUI is not set +# CONFIG_PKG_USING_NRF5X_SDK is not set +# CONFIG_PKG_USING_NRFX is not set +# CONFIG_PKG_USING_WM_LIBRARIES is not set # CONFIG_PKG_USING_KENDRYTE_SDK is not set +# CONFIG_PKG_USING_INFRARED is not set +# CONFIG_PKG_USING_ROSSERIAL is not set +# CONFIG_PKG_USING_AGILE_BUTTON is not set +# CONFIG_PKG_USING_AGILE_LED is not set +# CONFIG_PKG_USING_AT24CXX is not set +# CONFIG_PKG_USING_MOTIONDRIVER2RTT is not set +# CONFIG_PKG_USING_AD7746 is not set +# CONFIG_PKG_USING_PCA9685 is not set +# CONFIG_PKG_USING_I2C_TOOLS is not set +# CONFIG_PKG_USING_NRF24L01 is not set +# CONFIG_PKG_USING_TOUCH_DRIVERS is not set +# CONFIG_PKG_USING_MAX17048 is not set +# CONFIG_PKG_USING_RPLIDAR is not set +# CONFIG_PKG_USING_AS608 is not set +# CONFIG_PKG_USING_RC522 is not set +# CONFIG_PKG_USING_WS2812B is not set +# CONFIG_PKG_USING_EMBARC_BSP is not set +# CONFIG_PKG_USING_EXTERN_RTC_DRIVERS is not set +# CONFIG_PKG_USING_MULTI_RTIMER is not set +# CONFIG_PKG_USING_MAX7219 is not set +# CONFIG_PKG_USING_BEEP is not set +# CONFIG_PKG_USING_EASYBLINK is not set +# CONFIG_PKG_USING_PMS_SERIES is not set +# CONFIG_PKG_USING_CAN_YMODEM is not set +# CONFIG_PKG_USING_LORA_RADIO_DRIVER is not set +# CONFIG_PKG_USING_QLED is not set +# CONFIG_PKG_USING_PAJ7620 is not set +# CONFIG_PKG_USING_AGILE_CONSOLE is not set +# CONFIG_PKG_USING_LD3320 is not set # # miscellaneous packages @@ -341,11 +434,15 @@ CONFIG_RT_USING_PIN=y # CONFIG_PKG_USING_MINILZO is not set # CONFIG_PKG_USING_QUICKLZ is not set # CONFIG_PKG_USING_MULTIBUTTON is not set +# CONFIG_PKG_USING_FLEXIBLE_BUTTON is not set # CONFIG_PKG_USING_CANFESTIVAL is not set # CONFIG_PKG_USING_ZLIB is not set # CONFIG_PKG_USING_DSTR is not set # CONFIG_PKG_USING_TINYFRAME is not set # CONFIG_PKG_USING_KENDRYTE_DEMO is not set +# CONFIG_PKG_USING_DIGITALCTRL is not set +# CONFIG_PKG_USING_UPACKER is not set +# CONFIG_PKG_USING_UPARAM is not set # # samples: kernel and components samples @@ -356,6 +453,15 @@ CONFIG_RT_USING_PIN=y # CONFIG_PKG_USING_PERIPHERAL_SAMPLES is not set # CONFIG_PKG_USING_HELLO is not set # CONFIG_PKG_USING_VI is not set +# CONFIG_PKG_USING_NNOM is not set +# CONFIG_PKG_USING_LIBANN is not set +# CONFIG_PKG_USING_ELAPACK is not set +# CONFIG_PKG_USING_ARMv7M_DWT is not set +# CONFIG_PKG_USING_VT100 is not set +# CONFIG_PKG_USING_ULAPACK is not set +# CONFIG_PKG_USING_UKAL is not set +# CONFIG_PKG_USING_CRCLIB is not set +# CONFIG_PKG_USING_THREES is not set CONFIG_SOC_LPC4088=y # diff --git a/bsp/lpc408x/rtconfig.h b/bsp/lpc408x/rtconfig.h index 536e3712e7..d5e0c160be 100644 --- a/bsp/lpc408x/rtconfig.h +++ b/bsp/lpc408x/rtconfig.h @@ -40,8 +40,9 @@ #define RT_USING_CONSOLE #define RT_CONSOLEBUF_SIZE 128 #define RT_CONSOLE_DEVICE_NAME "uart0" -#define RT_VER_NUM 0x40001 +#define RT_VER_NUM 0x40003 #define ARCH_ARM +#define RT_USING_CPU_FFS #define ARCH_ARM_CORTEX_M #define ARCH_ARM_CORTEX_M4 @@ -101,26 +102,25 @@ #define RT_SERIAL_RB_BUFSZ 64 #define RT_USING_PIN -/* Using WiFi */ - - /* Using USB */ /* POSIX layer and C standard library */ +#define RT_USING_LIBC +#define RT_USING_POSIX /* Network */ /* Socket abstraction layer */ +/* Network interface device */ + + /* light weight TCP/IP stack */ -/* Modbus master and slave stack */ - - /* AT commands */ @@ -130,9 +130,6 @@ /* Utilities */ -/* ARM CMSIS */ - - /* RT-Thread online packages */ /* IoT - internet of things */ From 4305a678a38d65712d739f0d79bf55dc05e33073 Mon Sep 17 00:00:00 2001 From: mysterywolf <920369182@qq.com> Date: Tue, 8 Sep 2020 16:29:47 +0800 Subject: [PATCH 20/23] =?UTF-8?q?=E4=BF=AE=E6=94=B9common=E6=96=87?= =?UTF-8?q?=E4=BB=B6=E5=A4=B9=E7=9A=84sconscript=20=E5=B9=B6=20=E5=8F=96?= =?UTF-8?q?=E6=B6=88=E5=B9=B6=E6=81=A2=E5=A4=8D=E4=B8=8A=E4=B8=80=E4=B8=AA?= =?UTF-8?q?commit=E7=9A=84=E6=8F=90=E4=BA=A4=E5=86=85=E5=AE=B9?= 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(-) 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') From b9b15f89a04edeaa285f410b7193951d243521bf Mon Sep 17 00:00:00 2001 From: mysterywolf <920369182@qq.com> Date: Tue, 8 Sep 2020 16:42:58 +0800 Subject: [PATCH 21/23] =?UTF-8?q?[bsp][efm32]=20=E5=A2=9E=E5=8A=A0RT=5FLIB?= =?UTF-8?q?C=5FUSING=5FTIME?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bsp/efm32/rtconfig.h | 1 + 1 file changed, 1 insertion(+) diff --git a/bsp/efm32/rtconfig.h b/bsp/efm32/rtconfig.h index 4ee9bf1a8e..040f07fa02 100644 --- a/bsp/efm32/rtconfig.h +++ b/bsp/efm32/rtconfig.h @@ -213,6 +213,7 @@ /* SECTION: Runtime library */ // #define RT_USING_NOLIBC // #define RT_USING_NEWLIB +#define RT_LIBC_USING_TIME /* SECTION: Console options */ #define RT_USING_CONSOLE From 28e0c99d0032111add7fadee7834043c332feb79 Mon Sep 17 00:00:00 2001 From: mysterywolf <920369182@qq.com> Date: Wed, 9 Sep 2020 00:53:53 +0800 Subject: [PATCH 22/23] Signed-off-by: mysterywolf --- components/libc/compilers/common/SConscript | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 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) From b3ab8a99e10f68042a3f2cba11e130004aa124e4 Mon Sep 17 00:00:00 2001 From: mysterywolf <920369182@qq.com> Date: Wed, 9 Sep 2020 08:59:39 +0800 Subject: [PATCH 23/23] Signed-off-by: mysterywolf --- components/libc/compilers/common/SConscript | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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)