summaryrefslogtreecommitdiff
path: root/components/libc/compilers/dlib
diff options
context:
space:
mode:
authorcliff-cmc <[email protected]>2021-02-26 11:09:27 +0800
committerCliff Chen <[email protected]>2021-02-26 11:45:19 +0800
commiteea0c3d74a40f73235da45c6f77e8b411ac94cf2 (patch)
treea6906f1aed7118ab53dbe18f2ee4727a754583af /components/libc/compilers/dlib
parent1a9ecf27f31277750d92c921b62503f75275e122 (diff)
parentfae0fa8eea4c0e797940bf1eddc8ee6c1711734a (diff)
Add memtrace command for memheap.c
Diffstat (limited to 'components/libc/compilers/dlib')
-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.h15
-rw-r--r--components/libc/compilers/dlib/sys/unistd.h18
-rw-r--r--components/libc/compilers/dlib/syscall_remove.c10
-rw-r--r--components/libc/compilers/dlib/syscalls.c25
-rw-r--r--components/libc/compilers/dlib/syscalls.h10
-rw-r--r--components/libc/compilers/dlib/termios.h15
8 files changed, 64 insertions, 38 deletions
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..3af15ba251 100644
--- a/components/libc/compilers/dlib/sys/types.h
+++ b/components/libc/compilers/dlib/sys/types.h
@@ -5,20 +5,23 @@
*
* 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 int pid_t; /* Used for process IDs and process group IDs. */
+typedef unsigned short uid_t;
+typedef unsigned short gid_t;
#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 29f68f24f8..5b86822635 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 */
@@ -36,4 +40,18 @@
#endif
+
+int isatty (int fd);
+char * ttyname (int desc);
+
+unsigned int sleep(unsigned int seconds);
+int usleep(useconds_t usec);
+
+pid_t getpid(void);
+pid_t getppid(void);
+uid_t getuid(void);
+uid_t geteuid(void);
+gid_t getgid(void);
+gid_t getegid(void);
+
#endif /* _SYS_UNISTD_H */
diff --git a/components/libc/compilers/dlib/syscall_remove.c b/components/libc/compilers/dlib/syscall_remove.c
index e7f0268b1b..f7e64d1997 100644
--- a/components/libc/compilers/dlib/syscall_remove.c
+++ b/components/libc/compilers/dlib/syscall_remove.c
@@ -9,16 +9,16 @@
*/
#include <rtthread.h>
#ifdef RT_USING_DFS
-#include <dfs_file.h>
+#include <dfs_posix.h>
#endif
#include <yfuns.h>
#pragma module_name = "?remove"
int remove(const char *val)
{
-#ifdef RT_USING_DFS
- dfs_file_unlink(val);
+#ifndef RT_USING_DFS
+ return -1;
+#else
+ return unlink(val);
#endif
-
- return 0;
}
diff --git a/components/libc/compilers/dlib/syscalls.c b/components/libc/compilers/dlib/syscalls.c
new file mode 100644
index 0000000000..007ea76bd1
--- /dev/null
+++ b/components/libc/compilers/dlib/syscalls.c
@@ -0,0 +1,25 @@
+/*
+ * Copyright (c) 2006-2018, RT-Thread Development Team
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ *
+ * Change Logs:
+ * Date Author Notes
+ * 2021-02-13 Meco Man implement exit() and abort()
+ * 2021-02-20 Meco Man add system()
+ */
+#include <rtthread.h>
+
+/* for exit() and abort() */
+void __exit (int status)
+{
+ extern void __rt_libc_exit(int status);
+ __rt_libc_exit(status);
+ while(1);
+}
+
+int system(const char * string)
+{
+ extern int __rt_libc_system(const char *string);
+ return __rt_libc_system(string);
+}
diff --git a/components/libc/compilers/dlib/syscalls.h b/components/libc/compilers/dlib/syscalls.h
deleted file mode 100644
index 993962e8db..0000000000
--- a/components/libc/compilers/dlib/syscalls.h
+++ /dev/null
@@ -1,10 +0,0 @@
-/*
- * Copyright (c) 2006-2018, RT-Thread Development Team
- *
- * SPDX-License-Identifier: Apache-2.0
- *
- * Change Logs:
- * Date Author Notes
- * 2015-01-28 Bernard first version
- */
-
diff --git a/components/libc/compilers/dlib/termios.h b/components/libc/compilers/dlib/termios.h
deleted file mode 100644
index 1956121225..0000000000
--- a/components/libc/compilers/dlib/termios.h
+++ /dev/null
@@ -1,15 +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__
-
-#include <sys/types.h>
-#include <posix_termios.h>
-
-#endif