summaryrefslogtreecommitdiff
path: root/components/libc/compilers
diff options
context:
space:
mode:
authortmmdh <[email protected]>2021-01-20 18:45:20 +0800
committertmmdh <[email protected]>2021-01-20 18:45:20 +0800
commit9db4d446382426d215ffe79f60920c98a8b1be53 (patch)
treea3bd61199194d5f8251bf7ee889e22baedf5dc31 /components/libc/compilers
parent55c0a9f27900d19556d52110be6397f3ee15a6c3 (diff)
parentafd575105d2fdd29fb003fb49c6e4f5446f824ce (diff)
Merge branch 'master' of https://github.com/RT-Thread/rt-thread
Diffstat (limited to 'components/libc/compilers')
-rw-r--r--components/libc/compilers/armlibc/README.md9
-rw-r--r--components/libc/compilers/armlibc/sys/types.h14
-rw-r--r--components/libc/compilers/armlibc/sys/unistd.h7
-rw-r--r--components/libc/compilers/common/readme.md2
-rw-r--r--components/libc/compilers/common/sys/time.h6
-rw-r--r--components/libc/compilers/common/termios.h2
-rw-r--r--components/libc/compilers/dlib/README.md7
-rw-r--r--components/libc/compilers/dlib/SConscript2
-rw-r--r--components/libc/compilers/dlib/sys/types.h13
-rw-r--r--components/libc/compilers/dlib/sys/unistd.h7
-rw-r--r--components/libc/compilers/newlib/README.md9
-rw-r--r--components/libc/compilers/newlib/SConscript2
12 files changed, 63 insertions, 17 deletions
diff --git a/components/libc/compilers/armlibc/README.md b/components/libc/compilers/armlibc/README.md
new file mode 100644
index 0000000000..4d2a73b6be
--- /dev/null
+++ b/components/libc/compilers/armlibc/README.md
@@ -0,0 +1,9 @@
+# ARMLIB (Keil-MDK) porting for RT-Thread
+
+Please define RT_USING_LIBC and compile RT-Thread with Keil-MDK compiler.
+
+
+
+## More Information
+
+https://www.keil.com/support/man/docs/armlib/ \ No newline at end of file
diff --git a/components/libc/compilers/armlibc/sys/types.h b/components/libc/compilers/armlibc/sys/types.h
index 2aad77c99d..78fee1bb99 100644
--- a/components/libc/compilers/armlibc/sys/types.h
+++ b/components/libc/compilers/armlibc/sys/types.h
@@ -5,20 +5,22 @@
*
* Change Logs:
* Date Author Notes
- * 2020-09-05 Meco Man fix bugs
+ * 2020-09-05 Meco Man fix bugs
+ * 2020-12-16 Meco Man add useconds_t
*/
#ifndef __TYPES_H__
#define __TYPES_H__
#include <stdint.h>
-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. */
+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. */
+typedef signed int ssize_t; /* Used for a count of bytes or an error indication. */
#else
-typedef long signed int ssize_t; /* Used for a count of bytes or an error indication. */
+typedef long signed int ssize_t; /* Used for a count of bytes or an error indication. */
#endif
+typedef unsigned long useconds_t; /* microseconds (unsigned) */
#endif
diff --git a/components/libc/compilers/armlibc/sys/unistd.h b/components/libc/compilers/armlibc/sys/unistd.h
index 524de2cf83..73a73a267e 100644
--- a/components/libc/compilers/armlibc/sys/unistd.h
+++ b/components/libc/compilers/armlibc/sys/unistd.h
@@ -5,11 +5,13 @@
*
* Change Logs:
* Date Author Notes
+ * 2020-12-16 Meco Man add usleep
*/
#ifndef _SYS_UNISTD_H
#define _SYS_UNISTD_H
-#include <rtthread.h>
+#include <rtconfig.h>
+#include "types.h"
#ifdef RT_USING_DFS
@@ -68,4 +70,7 @@
int isatty (int fd);
char * ttyname (int desc);
+unsigned int sleep(unsigned int seconds);
+int usleep(useconds_t usec);
+
#endif /* _SYS_UNISTD_H */
diff --git a/components/libc/compilers/common/readme.md b/components/libc/compilers/common/readme.md
index 0cd56272ff..99797d933c 100644
--- a/components/libc/compilers/common/readme.md
+++ b/components/libc/compilers/common/readme.md
@@ -1,4 +1,4 @@
-# Attention :
+## Attentions
1. This folder is "common" for armlibc newlibc and dlib. It's not "common" for minilibc.
diff --git a/components/libc/compilers/common/sys/time.h b/components/libc/compilers/common/sys/time.h
index 22f1c17f5e..28a977c1f9 100644
--- a/components/libc/compilers/common/sys/time.h
+++ b/components/libc/compilers/common/sys/time.h
@@ -36,6 +36,12 @@ struct timeval {
};
#endif /* _TIMEVAL_DEFINED */
+#if !defined __GNUC__ && !defined __ICCARM__
+struct timespec {
+ time_t tv_sec; /* seconds */
+ long tv_nsec; /* and nanoseconds */
+};
+#endif
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
index ee2b4d5718..414d0c0cb3 100644
--- a/components/libc/compilers/common/termios.h
+++ b/components/libc/compilers/common/termios.h
@@ -9,6 +9,8 @@
#ifndef _TERMIOS_H__
#define _TERMIOS_H__
+#include <rtconfig.h>
+
#ifdef RT_USING_POSIX_TERMIOS
#include <sys/types.h>
#include <posix_termios.h>
diff --git a/components/libc/compilers/dlib/README.md b/components/libc/compilers/dlib/README.md
index 846eb3f5c0..acd08f9074 100644
--- a/components/libc/compilers/dlib/README.md
+++ b/components/libc/compilers/dlib/README.md
@@ -1,4 +1,9 @@
-Dlib(IAR) porting for RT-Thread.
+# DLIB (IAR) porting for RT-Thread
Please define RT_USING_LIBC and compile RT-Thread with IAR compiler.
+
+
+## More Information
+
+http://www.iarsys.co.jp/download/LMS2/arm/7502/ewarm7502doc/arm/doc/EWARM_DevelopmentGuide.ENU.pdf P.130 \ No newline at end of file
diff --git a/components/libc/compilers/dlib/SConscript b/components/libc/compilers/dlib/SConscript
index 456b762496..75a5812fab 100644
--- a/components/libc/compilers/dlib/SConscript
+++ b/components/libc/compilers/dlib/SConscript
@@ -20,7 +20,7 @@ if rtconfig.PLATFORM == 'iar':
if LooseVersion(IARVersion()) < LooseVersion("8.20.1"):
CPPDEFINES = CPPDEFINES + ['_DLIB_THREAD_SUPPORT']
- group = DefineGroup('dlib', src, depend = ['RT_USING_LIBC'],
+ group = DefineGroup('libc', src, depend = ['RT_USING_LIBC'],
CPPPATH = CPPPATH, CPPDEFINES = CPPDEFINES)
Return('group')
diff --git a/components/libc/compilers/dlib/sys/types.h b/components/libc/compilers/dlib/sys/types.h
index 001ace4dd2..7dbeddcaa9 100644
--- a/components/libc/compilers/dlib/sys/types.h
+++ b/components/libc/compilers/dlib/sys/types.h
@@ -5,20 +5,21 @@
*
* Change Logs:
* Date Author Notes
+ * 2020-12-16 Meco Man add useconds_t
*/
#ifndef __TYPES_H__
#define __TYPES_H__
#include <stdint.h>
-#include <rtthread.h>
-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. */
+typedef signed int ssize_t; /* Used for a count of bytes or an error indication. */
#else
-typedef long signed int ssize_t; /* Used for a count of bytes or an error indication. */
+typedef long signed int ssize_t; /* Used for a count of bytes or an error indication. */
#endif
+typedef unsigned long useconds_t; /* microseconds (unsigned) */
#endif
diff --git a/components/libc/compilers/dlib/sys/unistd.h b/components/libc/compilers/dlib/sys/unistd.h
index 9564daba8d..6d99cd6c55 100644
--- a/components/libc/compilers/dlib/sys/unistd.h
+++ b/components/libc/compilers/dlib/sys/unistd.h
@@ -5,10 +5,14 @@
*
* Change Logs:
* Date Author Notes
+ * 2020-12-16 Meco Man add usleep
*/
#ifndef _SYS_UNISTD_H
#define _SYS_UNISTD_H
+#include <rtconfig.h>
+#include "types.h"
+
#ifdef RT_USING_DFS
#define STDIN_FILENO 0 /* standard input file descriptor */
@@ -40,4 +44,7 @@
int isatty (int fd);
char * ttyname (int desc);
+unsigned int sleep(unsigned int seconds);
+int usleep(useconds_t usec);
+
#endif /* _SYS_UNISTD_H */
diff --git a/components/libc/compilers/newlib/README.md b/components/libc/compilers/newlib/README.md
new file mode 100644
index 0000000000..385f329a4f
--- /dev/null
+++ b/components/libc/compilers/newlib/README.md
@@ -0,0 +1,9 @@
+# NEWLIB (GCC) porting for RT-Thread
+
+Please define RT_USING_LIBC and compile RT-Thread with GCC compiler.
+
+
+
+## More Information
+
+https://sourceware.org/newlib/libc.html#Reentrancy \ No newline at end of file
diff --git a/components/libc/compilers/newlib/SConscript b/components/libc/compilers/newlib/SConscript
index 06e5faad09..d0868bbdea 100644
--- a/components/libc/compilers/newlib/SConscript
+++ b/components/libc/compilers/newlib/SConscript
@@ -15,7 +15,7 @@ CPPDEFINES = ['RT_USING_NEWLIB']
LIBS = ['c', 'm']
if rtconfig.PLATFORM == 'gcc':
- group = DefineGroup('newlib', src, depend = ['RT_USING_LIBC'],
+ group = DefineGroup('libc', src, depend = ['RT_USING_LIBC'],
CPPPATH = CPPPATH, CPPDEFINES = CPPDEFINES, LIBS = LIBS)
Return('group')