diff --git a/bsp/qemu-vexpress-a9/.config b/bsp/qemu-vexpress-a9/.config index 8a4c1837dcfdfaa93314d6f3d927730be6b2f265..37ff3cbd450cb941d26437cf387049b1db738922 100644 --- a/bsp/qemu-vexpress-a9/.config +++ b/bsp/qemu-vexpress-a9/.config @@ -1,9 +1,13 @@ -# Generated by Kconfiglib (https://github.com/ulfalizer/Kconfiglib) +# +# Automatically generated file; DO NOT EDIT. +# RT-Thread Project Configuration +# # # RT-Thread Kernel # CONFIG_RT_NAME_MAX=8 +# CONFIG_RT_USING_BIG_ENDIAN is not set # CONFIG_RT_USING_ARCH_DATA_TYPE is not set CONFIG_RT_USING_SMP=y CONFIG_RT_CPUS_NR=2 @@ -28,8 +32,7 @@ CONFIG_RT_TIMER_THREAD_STACK_SIZE=1024 # # CONFIG_RT_KSERVICE_USING_STDLIB is not set # CONFIG_RT_KSERVICE_USING_TINY_SIZE is not set -# end of kservice optimization - +# CONFIG_RT_USING_ASM_MEMCPY is not set CONFIG_RT_DEBUG=y CONFIG_RT_DEBUG_COLOR=y # CONFIG_RT_DEBUG_INIT_CONFIG is not set @@ -52,7 +55,6 @@ CONFIG_RT_USING_EVENT=y CONFIG_RT_USING_MAILBOX=y CONFIG_RT_USING_MESSAGEQUEUE=y CONFIG_RT_USING_SIGNALS=y -# end of Inter-Thread communication # # Memory Management @@ -66,7 +68,6 @@ CONFIG_RT_USING_SMALL_MEM=y # CONFIG_RT_USING_USERHEAP is not set CONFIG_RT_USING_MEMTRACE=y CONFIG_RT_USING_HEAP=y -# end of Memory Management # # Kernel Device Object @@ -78,16 +79,15 @@ CONFIG_RT_USING_CONSOLE=y CONFIG_RT_CONSOLEBUF_SIZE=256 CONFIG_RT_CONSOLE_DEVICE_NAME="uart0" # CONFIG_RT_PRINTF_LONGLONG is not set -# end of Kernel Device Object - CONFIG_RT_VER_NUM=0x40004 -# end of RT-Thread Kernel - CONFIG_ARCH_ARM=y CONFIG_RT_USING_CPU_FFS=y CONFIG_ARCH_ARM_CORTEX_A=y +# CONFIG_RT_SMP_AUTO_BOOT is not set CONFIG_RT_USING_GIC_V2=y +# CONFIG_RT_USING_GIC_V3 is not set CONFIG_ARCH_ARM_CORTEX_A9=y +# CONFIG_ARCH_CPU_STACK_GROWS_UPWARD is not set # # RT-Thread Components @@ -102,7 +102,6 @@ CONFIG_RT_MAIN_THREAD_PRIORITY=10 # CONFIG_RT_USING_CPLUSPLUS=y # CONFIG_RT_USING_CPLUSPLUS11 is not set -# end of C++ features # # Command shell @@ -122,7 +121,6 @@ CONFIG_FINSH_USING_DESCRIPTION=y # CONFIG_FINSH_ECHO_DISABLE_DEFAULT is not set # CONFIG_FINSH_USING_AUTH is not set CONFIG_FINSH_ARG_MAX=10 -# end of Command shell # # Device virtual file system @@ -156,13 +154,10 @@ CONFIG_RT_DFS_ELM_MAX_SECTOR_SIZE=4096 # CONFIG_RT_DFS_ELM_USE_ERASE is not set CONFIG_RT_DFS_ELM_REENTRANT=y CONFIG_RT_DFS_ELM_MUTEX_TIMEOUT=3000 -# end of elm-chan's FatFs, Generic FAT Filesystem Module - CONFIG_RT_USING_DFS_DEVFS=y CONFIG_RT_USING_DFS_ROMFS=y CONFIG_RT_USING_DFS_RAMFS=y # CONFIG_RT_USING_DFS_NFS is not set -# end of Device virtual file system # # Device Drivers @@ -226,26 +221,29 @@ CONFIG_RT_USING_WDT=y # # Using USB # +# CONFIG_RT_USING_USB is not set # CONFIG_RT_USING_USB_HOST is not set # CONFIG_RT_USING_USB_DEVICE is not set -# end of Using USB -# end of Device Drivers # # POSIX layer and C standard library # CONFIG_RT_USING_LIBC=y -CONFIG_RT_USING_PTHREADS=y -CONFIG_PTHREAD_NUM_MAX=8 +CONFIG_RT_LIBC_USING_TIME=y +# CONFIG_RT_LIBC_USING_FILEIO is not set +# CONFIG_RT_USING_MODULE is not set +CONFIG_RT_LIBC_DEFAULT_TIMEZONE=8 CONFIG_RT_USING_POSIX=y +# CONFIG_RT_USING_POSIX_STDIO is not set +CONFIG_RT_USING_POSIX_POLL=y +CONFIG_RT_USING_POSIX_SELECT=y +CONFIG_RT_USING_POSIX_DELAY=y +CONFIG_RT_USING_POSIX_GETLINE=y CONFIG_RT_USING_POSIX_MMAP=y CONFIG_RT_USING_POSIX_TERMIOS=y -CONFIG_RT_USING_POSIX_GETLINE=y CONFIG_RT_USING_POSIX_AIO=y -CONFIG_RT_LIBC_USING_TIME=y -# CONFIG_RT_USING_MODULE is not set -CONFIG_RT_LIBC_DEFAULT_TIMEZONE=8 -# end of POSIX layer and C standard library +CONFIG_RT_USING_PTHREADS=y +CONFIG_PTHREAD_NUM_MAX=8 # # Network @@ -261,10 +259,7 @@ CONFIG_SAL_INTERNET_CHECK=y # protocol stack implement # CONFIG_SAL_USING_LWIP=y -# end of protocol stack implement - CONFIG_SAL_USING_POSIX=y -# end of Socket abstraction layer # # Network interface device @@ -277,7 +272,7 @@ CONFIG_NETDEV_USING_AUTO_DEFAULT=y # CONFIG_NETDEV_USING_IPV6 is not set CONFIG_NETDEV_IPV4=1 CONFIG_NETDEV_IPV6=0 -# end of Network interface device +# CONFIG_NETDEV_IPV6_SCOPES is not set # # light weight TCP/IP stack @@ -303,8 +298,6 @@ CONFIG_IP_SOF_BROADCAST_RECV=1 CONFIG_RT_LWIP_IPADDR="192.168.1.30" CONFIG_RT_LWIP_GWADDR="192.168.1.1" CONFIG_RT_LWIP_MSKADDR="255.255.255.0" -# end of Static IPv4 Address - CONFIG_RT_LWIP_UDP=y CONFIG_RT_LWIP_TCP=y CONFIG_RT_LWIP_RAW=y @@ -339,22 +332,17 @@ CONFIG_LWIP_NETIF_LOOPBACK=0 # CONFIG_RT_LWIP_USING_HW_CHECKSUM is not set CONFIG_RT_LWIP_USING_PING=y # CONFIG_RT_LWIP_DEBUG is not set -# end of light weight TCP/IP stack # # AT commands # # CONFIG_RT_USING_AT is not set -# end of AT commands - # CONFIG_LWIP_USING_DHCPD is not set -# end of Network # # VBUS(Virtual Software BUS) # # CONFIG_RT_USING_VBUS is not set -# end of VBUS(Virtual Software BUS) # # Utilities @@ -364,16 +352,12 @@ CONFIG_RT_LWIP_USING_PING=y # CONFIG_RT_USING_UTEST is not set # CONFIG_RT_USING_VAR_EXPORT is not set # CONFIG_RT_USING_RT_LINK is not set -# end of Utilities - CONFIG_RT_USING_LWP=y -# end of RT-Thread Components # # RT-Thread Utestcases # # CONFIG_RT_USING_UTESTCASES is not set -# end of RT-Thread Utestcases # # RT-Thread online packages @@ -408,17 +392,12 @@ CONFIG_RT_USING_LWP=y # Marvell WiFi # # CONFIG_PKG_USING_WLANMARVELL is not set -# end of Marvell WiFi # # Wiced WiFi # # CONFIG_PKG_USING_WLAN_WICED is not set -# end of Wiced WiFi - # CONFIG_PKG_USING_RW007 is not set -# end of Wi-Fi - # CONFIG_PKG_USING_COAP is not set # CONFIG_PKG_USING_NOPOLL is not set # CONFIG_PKG_USING_NETUTILS is not set @@ -440,8 +419,6 @@ CONFIG_RT_USING_LWP=y # 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 -# end of IoT Cloud - # CONFIG_PKG_USING_NIMBLE is not set # CONFIG_PKG_USING_OTA_DOWNLOADER is not set # CONFIG_PKG_USING_IPMSG is not set @@ -475,7 +452,7 @@ CONFIG_RT_USING_LWP=y # CONFIG_PKG_USING_LORA_GW_DRIVER_LIB is not set # CONFIG_PKG_USING_LORA_PKT_SNIFFER is not set # CONFIG_PKG_USING_HM is not set -# end of IoT - internet of things +# CONFIG_PKG_USING_SMALL_MODBUS is not set # # security packages @@ -485,7 +462,6 @@ CONFIG_RT_USING_LWP=y # CONFIG_PKG_USING_TINYCRYPT is not set # CONFIG_PKG_USING_TFM is not set # CONFIG_PKG_USING_YD_CRYPTO is not set -# end of security packages # # language packages @@ -494,22 +470,19 @@ CONFIG_RT_USING_LWP=y # CONFIG_PKG_USING_JERRYSCRIPT is not set # CONFIG_PKG_USING_MICROPYTHON is not set # CONFIG_PKG_USING_PIKASCRIPT is not set -# end of language packages # # multimedia packages # -# CONFIG_PKG_USING_OPENMV is not set -# CONFIG_PKG_USING_MUPDF is not set -# CONFIG_PKG_USING_STEMWIN is not set # -# lvgl: powerful and easy-to-use embedded GUI library +# LVGL: powerful and easy-to-use embedded GUI library # # CONFIG_PKG_USING_LITTLEVGL2RTT is not set # CONFIG_PKG_USING_LVGL is not set -# end of lvgl: powerful and easy-to-use embedded GUI library - +# 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 # CONFIG_PKG_USING_PDFGEN is not set @@ -526,8 +499,6 @@ CONFIG_RT_USING_LWP=y # # CONFIG_PKG_USING_U8G2_OFFICIAL is not set # CONFIG_PKG_USING_U8G2 is not set -# end of u8g2: a monochrome graphic library -# end of multimedia packages # # tools packages @@ -570,7 +541,6 @@ CONFIG_RT_USING_LWP=y # CONFIG_PKG_USING_MEM_SANDBOX is not set # CONFIG_PKG_USING_SOLAR_TERMS is not set # CONFIG_PKG_USING_GAN_ZHI is not set -# end of tools packages # # system packages @@ -583,7 +553,13 @@ CONFIG_RT_USING_LWP=y # CONFIG_PKG_USING_QFPLIB_M0_FULL is not set # CONFIG_PKG_USING_QFPLIB_M0_TINY is not set # CONFIG_PKG_USING_QFPLIB_M3 is not set -# end of acceleration: Assembly language or algorithmic acceleration packages + +# +# CMSIS: ARM Cortex-M Microcontroller Software Interface Standard +# +# CONFIG_PKG_USING_CMSIS_5 is not set +# CONFIG_PKG_USING_CMSIS_5_AUX is not set +# CONFIG_PKG_USING_CMSIS_RTOS2 is not set # # Micrium: Micrium software products porting for RT-Thread @@ -594,8 +570,6 @@ CONFIG_RT_USING_LWP=y # CONFIG_PKG_USING_UC_CLK is not set # CONFIG_PKG_USING_UC_COMMON is not set # CONFIG_PKG_USING_UC_MODBUS is not set -# end of Micrium: Micrium software products porting for RT-Thread - # CONFIG_PKG_USING_GUIENGINE is not set # CONFIG_PKG_USING_PERSIMMON is not set # CONFIG_PKG_USING_CAIRO is not set @@ -605,7 +579,6 @@ CONFIG_RT_USING_LWP=y # CONFIG_PKG_USING_FLASHDB is not set # CONFIG_PKG_USING_SQLITE is not set # CONFIG_PKG_USING_RTI 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_DFS_JFFS2 is not set @@ -630,7 +603,6 @@ CONFIG_RT_USING_LWP=y # CONFIG_PKG_USING_WCWIDTH is not set # CONFIG_PKG_USING_MCUBOOT is not set # CONFIG_PKG_USING_TINYUSB is not set -# end of system packages # # peripheral libraries and drivers @@ -706,7 +678,7 @@ CONFIG_RT_USING_LWP=y # CONFIG_PKG_USING_MISAKA_RGB_BLING is not set # CONFIG_PKG_USING_BL_MCU_SDK is not set # CONFIG_PKG_USING_SOFT_SERIAL is not set -# end of peripheral libraries and drivers +# CONFIG_PKG_USING_MB85RS16 is not set # # AI packages @@ -720,7 +692,6 @@ CONFIG_RT_USING_LWP=y # CONFIG_PKG_USING_ULAPACK is not set # CONFIG_PKG_USING_QUEST is not set # CONFIG_PKG_USING_NAXOS is not set -# end of AI packages # # miscellaneous packages @@ -733,7 +704,6 @@ CONFIG_RT_USING_LWP=y # CONFIG_PKG_USING_FILESYSTEM_SAMPLES is not set # CONFIG_PKG_USING_NETWORK_SAMPLES is not set # CONFIG_PKG_USING_PERIPHERAL_SAMPLES is not set -# end of samples: kernel and components samples # # entertainment: terminal games and other interesting software packages @@ -747,8 +717,6 @@ CONFIG_RT_USING_LWP=y # CONFIG_PKG_USING_SNAKE is not set # CONFIG_PKG_USING_TETRIS is not set # CONFIG_PKG_USING_DONUT is not set -# end of entertainment: terminal games and other interesting software packages - # CONFIG_PKG_USING_LIBCSV is not set # CONFIG_PKG_USING_OPTPARSE is not set # CONFIG_PKG_USING_FASTLZ is not set @@ -778,9 +746,6 @@ CONFIG_RT_USING_LWP=y # CONFIG_PKG_USING_MCURSES is not set # CONFIG_PKG_USING_COWSAY is not set # CONFIG_PKG_USING_TERMBOX is not set -# end of miscellaneous packages -# end of RT-Thread online packages - CONFIG_SOC_VEXPRESS_A9=y CONFIG_RT_USING_UART0=y CONFIG_RT_USING_UART1=y diff --git a/bsp/qemu-vexpress-a9/rtconfig.h b/bsp/qemu-vexpress-a9/rtconfig.h index 0bede871b0d72507f5627624f1ca8f1cf76849aa..b0a94bfe080f7dcc7e5b3a9657555a0f4ff3740d 100644 --- a/bsp/qemu-vexpress-a9/rtconfig.h +++ b/bsp/qemu-vexpress-a9/rtconfig.h @@ -1,7 +1,8 @@ #ifndef RT_CONFIG_H__ #define RT_CONFIG_H__ -/* Generated by Kconfiglib (https://github.com/ulfalizer/Kconfiglib) */ +/* Automatically generated file; DO NOT EDIT. */ +/* RT-Thread Project Configuration */ /* RT-Thread Kernel */ @@ -24,7 +25,6 @@ /* kservice optimization */ -/* end of kservice optimization */ #define RT_DEBUG #define RT_DEBUG_COLOR @@ -36,7 +36,6 @@ #define RT_USING_MAILBOX #define RT_USING_MESSAGEQUEUE #define RT_USING_SIGNALS -/* end of Inter-Thread communication */ /* Memory Management */ @@ -45,7 +44,6 @@ #define RT_USING_SMALL_MEM #define RT_USING_MEMTRACE #define RT_USING_HEAP -/* end of Memory Management */ /* Kernel Device Object */ @@ -55,9 +53,7 @@ #define RT_USING_CONSOLE #define RT_CONSOLEBUF_SIZE 256 #define RT_CONSOLE_DEVICE_NAME "uart0" -/* end of Kernel Device Object */ #define RT_VER_NUM 0x40004 -/* end of RT-Thread Kernel */ #define ARCH_ARM #define RT_USING_CPU_FFS #define ARCH_ARM_CORTEX_A @@ -74,7 +70,6 @@ /* C++ features */ #define RT_USING_CPLUSPLUS -/* end of C++ features */ /* Command shell */ @@ -91,7 +86,6 @@ #define MSH_USING_BUILT_IN_COMMANDS #define FINSH_USING_DESCRIPTION #define FINSH_ARG_MAX 10 -/* end of Command shell */ /* Device virtual file system */ @@ -115,11 +109,9 @@ #define RT_DFS_ELM_MAX_SECTOR_SIZE 4096 #define RT_DFS_ELM_REENTRANT #define RT_DFS_ELM_MUTEX_TIMEOUT 3000 -/* end of elm-chan's FatFs, Generic FAT Filesystem Module */ #define RT_USING_DFS_DEVFS #define RT_USING_DFS_ROMFS #define RT_USING_DFS_RAMFS -/* end of Device virtual file system */ /* Device Drivers */ @@ -156,22 +148,22 @@ /* Using USB */ -/* end of Using USB */ -/* end of Device Drivers */ /* POSIX layer and C standard library */ #define RT_USING_LIBC -#define RT_USING_PTHREADS -#define PTHREAD_NUM_MAX 8 +#define RT_LIBC_USING_TIME +#define RT_LIBC_DEFAULT_TIMEZONE 8 #define RT_USING_POSIX +#define RT_USING_POSIX_POLL +#define RT_USING_POSIX_SELECT +#define RT_USING_POSIX_DELAY +#define RT_USING_POSIX_GETLINE #define RT_USING_POSIX_MMAP #define RT_USING_POSIX_TERMIOS -#define RT_USING_POSIX_GETLINE #define RT_USING_POSIX_AIO -#define RT_LIBC_USING_TIME -#define RT_LIBC_DEFAULT_TIMEZONE 8 -/* end of POSIX layer and C standard library */ +#define RT_USING_PTHREADS +#define PTHREAD_NUM_MAX 8 /* Network */ @@ -183,9 +175,7 @@ /* protocol stack implement */ #define SAL_USING_LWIP -/* end of protocol stack implement */ #define SAL_USING_POSIX -/* end of Socket abstraction layer */ /* Network interface device */ @@ -196,7 +186,6 @@ #define NETDEV_USING_AUTO_DEFAULT #define NETDEV_IPV4 1 #define NETDEV_IPV6 0 -/* end of Network interface device */ /* light weight TCP/IP stack */ @@ -214,7 +203,6 @@ #define RT_LWIP_IPADDR "192.168.1.30" #define RT_LWIP_GWADDR "192.168.1.1" #define RT_LWIP_MSKADDR "255.255.255.0" -/* end of Static IPv4 Address */ #define RT_LWIP_UDP #define RT_LWIP_TCP #define RT_LWIP_RAW @@ -242,26 +230,19 @@ #define LWIP_SO_LINGER 0 #define LWIP_NETIF_LOOPBACK 0 #define RT_LWIP_USING_PING -/* end of light weight TCP/IP stack */ /* AT commands */ -/* end of AT commands */ -/* end of Network */ /* VBUS(Virtual Software BUS) */ -/* end of VBUS(Virtual Software BUS) */ /* Utilities */ -/* end of Utilities */ #define RT_USING_LWP -/* end of RT-Thread Components */ /* RT-Thread Utestcases */ -/* end of RT-Thread Utestcases */ /* RT-Thread online packages */ @@ -272,72 +253,54 @@ /* Marvell WiFi */ -/* end of Marvell WiFi */ /* Wiced WiFi */ -/* end of Wiced WiFi */ -/* end of Wi-Fi */ /* IoT Cloud */ -/* end of IoT Cloud */ -/* end of IoT - internet of things */ /* security packages */ -/* end of security packages */ /* language packages */ -/* end of language packages */ /* multimedia packages */ +/* LVGL: powerful and easy-to-use embedded GUI library */ -/* lvgl: powerful and easy-to-use embedded GUI library */ - -/* end of lvgl: powerful and easy-to-use embedded GUI library */ /* u8g2: a monochrome graphic library */ -/* end of u8g2: a monochrome graphic library */ -/* end of multimedia packages */ /* tools packages */ -/* end of tools packages */ /* system packages */ /* acceleration: Assembly language or algorithmic acceleration packages */ -/* end of acceleration: Assembly language or algorithmic acceleration packages */ + +/* CMSIS: ARM Cortex-M Microcontroller Software Interface Standard */ + /* Micrium: Micrium software products porting for RT-Thread */ -/* end of Micrium: Micrium software products porting for RT-Thread */ -/* end of system packages */ /* peripheral libraries and drivers */ -/* end of peripheral libraries and drivers */ /* AI packages */ -/* end of AI packages */ /* miscellaneous packages */ /* samples: kernel and components samples */ -/* end of samples: kernel and components samples */ /* entertainment: terminal games and other interesting software packages */ -/* end of entertainment: terminal games and other interesting software packages */ -/* end of miscellaneous packages */ -/* end of RT-Thread online packages */ #define SOC_VEXPRESS_A9 #define RT_USING_UART0 #define RT_USING_UART1 diff --git a/components/dfs/Kconfig b/components/dfs/Kconfig index 7a4fbb655d1f71582537d857be30e852457d1a9a..1ec36784d733d8aeecd75c4a06a2a64e85afff7f 100644 --- a/components/dfs/Kconfig +++ b/components/dfs/Kconfig @@ -133,7 +133,7 @@ if RT_USING_DFS config RT_USING_DFS_DEVFS bool "Using devfs for device objects" - default y + default n config RT_USING_DFS_ROMFS bool "Enable ReadOnly file system on flash" diff --git a/components/dfs/include/dfs_fs.h b/components/dfs/include/dfs_fs.h index 3d194515dff8d992d85edcb41d05f47acc9c3384..0a13040c21fe958ddb4d3481658dd528abeb30b9 100644 --- a/components/dfs/include/dfs_fs.h +++ b/components/dfs/include/dfs_fs.h @@ -12,10 +12,9 @@ #define __DFS_FS_H__ #include -#ifdef RT_USING_LIBC #include -#endif #include + #ifdef __cplusplus extern "C" { #endif diff --git a/components/dfs/src/dfs.c b/components/dfs/src/dfs.c index ed8d8094aa2540156c010d7fa9f643044a42ec9f..29b2068a6c43025cfe94e6c4b03f45e68606a898 100644 --- a/components/dfs/src/dfs.c +++ b/components/dfs/src/dfs.c @@ -18,9 +18,9 @@ #include #endif -#ifdef RT_USING_POSIX +#ifdef RT_USING_POSIX_STDIO #include -#endif /* RT_USING_POSIX */ +#endif /* RT_USING_POSIX_STDIO */ /* Global variables */ const struct dfs_filesystem_ops *filesystem_operation_table[DFS_FILESYSTEM_TYPES_MAX]; @@ -216,10 +216,10 @@ struct dfs_fd *fd_get(int fd) struct dfs_fd *d; struct dfs_fdtable *fdt; -#ifdef RT_USING_POSIX +#ifdef RT_USING_POSIX_STDIO if ((0 <= fd) && (fd <= 2)) fd = libc_stdio_get_console(); -#endif /* RT_USING_POSIX */ +#endif /* RT_USING_POSIX_STDIO */ fdt = dfs_fdtable_get(); fd = fd - DFS_FD_OFFSET; diff --git a/components/finsh/shell.c b/components/finsh/shell.c index 6938ed1f24fa4afe9e63163bf7d970910ffd03df..c2f6e2a55011bccde56fe7dc45c2ab12c6ed38a0 100644 --- a/components/finsh/shell.c +++ b/components/finsh/shell.c @@ -146,7 +146,7 @@ int finsh_getchar(void) { #ifdef RT_USING_DEVICE char ch = 0; -#ifdef RT_USING_POSIX +#ifdef RT_USING_POSIX_STDIO if(read(STDIN_FILENO, &ch, 1) > 0) { return ch; @@ -170,14 +170,14 @@ int finsh_getchar(void) rt_sem_take(&shell->rx_sem, RT_WAITING_FOREVER); return ch; -#endif /* RT_USING_POSIX */ +#endif /* RT_USING_POSIX_STDIO */ #else extern char rt_hw_console_getchar(void); return rt_hw_console_getchar(); #endif /* RT_USING_DEVICE */ } -#if !defined(RT_USING_POSIX) && defined(RT_USING_DEVICE) +#if !defined(RT_USING_POSIX_STDIO) && defined(RT_USING_DEVICE) static rt_err_t finsh_rx_ind(rt_device_t dev, rt_size_t size) { RT_ASSERT(shell != RT_NULL); @@ -241,7 +241,7 @@ const char *finsh_get_device() RT_ASSERT(shell != RT_NULL); return shell->device->parent.name; } -#endif +#endif /* !defined(RT_USING_POSIX_STDIO) && defined(RT_USING_DEVICE) */ /** * @ingroup finsh @@ -443,7 +443,7 @@ void finsh_thread_entry(void *parameter) shell->echo_mode = 0; #endif -#if !defined(RT_USING_POSIX) && defined(RT_USING_DEVICE) +#if !defined(RT_USING_POSIX_STDIO) && defined(RT_USING_DEVICE) /* set console device as shell device */ if (shell->device == RT_NULL) { @@ -453,7 +453,7 @@ void finsh_thread_entry(void *parameter) finsh_set_device(console->parent.name); } } -#endif +#endif /* !defined(RT_USING_POSIX_STDIO) && defined(RT_USING_DEVICE) */ #ifdef FINSH_USING_AUTH /* set the default password when the password isn't setting */ diff --git a/components/finsh/shell.h b/components/finsh/shell.h index 985d3b3fbd4db7cece6f401c098212a5064cf42e..d421f603748d477cfaf94e1580dcb59d8ec2154e 100644 --- a/components/finsh/shell.h +++ b/components/finsh/shell.h @@ -78,7 +78,7 @@ struct finsh_shell rt_uint16_t line_position; rt_uint16_t line_curpos; -#if !defined(RT_USING_POSIX) && defined(RT_USING_DEVICE) +#if !defined(RT_USING_POSIX_STDIO) && defined(RT_USING_DEVICE) rt_device_t device; #endif diff --git a/components/libc/Kconfig b/components/libc/Kconfig index b2af15e8419b10a12032078ce5875a7bfbf19abc..4506001d428ec2c55514f2c96b1cd2b2b9624bcd 100644 --- a/components/libc/Kconfig +++ b/components/libc/Kconfig @@ -10,8 +10,8 @@ if RT_USING_LIBC config RT_LIBC_USING_FILEIO bool "Enable libc with file operation, eg.fopen/fwrite/fread/getchar" - select RT_USING_DFS select RT_USING_POSIX + select RT_USING_POSIX_STDIO default n config RT_USING_MODULE @@ -37,40 +37,59 @@ config RT_LIBC_DEFAULT_TIMEZONE range -12 12 default 8 -config RT_USING_PTHREADS - bool "Enable pthreads APIs" +config RT_USING_POSIX + bool "Enable basic POSIX layer, open/read/write/close etc" + select RT_USING_DFS default n -if RT_USING_PTHREADS - config PTHREAD_NUM_MAX - int "Maximum number of pthreads" - default 8 -endif - -if RT_USING_DFS - config RT_USING_POSIX - bool "Enable POSIX layer, open/read/write/select etc" +if RT_USING_POSIX + config RT_USING_POSIX_STDIO + bool "Enable standard I/O" + select RT_USING_DFS select RT_USING_DFS_DEVFS - default y + default n - if RT_USING_POSIX - config RT_USING_POSIX_MMAP - bool "Enable mmap() API" - default n + config RT_USING_POSIX_POLL + bool "Enable poll()" + select RT_USING_DFS + default n - config RT_USING_POSIX_TERMIOS - bool "Enable termios APIs" - default n + config RT_USING_POSIX_SELECT + bool "Enable select()" + select RT_USING_DFS + select RT_USING_POSIX_POLL + default n - config RT_USING_POSIX_GETLINE - bool "Enable getline()/getdelim() APIs" - default n + config RT_USING_POSIX_DELAY + bool "Enable delay functions" + default n - config RT_USING_POSIX_AIO - bool "Enable AIO" - default n - endif + config RT_USING_POSIX_GETLINE + bool "Enable getline()/getdelim() APIs" + default n + + config RT_USING_POSIX_MMAP + bool "Enable mmap() API" + select RT_USING_DFS + default n + + config RT_USING_POSIX_TERMIOS + bool "Enable termios APIs" + default n + config RT_USING_POSIX_AIO + bool "Enable AIO" + default n +endif + +config RT_USING_PTHREADS + bool "Enable pthreads APIs" + default n + +if RT_USING_PTHREADS + config PTHREAD_NUM_MAX + int "Maximum number of pthreads" + default 8 endif endmenu diff --git a/components/libc/compilers/armlibc/syscalls.c b/components/libc/compilers/armlibc/syscalls.c index 755ffef1a650711a614f3da4f12a521aba1ea005..62657a4b6491a7df35dfadffb4bde87023d31f5a 100644 --- a/components/libc/compilers/armlibc/syscalls.c +++ b/components/libc/compilers/armlibc/syscalls.c @@ -21,7 +21,7 @@ #include #include #include -#ifdef RT_USING_POSIX +#ifdef RT_USING_POSIX_STDIO #include "libc.h" #endif @@ -144,7 +144,7 @@ int _sys_close(FILEHANDLE fh) */ int _sys_read(FILEHANDLE fh, unsigned char *buf, unsigned len, int mode) { -#ifdef RT_USING_POSIX +#ifdef RT_USING_POSIX_STDIO int size; if (fh == STDIN) @@ -169,7 +169,7 @@ int _sys_read(FILEHANDLE fh, unsigned char *buf, unsigned len, int mode) return 0; /* error */ #else return 0; /* error */ -#endif /* RT_USING_POSIX */ +#endif /* RT_USING_POSIX_STDIO */ } /* @@ -185,7 +185,7 @@ int _sys_write(FILEHANDLE fh, const unsigned char *buf, unsigned len, int mode) if ((fh == STDOUT) || (fh == STDERR)) { -#ifdef RT_USING_POSIX +#ifdef RT_USING_POSIX_STDIO if (libc_stdio_get_console() < 0) { LOG_W("Do not invoke standard input before initializing libc"); @@ -200,7 +200,7 @@ int _sys_write(FILEHANDLE fh, const unsigned char *buf, unsigned len, int mode) } return 0; /* error */ -#endif /* RT_USING_POSIX */ +#endif /* RT_USING_POSIX_STDIO */ } else if (fh == STDIN) { @@ -325,7 +325,7 @@ int fputc(int c, FILE *f) int fgetc(FILE *f) { -#ifdef RT_USING_POSIX +#ifdef RT_USING_POSIX_STDIO char ch; if (libc_stdio_get_console() < 0) @@ -336,7 +336,7 @@ int fgetc(FILE *f) if(read(STDIN_FILENO, &ch, 1) == 1) return ch; -#endif /* RT_USING_POSIX */ +#endif /* RT_USING_POSIX_STDIO */ return 0; /* error */ } diff --git a/components/libc/compilers/dlib/syscall_read.c b/components/libc/compilers/dlib/syscall_read.c index 74cedb966a73f153b063321c60e0d740a547aaa6..c926c577b5871b24a8e3a95bb984128c293eb1fa 100644 --- a/components/libc/compilers/dlib/syscall_read.c +++ b/components/libc/compilers/dlib/syscall_read.c @@ -11,7 +11,7 @@ #include #include #include -#ifdef RT_USING_POSIX +#ifdef RT_USING_POSIX_STDIO #include "libc.h" #endif @@ -22,7 +22,7 @@ #pragma module_name = "?__read" size_t __read(int handle, unsigned char *buf, size_t len) { -#ifdef RT_USING_POSIX +#ifdef RT_USING_POSIX_STDIO int size; if (handle == _LLIO_STDIN) diff --git a/components/libc/compilers/dlib/syscall_write.c b/components/libc/compilers/dlib/syscall_write.c index ab011c1096fbc0d16652e29d8355391f61f3337c..72bac6ba49a59736ed77944420f327cfb5ae0b37 100644 --- a/components/libc/compilers/dlib/syscall_write.c +++ b/components/libc/compilers/dlib/syscall_write.c @@ -11,7 +11,7 @@ #include #include #include -#ifdef RT_USING_POSIX +#ifdef RT_USING_POSIX_STDIO #include "libc.h" #endif @@ -29,7 +29,7 @@ size_t __write(int handle, const unsigned char *buf, size_t len) if ((handle == _LLIO_STDOUT) || (handle == _LLIO_STDERR)) { -#ifdef RT_USING_POSIX +#ifdef RT_USING_POSIX_STDIO if (libc_stdio_get_console() < 0) { LOG_W("Do not invoke standard output before initializing libc"); diff --git a/components/libc/compilers/gcc/newlib/syscalls.c b/components/libc/compilers/gcc/newlib/syscalls.c index f95e695a854db00072490cad67b05c8b1e43c4df..e957aaf003739443a62e6d99ef571003a801d4f9 100644 --- a/components/libc/compilers/gcc/newlib/syscalls.c +++ b/components/libc/compilers/gcc/newlib/syscalls.c @@ -20,7 +20,7 @@ #include #include #include -#ifdef RT_USING_POSIX +#ifdef RT_USING_POSIX_STDIO #include "libc.h" #endif #ifdef RT_USING_MODULE @@ -216,7 +216,7 @@ int _open_r(struct _reent *ptr, const char *file, int flags, int mode) _ssize_t _read_r(struct _reent *ptr, int fd, void *buf, size_t nbytes) { -#ifdef RT_USING_POSIX +#ifdef RT_USING_POSIX_STDIO _ssize_t rc; if (libc_stdio_get_console() < 0 && fd == STDIN_FILENO) { @@ -271,11 +271,13 @@ _ssize_t _write_r(struct _reent *ptr, int fd, const void *buf, size_t nbytes) { #ifdef RT_USING_POSIX _ssize_t rc; +#ifdef RT_USING_POSIX_STDIO if (libc_stdio_get_console() < 0 && fd == STDOUT_FILENO) { LOG_W("Do not invoke standard output before initializing libc"); return 0; } +#endif /* RT_USING_POSIX_STDIO */ rc = write(fd, buf, nbytes); return rc; #elif defined(RT_USING_CONSOLE) diff --git a/components/libc/compilers/readme.md b/components/libc/compilers/readme.md new file mode 100644 index 0000000000000000000000000000000000000000..e376cc704fbbf022095bdada67f2b93b1c73eaeb --- /dev/null +++ b/components/libc/compilers/readme.md @@ -0,0 +1 @@ +This folder provides uniformed header files crossing different compiler platforms, and supports basic standard C library functions, such as memory management and time management, etc. \ No newline at end of file diff --git a/components/libc/posix/mmap/SConscript b/components/libc/posix/mmap/SConscript deleted file mode 100644 index fd5b2b953e83d2f2e81909bef3b76fffcf976c79..0000000000000000000000000000000000000000 --- a/components/libc/posix/mmap/SConscript +++ /dev/null @@ -1,13 +0,0 @@ -# RT-Thread building script for component - -from building import * - -cwd = GetCurrentDir() -src = Glob('*.c') + Glob('*.cpp') -CPPPATH = [cwd] - -group = DefineGroup('POSIX', src, - depend = ['RT_USING_DFS', 'RT_USING_POSIX_MMAP'], - CPPPATH = CPPPATH) - -Return('group') diff --git a/components/libc/posix/readme.md b/components/libc/posix/readme.md new file mode 100644 index 0000000000000000000000000000000000000000..787b9ddefa422f988a3e0fd2390fa30de3ea1dd0 --- /dev/null +++ b/components/libc/posix/readme.md @@ -0,0 +1 @@ +This folder provides functions that are not part of the standard C library but are part of the POSIX.1 (IEEE Standard 1003.1) standard. \ No newline at end of file diff --git a/components/libc/posix/src/SConscript b/components/libc/posix/src/SConscript index f338b52cec517c00e9bd7ce186c2a6cd43461970..0f5d0e9911da7ca7012c667a052bb0a0d76ad6d7 100644 --- a/components/libc/posix/src/SConscript +++ b/components/libc/posix/src/SConscript @@ -1,12 +1,22 @@ +# RT-Thread building script for component + from building import * -Import('rtconfig') -src = Glob('*.c') +src = ['unistd.c', 'delay.c'] cwd = GetCurrentDir() CPPPATH = [cwd] -if rtconfig.ARCH == 'sim': # the vs simulator does not support select and poll - SrcRemove(src, ['select.c', 'poll.c']) +if GetDepend('RT_USING_POSIX_STDIO'): + src += ['libc.c'] + +if GetDepend('RT_USING_POSIX_POLL'): + src += ['poll.c'] + +if GetDepend('RT_USING_POSIX_SELECT'): + src += ['select.c'] + +if GetDepend('RT_USING_POSIX_MMAP'): + src += ['mmap.c'] group = DefineGroup('POSIX', src, depend = ['RT_USING_POSIX'], CPPPATH = CPPPATH) diff --git a/components/libc/posix/src/delay.c b/components/libc/posix/src/delay.c index 1638caafbf51c1edbe455b8772378ace1b671be3..c8564dc54e1b08985204b03871d04102d5fa21f2 100644 --- a/components/libc/posix/src/delay.c +++ b/components/libc/posix/src/delay.c @@ -7,6 +7,7 @@ * Date Author Notes * 2021-05-07 Meco Man first Version */ +#include #include #include #define DBG_TAG "POSIX.delay" @@ -48,3 +49,38 @@ void ndelay(unsigned long nsecs) rt_hw_us_delay(1); } RTM_EXPORT(ndelay); + +unsigned int sleep(unsigned int seconds) +{ + if (rt_thread_self() != RT_NULL) + { + ssleep(seconds); + } + else /* scheduler has not run yet */ + { + while(seconds > 0) + { + udelay(1000000u); + seconds --; + } + } + + return 0; +} +RTM_EXPORT(sleep); + +int usleep(useconds_t usec) +{ + if (rt_thread_self() != RT_NULL) + { + msleep(usec / 1000u); + } + else /* scheduler has not run yet */ + { + udelay(usec / 1000u); + } + udelay(usec % 1000u); + + return 0; +} +RTM_EXPORT(usleep); diff --git a/components/libc/posix/mmap/posix_mmap.c b/components/libc/posix/src/mmap.c similarity index 100% rename from components/libc/posix/mmap/posix_mmap.c rename to components/libc/posix/src/mmap.c diff --git a/components/libc/posix/src/poll.c b/components/libc/posix/src/poll.c index 2109fb310bff6d831c4213c8ce724825e7b485a9..0c773b306c6a1a573457a1669cc319556b5f6678 100644 --- a/components/libc/posix/src/poll.c +++ b/components/libc/posix/src/poll.c @@ -14,8 +14,6 @@ #include #include -#ifdef RT_USING_POSIX - struct rt_poll_node; struct rt_poll_table @@ -226,5 +224,3 @@ int poll(struct pollfd *fds, nfds_t nfds, int timeout) return num; } - -#endif diff --git a/components/libc/posix/src/select.c b/components/libc/posix/src/select.c index 25cda0f0d138ea466826da1b503c6707d9aac354..55d320e92183e03a6d67e548af50bbde2c4867bb 100644 --- a/components/libc/posix/src/select.c +++ b/components/libc/posix/src/select.c @@ -11,8 +11,6 @@ #include #include -#ifdef RT_USING_POSIX - static void fdszero(fd_set *set, int nfds) { fd_mask *m; @@ -176,5 +174,3 @@ int select(int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, struc return ret; } - -#endif diff --git a/components/libc/posix/src/unistd.c b/components/libc/posix/src/unistd.c index ef2df2c2feb0ca97dd4157c1f8ed8047660fd497..85235965ea5cf9360fe384d54eddd9244d7c3ccb 100644 --- a/components/libc/posix/src/unistd.c +++ b/components/libc/posix/src/unistd.c @@ -13,7 +13,6 @@ #include #include #include -#include /** * this function is a POSIX compliant version, which will open a file and @@ -965,80 +964,3 @@ char *ttyname(int fd) return "/dev/tty"; /* TODO: need to add more specific */ } RTM_EXPORT(ttyname); - -unsigned int sleep(unsigned int seconds) -{ - if (rt_thread_self() != RT_NULL) - { - ssleep(seconds); - } - else /* scheduler has not run yet */ - { - while(seconds > 0) - { - udelay(1000000u); - seconds --; - } - } - - return 0; -} -RTM_EXPORT(sleep); - -int usleep(useconds_t usec) -{ - if (rt_thread_self() != RT_NULL) - { - msleep(usec / 1000u); - } - else /* scheduler has not run yet */ - { - udelay(usec / 1000u); - } - udelay(usec % 1000u); - - return 0; -} -RTM_EXPORT(usleep); - -pid_t gettid(void) -{ - /*TODO*/ - return 0; -} - -pid_t getpid(void) -{ - return gettid(); -} -RTM_EXPORT(getpid); - -pid_t getppid(void) -{ - return 0; -} -RTM_EXPORT(getppid); - -uid_t getuid(void) -{ - return 0; /*ROOT*/ -} -RTM_EXPORT(getuid); - -uid_t geteuid(void) -{ - return 0; /*ROOT*/ -} -RTM_EXPORT(geteuid); - -gid_t getgid(void) -{ - return 0; /*ROOT*/ -} -RTM_EXPORT(getgid); - -gid_t getegid(void) -{ - return 0; /*ROOT*/ -} -RTM_EXPORT(getegid); diff --git a/components/lwp/Kconfig b/components/lwp/Kconfig index 1b37829935e70a2d6e3f9ed2019eccefdf7b4a3f..3e1982001ead4967583865e6321aa74a3463e9a6 100644 --- a/components/lwp/Kconfig +++ b/components/lwp/Kconfig @@ -1,6 +1,7 @@ config RT_USING_LWP bool "Using light-weight process" - select RT_USING_DFS + select RT_USING_POSIX + select RT_USING_POSIX_SELECT select RT_USING_LIBC depends on ARCH_ARM_CORTEX_M || ARCH_ARM_ARM9 || ARCH_ARM_CORTEX_A default n diff --git a/components/lwp/lwp_syscall.c b/components/lwp/lwp_syscall.c index f9bc84ea97f390d22332177089a088d21e2c90dc..f2aec9303f8ba7f4d05186b22f0f7ab82b4d5a58 100644 --- a/components/lwp/lwp_syscall.c +++ b/components/lwp/lwp_syscall.c @@ -18,7 +18,6 @@ #if (defined(RT_USING_SAL) && defined(SAL_USING_POSIX)) #include - #define SYSCALL_NET(f) ((void*)(f)) #else #define SYSCALL_NET(f) ((void*)sys_notimpl) diff --git a/components/net/Kconfig b/components/net/Kconfig index 0fede3eb909bd2b2e86fa5df299f8bc9505cfb61..4d6317bac6b826d3e94b0f922f24e9bfa45186b8 100644 --- a/components/net/Kconfig +++ b/components/net/Kconfig @@ -41,9 +41,8 @@ config RT_USING_SAL config SAL_USING_POSIX bool "Enable BSD socket operated by file system API" default n - select RT_USING_DFS - select RT_USING_LIBC select RT_USING_POSIX + select RT_USING_POSIX_SELECT help Let BSD socket operated by file system API, such as read/write and involveed in select/poll POSIX APIs. diff --git a/include/rtdebug.h b/include/rtdebug.h index c170d148c10d25e1cdfc712ba08d8cd0f8121178..0858a5bbf10619cea92bb6676fab416a9f85752a 100644 --- a/include/rtdebug.h +++ b/include/rtdebug.h @@ -12,13 +12,6 @@ #include -/* settings depend check */ -#ifdef RT_USING_POSIX -#if !defined(RT_USING_DFS) || !defined(RT_USING_DFS_DEVFS) -#error "POSIX poll/select, stdin need file system(RT_USING_DFS) and device file system(RT_USING_DFS_DEVFS)" -#endif -#endif /* RT_USING_POSIX */ - /* Using this macro to control all kernel debug features. */ #ifdef RT_DEBUG