From 67e14adc4f0dfbaef4762e383a5328add42f6cf5 Mon Sep 17 00:00:00 2001 From: Meco Man <920369182@qq.com> Date: Sun, 5 Dec 2021 18:52:59 -0500 Subject: [PATCH] =?UTF-8?q?[posix]=20=E6=8C=89=E7=85=A7=E9=AB=98=E7=BA=A7u?= =?UTF-8?q?nix=E7=8E=AF=E5=A2=83=E7=BC=96=E7=A8=8B=E6=95=B4=E7=90=86IO?= =?UTF-8?q?=E7=B1=BB=E5=88=AB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bsp/raspberry-pi/raspi4-32/.config | 181 +++++++++++++----- bsp/raspberry-pi/raspi4-32/rtconfig.h | 37 +++- components/drivers/serial/serial.c | 2 +- .../libc/compilers/common/sys/termios.h | 8 - components/libc/compilers/common/termios.h | 19 -- components/libc/posix/Kconfig | 32 ++-- components/libc/posix/io/SConscript | 34 ++++ components/libc/posix/{ => io}/aio/SConscript | 2 +- .../posix/{aio/posix_aio.c => io/aio/aio.c} | 2 +- .../posix/{aio/posix_aio.h => io/aio/aio.h} | 4 +- components/libc/posix/{src => io}/libc.c | 0 components/libc/posix/{src => io}/libc.h | 0 components/libc/posix/{src => io}/mmap.c | 0 components/libc/posix/io/poll/SConscript | 11 ++ components/libc/posix/{src => io/poll}/poll.c | 0 .../common => posix/io/poll}/poll.h | 0 components/libc/posix/{src => io}/select.c | 0 components/libc/posix/io/termios/SConscript | 11 ++ .../posix_termios.c => io/termios/termios.c} | 2 +- .../posix_termios.h => io/termios/termios.h} | 4 +- components/libc/posix/src/SConscript | 16 -- components/libc/posix/termios/SConscript | 11 -- 22 files changed, 240 insertions(+), 136 deletions(-) delete mode 100644 components/libc/compilers/common/sys/termios.h delete mode 100644 components/libc/compilers/common/termios.h create mode 100644 components/libc/posix/io/SConscript rename components/libc/posix/{ => io}/aio/SConscript (90%) rename components/libc/posix/{aio/posix_aio.c => io/aio/aio.c} (99%) rename components/libc/posix/{aio/posix_aio.h => io/aio/aio.h} (96%) rename components/libc/posix/{src => io}/libc.c (100%) rename components/libc/posix/{src => io}/libc.h (100%) rename components/libc/posix/{src => io}/mmap.c (100%) create mode 100644 components/libc/posix/io/poll/SConscript rename components/libc/posix/{src => io/poll}/poll.c (100%) rename components/libc/{compilers/common => posix/io/poll}/poll.h (100%) rename components/libc/posix/{src => io}/select.c (100%) create mode 100644 components/libc/posix/io/termios/SConscript rename components/libc/posix/{termios/posix_termios.c => io/termios/termios.c} (99%) rename components/libc/posix/{termios/posix_termios.h => io/termios/termios.h} (99%) delete mode 100644 components/libc/posix/termios/SConscript diff --git a/bsp/raspberry-pi/raspi4-32/.config b/bsp/raspberry-pi/raspi4-32/.config index 40f89fce1a..670259ce0d 100644 --- a/bsp/raspberry-pi/raspi4-32/.config +++ b/bsp/raspberry-pi/raspi4-32/.config @@ -7,6 +7,7 @@ # 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 is not set CONFIG_RT_ALIGN_SIZE=4 @@ -29,6 +30,10 @@ CONFIG_RT_TIMER_THREAD_STACK_SIZE=2048 # # CONFIG_RT_KSERVICE_USING_STDLIB is not set # CONFIG_RT_KSERVICE_USING_TINY_SIZE is not set +# CONFIG_RT_USING_ASM_MEMCPY is not set +# CONFIG_RT_USING_ASM_MEMSET is not set +# CONFIG_RT_USING_TINY_FFS is not set +# CONFIG_RT_PRINTF_LONGLONG is not set CONFIG_RT_DEBUG=y # CONFIG_RT_DEBUG_COLOR is not set # CONFIG_RT_DEBUG_INIT_CONFIG is not set @@ -73,8 +78,7 @@ CONFIG_RT_USING_DEVICE=y CONFIG_RT_USING_CONSOLE=y CONFIG_RT_CONSOLEBUF_SIZE=128 CONFIG_RT_CONSOLE_DEVICE_NAME="uart1" -# CONFIG_RT_PRINTF_LONGLONG is not set -CONFIG_RT_VER_NUM=0x40004 +CONFIG_RT_VER_NUM=0x40100 # CONFIG_RT_USING_CPU_FFS is not set CONFIG_RT_USING_GIC_V2=y CONFIG_ARCH_ARMV8=y @@ -87,6 +91,7 @@ CONFIG_RT_USING_COMPONENTS_INIT=y CONFIG_RT_USING_USER_MAIN=y CONFIG_RT_MAIN_THREAD_STACK_SIZE=2048 CONFIG_RT_MAIN_THREAD_PRIORITY=10 +# CONFIG_RT_USING_LEGACY is not set # # C++ features @@ -97,25 +102,26 @@ CONFIG_RT_MAIN_THREAD_PRIORITY=10 # Command shell # CONFIG_RT_USING_FINSH=y +CONFIG_RT_USING_MSH=y +CONFIG_FINSH_USING_MSH=y CONFIG_FINSH_THREAD_NAME="tshell" +CONFIG_FINSH_THREAD_PRIORITY=20 +CONFIG_FINSH_THREAD_STACK_SIZE=4096 CONFIG_FINSH_USING_HISTORY=y CONFIG_FINSH_HISTORY_LINES=5 CONFIG_FINSH_USING_SYMTAB=y +CONFIG_FINSH_CMD_SIZE=80 +CONFIG_MSH_USING_BUILT_IN_COMMANDS=y CONFIG_FINSH_USING_DESCRIPTION=y # CONFIG_FINSH_ECHO_DISABLE_DEFAULT is not set -CONFIG_FINSH_THREAD_PRIORITY=20 -CONFIG_FINSH_THREAD_STACK_SIZE=4096 -CONFIG_FINSH_CMD_SIZE=80 # CONFIG_FINSH_USING_AUTH is not set -CONFIG_FINSH_USING_MSH=y -CONFIG_FINSH_USING_MSH_DEFAULT=y -# CONFIG_FINSH_USING_MSH_ONLY is not set CONFIG_FINSH_ARG_MAX=10 # # Device virtual file system # CONFIG_RT_USING_DFS=y +CONFIG_DFS_USING_POSIX=y CONFIG_DFS_USING_WORKDIR=y CONFIG_DFS_FILESYSTEMS_MAX=2 CONFIG_DFS_FILESYSTEM_TYPES_MAX=2 @@ -143,6 +149,7 @@ CONFIG_RT_DFS_ELM_DRIVES=2 CONFIG_RT_DFS_ELM_MAX_SECTOR_SIZE=512 # CONFIG_RT_DFS_ELM_USE_ERASE is not set CONFIG_RT_DFS_ELM_REENTRANT=y +CONFIG_RT_DFS_ELM_MUTEX_TIMEOUT=3000 CONFIG_RT_USING_DFS_DEVFS=y # CONFIG_RT_USING_DFS_ROMFS is not set # CONFIG_RT_USING_DFS_RAMFS is not set @@ -203,6 +210,7 @@ CONFIG_RT_USING_TOUCH=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 @@ -210,15 +218,25 @@ CONFIG_RT_USING_TOUCH=y # POSIX layer and C standard library # CONFIG_RT_USING_LIBC=y -# CONFIG_RT_USING_PTHREADS is not set -CONFIG_RT_USING_POSIX=y -# CONFIG_RT_USING_POSIX_MMAP is not set -# CONFIG_RT_USING_POSIX_TERMIOS is not set -# CONFIG_RT_USING_POSIX_GETLINE is not set -# CONFIG_RT_USING_POSIX_AIO is not set +CONFIG_RT_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 +# +# POSIX (Portable Operating System Interface) layer +# +CONFIG_RT_USING_POSIX_FS=y +# CONFIG_RT_USING_POSIX_DEVIO is not set +CONFIG_RT_USING_POSIX_POLL=y +CONFIG_RT_USING_POSIX_SELECT=y +# CONFIG_RT_USING_POSIX_TERMIOS is not set +# CONFIG_RT_USING_POSIX_AIO is not set +# CONFIG_RT_USING_POSIX_MMAP is not set +# CONFIG_RT_USING_POSIX_DELAY is not set +# CONFIG_RT_USING_POSIX_GETLINE is not set +# CONFIG_RT_USING_PTHREADS is not set + # # Network # @@ -324,6 +342,7 @@ CONFIG_RT_LWIP_USING_PING=y # CONFIG_RT_USING_RYM is not set # CONFIG_RT_USING_ULOG is not set # CONFIG_RT_USING_UTEST is not set +# CONFIG_RT_USING_VAR_EXPORT is not set # CONFIG_RT_USING_RT_LINK is not set # @@ -378,6 +397,7 @@ CONFIG_RT_LWIP_USING_PING=y # CONFIG_PKG_USING_AT_DEVICE is not set # CONFIG_PKG_USING_ATSRV_SOCKET is not set # CONFIG_PKG_USING_WIZNET is not set +# CONFIG_PKG_USING_ZB_COORDINATOR is not set # # IoT Cloud @@ -418,6 +438,12 @@ CONFIG_RT_LWIP_USING_PING=y # CONFIG_PKG_USING_AGILE_MODBUS is not set # CONFIG_PKG_USING_AGILE_FTP is not set # CONFIG_PKG_USING_EMBEDDEDPROTO is not set +# CONFIG_PKG_USING_RT_LINK_HW is not set +# CONFIG_PKG_USING_LORA_PKT_FWD is not set +# 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 +# CONFIG_PKG_USING_SMALL_MODBUS is not set # # security packages @@ -434,10 +460,17 @@ CONFIG_RT_LWIP_USING_PING=y # CONFIG_PKG_USING_LUA is not set # CONFIG_PKG_USING_JERRYSCRIPT is not set # CONFIG_PKG_USING_MICROPYTHON is not set +# CONFIG_PKG_USING_PIKASCRIPT is not set # # multimedia packages # + +# +# LVGL: powerful and easy-to-use embedded GUI library +# +# CONFIG_PKG_USING_LITTLEVGL2RTT is not set +# CONFIG_PKG_USING_LVGL is not set # CONFIG_PKG_USING_OPENMV is not set # CONFIG_PKG_USING_MUPDF is not set # CONFIG_PKG_USING_STEMWIN is not set @@ -447,6 +480,22 @@ CONFIG_RT_LWIP_USING_PING=y # CONFIG_PKG_USING_HELIX is not set # CONFIG_PKG_USING_AZUREGUIX is not set # CONFIG_PKG_USING_TOUCHGFX2RTT is not set +# CONFIG_PKG_USING_NUEMWIN is not set +# CONFIG_PKG_USING_MP3PLAYER is not set +# CONFIG_PKG_USING_TINYJPEG is not set +# CONFIG_PKG_USING_UGUI is not set + +# +# u8g2: a monochrome graphic library +# +# CONFIG_PKG_USING_U8G2_OFFICIAL is not set +# CONFIG_PKG_USING_U8G2 is not set + +# +# PainterEngine: A cross-platform graphics application framework written in C language +# +# CONFIG_PKG_USING_PAINTERENGINE is not set +# CONFIG_PKG_USING_PAINTERENGINE_AUX is not set # # tools packages @@ -455,6 +504,7 @@ CONFIG_RT_LWIP_USING_PING=y # CONFIG_PKG_USING_EASYFLASH is not set # CONFIG_PKG_USING_EASYLOGGER is not set # CONFIG_PKG_USING_SYSTEMVIEW is not set +# CONFIG_PKG_USING_SEGGER_RTT is not set # CONFIG_PKG_USING_RDB is not set # CONFIG_PKG_USING_QRCODE is not set # CONFIG_PKG_USING_ULOG_EASYFLASH is not set @@ -486,10 +536,38 @@ CONFIG_RT_LWIP_USING_PING=y # CONFIG_PKG_USING_DEVMEM is not set # CONFIG_PKG_USING_REGEX is not set # CONFIG_PKG_USING_MEM_SANDBOX is not set +# CONFIG_PKG_USING_SOLAR_TERMS is not set +# CONFIG_PKG_USING_GAN_ZHI is not set +# CONFIG_PKG_USING_FDT is not set # # system packages # + +# +# acceleration: Assembly language or algorithmic acceleration packages +# +# CONFIG_PKG_USING_RT_MEMCPY_CM is not set +# 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 + +# +# 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 +# +# CONFIG_PKG_USING_UCOSIII_WRAPPER is not set +# CONFIG_PKG_USING_UCOSII_WRAPPER is not set +# CONFIG_PKG_USING_UC_CRC is not set +# CONFIG_PKG_USING_UC_CLK is not set +# CONFIG_PKG_USING_UC_COMMON is not set +# CONFIG_PKG_USING_UC_MODBUS is not set # CONFIG_PKG_USING_GUIENGINE is not set # CONFIG_PKG_USING_CAIRO is not set # CONFIG_PKG_USING_PIXMAN is not set @@ -498,8 +576,6 @@ CONFIG_RT_LWIP_USING_PING=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_LITTLEVGL2RTT is not set -# CONFIG_PKG_USING_CMSIS is not set # CONFIG_PKG_USING_DFS_YAFFS is not set # CONFIG_PKG_USING_LITTLEFS is not set # CONFIG_PKG_USING_DFS_JFFS2 is not set @@ -514,26 +590,17 @@ CONFIG_RT_LWIP_USING_PING=y # CONFIG_PKG_USING_RAMDISK is not set # CONFIG_PKG_USING_MININI is not set # CONFIG_PKG_USING_QBOOT is not set - -# -# Micrium: Micrium software products porting for RT-Thread -# -# CONFIG_PKG_USING_UCOSIII_WRAPPER is not set -# CONFIG_PKG_USING_UCOSII_WRAPPER is not set -# CONFIG_PKG_USING_UC_CRC is not set -# CONFIG_PKG_USING_UC_CLK is not set -# CONFIG_PKG_USING_UC_COMMON is not set -# CONFIG_PKG_USING_UC_MODBUS is not set # CONFIG_PKG_USING_PPOOL is not set # CONFIG_PKG_USING_OPENAMP is not set +# CONFIG_PKG_USING_RT_VSNPRINTF_FULL is not set # CONFIG_PKG_USING_RT_KPRINTF_THREADSAFE is not set -# CONFIG_PKG_USING_RT_MEMCPY_CM is not set -# 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 # CONFIG_PKG_USING_LPM is not set # CONFIG_PKG_USING_TLSF is not set # CONFIG_PKG_USING_EVENT_RECORDER is not set +# CONFIG_PKG_USING_ARM_2D is not set +# CONFIG_PKG_USING_WCWIDTH is not set +# CONFIG_PKG_USING_MCUBOOT is not set +# CONFIG_PKG_USING_TINYUSB is not set # # peripheral libraries and drivers @@ -545,7 +612,6 @@ CONFIG_RT_LWIP_USING_PING=y # CONFIG_PKG_USING_AS7341 is not set # CONFIG_PKG_USING_STM32_SDIO is not set # CONFIG_PKG_USING_ICM20608 is not set -# CONFIG_PKG_USING_U8G2 is not set # CONFIG_PKG_USING_BUTTON is not set # CONFIG_PKG_USING_PCF8574 is not set # CONFIG_PKG_USING_SX12XX is not set @@ -558,7 +624,6 @@ CONFIG_RT_LWIP_USING_PING=y # CONFIG_PKG_USING_WM_LIBRARIES is not set # CONFIG_PKG_USING_KENDRYTE_SDK is not set # CONFIG_PKG_USING_INFRARED is not set -# CONFIG_PKG_USING_ROSSERIAL is not set # CONFIG_PKG_USING_AGILE_BUTTON is not set # CONFIG_PKG_USING_AGILE_LED is not set # CONFIG_PKG_USING_AT24CXX is not set @@ -601,6 +666,17 @@ CONFIG_RT_LWIP_USING_PING=y # CONFIG_PKG_USING_LIBNFC is not set # CONFIG_PKG_USING_MFOC is not set # CONFIG_PKG_USING_TMC51XX is not set +# CONFIG_PKG_USING_TCA9534 is not set +# CONFIG_PKG_USING_KOBUKI is not set +# CONFIG_PKG_USING_ROSSERIAL is not set +# CONFIG_PKG_USING_MICRO_ROS is not set +# CONFIG_PKG_USING_MCP23008 is not set +# CONFIG_PKG_USING_BLUETRUM_SDK is not set +# CONFIG_PKG_USING_MISAKA_AT24CXX is not set +# 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 +# CONFIG_PKG_USING_MB85RS16 is not set # # AI packages @@ -618,6 +694,27 @@ CONFIG_RT_LWIP_USING_PING=y # # miscellaneous packages # + +# +# samples: kernel and components samples +# +# CONFIG_PKG_USING_KERNEL_SAMPLES is not set +# CONFIG_PKG_USING_FILESYSTEM_SAMPLES is not set +# CONFIG_PKG_USING_NETWORK_SAMPLES is not set +# CONFIG_PKG_USING_PERIPHERAL_SAMPLES is not set + +# +# entertainment: terminal games and other interesting software packages +# +# CONFIG_PKG_USING_CMATRIX is not set +# CONFIG_PKG_USING_SL is not set +# CONFIG_PKG_USING_CAL is not set +# CONFIG_PKG_USING_ACLOCK is not set +# CONFIG_PKG_USING_THREES is not set +# CONFIG_PKG_USING_2048 is not set +# CONFIG_PKG_USING_SNAKE is not set +# CONFIG_PKG_USING_TETRIS is not set +# CONFIG_PKG_USING_DONUT is not set # CONFIG_PKG_USING_LIBCSV is not set # CONFIG_PKG_USING_OPTPARSE is not set # CONFIG_PKG_USING_FASTLZ is not set @@ -628,20 +725,13 @@ CONFIG_RT_LWIP_USING_PING=y # CONFIG_PKG_USING_FLEXIBLE_BUTTON is not set # CONFIG_PKG_USING_CANFESTIVAL is not set # CONFIG_PKG_USING_ZLIB is not set +# CONFIG_PKG_USING_MINIZIP is not set # CONFIG_PKG_USING_DSTR is not set # CONFIG_PKG_USING_TINYFRAME is not set # CONFIG_PKG_USING_KENDRYTE_DEMO is not set # CONFIG_PKG_USING_DIGITALCTRL is not set # CONFIG_PKG_USING_UPACKER is not set # CONFIG_PKG_USING_UPARAM is not set - -# -# samples: kernel and components samples -# -# CONFIG_PKG_USING_KERNEL_SAMPLES is not set -# CONFIG_PKG_USING_FILESYSTEM_SAMPLES is not set -# CONFIG_PKG_USING_NETWORK_SAMPLES is not set -# CONFIG_PKG_USING_PERIPHERAL_SAMPLES is not set # CONFIG_PKG_USING_HELLO is not set # CONFIG_PKG_USING_VI is not set # CONFIG_PKG_USING_KI is not set @@ -649,20 +739,11 @@ CONFIG_RT_LWIP_USING_PING=y # CONFIG_PKG_USING_VT100 is not set # CONFIG_PKG_USING_UKAL is not set # CONFIG_PKG_USING_CRCLIB is not set - -# -# entertainment: terminal games and other interesting software packages -# -# CONFIG_PKG_USING_THREES is not set -# CONFIG_PKG_USING_2048 is not set -# CONFIG_PKG_USING_SNAKE is not set -# CONFIG_PKG_USING_TETRIS is not set -# CONFIG_PKG_USING_DONUT is not set -# CONFIG_PKG_USING_ACLOCK is not set # CONFIG_PKG_USING_LWGPS is not set # CONFIG_PKG_USING_STATE_MACHINE is not set # CONFIG_PKG_USING_MCURSES is not set # CONFIG_PKG_USING_COWSAY is not set +# CONFIG_PKG_USING_TERMBOX is not set CONFIG_BCM2711_SOC=y # CONFIG_BSP_SUPPORT_FPU is not set diff --git a/bsp/raspberry-pi/raspi4-32/rtconfig.h b/bsp/raspberry-pi/raspi4-32/rtconfig.h index 0ceac4cfd7..9ada92a09d 100644 --- a/bsp/raspberry-pi/raspi4-32/rtconfig.h +++ b/bsp/raspberry-pi/raspi4-32/rtconfig.h @@ -44,7 +44,7 @@ #define RT_USING_CONSOLE #define RT_CONSOLEBUF_SIZE 128 #define RT_CONSOLE_DEVICE_NAME "uart1" -#define RT_VER_NUM 0x40004 +#define RT_VER_NUM 0x40100 #define RT_USING_GIC_V2 #define ARCH_ARMV8 @@ -61,21 +61,23 @@ /* Command shell */ #define RT_USING_FINSH +#define RT_USING_MSH +#define FINSH_USING_MSH #define FINSH_THREAD_NAME "tshell" +#define FINSH_THREAD_PRIORITY 20 +#define FINSH_THREAD_STACK_SIZE 4096 #define FINSH_USING_HISTORY #define FINSH_HISTORY_LINES 5 #define FINSH_USING_SYMTAB -#define FINSH_USING_DESCRIPTION -#define FINSH_THREAD_PRIORITY 20 -#define FINSH_THREAD_STACK_SIZE 4096 #define FINSH_CMD_SIZE 80 -#define FINSH_USING_MSH -#define FINSH_USING_MSH_DEFAULT +#define MSH_USING_BUILT_IN_COMMANDS +#define FINSH_USING_DESCRIPTION #define FINSH_ARG_MAX 10 /* Device virtual file system */ #define RT_USING_DFS +#define DFS_USING_POSIX #define DFS_USING_WORKDIR #define DFS_FILESYSTEMS_MAX 2 #define DFS_FILESYSTEM_TYPES_MAX 2 @@ -94,6 +96,7 @@ #define RT_DFS_ELM_DRIVES 2 #define RT_DFS_ELM_MAX_SECTOR_SIZE 512 #define RT_DFS_ELM_REENTRANT +#define RT_DFS_ELM_MUTEX_TIMEOUT 3000 #define RT_USING_DFS_DEVFS /* Device Drivers */ @@ -126,9 +129,15 @@ /* POSIX layer and C standard library */ #define RT_USING_LIBC -#define RT_USING_POSIX +#define RT_LIBC_USING_TIME #define RT_LIBC_DEFAULT_TIMEZONE 8 +/* POSIX (Portable Operating System Interface) layer */ + +#define RT_USING_POSIX_FS +#define RT_USING_POSIX_POLL +#define RT_USING_POSIX_SELECT + /* Network */ /* Socket abstraction layer */ @@ -231,12 +240,25 @@ /* multimedia packages */ +/* LVGL: powerful and easy-to-use embedded GUI library */ + + +/* u8g2: a monochrome graphic library */ + + +/* PainterEngine: A cross-platform graphics application framework written in C language */ + /* tools packages */ /* system packages */ +/* acceleration: Assembly language or algorithmic acceleration packages */ + + +/* CMSIS: ARM Cortex-M Microcontroller Software Interface Standard */ + /* Micrium: Micrium software products porting for RT-Thread */ @@ -249,7 +271,6 @@ /* miscellaneous packages */ - /* samples: kernel and components samples */ diff --git a/components/drivers/serial/serial.c b/components/drivers/serial/serial.c index 0e944b5e95..6f7e7d5b2b 100644 --- a/components/drivers/serial/serial.c +++ b/components/drivers/serial/serial.c @@ -42,7 +42,7 @@ #include #ifdef RT_USING_POSIX_TERMIOS -#include +#include #endif /* it's possible the 'getc/putc' is defined by stdio.h in gcc/newlib. */ diff --git a/components/libc/compilers/common/sys/termios.h b/components/libc/compilers/common/sys/termios.h deleted file mode 100644 index c4b42083c4..0000000000 --- a/components/libc/compilers/common/sys/termios.h +++ /dev/null @@ -1,8 +0,0 @@ -/* - * Copyright (c) 2006-2021, RT-Thread Development Team - * - * SPDX-License-Identifier: Apache-2.0 - * - * Change Logs: - * Date Author Notes - */ diff --git a/components/libc/compilers/common/termios.h b/components/libc/compilers/common/termios.h deleted file mode 100644 index 2960d52c58..0000000000 --- a/components/libc/compilers/common/termios.h +++ /dev/null @@ -1,19 +0,0 @@ -/* - * Copyright (c) 2006-2021, RT-Thread Development Team - * - * SPDX-License-Identifier: Apache-2.0 - * - * Change Logs: - * Date Author Notes - */ -#ifndef _TERMIOS_H__ -#define _TERMIOS_H__ - -#include - -#ifdef RT_USING_POSIX_TERMIOS -#include -#include -#endif - -#endif diff --git a/components/libc/posix/Kconfig b/components/libc/posix/Kconfig index 0afff161ff..db83269dd0 100644 --- a/components/libc/posix/Kconfig +++ b/components/libc/posix/Kconfig @@ -1,7 +1,7 @@ menu "POSIX (Portable Operating System Interface) layer" config RT_USING_POSIX_FS - bool "Enable POSIX file system, open()/read()/write()/close() etc" + bool "Enable POSIX file system and I/O" select RT_USING_DFS select DFS_USING_POSIX default n @@ -13,13 +13,26 @@ if RT_USING_POSIX_FS default n config RT_USING_POSIX_POLL - bool "Enable poll()" + bool "Enable I/O Multiplexing poll() " default n config RT_USING_POSIX_SELECT - bool "Enable select()" + bool "Enable I/O Multiplexing select() " select RT_USING_POSIX_POLL default n + + config RT_USING_POSIX_TERMIOS + bool "Enable Terminal I/O " + select RT_USING_POSIX_DEVIO + default n + + config RT_USING_POSIX_AIO + bool "Enable Asynchronous I/O " + default n + + config RT_USING_POSIX_MMAP + bool "Enable Memory-Mapped I/O " + default n endif config RT_USING_POSIX_DELAY @@ -32,19 +45,6 @@ config RT_USING_POSIX_GETLINE select RT_LIBC_USING_FILEIO default n -config RT_USING_POSIX_MMAP - bool "Enable mmap()" - select RT_USING_POSIX_FS - default n - -config RT_USING_POSIX_TERMIOS - bool "Enable termios APIs" - default n - -config RT_USING_POSIX_AIO - bool "Enable AIO APIs" - default n - config RT_USING_PTHREADS bool "Enable pthreads APIs" default n diff --git a/components/libc/posix/io/SConscript b/components/libc/posix/io/SConscript new file mode 100644 index 0000000000..2a7cd76ded --- /dev/null +++ b/components/libc/posix/io/SConscript @@ -0,0 +1,34 @@ +# RT-Thread building script for component + +import os +from building import * + +src = [] +cwd = GetCurrentDir() +CPPPATH = [cwd] +group = [] + +flag = False + +if GetDepend('RT_USING_POSIX_DEVIO'): + src += ['libc.c'] + flag = True + +if GetDepend('RT_USING_POSIX_SELECT'): + src += ['select.c'] + flag = True + +if GetDepend('RT_USING_POSIX_MMAP'): + src += ['mmap.c'] + flag = True + +if flag == True: + group = DefineGroup('POSIX', src, depend = [], CPPPATH = CPPPATH) + +list = os.listdir(cwd) +for d in list: + path = os.path.join(cwd, d) + if os.path.isfile(os.path.join(path, 'SConscript')): + group = group + SConscript(os.path.join(d, 'SConscript')) + +Return('group') diff --git a/components/libc/posix/aio/SConscript b/components/libc/posix/io/aio/SConscript similarity index 90% rename from components/libc/posix/aio/SConscript rename to components/libc/posix/io/aio/SConscript index 139bc45749..6d4014311c 100644 --- a/components/libc/posix/aio/SConscript +++ b/components/libc/posix/io/aio/SConscript @@ -3,7 +3,7 @@ from building import * cwd = GetCurrentDir() -src = Glob('*.c') +src = ['aio.c'] CPPPATH = [cwd] group = DefineGroup('POSIX', src, depend = ['RT_USING_POSIX_AIO'], CPPPATH = CPPPATH) diff --git a/components/libc/posix/aio/posix_aio.c b/components/libc/posix/io/aio/aio.c similarity index 99% rename from components/libc/posix/aio/posix_aio.c rename to components/libc/posix/io/aio/aio.c index 66cced8687..08ef4c634a 100644 --- a/components/libc/posix/aio/posix_aio.c +++ b/components/libc/posix/io/aio/aio.c @@ -11,7 +11,7 @@ #include #include #include -#include "posix_aio.h" +#include "aio.h" struct rt_workqueue* aio_queue = NULL; diff --git a/components/libc/posix/aio/posix_aio.h b/components/libc/posix/io/aio/aio.h similarity index 96% rename from components/libc/posix/aio/posix_aio.h rename to components/libc/posix/io/aio/aio.h index 4e25e1d15b..35a5c194db 100644 --- a/components/libc/posix/aio/posix_aio.h +++ b/components/libc/posix/io/aio/aio.h @@ -8,8 +8,8 @@ * 2017/12/30 Bernard The first version. */ -#ifndef POSIX_AIO_H__ -#define POSIX_AIO_H__ +#ifndef __AIO_H__ +#define __AIO_H__ #include #include diff --git a/components/libc/posix/src/libc.c b/components/libc/posix/io/libc.c similarity index 100% rename from components/libc/posix/src/libc.c rename to components/libc/posix/io/libc.c diff --git a/components/libc/posix/src/libc.h b/components/libc/posix/io/libc.h similarity index 100% rename from components/libc/posix/src/libc.h rename to components/libc/posix/io/libc.h diff --git a/components/libc/posix/src/mmap.c b/components/libc/posix/io/mmap.c similarity index 100% rename from components/libc/posix/src/mmap.c rename to components/libc/posix/io/mmap.c diff --git a/components/libc/posix/io/poll/SConscript b/components/libc/posix/io/poll/SConscript new file mode 100644 index 0000000000..47f1722ed3 --- /dev/null +++ b/components/libc/posix/io/poll/SConscript @@ -0,0 +1,11 @@ +# RT-Thread building script for component + +from building import * + +cwd = GetCurrentDir() +src = ['poll.c'] +CPPPATH = [cwd] + +group = DefineGroup('POSIX', src, depend = ['RT_USING_POSIX_POLL'], CPPPATH = CPPPATH) + +Return('group') diff --git a/components/libc/posix/src/poll.c b/components/libc/posix/io/poll/poll.c similarity index 100% rename from components/libc/posix/src/poll.c rename to components/libc/posix/io/poll/poll.c diff --git a/components/libc/compilers/common/poll.h b/components/libc/posix/io/poll/poll.h similarity index 100% rename from components/libc/compilers/common/poll.h rename to components/libc/posix/io/poll/poll.h diff --git a/components/libc/posix/src/select.c b/components/libc/posix/io/select.c similarity index 100% rename from components/libc/posix/src/select.c rename to components/libc/posix/io/select.c diff --git a/components/libc/posix/io/termios/SConscript b/components/libc/posix/io/termios/SConscript new file mode 100644 index 0000000000..68bd9d81c9 --- /dev/null +++ b/components/libc/posix/io/termios/SConscript @@ -0,0 +1,11 @@ +# RT-Thread building script for component + +from building import * + +cwd = GetCurrentDir() +src = ['termios.c'] +CPPPATH = [cwd] + +group = DefineGroup('POSIX', src, depend = ['RT_USING_POSIX_TERMIOS'], CPPPATH = CPPPATH) + +Return('group') diff --git a/components/libc/posix/termios/posix_termios.c b/components/libc/posix/io/termios/termios.c similarity index 99% rename from components/libc/posix/termios/posix_termios.c rename to components/libc/posix/io/termios/termios.c index 9f33c857e6..d7d869d67f 100644 --- a/components/libc/posix/termios/posix_termios.c +++ b/components/libc/posix/io/termios/termios.c @@ -11,7 +11,7 @@ #include #include #include -#include +#include "termios.h" int tcgetattr(int fd, struct termios *tio) { diff --git a/components/libc/posix/termios/posix_termios.h b/components/libc/posix/io/termios/termios.h similarity index 99% rename from components/libc/posix/termios/posix_termios.h rename to components/libc/posix/io/termios/termios.h index 6dc5531955..b647fa0728 100644 --- a/components/libc/posix/termios/posix_termios.h +++ b/components/libc/posix/io/termios/termios.h @@ -7,8 +7,8 @@ * Date Author Notes * 2017/08/30 Bernard The first version */ -#ifndef TERMIOS_H__ -#define TERMIOS_H__ +#ifndef __TERMIOS_H__ +#define __TERMIOS_H__ #include #include diff --git a/components/libc/posix/src/SConscript b/components/libc/posix/src/SConscript index 4be5ac83cc..87be6b6a06 100644 --- a/components/libc/posix/src/SConscript +++ b/components/libc/posix/src/SConscript @@ -10,26 +10,10 @@ group = [] flag = False src += ['unistd.c'] #TODO -if GetDepend('RT_USING_POSIX_DEVIO'): - src += ['libc.c'] - flag = True - if GetDepend('RT_USING_POSIX_DELAY'): src += ['delay.c'] flag = True -if GetDepend('RT_USING_POSIX_POLL'): - src += ['poll.c'] - flag = True - -if GetDepend('RT_USING_POSIX_SELECT'): - src += ['select.c'] - flag = True - -if GetDepend('RT_USING_POSIX_MMAP'): - src += ['mmap.c'] - flag = True - if flag == True: group = DefineGroup('POSIX', src, depend = [], CPPPATH = CPPPATH) diff --git a/components/libc/posix/termios/SConscript b/components/libc/posix/termios/SConscript deleted file mode 100644 index 3615926251..0000000000 --- a/components/libc/posix/termios/SConscript +++ /dev/null @@ -1,11 +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_LIBC', 'RT_USING_POSIX_TERMIOS'], CPPPATH = CPPPATH) - -Return('group')