summaryrefslogtreecommitdiff
path: root/components
diff options
context:
space:
mode:
Diffstat (limited to 'components')
-rw-r--r--components/dfs/SConscript2
-rw-r--r--components/dfs/include/dfs.h10
-rw-r--r--components/dfs/include/dfs_poll.h33
-rw-r--r--components/dfs/include/dfs_posix.h55
-rw-r--r--components/dfs/include/dfs_select.h11
-rw-r--r--components/dfs/src/dfs_poll.c (renamed from components/dfs/src/poll.c)2
-rw-r--r--components/dfs/src/dfs_posix.c12
-rw-r--r--components/dfs/src/dfs_select.c (renamed from components/dfs/src/select.c)2
-rw-r--r--components/drivers/can/can.c3
-rw-r--r--components/drivers/include/drivers/cputime.h2
-rw-r--r--components/drivers/include/drivers/pm.h1
-rw-r--r--components/drivers/include/drivers/serial.h7
-rw-r--r--components/drivers/include/ipc/ringblk_buf.h5
-rw-r--r--components/drivers/phy/phy.c2
-rw-r--r--components/drivers/rtc/alarm.c2
-rw-r--r--components/drivers/rtc/rtc.c7
-rw-r--r--components/drivers/serial/serial.c4
-rw-r--r--components/drivers/serial/serial_v2.c2
-rw-r--r--components/drivers/src/pipe.c2
-rw-r--r--components/drivers/src/ringblk_buf.c4
-rw-r--r--components/drivers/wlan/wlan_cmd.c2
-rw-r--r--components/finsh/Kconfig4
-rw-r--r--components/finsh/finsh.h16
-rw-r--r--components/libc/compilers/armlibc/libc.c5
-rw-r--r--components/libc/compilers/armlibc/mem_std.c3
-rw-r--r--components/libc/compilers/common/fcntl.h72
-rw-r--r--components/libc/compilers/common/nogcc/SConscript (renamed from components/libc/compilers/common/none-gcc/SConscript)0
-rw-r--r--components/libc/compilers/common/nogcc/readme.md (renamed from components/libc/compilers/common/none-gcc/readme.md)0
-rw-r--r--components/libc/compilers/common/nogcc/sys/errno.h (renamed from components/libc/compilers/common/none-gcc/sys/errno.h)0
-rw-r--r--components/libc/compilers/common/nogcc/sys/select.h (renamed from components/libc/compilers/common/sys/select.h)3
-rw-r--r--components/libc/compilers/common/nogcc/sys/stat.h83
-rw-r--r--components/libc/compilers/common/nogcc/sys/types.h (renamed from components/libc/compilers/common/none-gcc/sys/types.h)0
-rw-r--r--components/libc/compilers/common/nogcc/sys/unistd.h45
-rw-r--r--components/libc/compilers/common/nogcc/unistd.h (renamed from components/libc/compilers/common/none-gcc/unistd.h)0
-rw-r--r--components/libc/compilers/common/none-gcc/sys/stat.h13
-rw-r--r--components/libc/compilers/common/none-gcc/sys/unistd.h81
-rw-r--r--components/libc/compilers/common/partial/SConscript15
-rw-r--r--components/libc/compilers/common/partial/ls/SConscript23
-rw-r--r--components/libc/compilers/common/partial/ls/readme.md9
-rw-r--r--components/libc/compilers/common/partial/ls/sys/select.h52
-rw-r--r--components/libc/compilers/common/poll.h49
-rw-r--r--components/libc/compilers/common/sys/ioctl.h2
-rw-r--r--components/libc/compilers/common/sys/statfs.h15
-rw-r--r--components/libc/compilers/common/sys/time.h6
-rw-r--r--components/libc/compilers/common/sys/vfs.h (renamed from components/libc/compilers/common/none-gcc/fcntl.h)11
-rw-r--r--components/libc/compilers/dlib/libc.c5
-rw-r--r--components/libc/compilers/newlib/stdio.c2
-rw-r--r--components/libc/libdl/dlelf.h113
-rw-r--r--components/lwp/lwp_syscall.c2
-rw-r--r--components/net/at/at_socket/at_socket.c2
-rw-r--r--components/net/at/include/at.h1
-rw-r--r--components/net/at/src/at_cli.c2
-rw-r--r--components/net/at/src/at_client.c43
-rw-r--r--components/net/lwip-1.4.1/src/apps/ping/ping.c2
-rw-r--r--components/net/lwip-1.4.1/src/lwipopts.h1
-rw-r--r--components/net/lwip-2.0.2/src/apps/ping/ping.c2
-rw-r--r--components/net/lwip-2.0.2/src/lwipopts.h1
-rw-r--r--components/net/lwip-2.0.3/src/apps/ping/ping.c2
-rw-r--r--components/net/lwip-2.0.3/src/lwipopts.h1
-rw-r--r--components/net/lwip-2.1.2/src/apps/ping/ping.c2
-rw-r--r--components/net/lwip-2.1.2/src/include/netif/ethernetif.h1
-rw-r--r--components/net/lwip-2.1.2/src/lwipopts.h1
-rw-r--r--components/net/lwip-2.1.2/src/netif/ethernetif.c13
-rw-r--r--components/net/netdev/src/netdev.c10
-rw-r--r--components/net/netdev/src/netdev_ipaddr.c2
-rw-r--r--components/net/sal_socket/impl/af_inet_at.c2
-rw-r--r--components/net/sal_socket/impl/af_inet_lwip.c2
-rw-r--r--components/net/sal_socket/include/sal_netdb.h1
-rw-r--r--components/net/sal_socket/include/sal_socket.h1
-rw-r--r--components/net/sal_socket/include/socket/netdb.h1
-rw-r--r--components/net/sal_socket/socket/net_netdb.c1
-rw-r--r--components/net/sal_socket/socket/net_sockets.c2
-rw-r--r--components/utilities/rt-link/src/rtlink_dev.c2
-rw-r--r--components/utilities/ulog/ulog.c2
-rw-r--r--components/utilities/utest/utest_assert.h4
-rw-r--r--components/vbus/vbus.c2
76 files changed, 546 insertions, 359 deletions
diff --git a/components/dfs/SConscript b/components/dfs/SConscript
index 3ccaeb1080..e449c84911 100644
--- a/components/dfs/SConscript
+++ b/components/dfs/SConscript
@@ -11,7 +11,7 @@ cwd = GetCurrentDir()
CPPPATH = [cwd + "/include"]
if GetDepend('RT_USING_POSIX'):
- src += ['src/poll.c', 'src/select.c']
+ src += ['src/dfs_poll.c', 'src/dfs_select.c']
group = DefineGroup('Filesystem', src, depend = ['RT_USING_DFS'], CPPPATH = CPPPATH)
diff --git a/components/dfs/include/dfs.h b/components/dfs/include/dfs.h
index 0fd8c2dccc..38f19aa7e7 100644
--- a/components/dfs/include/dfs.h
+++ b/components/dfs/include/dfs.h
@@ -16,6 +16,9 @@
#include <stdlib.h>
#include <string.h>
#include <dirent.h>
+#include <fcntl.h>
+#include <sys/stat.h>
+#include <sys/statfs.h>
#include <sys/time.h>
#include <rtdevice.h>
@@ -66,13 +69,6 @@ extern "C" {
#define DFS_F_EOF 0x04000000
#define DFS_F_ERR 0x08000000
-struct statfs
-{
- size_t f_bsize; /* block size */
- size_t f_blocks; /* total data blocks in file system */
- size_t f_bfree; /* free blocks in file system */
-};
-
struct dfs_fdtable
{
uint32_t maxfd;
diff --git a/components/dfs/include/dfs_poll.h b/components/dfs/include/dfs_poll.h
index 096a5fe712..11d17cc1ff 100644
--- a/components/dfs/include/dfs_poll.h
+++ b/components/dfs/include/dfs_poll.h
@@ -10,37 +10,6 @@
#ifndef DFS_POLL_H__
#define DFS_POLL_H__
-#include <rtthread.h>
-
-#ifdef RT_USING_POSIX
-#include <sys/time.h> /* for struct timeval */
-
-#if !defined(POLLIN) && !defined(POLLOUT)
-#define POLLIN (0x01)
-#define POLLRDNORM (0x01)
-#define POLLRDBAND (0x01)
-#define POLLPRI (0x01)
-
-#define POLLOUT (0x02)
-#define POLLWRNORM (0x02)
-#define POLLWRBAND (0x02)
-
-#define POLLERR (0x04)
-#define POLLHUP (0x08)
-#define POLLNVAL (0x10)
-
-typedef unsigned int nfds_t;
-
-struct pollfd
-{
- int fd;
- short events;
- short revents;
-};
-#endif /* !defined(POLLIN) && !defined(POLLOUT) */
-
-#define POLLMASK_DEFAULT (POLLIN | POLLOUT | POLLRDNORM | POLLWRNORM)
-int poll(struct pollfd *fds, nfds_t nfds, int timeout);
-#endif /* RT_USING_POSIX */
+#include <poll.h>
#endif /* DFS_POLL_H__ */
diff --git a/components/dfs/include/dfs_posix.h b/components/dfs/include/dfs_posix.h
index ec7cdc9de4..ee62cdde82 100644
--- a/components/dfs/include/dfs_posix.h
+++ b/components/dfs/include/dfs_posix.h
@@ -16,56 +16,9 @@
#define __DFS_POSIX_H__
#include <dfs_file.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* directory api*/
-int mkdir(const char *path, mode_t mode);
-DIR *opendir(const char *name);
-struct dirent *readdir(DIR *d);
-long telldir(DIR *d);
-void seekdir(DIR *d, off_t offset);
-void rewinddir(DIR *d);
-int closedir(DIR *d);
-
-/* file api*/
-int open(const char *file, int flags, ...);
-int close(int d);
-
-#if defined(RT_USING_NEWLIB) && defined(_EXFUN)
-_READ_WRITE_RETURN_TYPE _EXFUN(read, (int __fd, void *__buf, size_t __nbyte));
-_READ_WRITE_RETURN_TYPE _EXFUN(write, (int __fd, const void *__buf, size_t __nbyte));
-#else
-int read(int fd, void *buf, size_t len);
-int write(int fd, const void *buf, size_t len);
-#endif
-
-off_t lseek(int fd, off_t offset, int whence);
-int rename(const char *from, const char *to);
-int unlink(const char *pathname);
-int stat(const char *file, struct stat *buf);
-int fstat(int fildes, struct stat *buf);
-int fsync(int fildes);
-int fcntl(int fildes, int cmd, ...);
-int ioctl(int fildes, int cmd, ...);
-int ftruncate(int fd, off_t length);
-
-/* directory api*/
-int rmdir(const char *path);
-int chdir(const char *path);
-char *getcwd(char *buf, size_t size);
-
-/* file system api */
-int statfs(const char *path, struct statfs *buf);
-
-int access(const char *path, int amode);
-int pipe(int fildes[2]);
-int mkfifo(const char *path, mode_t mode);
-
-#ifdef __cplusplus
-}
-#endif
+#include <unistd.h>
+#include <stdio.h> /* rename() */
+#include <sys/stat.h>
+#include <sys/statfs.h> /* statfs() */
#endif
diff --git a/components/dfs/include/dfs_select.h b/components/dfs/include/dfs_select.h
index e0572c5059..17291a60dc 100644
--- a/components/dfs/include/dfs_select.h
+++ b/components/dfs/include/dfs_select.h
@@ -12,15 +12,4 @@
#include <sys/select.h>
-#ifdef __cplusplus
-extern "C" {
#endif
-
-int select(int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, struct timeval *timeout);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
-
diff --git a/components/dfs/src/poll.c b/components/dfs/src/dfs_poll.c
index d1e0372494..607b3487be 100644
--- a/components/dfs/src/poll.c
+++ b/components/dfs/src/dfs_poll.c
@@ -17,7 +17,7 @@
#include <dfs.h>
#include <dfs_file.h>
#include <dfs_posix.h>
-#include <dfs_poll.h>
+#include <poll.h>
#ifdef RT_USING_POSIX
diff --git a/components/dfs/src/dfs_posix.c b/components/dfs/src/dfs_posix.c
index a7c306366f..ed3fdb2eeb 100644
--- a/components/dfs/src/dfs_posix.c
+++ b/components/dfs/src/dfs_posix.c
@@ -110,10 +110,10 @@ RTM_EXPORT(close);
* @return the actual read data buffer length. If the returned value is 0, it
* may be reach the end of file, please check errno.
*/
-#if defined(RT_USING_NEWLIB) && defined(_EXFUN)
-_READ_WRITE_RETURN_TYPE _EXFUN(read, (int fd, void *buf, size_t len))
+#ifdef _READ_WRITE_RETURN_TYPE
+_READ_WRITE_RETURN_TYPE read(int fd, void *buf, size_t len) /* some gcc tool chains will use different data structure */
#else
-int read(int fd, void *buf, size_t len)
+ssize_t read(int fd, void *buf, size_t len)
#endif
{
int result;
@@ -154,10 +154,10 @@ RTM_EXPORT(read);
*
* @return the actual written data buffer length.
*/
-#if defined(RT_USING_NEWLIB) && defined(_EXFUN)
-_READ_WRITE_RETURN_TYPE _EXFUN(write, (int fd, const void *buf, size_t len))
+#ifdef _READ_WRITE_RETURN_TYPE
+_READ_WRITE_RETURN_TYPE write(int fd, const void *buf, size_t len) /* some gcc tool chains will use different data structure */
#else
-int write(int fd, const void *buf, size_t len)
+ssize_t write(int fd, const void *buf, size_t len)
#endif
{
int result;
diff --git a/components/dfs/src/select.c b/components/dfs/src/dfs_select.c
index c9286ca97f..ca9c549259 100644
--- a/components/dfs/src/select.c
+++ b/components/dfs/src/dfs_select.c
@@ -11,7 +11,7 @@
#include <dfs_fs.h>
#include <dfs_posix.h>
-#include <dfs_poll.h>
+#include <poll.h>
#include <dfs_select.h>
#ifdef RT_USING_POSIX
diff --git a/components/drivers/can/can.c b/components/drivers/can/can.c
index 55444c3a0e..358220013f 100644
--- a/components/drivers/can/can.c
+++ b/components/drivers/can/can.c
@@ -966,6 +966,5 @@ int cmd_canstat(int argc, void **argv)
}
return 0;
}
-FINSH_FUNCTION_EXPORT_ALIAS(cmd_canstat, __cmd_canstat, Stat Can Device Status.);
+MSH_CMD_EXPORT_ALIAS(cmd_canstat, canstat, stat can device status);
#endif
-
diff --git a/components/drivers/include/drivers/cputime.h b/components/drivers/include/drivers/cputime.h
index 0141f24805..26a1e40f8e 100644
--- a/components/drivers/include/drivers/cputime.h
+++ b/components/drivers/include/drivers/cputime.h
@@ -11,6 +11,8 @@
#ifndef CPUTIME_H__
#define CPUTIME_H__
+#include <stdint.h>
+
struct rt_clock_cputime_ops
{
float (*cputime_getres) (void);
diff --git a/components/drivers/include/drivers/pm.h b/components/drivers/include/drivers/pm.h
index 51bff54ebb..d38c0a4e2a 100644
--- a/components/drivers/include/drivers/pm.h
+++ b/components/drivers/include/drivers/pm.h
@@ -15,6 +15,7 @@
#ifndef __PM_H__
#define __PM_H__
+#include <stdint.h>
#include <rtthread.h>
#ifndef PM_HAS_CUSTOM_CONFIG
diff --git a/components/drivers/include/drivers/serial.h b/components/drivers/include/drivers/serial.h
index c2e951e9b1..f0d0edbfad 100644
--- a/components/drivers/include/drivers/serial.h
+++ b/components/drivers/include/drivers/serial.h
@@ -77,6 +77,9 @@
#define RT_SERIAL_TX_DATAQUEUE_SIZE 2048
#define RT_SERIAL_TX_DATAQUEUE_LWM 30
+#define RT_SERIAL_FLOWCONTROL_CTSRTS 1
+#define RT_SERIAL_FLOWCONTROL_NONE 0
+
/* Default config for serial_configure structure */
#define RT_SERIAL_CONFIG_DEFAULT \
{ \
@@ -87,6 +90,7 @@
BIT_ORDER_LSB, /* LSB first sent */ \
NRZ_NORMAL, /* Normal mode */ \
RT_SERIAL_RB_BUFSZ, /* Buffer size */ \
+ RT_SERIAL_FLOWCONTROL_NONE, /* Off flowcontrol */ \
0 \
}
@@ -100,7 +104,8 @@ struct serial_configure
rt_uint32_t bit_order :1;
rt_uint32_t invert :1;
rt_uint32_t bufsz :16;
- rt_uint32_t reserved :6;
+ rt_uint32_t flowcontrol :1;
+ rt_uint32_t reserved :5;
};
/*
diff --git a/components/drivers/include/ipc/ringblk_buf.h b/components/drivers/include/ipc/ringblk_buf.h
index 5b2971b800..df05659f3e 100644
--- a/components/drivers/include/ipc/ringblk_buf.h
+++ b/components/drivers/include/ipc/ringblk_buf.h
@@ -76,9 +76,12 @@ typedef struct rt_rbb *rt_rbb_t;
/* rbb (ring block buffer) API */
void rt_rbb_init(rt_rbb_t rbb, rt_uint8_t *buf, rt_size_t buf_size, rt_rbb_blk_t block_set, rt_size_t blk_max_num);
+rt_size_t rt_rbb_get_buf_size(rt_rbb_t rbb);
+
+#ifdef RT_USING_HEAP
rt_rbb_t rt_rbb_create(rt_size_t buf_size, rt_size_t blk_max_num);
void rt_rbb_destroy(rt_rbb_t rbb);
-rt_size_t rt_rbb_get_buf_size(rt_rbb_t rbb);
+#endif
/* rbb block API */
rt_rbb_blk_t rt_rbb_blk_alloc(rt_rbb_t rbb, rt_size_t blk_size);
diff --git a/components/drivers/phy/phy.c b/components/drivers/phy/phy.c
index 6d408ce612..87152a306e 100644
--- a/components/drivers/phy/phy.c
+++ b/components/drivers/phy/phy.c
@@ -8,7 +8,7 @@
* Date Author Notes
* 2020-09-27 wangqiang first version
*/
-
+#include <stddef.h>
#include <rthw.h>
#include <rtthread.h>
#include <rtdevice.h>
diff --git a/components/drivers/rtc/alarm.c b/components/drivers/rtc/alarm.c
index cd0a976328..2bcc51f2ee 100644
--- a/components/drivers/rtc/alarm.c
+++ b/components/drivers/rtc/alarm.c
@@ -777,7 +777,7 @@ void rt_alarm_dump(void)
rt_kprintf("+----+---------------------+------+------+----+\n");
}
-FINSH_FUNCTION_EXPORT_ALIAS(rt_alarm_dump, __cmd_alarm_dump, dump alarm info);
+MSH_CMD_EXPORT_ALIAS(rt_alarm_dump, rt_alarm_dump, dump alarm info);
/** \brief initialize alarm service system
*
diff --git a/components/drivers/rtc/rtc.c b/components/drivers/rtc/rtc.c
index 35e7ddc3c4..bc75c83e7d 100644
--- a/components/drivers/rtc/rtc.c
+++ b/components/drivers/rtc/rtc.c
@@ -223,7 +223,7 @@ rt_err_t set_time(rt_uint32_t hour, rt_uint32_t minute, rt_uint32_t second)
/**
* get date and time or set (local timezone) [year month day hour min sec]
*/
-static void date(uint8_t argc, char **argv)
+static void date(int argc, char **argv)
{
if (argc == 1)
{
@@ -235,8 +235,9 @@ static void date(uint8_t argc, char **argv)
else if (argc >= 7)
{
/* set time and date */
- uint16_t year;
- uint8_t month, day, hour, min, sec;
+ rt_uint16_t year;
+ rt_uint8_t month, day, hour, min, sec;
+
year = atoi(argv[1]);
month = atoi(argv[2]);
day = atoi(argv[3]);
diff --git a/components/drivers/serial/serial.c b/components/drivers/serial/serial.c
index 97068b30aa..289d523bd2 100644
--- a/components/drivers/serial/serial.c
+++ b/components/drivers/serial/serial.c
@@ -38,7 +38,7 @@
#ifdef RT_USING_POSIX
#include <dfs_posix.h>
-#include <dfs_poll.h>
+#include <poll.h>
#include <sys/ioctl.h>
#ifdef RT_USING_POSIX_TERMIOS
@@ -1112,6 +1112,7 @@ static rt_err_t rt_serial_control(struct rt_device *dev,
break;
case TCXONC:
break;
+#endif /*RT_USING_POSIX_TERMIOS*/
case TIOCSWINSZ:
{
struct winsize* p_winsize;
@@ -1202,7 +1203,6 @@ static rt_err_t rt_serial_control(struct rt_device *dev,
p_winsize->ws_ypixel = 0;/* unused */
}
break;
-#endif /*RT_USING_POSIX_TERMIOS*/
case FIONREAD:
{
rt_size_t recved = 0;
diff --git a/components/drivers/serial/serial_v2.c b/components/drivers/serial/serial_v2.c
index 6e65457a5d..390dd31748 100644
--- a/components/drivers/serial/serial_v2.c
+++ b/components/drivers/serial/serial_v2.c
@@ -18,7 +18,7 @@
#ifdef RT_USING_POSIX
#include <dfs_posix.h>
-#include <dfs_poll.h>
+#include <poll.h>
#include <sys/ioctl.h>
#ifdef getc
diff --git a/components/drivers/src/pipe.c b/components/drivers/src/pipe.c
index 7fa5eb067d..af90f13c6f 100644
--- a/components/drivers/src/pipe.c
+++ b/components/drivers/src/pipe.c
@@ -16,7 +16,7 @@
#ifdef RT_USING_POSIX
#include <dfs_file.h>
#include <dfs_posix.h>
-#include <dfs_poll.h>
+#include <poll.h>
#include <sys/ioctl.h>
static int pipe_fops_open(struct dfs_fd *fd)
diff --git a/components/drivers/src/ringblk_buf.c b/components/drivers/src/ringblk_buf.c
index c6688b3d2b..b966da3d36 100644
--- a/components/drivers/src/ringblk_buf.c
+++ b/components/drivers/src/ringblk_buf.c
@@ -44,6 +44,8 @@ void rt_rbb_init(rt_rbb_t rbb, rt_uint8_t *buf, rt_size_t buf_size, rt_rbb_blk_t
}
RTM_EXPORT(rt_rbb_init);
+#ifdef RT_USING_HEAP
+
/**
* ring block buffer object create
*
@@ -102,6 +104,8 @@ void rt_rbb_destroy(rt_rbb_t rbb)
}
RTM_EXPORT(rt_rbb_destroy);
+#endif
+
static rt_rbb_blk_t find_empty_blk_in_set(rt_rbb_t rbb)
{
rt_size_t i;
diff --git a/components/drivers/wlan/wlan_cmd.c b/components/drivers/wlan/wlan_cmd.c
index 3b8a119784..52c25f6755 100644
--- a/components/drivers/wlan/wlan_cmd.c
+++ b/components/drivers/wlan/wlan_cmd.c
@@ -587,7 +587,7 @@ static int wifi_msh(int argc, char *argv[])
}
#if defined(RT_USING_FINSH)
-FINSH_FUNCTION_EXPORT_ALIAS(wifi_msh, __cmd_wifi, wifi command.);
+MSH_CMD_EXPORT_ALIAS(wifi_msh, wifi, wifi command);
#endif
#endif
diff --git a/components/finsh/Kconfig b/components/finsh/Kconfig
index cf4e673c75..cc891e3951 100644
--- a/components/finsh/Kconfig
+++ b/components/finsh/Kconfig
@@ -11,6 +11,10 @@ config RT_USING_MSH
if RT_USING_MSH
+ config FINSH_USING_MSH
+ bool
+ default y
+
config FINSH_THREAD_NAME
string "The msh thread name"
default "tshell"
diff --git a/components/finsh/finsh.h b/components/finsh/finsh.h
index 380cade403..98048ebad4 100644
--- a/components/finsh/finsh.h
+++ b/components/finsh/finsh.h
@@ -116,15 +116,25 @@ typedef long (*syscall_func)(void);
#define FINSH_FUNCTION_EXPORT_ALIAS(name, alias, desc)
/**
- * @ingroup finsh
+ * @ingroup msh
*
* This macro exports a command to module shell.
*
- * @param command the name of command.
- * @param desc the description of command, which will show in help.
+ * @param command is the name of the command.
+ * @param desc is the description of the command, which will show in help list.
*/
#define MSH_CMD_EXPORT(command, desc) \
MSH_FUNCTION_EXPORT_CMD(command, command, desc)
+
+/**
+ * @ingroup msh
+ *
+ * This macro exports a command with alias to module shell.
+ *
+ * @param command is the name of the command.
+ * @param alias is the alias of the command.
+ * @param desc is the description of the command, which will show in help list.
+ */
#define MSH_CMD_EXPORT_ALIAS(command, alias, desc) \
MSH_FUNCTION_EXPORT_CMD(command, alias, desc)
diff --git a/components/libc/compilers/armlibc/libc.c b/components/libc/compilers/armlibc/libc.c
index 971ddb8d49..889c687309 100644
--- a/components/libc/compilers/armlibc/libc.c
+++ b/components/libc/compilers/armlibc/libc.c
@@ -7,11 +7,8 @@
* Date Author Notes
* 2017/10/15 bernard the first version
*/
-#include <stdio.h>
-#include <stdlib.h>
-
+#include <fcntl.h>
#include <rtthread.h>
-
#include "libc.h"
#ifdef RT_USING_PTHREADS
diff --git a/components/libc/compilers/armlibc/mem_std.c b/components/libc/compilers/armlibc/mem_std.c
index c350aa68fa..fbfd17eee1 100644
--- a/components/libc/compilers/armlibc/mem_std.c
+++ b/components/libc/compilers/armlibc/mem_std.c
@@ -7,7 +7,8 @@
* 2014-08-03 bernard Add file header.
*/
-#include "rtthread.h"
+#include <rtthread.h>
+#include <stddef.h>
#ifdef RT_USING_HEAP
diff --git a/components/libc/compilers/common/fcntl.h b/components/libc/compilers/common/fcntl.h
new file mode 100644
index 0000000000..b98f540627
--- /dev/null
+++ b/components/libc/compilers/common/fcntl.h
@@ -0,0 +1,72 @@
+/*
+ * Copyright (c) 2006-2021, RT-Thread Development Team
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ *
+ * Change Logs:
+ * Date Author Notes
+ * 2021-09-02 Meco Man First version
+ */
+#ifndef __FCNTL_H__
+#define __FCNTL_H__
+
+#include <sys/types.h>
+
+#if defined(_WIN32)
+#define O_ACCMODE (_O_RDONLY | _O_WRONLY | _O_RDWR)
+#endif
+
+#define O_RDONLY 00
+#define O_WRONLY 01
+#define O_RDWR 02
+
+#define O_CREAT 0100
+#define O_EXCL 0200
+#define O_NOCTTY 0400
+#define O_TRUNC 01000
+#define O_APPEND 02000
+#define O_NONBLOCK 04000
+#define O_DSYNC 010000
+#define O_SYNC 04010000
+#define O_RSYNC 04010000
+#define O_BINARY 0100000
+#define O_DIRECTORY 0200000
+#define O_NOFOLLOW 0400000
+#define O_CLOEXEC 02000000
+#define O_ASYNC 020000
+#define O_DIRECT 040000
+#define O_LARGEFILE 0100000
+#define O_NOATIME 01000000
+#define O_PATH 010000000
+#define O_TMPFILE 020200000
+#define O_NDELAY O_NONBLOCK
+#define O_SEARCH O_PATH
+#define O_EXEC O_PATH
+
+#define O_ACCMODE (03|O_SEARCH)
+
+#define F_DUPFD 0
+#define F_GETFD 1
+#define F_SETFD 2
+#define F_GETFL 3
+#define F_SETFL 4
+
+#define F_SETOWN 8
+#define F_GETOWN 9
+#define F_SETSIG 10
+#define F_GETSIG 11
+
+#define F_GETLK 12
+#define F_SETLK 13
+#define F_SETLKW 14
+
+#define F_SETOWN_EX 15
+#define F_GETOWN_EX 16
+
+#define F_GETOWNER_UIDS 17
+
+int open(const char *file, int flags, ...);
+int fcntl(int fildes, int cmd, ...);
+int creat(const char *, mode_t);
+
+#endif
diff --git a/components/libc/compilers/common/none-gcc/SConscript b/components/libc/compilers/common/nogcc/SConscript
index c766c8f82d..c766c8f82d 100644
--- a/components/libc/compilers/common/none-gcc/SConscript
+++ b/components/libc/compilers/common/nogcc/SConscript
diff --git a/components/libc/compilers/common/none-gcc/readme.md b/components/libc/compilers/common/nogcc/readme.md
index b10940d003..b10940d003 100644
--- a/components/libc/compilers/common/none-gcc/readme.md
+++ b/components/libc/compilers/common/nogcc/readme.md
diff --git a/components/libc/compilers/common/none-gcc/sys/errno.h b/components/libc/compilers/common/nogcc/sys/errno.h
index ff1abca387..ff1abca387 100644
--- a/components/libc/compilers/common/none-gcc/sys/errno.h
+++ b/components/libc/compilers/common/nogcc/sys/errno.h
diff --git a/components/libc/compilers/common/sys/select.h b/components/libc/compilers/common/nogcc/sys/select.h
index db42b6ebcc..575ad3a1b5 100644
--- a/components/libc/compilers/common/sys/select.h
+++ b/components/libc/compilers/common/nogcc/sys/select.h
@@ -13,6 +13,7 @@
#include <rtconfig.h>
#include <sys/types.h>
+#include <sys/time.h>
#ifndef FD_SETSIZE
#define FD_SETSIZE 32
@@ -46,4 +47,6 @@ typedef struct _types_fd_set {
#define FD_ZERO(p) memset((void*)(p), 0, sizeof(*(p)))
#endif /* _SYS_TYPES_FD_SET */
+int select(int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, struct timeval *timeout);
+
#endif /* __SYS_SELECT_H__ */
diff --git a/components/libc/compilers/common/nogcc/sys/stat.h b/components/libc/compilers/common/nogcc/sys/stat.h
new file mode 100644
index 0000000000..107c15decf
--- /dev/null
+++ b/components/libc/compilers/common/nogcc/sys/stat.h
@@ -0,0 +1,83 @@
+/*
+ * Copyright (c) 2006-2021, RT-Thread Development Team
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ *
+ * Change Logs:
+ * Date Author Notes
+ * 2021-09-02 Meco Man First version
+ */
+
+#ifndef __SYS_STAT_H__
+#define __SYS_STAT_H__
+
+#include <sys/types.h>
+#include <sys/time.h>
+
+#define S_IFMT 00170000
+#define S_IFSOCK 0140000
+#define S_IFLNK 0120000
+#define S_IFREG 0100000
+#define S_IFBLK 0060000
+#define S_IFDIR 0040000
+#define S_IFCHR 0020000
+#define S_IFIFO 0010000
+#define S_ISUID 0004000
+#define S_ISGID 0002000
+#define S_ISVTX 0001000
+
+#define S_ISLNK(m) (((m) & S_IFMT) == S_IFLNK)
+#define S_ISREG(m) (((m) & S_IFMT) == S_IFREG)
+#define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR)
+#define S_ISCHR(m) (((m) & S_IFMT) == S_IFCHR)
+#define S_ISBLK(m) (((m) & S_IFMT) == S_IFBLK)
+#define S_ISFIFO(m) (((m) & S_IFMT) == S_IFIFO)
+#define S_ISSOCK(m) (((m) & S_IFMT) == S_IFSOCK)
+
+#define S_IRWXU 00700
+#define S_IRUSR 00400
+#define S_IWUSR 00200
+#define S_IXUSR 00100
+
+#define S_IRWXG 00070
+#define S_IRGRP 00040
+#define S_IWGRP 00020
+#define S_IXGRP 00010
+
+#define S_IRWXO 00007
+#define S_IROTH 00004
+#define S_IWOTH 00002
+#define S_IXOTH 00001
+
+struct stat
+{
+ struct rt_device *st_dev;
+ uint16_t st_ino;
+ uint16_t st_mode;
+ uint16_t st_nlink;
+ uint16_t st_uid;
+ uint16_t st_gid;
+ struct rt_device *st_rdev;
+ uint32_t st_size;
+ time_t st_atime;
+ long st_spare1;
+ time_t st_mtime;
+ long st_spare2;
+ time_t st_ctime;
+ long st_spare3;
+ uint32_t st_blksize;
+ uint32_t st_blocks;
+ long st_spare4[2];
+};
+
+int chmod(const char *, mode_t);
+int fchmod(int, mode_t);
+int fstat(int, struct stat *);
+int lstat(const char *, struct stat *);
+int mkdir(const char *, mode_t);
+int mkfifo(const char *, mode_t);
+int mknod(const char *, mode_t, dev_t);
+int stat(const char *, struct stat *);
+mode_t umask(mode_t);
+
+#endif
diff --git a/components/libc/compilers/common/none-gcc/sys/types.h b/components/libc/compilers/common/nogcc/sys/types.h
index f7f563035c..f7f563035c 100644
--- a/components/libc/compilers/common/none-gcc/sys/types.h
+++ b/components/libc/compilers/common/nogcc/sys/types.h
diff --git a/components/libc/compilers/common/nogcc/sys/unistd.h b/components/libc/compilers/common/nogcc/sys/unistd.h
new file mode 100644
index 0000000000..6195c4c2aa
--- /dev/null
+++ b/components/libc/compilers/common/nogcc/sys/unistd.h
@@ -0,0 +1,45 @@
+/*
+ * Copyright (c) 2006-2021, RT-Thread Development Team
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ *
+ * Change Logs:
+ * Date Author Notes
+ * 2020-12-16 Meco Man add usleep
+ * 2021-09-11 Meco Man move functions from dfs_posix.h to unistd.h
+ */
+#ifndef __SYS_UNISTD_H__
+#define __SYS_UNISTD_H__
+
+#include <stddef.h>
+#include "types.h" /* <sys/types.h> */
+
+#define STDIN_FILENO 0 /* standard input file descriptor */
+#define STDOUT_FILENO 1 /* standard output file descriptor */
+#define STDERR_FILENO 2 /* standard error file descriptor */
+
+ssize_t read(int fd, void *buf, size_t len);
+ssize_t write(int fd, const void *buf, size_t len);
+off_t lseek(int fd, off_t offset, int whence);
+int fsync(int fildes);
+int unlink(const char *pathname);
+int close(int d);
+int ftruncate(int fd, off_t length);
+int rmdir(const char *path);
+int chdir(const char *path);
+char *getcwd(char *buf, size_t size);
+int access(const char *path, int amode);
+int pipe(int fildes[2]);
+int isatty(int fd);
+char *ttyname(int desc);
+unsigned int sleep(unsigned int seconds);
+int usleep(useconds_t usec);
+pid_t gettid(void);
+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/common/none-gcc/unistd.h b/components/libc/compilers/common/nogcc/unistd.h
index cd77a12e3b..cd77a12e3b 100644
--- a/components/libc/compilers/common/none-gcc/unistd.h
+++ b/components/libc/compilers/common/nogcc/unistd.h
diff --git a/components/libc/compilers/common/none-gcc/sys/stat.h b/components/libc/compilers/common/none-gcc/sys/stat.h
deleted file mode 100644
index c8f65df435..0000000000
--- a/components/libc/compilers/common/none-gcc/sys/stat.h
+++ /dev/null
@@ -1,13 +0,0 @@
-/*
- * Copyright (c) 2006-2021, RT-Thread Development Team
- *
- * SPDX-License-Identifier: Apache-2.0
- *
- * Change Logs:
- * Date Author Notes
- */
-
- #ifndef __SYS_STAT_H__
- #define __SYS_STAT_H__
-
- #endif
diff --git a/components/libc/compilers/common/none-gcc/sys/unistd.h b/components/libc/compilers/common/none-gcc/sys/unistd.h
deleted file mode 100644
index ea2d674b0f..0000000000
--- a/components/libc/compilers/common/none-gcc/sys/unistd.h
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
- * Copyright (c) 2006-2021, RT-Thread Development Team
- *
- * SPDX-License-Identifier: Apache-2.0
- *
- * 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 */
-#define STDOUT_FILENO 1 /* standard output file descriptor */
-#define STDERR_FILENO 2 /* standard error file descriptor */
-
-#include <dfs_posix.h>
-#else
-#define _FREAD 0x0001 /* read enabled */
-#define _FWRITE 0x0002 /* write enabled */
-#define _FAPPEND 0x0008 /* append (writes guaranteed at the end) */
-#define _FMARK 0x0010 /* internal; mark during gc() */
-#define _FDEFER 0x0020 /* internal; defer for next gc pass */
-#define _FASYNC 0x0040 /* signal pgrp when data ready */
-#define _FSHLOCK 0x0080 /* BSD flock() shared lock present */
-#define _FEXLOCK 0x0100 /* BSD flock() exclusive lock present */
-#define _FCREAT 0x0200 /* open with file create */
-#define _FTRUNC 0x0400 /* open with truncation */
-#define _FEXCL 0x0800 /* error on open if file exists */
-#define _FNBIO 0x1000 /* non blocking I/O (sys5 style) */
-#define _FSYNC 0x2000 /* do all writes synchronously */
-#define _FNONBLOCK 0x4000 /* non blocking I/O (POSIX style) */
-#define _FNDELAY _FNONBLOCK /* non blocking I/O (4.2 style) */
-#define _FNOCTTY 0x8000 /* don't assign a ctty on this open */
-
-
-#ifndef O_RDONLY
-#define O_RDONLY 0 /* +1 == FREAD */
-#endif
-#ifndef O_WRONLY
-#define O_WRONLY 1 /* +1 == FWRITE */
-#endif
-#ifndef O_RDWR
-#define O_RDWR 2 /* +1 == FREAD|FWRITE */
-#endif
-#ifndef O_APPEND
-#define O_APPEND _FAPPEND
-#endif
-#ifndef O_CREAT
-#define O_CREAT _FCREAT
-#endif
-#ifndef O_TRUNC
-#define O_TRUNC _FTRUNC
-#endif
-#ifndef O_EXCL
-#define O_EXCL _FEXCL
-#endif
-#ifndef O_SYNC
-#define O_SYNC _FSYNC
-#endif
-
-#endif
-
-int isatty (int fd);
-char * ttyname (int desc);
-unsigned int sleep(unsigned int seconds);
-int usleep(useconds_t usec);
-pid_t gettid(void);
-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/common/partial/SConscript b/components/libc/compilers/common/partial/SConscript
new file mode 100644
index 0000000000..4c815c49b8
--- /dev/null
+++ b/components/libc/compilers/common/partial/SConscript
@@ -0,0 +1,15 @@
+# RT-Thread building script for bridge
+
+import os
+from building import *
+
+cwd = GetCurrentDir()
+objs = []
+list = os.listdir(cwd)
+
+for d in list:
+ path = os.path.join(cwd, d)
+ if os.path.isfile(os.path.join(path, 'SConscript')):
+ objs = objs + SConscript(os.path.join(d, 'SConscript'))
+
+Return('objs')
diff --git a/components/libc/compilers/common/partial/ls/SConscript b/components/libc/compilers/common/partial/ls/SConscript
new file mode 100644
index 0000000000..2665bee078
--- /dev/null
+++ b/components/libc/compilers/common/partial/ls/SConscript
@@ -0,0 +1,23 @@
+from shutil import copy
+from building import *
+
+Import('rtconfig')
+
+src = []
+cwd = GetCurrentDir()
+CPPPATH = [cwd]
+group = []
+
+if rtconfig.PLATFORM == 'gcc' and GetDepend('SOC_LS'):
+ try:
+ # There is no 'sys/select.h' in these bsp's gcc toolchain; thus, we need to copy this file from 'nogcc/sys/select.h'
+ copy("../../nogcc/sys/select.h", "./sys/select.h")
+ except:
+ pass
+
+ if GetDepend('RT_USING_LIBC'):
+ src += Glob('*.c')
+
+ group = DefineGroup('libc', src, depend = [], CPPPATH = CPPPATH)
+
+Return('group')
diff --git a/components/libc/compilers/common/partial/ls/readme.md b/components/libc/compilers/common/partial/ls/readme.md
new file mode 100644
index 0000000000..fa68e1e84a
--- /dev/null
+++ b/components/libc/compilers/common/partial/ls/readme.md
@@ -0,0 +1,9 @@
+This folder will be included when compiling the BSPs as follow:
+
+- ls1bdev
+- ls1cdev
+- ls2kdev
+
+These files will be generated by scons automatically , and **DO NOT** change them:
+
+- sys/select.h \ No newline at end of file
diff --git a/components/libc/compilers/common/partial/ls/sys/select.h b/components/libc/compilers/common/partial/ls/sys/select.h
new file mode 100644
index 0000000000..575ad3a1b5
--- /dev/null
+++ b/components/libc/compilers/common/partial/ls/sys/select.h
@@ -0,0 +1,52 @@
+/*
+ * Copyright (c) 2006-2021, RT-Thread Development Team
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ *
+ * Change Logs:
+ * Date Author Notes
+ * 2021-07-21 Meco Man The first version
+ */
+
+#ifndef __SYS_SELECT_H__
+#define __SYS_SELECT_H__
+
+#include <rtconfig.h>
+#include <sys/types.h>
+#include <sys/time.h>
+
+#ifndef FD_SETSIZE
+#define FD_SETSIZE 32
+#endif
+
+#ifdef SAL_USING_POSIX
+#ifdef FD_SETSIZE
+#undef FD_SETSIZE
+#endif
+#define FD_SETSIZE DFS_FD_MAX
+#endif /* SAL_USING_POSIX */
+
+#define NBBY 8 /* number of bits in a byte */
+
+typedef long fd_mask;
+
+#define NFDBITS (sizeof (fd_mask) * NBBY) /* bits per mask */
+#ifndef howmany
+#define howmany(x,y) (((x)+((y)-1))/(y))
+#endif
+
+#ifndef _SYS_TYPES_FD_SET /* MIPS */
+typedef struct _types_fd_set {
+ fd_mask fds_bits[howmany(FD_SETSIZE, NFDBITS)];
+} _types_fd_set;
+#define fd_set _types_fd_set
+
+#define FD_SET(n, p) ((p)->fds_bits[(n)/NFDBITS] |= (1L << ((n) % NFDBITS)))
+#define FD_CLR(n, p) ((p)->fds_bits[(n)/NFDBITS] &= ~(1L << ((n) % NFDBITS)))
+#define FD_ISSET(n, p) ((p)->fds_bits[(n)/NFDBITS] & (1L << ((n) % NFDBITS)))
+#define FD_ZERO(p) memset((void*)(p), 0, sizeof(*(p)))
+#endif /* _SYS_TYPES_FD_SET */
+
+int select(int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, struct timeval *timeout);
+
+#endif /* __SYS_SELECT_H__ */
diff --git a/components/libc/compilers/common/poll.h b/components/libc/compilers/common/poll.h
new file mode 100644
index 0000000000..aea73d6eaf
--- /dev/null
+++ b/components/libc/compilers/common/poll.h
@@ -0,0 +1,49 @@
+/*
+ * Copyright (c) 2006-2021, RT-Thread Development Team
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ *
+ * Change Logs:
+ * Date Author Notes
+ * 2021-09-11 Meco Man First version
+ */
+#ifndef __POLL_H__
+#define __POLL_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#if !defined(POLLIN) && !defined(POLLOUT)
+#define POLLIN (0x01)
+#define POLLRDNORM (0x01)
+#define POLLRDBAND (0x01)
+#define POLLPRI (0x01)
+
+#define POLLOUT (0x02)
+#define POLLWRNORM (0x02)
+#define POLLWRBAND (0x02)
+
+#define POLLERR (0x04)
+#define POLLHUP (0x08)
+#define POLLNVAL (0x10)
+
+typedef unsigned int nfds_t;
+
+struct pollfd
+{
+ int fd;
+ short events;
+ short revents;
+};
+#endif /* !defined(POLLIN) && !defined(POLLOUT) */
+
+#define POLLMASK_DEFAULT (POLLIN | POLLOUT | POLLRDNORM | POLLWRNORM)
+
+int poll(struct pollfd *fds, nfds_t nfds, int timeout);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __POLL_H__ */
diff --git a/components/libc/compilers/common/sys/ioctl.h b/components/libc/compilers/common/sys/ioctl.h
index 51f51f2ea4..b926a71875 100644
--- a/components/libc/compilers/common/sys/ioctl.h
+++ b/components/libc/compilers/common/sys/ioctl.h
@@ -235,4 +235,6 @@ struct winsize {
#define SIOCDEVPRIVATE 0x89F0
#define SIOCPROTOPRIVATE 0x89E0
+int ioctl(int fildes, int cmd, ...);
+
#endif
diff --git a/components/libc/compilers/common/sys/statfs.h b/components/libc/compilers/common/sys/statfs.h
index 0996af9a18..0c6dc44df3 100644
--- a/components/libc/compilers/common/sys/statfs.h
+++ b/components/libc/compilers/common/sys/statfs.h
@@ -6,16 +6,19 @@
* Change Logs:
* Date Author Notes
*/
-#ifndef __RTT_STATFS_H__
-#define __RTT_STATFS_H__
+#ifndef __SYS_STATFS_H__
+#define __SYS_STATFS_H__
-#include <rtthread.h>
+#include <stddef.h>
struct statfs
{
- rt_size_t f_bsize; /* block size */
- rt_size_t f_blocks; /* total data blocks in file system */
- rt_size_t f_bfree; /* free blocks in file system */
+ size_t f_bsize; /* block size */
+ size_t f_blocks; /* total data blocks in file system */
+ size_t f_bfree; /* free blocks in file system */
};
+int statfs(const char *path, struct statfs *buf);
+int fstatfs(int fd, struct statfs *buf);
+
#endif
diff --git a/components/libc/compilers/common/sys/time.h b/components/libc/compilers/common/sys/time.h
index 95605d47c7..ecf6e85ac6 100644
--- a/components/libc/compilers/common/sys/time.h
+++ b/components/libc/compilers/common/sys/time.h
@@ -8,8 +8,8 @@
* 2020-09-07 Meco Man combine gcc armcc iccarm
* 2021-02-12 Meco Man move all definitions located in <clock_time.h> to this file
*/
-#ifndef _SYS_TIME_H_
-#define _SYS_TIME_H_
+#ifndef __SYS_TIME_H__
+#define __SYS_TIME_H__
#include <rtconfig.h>
#include <rtdef.h>
@@ -74,7 +74,7 @@ struct timespec {
};
#endif
-/* posix clock and timer */
+/* POSIX clock and timer */
#define MILLISECOND_PER_SECOND 1000UL
#define MICROSECOND_PER_SECOND 1000000UL
#define NANOSECOND_PER_SECOND 1000000000UL
diff --git a/components/libc/compilers/common/none-gcc/fcntl.h b/components/libc/compilers/common/sys/vfs.h
index f247b926e9..00739ab1c6 100644
--- a/components/libc/compilers/common/none-gcc/fcntl.h
+++ b/components/libc/compilers/common/sys/vfs.h
@@ -5,14 +5,11 @@
*
* Change Logs:
* Date Author Notes
+ * 2021-09-11 Meco Man First version
*/
-#ifndef FCNTL_H__
-#define FCNTL_H__
+#ifndef __SYS_VFS_H__
+#define __SYS_VFS_H__
-#include <rtconfig.h>
-
-#ifdef RT_USING_DFS
-#include <dfs_posix.h>
-#endif
+#include "statfs.h" /* <sys/statfs.h> */
#endif
diff --git a/components/libc/compilers/dlib/libc.c b/components/libc/compilers/dlib/libc.c
index d0dca7c5f6..f540ac955f 100644
--- a/components/libc/compilers/dlib/libc.c
+++ b/components/libc/compilers/dlib/libc.c
@@ -7,11 +7,8 @@
* Date Author Notes
* 2017/10/15 bernard the first version
*/
-#include <stdio.h>
-#include <stdlib.h>
-
+#include <fcntl.h>
#include <rtthread.h>
-
#include "libc.h"
#ifdef RT_USING_PTHREADS
diff --git a/components/libc/compilers/newlib/stdio.c b/components/libc/compilers/newlib/stdio.c
index ce5bdb75cb..baccafad87 100644
--- a/components/libc/compilers/newlib/stdio.c
+++ b/components/libc/compilers/newlib/stdio.c
@@ -9,7 +9,7 @@
*/
#include <stdio.h>
#include <stdlib.h>
-
+#include <fcntl.h>
#include <rtthread.h>
#include "libc.h"
diff --git a/components/libc/libdl/dlelf.h b/components/libc/libdl/dlelf.h
index 540fe2c8aa..339e172bb4 100644
--- a/components/libc/libdl/dlelf.h
+++ b/components/libc/libdl/dlelf.h
@@ -4,9 +4,9 @@
* SPDX-License-Identifier: Apache-2.0
*
* Change Logs:
- * Date Author Notes
- * 2018/08/29 Bernard first version
- * 2021/04/23 chunyexixiaoyu distinguish 32-bit and 64-bit
+ * Date Author Notes
+ * 2018/08/29 Bernard first version
+ * 2021/04/23 chunyexixiaoyu distinguish 32-bit and 64-bit
*/
#ifndef DL_ELF_H__
@@ -20,20 +20,15 @@ typedef rt_int32_t Elf32_Sword; /* Signed large integer */
typedef rt_uint32_t Elf32_Word; /* Unsigned large integer */
typedef rt_uint16_t Elf32_Half; /* Unsigned medium integer */
-typedef rt_uint64_t Elf64_Addr;
-typedef rt_uint16_t Elf64_Half;
-typedef rt_int16_t Elf64_SHalf;
-typedef rt_uint64_t Elf64_Off;
-typedef rt_int32_t Elf64_Sword;
-typedef rt_uint32_t Elf64_Word;
-typedef rt_uint64_t Elf64_Xword;
-typedef rt_int64_t Elf64_Sxword;
-typedef uint16_t Elf64_Section;
-
-
-
-
-
+typedef rt_uint64_t Elf64_Addr;
+typedef rt_uint16_t Elf64_Half;
+typedef rt_int16_t Elf64_SHalf;
+typedef rt_uint64_t Elf64_Off;
+typedef rt_int32_t Elf64_Sword;
+typedef rt_uint32_t Elf64_Word;
+typedef rt_uint64_t Elf64_Xword;
+typedef rt_int64_t Elf64_Sxword;
+typedef rt_uint16_t Elf64_Section;
/* e_ident[] magic number */
#define ELFMAG0 0x7f /* e_ident[EI_MAG0] */
@@ -91,24 +86,24 @@ typedef struct elfhdr
header string table" entry offset */
} Elf32_Ehdr;
-
-typedef struct elf64_hdr {
- unsigned char e_ident[EI_NIDENT]; /* ELF Identification */
- Elf64_Half e_type; /* object file type */
- Elf64_Half e_machine; /* machine */
- Elf64_Word e_version; /* object file version */
- Elf64_Addr e_entry; /* virtual entry point */
- Elf64_Off e_phoff; /* program header table offset */
- Elf64_Off e_shoff; /* section header table offset */
- Elf64_Word e_flags; /* processor-specific flags */
- Elf64_Half e_ehsize; /* ELF header size */
- Elf64_Half e_phentsize; /* program header entry size */
- Elf64_Half e_phnum; /* number of program header entries */
- Elf64_Half e_shentsize; /* section header entry size */
- Elf64_Half e_shnum; /* number of section header entries */
- Elf64_Half e_shstrndx; /* section header table's "section
+typedef struct elf64_hdr
+{
+ unsigned char e_ident[EI_NIDENT]; /* ELF Identification */
+ Elf64_Half e_type; /* object file type */
+ Elf64_Half e_machine; /* machine */
+ Elf64_Word e_version; /* object file version */
+ Elf64_Addr e_entry; /* virtual entry point */
+ Elf64_Off e_phoff; /* program header table offset */
+ Elf64_Off e_shoff; /* section header table offset */
+ Elf64_Word e_flags; /* processor-specific flags */
+ Elf64_Half e_ehsize; /* ELF header size */
+ Elf64_Half e_phentsize; /* program header entry size */
+ Elf64_Half e_phnum; /* number of program header entries */
+ Elf64_Half e_shentsize; /* section header entry size */
+ Elf64_Half e_shnum; /* number of section header entries */
+ Elf64_Half e_shstrndx; /* section header table's "section
header string table" entry offset */
-} Elf64_Ehdr;
+} Elf64_Ehdr;
/* Section Header */
typedef struct
@@ -128,19 +123,18 @@ typedef struct
typedef struct
{
- Elf64_Word sh_name; /* Section name (string tbl index) */
- Elf64_Word sh_type; /* Section type */
- Elf64_Xword sh_flags; /* Section flags */
- Elf64_Addr sh_addr; /* Section virtual addr at execution */
- Elf64_Off sh_offset; /* Section file offset */
- Elf64_Xword sh_size; /* Section size in bytes */
- Elf64_Word sh_link; /* Link to another section */
- Elf64_Word sh_info; /* Additional section information */
- Elf64_Xword sh_addralign; /* Section alignment */
- Elf64_Xword sh_entsize; /* Entry size if section holds table */
+ Elf64_Word sh_name; /* Section name (string tbl index) */
+ Elf64_Word sh_type; /* Section type */
+ Elf64_Xword sh_flags; /* Section flags */
+ Elf64_Addr sh_addr; /* Section virtual addr at execution */
+ Elf64_Off sh_offset; /* Section file offset */
+ Elf64_Xword sh_size; /* Section size in bytes */
+ Elf64_Word sh_link; /* Link to another section */
+ Elf64_Word sh_info; /* Additional section information */
+ Elf64_Xword sh_addralign; /* Section alignment */
+ Elf64_Xword sh_entsize; /* Entry size if section holds table */
} Elf64_Shdr;
-
/* Section names */
#define ELF_BSS ".bss" /* uninitialized data */
#define ELF_DATA ".data" /* initialized data */
@@ -176,19 +170,16 @@ typedef struct elf32_sym
Elf32_Half st_shndx; /* section header index */
} Elf32_Sym;
-
typedef struct
{
- Elf64_Word st_name; /* Symbol name (string tbl index) */
- unsigned char st_info; /* Symbol type and binding */
- unsigned char st_other; /* Symbol visibility */
- Elf64_Section st_shndx; /* Section index */
- Elf64_Addr st_value; /* Symbol value */
- Elf64_Xword st_size; /* Symbol size */
+ Elf64_Word st_name; /* Symbol name (string tbl index) */
+ unsigned char st_info; /* Symbol type and binding */
+ unsigned char st_other; /* Symbol visibility */
+ Elf64_Section st_shndx; /* Section index */
+ Elf64_Addr st_value; /* Symbol value */
+ Elf64_Xword st_size; /* Symbol size */
} Elf64_Sym;
-
-
#define STB_LOCAL 0 /* BIND */
#define STB_GLOBAL 1
#define STB_WEAK 2
@@ -249,8 +240,6 @@ typedef struct
#define ELF32_R_TYPE(i) ((unsigned char) (i))
#define ELF32_R_INFO(s,t) (((s) << 8) + (unsigned char)(t))
-
-
#define ELF64_R_SYM(i) ((i) >> 32)
#define ELF64_R_TYPE(i) ((i) & 0xffffffff)
#define ELF64_R_INFO(sym,type) ((((Elf64_Xword) (sym)) << 32) + (type))
@@ -301,7 +290,6 @@ typedef struct
Elf32_Word p_align; /* memory alignment */
} Elf32_Phdr;
-
typedef struct
{
Elf64_Word p_type; /* Segment type */
@@ -314,10 +302,6 @@ typedef struct
Elf64_Xword p_align; /* Segment alignment */
} Elf64_Phdr;
-
-
-
-
/* p_type */
#define PT_NULL 0
#define PT_LOAD 1
@@ -389,10 +373,9 @@ typedef Elf64_Sym Elf_Sym;
typedef Elf64_Rela Elf_Rel;
typedef Elf64_Addr Elf_Addr;
#endif
-int dlmodule_relocate(struct rt_dlmodule *module, Elf_Rel *rel, Elf_Addr sym_val);
-rt_err_t dlmodule_load_shared_object(struct rt_dlmodule* module, void *module_ptr);
-rt_err_t dlmodule_load_relocated_object(struct rt_dlmodule* module, void *module_ptr);
-
+int dlmodule_relocate(struct rt_dlmodule *module, Elf_Rel *rel, Elf_Addr sym_val);
+rt_err_t dlmodule_load_shared_object(struct rt_dlmodule *module, void *module_ptr);
+rt_err_t dlmodule_load_relocated_object(struct rt_dlmodule *module, void *module_ptr);
#endif
diff --git a/components/lwp/lwp_syscall.c b/components/lwp/lwp_syscall.c
index 02915ab1cc..d9112eed3e 100644
--- a/components/lwp/lwp_syscall.c
+++ b/components/lwp/lwp_syscall.c
@@ -13,7 +13,7 @@
#include <lwp_mem.h>
#include <lwp_syscall.h>
-#include <dfs_poll.h>
+#include <poll.h>
#include <dfs_select.h>
#if (defined(RT_USING_SAL) && defined(SAL_USING_POSIX))
diff --git a/components/net/at/at_socket/at_socket.c b/components/net/at/at_socket/at_socket.c
index 8215dd4417..96ea053f9c 100644
--- a/components/net/at/at_socket/at_socket.c
+++ b/components/net/at/at_socket/at_socket.c
@@ -19,7 +19,7 @@
#include <at_device.h>
#ifdef SAL_USING_POSIX
-#include <dfs_poll.h>
+#include <poll.h>
#endif
#include <arpa/inet.h>
diff --git a/components/net/at/include/at.h b/components/net/at/include/at.h
index 0e93720ff0..0a385058a0 100644
--- a/components/net/at/include/at.h
+++ b/components/net/at/include/at.h
@@ -12,6 +12,7 @@
#ifndef __AT_H__
#define __AT_H__
+#include <stddef.h>
#include <rtthread.h>
#ifdef __cplusplus
diff --git a/components/net/at/src/at_cli.c b/components/net/at/src/at_cli.c
index 25fbb708f4..c589bb68a0 100644
--- a/components/net/at/src/at_cli.c
+++ b/components/net/at/src/at_cli.c
@@ -11,7 +11,7 @@
#include <at.h>
#include <stdio.h>
#include <string.h>
-
+#include <stdint.h>
#include <rtthread.h>
#include <rtdevice.h>
#include <rthw.h>
diff --git a/components/net/at/src/at_client.c b/components/net/at/src/at_client.c
index 948020f4cf..845d8c0fa6 100644
--- a/components/net/at/src/at_client.c
+++ b/components/net/at/src/at_client.c
@@ -310,7 +310,6 @@ int at_obj_exec_cmd(at_client_t client, at_response_t resp, const char *cmd_expr
rt_mutex_take(client->lock, RT_WAITING_FOREVER);
client->resp_status = AT_RESP_OK;
- client->resp = resp;
if (resp != RT_NULL)
{
@@ -318,6 +317,9 @@ int at_obj_exec_cmd(at_client_t client, at_response_t resp, const char *cmd_expr
resp->line_counts = 0;
}
+ client->resp = resp;
+ rt_sem_control(client->resp_notice, RT_IPC_CMD_RESET, RT_NULL);
+
va_start(args, cmd_expr);
at_vprintfln(client->device, cmd_expr, args);
va_end(args);
@@ -327,7 +329,7 @@ int at_obj_exec_cmd(at_client_t client, at_response_t resp, const char *cmd_expr
if (rt_sem_take(client->resp_notice, resp->timeout) != RT_EOK)
{
cmd = at_get_last_cmd(&cmd_size);
- LOG_D("execute command (%.*s) timeout (%d ticks)!", cmd_size, cmd, resp->timeout);
+ LOG_W("execute command (%.*s) timeout (%d ticks)!", cmd_size, cmd, resp->timeout);
client->resp_status = AT_RESP_TIMEOUT;
result = -RT_ETIMEOUT;
goto __exit;
@@ -381,6 +383,7 @@ int at_client_obj_wait_connect(at_client_t client, rt_uint32_t timeout)
rt_mutex_take(client->lock, RT_WAITING_FOREVER);
client->resp = resp;
+ rt_sem_control(client->resp_notice, RT_IPC_CMD_RESET, RT_NULL);
start_time = rt_tick_get();
@@ -426,6 +429,8 @@ int at_client_obj_wait_connect(at_client_t client, rt_uint32_t timeout)
*/
rt_size_t at_client_obj_send(at_client_t client, const char *buf, rt_size_t size)
{
+ rt_size_t len;
+
RT_ASSERT(buf);
if (client == RT_NULL)
@@ -440,7 +445,7 @@ rt_size_t at_client_obj_send(at_client_t client, const char *buf, rt_size_t size
rt_mutex_take(client->lock, RT_WAITING_FOREVER);
- rt_size_t len = at_utils_send(client->device, 0, buf, size);
+ len = at_utils_send(client->device, 0, buf, size);
rt_mutex_release(client->lock);
@@ -480,9 +485,7 @@ static rt_err_t at_client_getchar(at_client_t client, char *ch, rt_int32_t timeo
*/
rt_size_t at_client_obj_recv(at_client_t client, char *buf, rt_size_t size, rt_int32_t timeout)
{
- rt_size_t read_idx = 0;
- rt_err_t result = RT_EOK;
- char ch;
+ rt_size_t len = 0;
RT_ASSERT(buf);
@@ -494,28 +497,30 @@ rt_size_t at_client_obj_recv(at_client_t client, char *buf, rt_size_t size, rt_i
while (1)
{
- if (read_idx < size)
+ rt_size_t read_len;
+
+ rt_sem_control(client->rx_notice, RT_IPC_CMD_RESET, RT_NULL);
+
+ read_len = rt_device_read(client->device, 0, buf + len, size);
+ if(read_len > 0)
{
- result = at_client_getchar(client, &ch, timeout);
- if (result != RT_EOK)
- {
- LOG_E("AT Client receive failed, uart device get data error(%d)", result);
- return 0;
- }
+ len += read_len;
+ size -= read_len;
+ if(size == 0)
+ break;
- buf[read_idx++] = ch;
+ continue;
}
- else
- {
+
+ if(rt_sem_take(client->rx_notice, rt_tick_from_millisecond(timeout)) != RT_EOK)
break;
- }
}
#ifdef AT_PRINT_RAW_CMD
- at_print_raw_cmd("urc_recv", buf, size);
+ at_print_raw_cmd("urc_recv", buf, len);
#endif
- return read_idx;
+ return len;
}
/**
diff --git a/components/net/lwip-1.4.1/src/apps/ping/ping.c b/components/net/lwip-1.4.1/src/apps/ping/ping.c
index 6d3cfe0fc3..6251504f59 100644
--- a/components/net/lwip-1.4.1/src/apps/ping/ping.c
+++ b/components/net/lwip-1.4.1/src/apps/ping/ping.c
@@ -236,7 +236,7 @@ int cmd_ping(int argc, char **argv)
return 0;
}
-FINSH_FUNCTION_EXPORT_ALIAS(cmd_ping, __cmd_ping, ping network host);
+MSH_CMD_EXPORT_ALIAS(cmd_ping, ping, ping network host);
#endif /* RT_USING_FINSH */
#endif /* RT_USING_NETDEV */
diff --git a/components/net/lwip-1.4.1/src/lwipopts.h b/components/net/lwip-1.4.1/src/lwipopts.h
index 9148066d50..a5e035b53a 100644
--- a/components/net/lwip-1.4.1/src/lwipopts.h
+++ b/components/net/lwip-1.4.1/src/lwipopts.h
@@ -533,6 +533,7 @@
#ifndef LWIP_SOCKET
#define LWIP_SOCKET 1
#endif
+#include <fcntl.h>
/*
* LWIP_COMPAT_SOCKETS==1: Enable BSD-style sockets functions names.
diff --git a/components/net/lwip-2.0.2/src/apps/ping/ping.c b/components/net/lwip-2.0.2/src/apps/ping/ping.c
index 6d3cfe0fc3..6251504f59 100644
--- a/components/net/lwip-2.0.2/src/apps/ping/ping.c
+++ b/components/net/lwip-2.0.2/src/apps/ping/ping.c
@@ -236,7 +236,7 @@ int cmd_ping(int argc, char **argv)
return 0;
}
-FINSH_FUNCTION_EXPORT_ALIAS(cmd_ping, __cmd_ping, ping network host);
+MSH_CMD_EXPORT_ALIAS(cmd_ping, ping, ping network host);
#endif /* RT_USING_FINSH */
#endif /* RT_USING_NETDEV */
diff --git a/components/net/lwip-2.0.2/src/lwipopts.h b/components/net/lwip-2.0.2/src/lwipopts.h
index fdfe1437b2..fe6e2fef6f 100644
--- a/components/net/lwip-2.0.2/src/lwipopts.h
+++ b/components/net/lwip-2.0.2/src/lwipopts.h
@@ -572,6 +572,7 @@
#ifndef LWIP_SOCKET
#define LWIP_SOCKET 1
#endif
+#include <fcntl.h>
/*
* LWIP_COMPAT_SOCKETS==1: Enable BSD-style sockets functions names.
diff --git a/components/net/lwip-2.0.3/src/apps/ping/ping.c b/components/net/lwip-2.0.3/src/apps/ping/ping.c
index 6d3cfe0fc3..6251504f59 100644
--- a/components/net/lwip-2.0.3/src/apps/ping/ping.c
+++ b/components/net/lwip-2.0.3/src/apps/ping/ping.c
@@ -236,7 +236,7 @@ int cmd_ping(int argc, char **argv)
return 0;
}
-FINSH_FUNCTION_EXPORT_ALIAS(cmd_ping, __cmd_ping, ping network host);
+MSH_CMD_EXPORT_ALIAS(cmd_ping, ping, ping network host);
#endif /* RT_USING_FINSH */
#endif /* RT_USING_NETDEV */
diff --git a/components/net/lwip-2.0.3/src/lwipopts.h b/components/net/lwip-2.0.3/src/lwipopts.h
index fdfe1437b2..fe6e2fef6f 100644
--- a/components/net/lwip-2.0.3/src/lwipopts.h
+++ b/components/net/lwip-2.0.3/src/lwipopts.h
@@ -572,6 +572,7 @@
#ifndef LWIP_SOCKET
#define LWIP_SOCKET 1
#endif
+#include <fcntl.h>
/*
* LWIP_COMPAT_SOCKETS==1: Enable BSD-style sockets functions names.
diff --git a/components/net/lwip-2.1.2/src/apps/ping/ping.c b/components/net/lwip-2.1.2/src/apps/ping/ping.c
index 6d3cfe0fc3..6251504f59 100644
--- a/components/net/lwip-2.1.2/src/apps/ping/ping.c
+++ b/components/net/lwip-2.1.2/src/apps/ping/ping.c
@@ -236,7 +236,7 @@ int cmd_ping(int argc, char **argv)
return 0;
}
-FINSH_FUNCTION_EXPORT_ALIAS(cmd_ping, __cmd_ping, ping network host);
+MSH_CMD_EXPORT_ALIAS(cmd_ping, ping, ping network host);
#endif /* RT_USING_FINSH */
#endif /* RT_USING_NETDEV */
diff --git a/components/net/lwip-2.1.2/src/include/netif/ethernetif.h b/components/net/lwip-2.1.2/src/include/netif/ethernetif.h
index 1459e3241d..6d5044b1b7 100644
--- a/components/net/lwip-2.1.2/src/include/netif/ethernetif.h
+++ b/components/net/lwip-2.1.2/src/include/netif/ethernetif.h
@@ -22,7 +22,6 @@ struct eth_device
/* network interface for lwip */
struct netif *netif;
- struct rt_semaphore tx_ack;
rt_uint16_t flags;
rt_uint8_t link_changed;
diff --git a/components/net/lwip-2.1.2/src/lwipopts.h b/components/net/lwip-2.1.2/src/lwipopts.h
index a964ab13ac..81409a9d0a 100644
--- a/components/net/lwip-2.1.2/src/lwipopts.h
+++ b/components/net/lwip-2.1.2/src/lwipopts.h
@@ -579,6 +579,7 @@
#ifndef LWIP_SOCKET
#define LWIP_SOCKET 1
#endif
+#include <fcntl.h>
/*
* LWIP_COMPAT_SOCKETS==1: Enable BSD-style sockets functions names.
diff --git a/components/net/lwip-2.1.2/src/netif/ethernetif.c b/components/net/lwip-2.1.2/src/netif/ethernetif.c
index bd4db225ee..e9c2a20a15 100644
--- a/components/net/lwip-2.1.2/src/netif/ethernetif.c
+++ b/components/net/lwip-2.1.2/src/netif/ethernetif.c
@@ -39,6 +39,7 @@
* 2013-02-28 aozima fixed list_tcps bug: ipaddr_ntoa isn't reentrant.
* 2016-08-18 Bernard port to lwIP 2.0.0
* 2018-11-02 MurphyZhao port to lwIP 2.1.0
+ * 2021-09-07 Grissiom fix eth_tx_msg ack bug
*/
#include "lwip/opt.h"
@@ -58,6 +59,8 @@
#include "lwip/inet.h"
+#include <ipc/completion.h>
+
#if LWIP_IPV6
#include "lwip/ethip6.h"
#endif /* LWIP_IPV6 */
@@ -79,6 +82,7 @@ struct eth_tx_msg
{
struct netif *netif;
struct pbuf *buf;
+ struct rt_completion ack;
};
static struct rt_mailbox eth_tx_thread_mb;
@@ -387,18 +391,17 @@ static err_t ethernetif_linkoutput(struct netif *netif, struct pbuf *p)
{
#ifndef LWIP_NO_TX_THREAD
struct eth_tx_msg msg;
- struct eth_device* enetif;
RT_ASSERT(netif != RT_NULL);
- enetif = (struct eth_device*)netif->state;
/* send a message to eth tx thread */
msg.netif = netif;
msg.buf = p;
+ rt_completion_init(&msg.ack);
if (rt_mb_send(&eth_tx_thread_mb, (rt_uint32_t) &msg) == RT_EOK)
{
/* waiting for ack */
- rt_sem_take(&(enetif->tx_ack), RT_WAITING_FOREVER);
+ rt_completion_wait(&msg.ack, RT_WAITING_FOREVER);
}
#else
struct eth_device* enetif;
@@ -519,7 +522,6 @@ rt_err_t eth_device_init_with_flag(struct eth_device *dev, const char *name, rt_
dev->parent.type = RT_Device_Class_NetIf;
/* register to RT-Thread device manager */
rt_device_register(&(dev->parent), name, RT_DEVICE_FLAG_RDWR);
- rt_sem_init(&(dev->tx_ack), name, 0, RT_IPC_FLAG_FIFO);
/* set name */
netif->name[0] = name[0];
@@ -595,7 +597,6 @@ void eth_device_deinit(struct eth_device *dev)
#endif
rt_device_close(&(dev->parent));
rt_device_unregister(&(dev->parent));
- rt_sem_detach(&(dev->tx_ack));
rt_free(netif);
}
@@ -673,7 +674,7 @@ static void eth_tx_thread_entry(void* parameter)
}
/* send ACK */
- rt_sem_release(&(enetif->tx_ack));
+ rt_completion_done(&msg->ack);
}
}
}
diff --git a/components/net/netdev/src/netdev.c b/components/net/netdev/src/netdev.c
index f722909cc8..4c5d524510 100644
--- a/components/net/netdev/src/netdev.c
+++ b/components/net/netdev/src/netdev.c
@@ -10,6 +10,7 @@
#include <stdio.h>
#include <string.h>
+#include <stdlib.h>
#include <rtthread.h>
#include <rthw.h>
@@ -1047,7 +1048,7 @@ int netdev_ifconfig(int argc, char **argv)
return 0;
}
-FINSH_FUNCTION_EXPORT_ALIAS(netdev_ifconfig, __cmd_ifconfig, list the information of all network interfaces);
+MSH_CMD_EXPORT_ALIAS(netdev_ifconfig, ifconfig, list the information of all network interfaces);
#endif /* NETDEV_USING_IFCONFIG */
#ifdef NETDEV_USING_PING
@@ -1152,7 +1153,7 @@ int netdev_ping(int argc, char **argv)
return 0;
}
-FINSH_FUNCTION_EXPORT_ALIAS(netdev_ping, __cmd_ping, ping network host);
+MSH_CMD_EXPORT_ALIAS(netdev_ping, ping, ping network host);
#endif /* NETDEV_USING_IFCONFIG */
static void netdev_list_dns(void)
@@ -1222,8 +1223,7 @@ int netdev_dns(int argc, char **argv)
return 0;
}
-FINSH_FUNCTION_EXPORT_ALIAS(netdev_dns, __cmd_dns, list and set the information of dns);
-
+MSH_CMD_EXPORT_ALIAS(netdev_dns, dns, list and set the information of dns);
#ifdef NETDEV_USING_NETSTAT
static void netdev_cmd_netstat(void)
{
@@ -1270,7 +1270,7 @@ int netdev_netstat(int argc, char **argv)
return 0;
}
-FINSH_FUNCTION_EXPORT_ALIAS(netdev_netstat, __cmd_netstat, list the information of TCP / IP);
+MSH_CMD_EXPORT_ALIAS(netdev_netstat, netstat, list the information of TCP / IP);
#endif /* NETDEV_USING_NETSTAT */
#endif /* RT_USING_FINSH */
diff --git a/components/net/netdev/src/netdev_ipaddr.c b/components/net/netdev/src/netdev_ipaddr.c
index 9abb41bd14..afb6d1d962 100644
--- a/components/net/netdev/src/netdev_ipaddr.c
+++ b/components/net/netdev/src/netdev_ipaddr.c
@@ -7,7 +7,7 @@
* Date Author Notes
* 2018-05-18 ChenYong First version
*/
-
+#include <stdlib.h>
#include <rtthread.h>
#include <netdev_ipaddr.h>
diff --git a/components/net/sal_socket/impl/af_inet_at.c b/components/net/sal_socket/impl/af_inet_at.c
index c85dfe9f06..07dff0018c 100644
--- a/components/net/sal_socket/impl/af_inet_at.c
+++ b/components/net/sal_socket/impl/af_inet_at.c
@@ -19,7 +19,7 @@
#include <netdev.h>
#ifdef SAL_USING_POSIX
-#include <dfs_poll.h>
+#include <poll.h>
#endif
#ifdef SAL_USING_AT
diff --git a/components/net/sal_socket/impl/af_inet_lwip.c b/components/net/sal_socket/impl/af_inet_lwip.c
index 2e19275b5d..2cf0958ee4 100644
--- a/components/net/sal_socket/impl/af_inet_lwip.c
+++ b/components/net/sal_socket/impl/af_inet_lwip.c
@@ -17,7 +17,7 @@
#include <lwip/netif.h>
#ifdef SAL_USING_POSIX
-#include <dfs_poll.h>
+#include <poll.h>
#endif
#include <sal.h>
diff --git a/components/net/sal_socket/include/sal_netdb.h b/components/net/sal_socket/include/sal_netdb.h
index 50064ce343..9b1421270f 100644
--- a/components/net/sal_socket/include/sal_netdb.h
+++ b/components/net/sal_socket/include/sal_netdb.h
@@ -10,6 +10,7 @@
#ifndef SAL_NETDB_H__
#define SAL_NETDB_H__
+#include <stddef.h>
#include "sal_socket.h"
#ifdef __cplusplus
diff --git a/components/net/sal_socket/include/sal_socket.h b/components/net/sal_socket/include/sal_socket.h
index 497be47e41..c479d21c62 100644
--- a/components/net/sal_socket/include/sal_socket.h
+++ b/components/net/sal_socket/include/sal_socket.h
@@ -11,6 +11,7 @@
#ifndef SAL_SOCKET_H__
#define SAL_SOCKET_H__
+#include <stddef.h>
#include <arpa/inet.h>
#ifdef __cplusplus
diff --git a/components/net/sal_socket/include/socket/netdb.h b/components/net/sal_socket/include/socket/netdb.h
index 9d54953681..8394fddea5 100644
--- a/components/net/sal_socket/include/socket/netdb.h
+++ b/components/net/sal_socket/include/socket/netdb.h
@@ -16,6 +16,7 @@
extern "C" {
#endif
+#include <stddef.h>
#include <sal_netdb.h>
struct hostent *gethostbyname(const char *name);
diff --git a/components/net/sal_socket/socket/net_netdb.c b/components/net/sal_socket/socket/net_netdb.c
index 03b995c68d..1eb84e1c32 100644
--- a/components/net/sal_socket/socket/net_netdb.c
+++ b/components/net/sal_socket/socket/net_netdb.c
@@ -9,6 +9,7 @@
* 2108-05-24 ChenYong Add socket abstraction layer
*/
+#include <stddef.h>
#include <rtthread.h>
#include <netdb.h>
diff --git a/components/net/sal_socket/socket/net_sockets.c b/components/net/sal_socket/socket/net_sockets.c
index 7d4db34327..1b6db50e6d 100644
--- a/components/net/sal_socket/socket/net_sockets.c
+++ b/components/net/sal_socket/socket/net_sockets.c
@@ -11,7 +11,7 @@
#include <dfs.h>
#include <dfs_file.h>
-#include <dfs_poll.h>
+#include <poll.h>
#include <dfs_net.h>
#include <sys/errno.h>
#include <sys/socket.h>
diff --git a/components/utilities/rt-link/src/rtlink_dev.c b/components/utilities/rt-link/src/rtlink_dev.c
index 5eff1f9782..efebf37565 100644
--- a/components/utilities/rt-link/src/rtlink_dev.c
+++ b/components/utilities/rt-link/src/rtlink_dev.c
@@ -21,7 +21,7 @@
#ifdef RT_USING_POSIX
#include <dfs_posix.h>
-#include <dfs_poll.h>
+#include <poll.h>
int rtlink_fops_open(struct dfs_fd *fd)
{
diff --git a/components/utilities/ulog/ulog.c b/components/utilities/ulog/ulog.c
index 89ba58cf48..0e227e39f3 100644
--- a/components/utilities/ulog/ulog.c
+++ b/components/utilities/ulog/ulog.c
@@ -1075,7 +1075,7 @@ const char *ulog_global_filter_kw_get(void)
return ulog.filter.keyword;
}
-#ifdef(RT_USING_FINSH)
+#ifdef RT_USING_FINSH
#include <finsh.h>
static void _print_lvl_info(void)
diff --git a/components/utilities/utest/utest_assert.h b/components/utilities/utest/utest_assert.h
index 2e2007e773..ba76fc39ee 100644
--- a/components/utilities/utest/utest_assert.h
+++ b/components/utilities/utest/utest_assert.h
@@ -50,8 +50,8 @@ void utest_assert_buf(const char *a, const char *b, rt_size_t sz, rt_bool_t equa
*/
#define uassert_true(value) __utest_assert(value, "(" #value ") is false")
#define uassert_false(value) __utest_assert(!(value), "(" #value ") is true")
-#define uassert_null(value) __utest_assert((const char *)(value) == NULL, "(" #value ") is not null")
-#define uassert_not_null(value) __utest_assert((const char *)(value) != NULL, "(" #value ") is null")
+#define uassert_null(value) __utest_assert((const char *)(value) == RT_NULL, "(" #value ") is not null")
+#define uassert_not_null(value) __utest_assert((const char *)(value) != RT_NULL, "(" #value ") is null")
#define uassert_int_equal(a, b) __utest_assert((a) == (b), "(" #a ") not equal to (" #b ")")
#define uassert_int_not_equal(a, b) __utest_assert((a) != (b), "(" #a ") equal to (" #b ")")
diff --git a/components/vbus/vbus.c b/components/vbus/vbus.c
index 2adaad9449..cb28b33fca 100644
--- a/components/vbus/vbus.c
+++ b/components/vbus/vbus.c
@@ -1308,7 +1308,7 @@ void rt_vbus_chm_wm_dump(void)
#ifdef RT_USING_FINSH
#include <finsh.h>
-FINSH_FUNCTION_EXPORT_ALIAS(rt_vbus_rb_dump, vbrb, dump vbus ringbuffer status);
+FINSH_FUNCTION_EXPORT_ALIAS(rt_vbus_rb_dump, vbrb, dump vbus ringbuffer status);
FINSH_FUNCTION_EXPORT_ALIAS(rt_vbus_chn_dump, vbchn, dump vbus channel status);
FINSH_FUNCTION_EXPORT_ALIAS(rt_vbus_sess_dump, vbses, dump vbus session status);
FINSH_FUNCTION_EXPORT_ALIAS(rt_vbus_que_dump, vbque, dump vbus out queue status);