diff --git a/.github/workflows/action_tools.yml b/.github/workflows/action_tools.yml index 7bc67fc6b80..60b1917b5d2 100644 --- a/.github/workflows/action_tools.yml +++ b/.github/workflows/action_tools.yml @@ -45,8 +45,9 @@ jobs: - name: Install Tools shell: bash run: | - sudo apt-get update - sudo apt-get -yqq install scons + wget https://raw.githubusercontent.com/RT-Thread/env/master/install_ubuntu.sh + chmod 777 install_ubuntu.sh + ./install_ubuntu.sh - name: Install Arm ToolChains if: ${{ success() }} diff --git a/.github/workflows/compile_bsp_with_drivers.yml b/.github/workflows/compile_bsp_with_drivers.yml index 53d6e4269fb..43fcb59ab3e 100644 --- a/.github/workflows/compile_bsp_with_drivers.yml +++ b/.github/workflows/compile_bsp_with_drivers.yml @@ -46,9 +46,9 @@ jobs: - name: Install Tools shell: bash run: | - sudo apt-get update - sudo apt-get -qq install gcc-multilib libncurses5 libncurses5-dev libncursesw5-dev scons - sudo python -m pip install --upgrade pip -qq + wget https://raw.githubusercontent.com/RT-Thread/env/master/install_ubuntu.sh + chmod 777 install_ubuntu.sh + ./install_ubuntu.sh git config --global http.postBuffer 524288000 git remote -v git fetch origin diff --git a/.gitignore b/.gitignore index 9ddfece39e8..cff9ff536bc 100644 --- a/.gitignore +++ b/.gitignore @@ -50,3 +50,7 @@ tags CMakeLists.txt cmake-build-debug *.mk + +# vDSO +vdso_sys.os +vdso.lds diff --git a/bsp/allwinner/d1s/.config b/bsp/allwinner/d1s/.config index 8beb51059e8..c2a2054637b 100644 --- a/bsp/allwinner/d1s/.config +++ b/bsp/allwinner/d1s/.config @@ -1,7 +1,3 @@ -# -# Automatically generated file; DO NOT EDIT. -# RT-Thread Project Configuration -# # # RT-Thread Kernel @@ -19,7 +15,6 @@ CONFIG_RT_THREAD_PRIORITY_32=y # CONFIG_RT_THREAD_PRIORITY_256 is not set CONFIG_RT_THREAD_PRIORITY_MAX=32 CONFIG_RT_TICK_PER_SECOND=100 -# CONFIG_RT_USING_OVERFLOW_CHECK is not set CONFIG_RT_USING_HOOK=y CONFIG_RT_HOOK_USING_FUNC_PTR=y # CONFIG_RT_USING_HOOKLIST is not set @@ -29,20 +24,30 @@ CONFIG_IDLE_THREAD_STACK_SIZE=16384 CONFIG_RT_USING_TIMER_SOFT=y CONFIG_RT_TIMER_THREAD_PRIO=4 CONFIG_RT_TIMER_THREAD_STACK_SIZE=16384 +# CONFIG_RT_USING_TIMER_ALL_SOFT is not set +CONFIG_RT_USING_CPU_USAGE_TRACER=y # # kservice optimization # -CONFIG_RT_KSERVICE_USING_STDLIB=y -# CONFIG_RT_KSERVICE_USING_STDLIB_MEMORY is not set -# CONFIG_RT_KSERVICE_USING_TINY_SIZE is not set # CONFIG_RT_USING_TINY_FFS is not set -CONFIG_RT_KPRINTF_USING_LONGLONG=y +# end of kservice optimization + +# +# klibc optimization +# +# CONFIG_RT_KLIBC_USING_STDLIB is not set +# CONFIG_RT_KLIBC_USING_TINY_SIZE is not set +CONFIG_RT_KLIBC_USING_PRINTF_LONGLONG=y +# end of klibc optimization + CONFIG_RT_USING_DEBUG=y +CONFIG_RT_DEBUGING_ASSERT=y CONFIG_RT_DEBUGING_COLOR=y CONFIG_RT_DEBUGING_CONTEXT=y # CONFIG_RT_DEBUGING_AUTO_INIT is not set # CONFIG_RT_DEBUGING_PAGE_LEAK is not set +# CONFIG_RT_USING_OVERFLOW_CHECK is not set # # Inter-Thread communication @@ -54,40 +59,44 @@ CONFIG_RT_USING_MAILBOX=y CONFIG_RT_USING_MESSAGEQUEUE=y # CONFIG_RT_USING_MESSAGEQUEUE_PRIORITY is not set # CONFIG_RT_USING_SIGNALS is not set +# end of Inter-Thread communication # # Memory Management # CONFIG_RT_PAGE_MAX_ORDER=11 -CONFIG_RT_USING_MEMPOOL=y -CONFIG_RT_USING_SMALL_MEM=y +# CONFIG_RT_USING_MEMPOOL is not set +# CONFIG_RT_USING_SMALL_MEM is not set # CONFIG_RT_USING_SLAB is not set -# CONFIG_RT_USING_MEMHEAP is not set -CONFIG_RT_USING_SMALL_MEM_AS_HEAP=y -# CONFIG_RT_USING_MEMHEAP_AS_HEAP is not set +CONFIG_RT_USING_MEMHEAP=y +CONFIG_RT_MEMHEAP_FAST_MODE=y +# CONFIG_RT_MEMHEAP_BEST_MODE is not set +# CONFIG_RT_USING_SMALL_MEM_AS_HEAP is not set +CONFIG_RT_USING_MEMHEAP_AS_HEAP=y +CONFIG_RT_USING_MEMHEAP_AUTO_BINDING=y # CONFIG_RT_USING_SLAB_AS_HEAP is not set # CONFIG_RT_USING_USERHEAP is not set # CONFIG_RT_USING_NOHEAP is not set CONFIG_RT_USING_MEMTRACE=y # CONFIG_RT_USING_HEAP_ISR is not set CONFIG_RT_USING_HEAP=y +# end of Memory Management + CONFIG_RT_USING_DEVICE=y -# CONFIG_RT_USING_DEVICE_OPS is not set +CONFIG_RT_USING_DEVICE_OPS=y # CONFIG_RT_USING_INTERRUPT_INFO is not set # CONFIG_RT_USING_THREADSAFE_PRINTF is not set -# CONFIG_RT_USING_SCHED_THREAD_CTX is not set +CONFIG_RT_USING_SCHED_THREAD_CTX=y CONFIG_RT_USING_CONSOLE=y CONFIG_RT_CONSOLEBUF_SIZE=256 CONFIG_RT_CONSOLE_DEVICE_NAME="uart0" -CONFIG_RT_VER_NUM=0x50100 +CONFIG_RT_VER_NUM=0x50200 CONFIG_RT_USING_STDC_ATOMIC=y CONFIG_RT_BACKTRACE_LEVEL_MAX_NR=32 +# end of RT-Thread Kernel + CONFIG_ARCH_CPU_64BIT=y CONFIG_RT_USING_CACHE=y -# CONFIG_RT_USING_HW_ATOMIC is not set -# CONFIG_ARCH_ARM_BOOTWITH_FLUSH_CACHE is not set -# CONFIG_ARCH_CPU_STACK_GROWS_UPWARD is not set -# CONFIG_RT_USING_CPU_FFS is not set CONFIG_ARCH_MM_MMU=y CONFIG_KERNEL_VADDR_START=0x40000000 CONFIG_ARCH_RISCV=y @@ -150,10 +159,13 @@ CONFIG_RT_DFS_ELM_MAX_SECTOR_SIZE=512 CONFIG_RT_DFS_ELM_REENTRANT=y CONFIG_RT_DFS_ELM_MUTEX_TIMEOUT=3000 # CONFIG_RT_DFS_ELM_USE_EXFAT is not set +# end of elm-chan's FatFs, Generic FAT Filesystem Module + CONFIG_RT_USING_DFS_DEVFS=y # CONFIG_RT_USING_DFS_ROMFS is not set +CONFIG_RT_USING_DFS_PTYFS=y # CONFIG_RT_USING_DFS_CROMFS is not set -# CONFIG_RT_USING_DFS_TMPFS is not set +CONFIG_RT_USING_DFS_TMPFS=y # CONFIG_RT_USING_DFS_MQUEUE is not set CONFIG_RT_USING_PAGECACHE=y @@ -166,6 +178,9 @@ CONFIG_RT_PAGECACHE_PRELOAD=4 CONFIG_RT_PAGECACHE_HASH_NR=1024 CONFIG_RT_PAGECACHE_GC_WORK_LEVEL=90 CONFIG_RT_PAGECACHE_GC_STOP_LEVEL=70 +# end of page cache config +# end of DFS: device virtual file system + CONFIG_RT_USING_FAL=y CONFIG_FAL_DEBUG_CONFIG=y CONFIG_FAL_DEBUG=1 @@ -176,17 +191,16 @@ CONFIG_FAL_PART_HAS_TABLE_CFG=y # Device Drivers # # CONFIG_RT_USING_DM is not set +CONFIG_RT_USING_DEV_BUS=y CONFIG_RT_USING_DEVICE_IPC=y CONFIG_RT_UNAMED_PIPE_NUMBER=64 CONFIG_RT_USING_SYSTEM_WORKQUEUE=y -CONFIG_RT_SYSTEM_WORKQUEUE_STACKSIZE=4096 +CONFIG_RT_SYSTEM_WORKQUEUE_STACKSIZE=16384 CONFIG_RT_SYSTEM_WORKQUEUE_PRIORITY=23 CONFIG_RT_USING_SERIAL=y # CONFIG_RT_USING_SERIAL_V1 is not set CONFIG_RT_USING_SERIAL_V2=y # CONFIG_RT_SERIAL_USING_DMA is not set -CONFIG_RT_USING_TTY=y -# CONFIG_RT_TTY_DEBUG is not set # CONFIG_RT_USING_CAN is not set # CONFIG_RT_USING_CPUTIME is not set # CONFIG_RT_USING_I2C is not set @@ -197,6 +211,8 @@ CONFIG_RT_USING_NULL=y CONFIG_RT_USING_ZERO=y CONFIG_RT_USING_RANDOM=y # CONFIG_RT_USING_PWM is not set +# CONFIG_RT_USING_PULSE_ENCODER is not set +# CONFIG_RT_USING_INPUT_CAPTURE is not set # CONFIG_RT_USING_MTD_NOR is not set # CONFIG_RT_USING_MTD_NAND is not set # CONFIG_RT_USING_PM is not set @@ -211,21 +227,13 @@ CONFIG_RT_USING_WDT=y # CONFIG_RT_USING_TOUCH is not set # CONFIG_RT_USING_LCD is not set # CONFIG_RT_USING_HWCRYPTO is not set -# CONFIG_RT_USING_PULSE_ENCODER is not set -# CONFIG_RT_USING_INPUT_CAPTURE is not set -CONFIG_RT_USING_DEV_BUS=y # CONFIG_RT_USING_WIFI is not set # CONFIG_RT_USING_VIRTIO is not set CONFIG_RT_USING_PIN=y CONFIG_RT_USING_KTIME=y # CONFIG_RT_USING_HWTIMER is not set - -# -# 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 +# CONFIG_RT_USING_CHERRYUSB is not set +# end of Device Drivers # # C/C++ and POSIX layer @@ -243,6 +251,8 @@ CONFIG_RT_LIBC_USING_LIGHT_TZ_DST=y CONFIG_RT_LIBC_TZ_DEFAULT_HOUR=8 CONFIG_RT_LIBC_TZ_DEFAULT_MIN=0 CONFIG_RT_LIBC_TZ_DEFAULT_SEC=0 +# end of Timezone and Daylight Saving Time +# end of ISO-ANSI C layer # # POSIX (Portable Operating System Interface) layer @@ -277,7 +287,11 @@ CONFIG_RT_USING_POSIX_PIPE_SIZE=512 # # Socket is in the 'Network' category # +# end of Interprocess Communication (IPC) +# end of POSIX (Portable Operating System Interface) layer + # CONFIG_RT_USING_CPLUSPLUS is not set +# end of C/C++ and POSIX layer # # Network @@ -286,12 +300,14 @@ CONFIG_RT_USING_POSIX_PIPE_SIZE=512 # CONFIG_RT_USING_NETDEV is not set # CONFIG_RT_USING_LWIP is not set # CONFIG_RT_USING_AT is not set +# end of Network # # Memory protection # # CONFIG_RT_USING_MEM_PROTECTION is not set # CONFIG_RT_USING_HW_STACK_GUARD is not set +# end of Memory protection # # Utilities @@ -307,6 +323,8 @@ CONFIG_RT_USING_ADT_BITMAP=y CONFIG_RT_USING_ADT_HASHMAP=y CONFIG_RT_USING_ADT_REF=y # CONFIG_RT_USING_RT_LINK is not set +# end of Utilities + # CONFIG_RT_USING_VBUS is not set CONFIG_RT_USING_LWP=y # CONFIG_LWP_DEBUG is not set @@ -316,20 +334,33 @@ CONFIG_RT_CH_MSG_MAX_NR=1024 CONFIG_LWP_CONSOLE_INPUT_BUFFER_SIZE=1024 CONFIG_LWP_TID_MAX_NR=64 CONFIG_RT_LWP_SHM_MAX_NR=64 -# CONFIG_LWP_UNIX98_PTY is not set CONFIG_RT_USING_LDSO=y # CONFIG_ELF_DEBUG_ENABLE is not set # CONFIG_ELF_LOAD_RANDOMIZE is not set +CONFIG_LWP_USING_TERMINAL=y +CONFIG_LWP_PTY_MAX_PARIS_LIMIT=64 # # Memory management # # CONFIG_RT_USING_MEMBLOCK is not set +# end of Memory management + +# +# Using USB legacy version +# +# CONFIG_RT_USING_USB_HOST is not set +# CONFIG_RT_USING_USB_DEVICE is not set +# end of Using USB legacy version + +# CONFIG_RT_USING_FDT is not set +# end of RT-Thread Components # # RT-Thread Utestcases # # CONFIG_RT_USING_UTESTCASES is not set +# end of RT-Thread Utestcases # # RT-Thread online packages @@ -338,7 +369,6 @@ CONFIG_RT_USING_LDSO=y # # IoT - internet of things # -# CONFIG_PKG_USING_LWIP is not set # CONFIG_PKG_USING_LORAWAN_DRIVER is not set # CONFIG_PKG_USING_PAHOMQTT is not set # CONFIG_PKG_USING_UMQTT is not set @@ -349,6 +379,7 @@ CONFIG_RT_USING_LDSO=y # CONFIG_PKG_USING_KAWAII_MQTT is not set # CONFIG_PKG_USING_BC28_MQTT is not set # CONFIG_PKG_USING_WEBTERMINAL is not set +# CONFIG_PKG_USING_LIBMODBUS is not set # CONFIG_PKG_USING_FREEMODBUS is not set # CONFIG_PKG_USING_NANOPB is not set @@ -360,27 +391,17 @@ CONFIG_RT_USING_LDSO=y # Marvell WiFi # # CONFIG_PKG_USING_WLANMARVELL is not set +# end of Marvell WiFi # # Wiced WiFi # # CONFIG_PKG_USING_WLAN_WICED is not set -# CONFIG_PKG_USING_RW007 is not set - -# -# CYW43012 WiFi -# -# CONFIG_PKG_USING_WLAN_CYW43012 is not set +# end of Wiced WiFi -# -# BL808 WiFi -# -# CONFIG_PKG_USING_WLAN_BL808 is not set +# CONFIG_PKG_USING_RW007 is not set +# end of Wi-Fi -# -# CYW43439 WiFi -# -# CONFIG_PKG_USING_WLAN_CYW43439 is not set # CONFIG_PKG_USING_COAP is not set # CONFIG_PKG_USING_NOPOLL is not set # CONFIG_PKG_USING_NETUTILS is not set @@ -402,7 +423,10 @@ CONFIG_RT_USING_LDSO=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 +# CONFIG_PKG_USING_EZ_IOT_OS is not set # CONFIG_PKG_USING_IOTSHARP_SDK is not set +# end of IoT Cloud + # CONFIG_PKG_USING_NIMBLE is not set # CONFIG_PKG_USING_LLSYNC_SDK_ADAPTER is not set # CONFIG_PKG_USING_OTA_DOWNLOADER is not set @@ -422,8 +446,6 @@ CONFIG_RT_USING_LDSO=y # CONFIG_PKG_USING_NMEALIB is not set # CONFIG_PKG_USING_PDULIB is not set # CONFIG_PKG_USING_BTSTACK is not set -# CONFIG_PKG_USING_BT_CYW43012 is not set -# CONFIG_PKG_USING_CYW43XX is not set # CONFIG_PKG_USING_LORAWAN_ED_STACK is not set # CONFIG_PKG_USING_WAYZ_IOTKIT is not set # CONFIG_PKG_USING_MAVLINK is not set @@ -432,8 +454,6 @@ CONFIG_RT_USING_LDSO=y # 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_RYANMQTT is not set -# CONFIG_PKG_USING_RYANW5500 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 @@ -441,10 +461,7 @@ CONFIG_RT_USING_LDSO=y # CONFIG_PKG_USING_SMALL_MODBUS is not set # CONFIG_PKG_USING_NET_SERVER is not set # CONFIG_PKG_USING_ZFTP is not set -# CONFIG_PKG_USING_WOL is not set -# CONFIG_PKG_USING_ZEPHYR_POLLING is not set -# CONFIG_PKG_USING_MATTER_ADAPTATION_LAYER is not set -# CONFIG_PKG_USING_LHC_MODBUS is not set +# end of IoT - internet of things # # security packages @@ -455,6 +472,7 @@ CONFIG_RT_USING_LDSO=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 @@ -470,18 +488,22 @@ CONFIG_RT_USING_LDSO=y # CONFIG_PKG_USING_JSMN is not set # CONFIG_PKG_USING_AGILE_JSMN is not set # CONFIG_PKG_USING_PARSON is not set +# end of JSON: JavaScript Object Notation, a lightweight data-interchange format # # XML: Extensible Markup Language # # CONFIG_PKG_USING_SIMPLE_XML is not set # CONFIG_PKG_USING_EZXML is not set +# end of XML: Extensible Markup Language + # CONFIG_PKG_USING_LUATOS_SOC is not set # 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 # CONFIG_PKG_USING_RTT_RUST is not set +# end of language packages # # multimedia packages @@ -491,14 +513,18 @@ CONFIG_RT_USING_LDSO=y # LVGL: powerful and easy-to-use embedded GUI library # # CONFIG_PKG_USING_LVGL is not set +# CONFIG_PKG_USING_LITTLEVGL2RTT is not set # CONFIG_PKG_USING_LV_MUSIC_DEMO is not set # CONFIG_PKG_USING_GUI_GUIDER_DEMO is not set +# end of LVGL: powerful and easy-to-use embedded GUI library # # u8g2: a monochrome graphic library # # CONFIG_PKG_USING_U8G2_OFFICIAL is not set # CONFIG_PKG_USING_U8G2 is not set +# end of u8g2: a monochrome graphic library + # CONFIG_PKG_USING_OPENMV is not set # CONFIG_PKG_USING_MUPDF is not set # CONFIG_PKG_USING_STEMWIN is not set @@ -512,12 +538,20 @@ CONFIG_RT_USING_LDSO=y # CONFIG_PKG_USING_MP3PLAYER is not set # CONFIG_PKG_USING_TINYJPEG is not set # CONFIG_PKG_USING_UGUI 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 +# end of PainterEngine: A cross-platform graphics application framework written in C language + # CONFIG_PKG_USING_MCURSES is not set # CONFIG_PKG_USING_TERMBOX is not set # CONFIG_PKG_USING_VT100 is not set # CONFIG_PKG_USING_QRCODE is not set # CONFIG_PKG_USING_GUIENGINE is not set -# CONFIG_PKG_USING_3GPP_AMRNB is not set +# end of multimedia packages # # tools packages @@ -527,9 +561,9 @@ CONFIG_RT_USING_LDSO=y # 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_RTT_AUTO_EXE_CMD is not set # CONFIG_PKG_USING_RDB is not set # CONFIG_PKG_USING_ULOG_EASYFLASH is not set +# CONFIG_PKG_USING_ULOG_FILE is not set # CONFIG_PKG_USING_LOGMGR is not set # CONFIG_PKG_USING_ADBD is not set # CONFIG_PKG_USING_COREMARK is not set @@ -563,9 +597,10 @@ CONFIG_RT_USING_LDSO=y # CONFIG_PKG_USING_CBOX is not set # CONFIG_PKG_USING_SNOWFLAKE is not set # CONFIG_PKG_USING_HASH_MATCH is not set +# CONFIG_PKG_USING_FIRE_PID_CURVE is not set # CONFIG_PKG_USING_ARMV7M_DWT_TOOL is not set # CONFIG_PKG_USING_VOFA_PLUS is not set -# CONFIG_PKG_USING_ZDEBUG is not set +# end of tools packages # # system packages @@ -577,6 +612,7 @@ CONFIG_RT_USING_LDSO=y # CONFIG_PKG_USING_RT_MEMCPY_CM is not set # CONFIG_PKG_USING_RT_KPRINTF_THREADSAFE is not set # CONFIG_PKG_USING_RT_VSNPRINTF_FULL is not set +# end of enhanced kernel services # # acceleration: Assembly language or algorithmic acceleration packages @@ -584,16 +620,15 @@ CONFIG_RT_USING_LDSO=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_CORE is not set -# CONFIG_PKG_USING_CMSIS_DSP is not set -# CONFIG_PKG_USING_CMSIS_NN is not set # CONFIG_PKG_USING_CMSIS_RTOS1 is not set # CONFIG_PKG_USING_CMSIS_RTOS2 is not set +# end of CMSIS: ARM Cortex-M Microcontroller Software Interface Standard # # Micrium: Micrium software products porting for RT-Thread @@ -604,15 +639,13 @@ CONFIG_RT_USING_LDSO=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_FREERTOS_WRAPPER is not set -# CONFIG_PKG_USING_LITEOS_SDK is not set -# CONFIG_PKG_USING_TZ_DATABASE is not set # CONFIG_PKG_USING_CAIRO is not set # CONFIG_PKG_USING_PIXMAN is not set # CONFIG_PKG_USING_PARTITION is not set # CONFIG_PKG_USING_PERF_COUNTER is not set -# CONFIG_PKG_USING_FILEX is not set -# CONFIG_PKG_USING_LEVELX is not set # CONFIG_PKG_USING_FLASHDB is not set # CONFIG_PKG_USING_SQLITE is not set # CONFIG_PKG_USING_RTI is not set @@ -632,7 +665,6 @@ CONFIG_RT_USING_LDSO=y # CONFIG_PKG_USING_QBOOT is not set # CONFIG_PKG_USING_PPOOL is not set # CONFIG_PKG_USING_OPENAMP is not set -# CONFIG_PKG_USING_RPMSG_LITE 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 @@ -644,125 +676,20 @@ CONFIG_RT_USING_LDSO=y # CONFIG_PKG_USING_TFDB is not set # CONFIG_PKG_USING_QPC is not set # CONFIG_PKG_USING_AGILE_UPGRADE is not set -# CONFIG_PKG_USING_FLASH_BLOB is not set -# CONFIG_PKG_USING_MLIBC is not set -# CONFIG_PKG_USING_TASK_MSG_BUS is not set -# CONFIG_PKG_USING_SFDB is not set -# CONFIG_PKG_USING_RTP is not set -# CONFIG_PKG_USING_REB is not set -# CONFIG_PKG_USING_R_RHEALSTONE is not set +# end of system packages # # peripheral libraries and drivers # - -# -# HAL & SDK Drivers -# - -# -# STM32 HAL & SDK Drivers -# -# CONFIG_PKG_USING_STM32L4XX_HAL_DRIVER is not set -# CONFIG_PKG_USING_STM32WB55_SDK is not set -# CONFIG_PKG_USING_STM32_SDIO is not set -# CONFIG_PKG_USING_BLUETRUM_SDK is not set -# CONFIG_PKG_USING_EMBARC_BSP is not set -# CONFIG_PKG_USING_ESP_IDF is not set - -# -# Kendryte SDK -# -# CONFIG_PKG_USING_K210_SDK is not set -# CONFIG_PKG_USING_KENDRYTE_SDK is not set -# CONFIG_PKG_USING_NRF5X_SDK is not set -# CONFIG_PKG_USING_NRFX is not set -# CONFIG_PKG_USING_NUCLEI_SDK is not set -# CONFIG_PKG_USING_RASPBERRYPI_PICO_SDK is not set - -# -# sensors drivers -# -# CONFIG_PKG_USING_LSM6DSM is not set -# CONFIG_PKG_USING_LSM6DSL is not set -# CONFIG_PKG_USING_LPS22HB is not set -# CONFIG_PKG_USING_HTS221 is not set -# CONFIG_PKG_USING_LSM303AGR is not set -# CONFIG_PKG_USING_BME280 is not set -# CONFIG_PKG_USING_BME680 is not set -# CONFIG_PKG_USING_BMA400 is not set -# CONFIG_PKG_USING_BMI160_BMX160 is not set -# CONFIG_PKG_USING_SPL0601 is not set -# CONFIG_PKG_USING_MS5805 is not set -# CONFIG_PKG_USING_DA270 is not set -# CONFIG_PKG_USING_DF220 is not set -# CONFIG_PKG_USING_HSHCAL001 is not set -# CONFIG_PKG_USING_BH1750 is not set -# CONFIG_PKG_USING_MPU6XXX is not set -# CONFIG_PKG_USING_AHT10 is not set -# CONFIG_PKG_USING_AP3216C is not set -# CONFIG_PKG_USING_TSL4531 is not set -# CONFIG_PKG_USING_DS18B20 is not set -# CONFIG_PKG_USING_DHT11 is not set -# CONFIG_PKG_USING_DHTXX is not set -# CONFIG_PKG_USING_GY271 is not set -# CONFIG_PKG_USING_GP2Y10 is not set -# CONFIG_PKG_USING_SGP30 is not set -# CONFIG_PKG_USING_HDC1000 is not set -# CONFIG_PKG_USING_BMP180 is not set -# CONFIG_PKG_USING_BMP280 is not set -# CONFIG_PKG_USING_SHTC1 is not set -# CONFIG_PKG_USING_BMI088 is not set -# CONFIG_PKG_USING_HMC5883 is not set -# CONFIG_PKG_USING_MAX6675 is not set -# CONFIG_PKG_USING_TMP1075 is not set -# CONFIG_PKG_USING_SR04 is not set -# CONFIG_PKG_USING_CCS811 is not set -# CONFIG_PKG_USING_PMSXX is not set -# CONFIG_PKG_USING_RT3020 is not set -# CONFIG_PKG_USING_MLX90632 is not set -# CONFIG_PKG_USING_MLX90393 is not set -# CONFIG_PKG_USING_MLX90392 is not set -# CONFIG_PKG_USING_MLX90397 is not set -# CONFIG_PKG_USING_MS5611 is not set -# CONFIG_PKG_USING_MAX31865 is not set -# CONFIG_PKG_USING_VL53L0X is not set -# CONFIG_PKG_USING_INA260 is not set -# CONFIG_PKG_USING_MAX30102 is not set -# CONFIG_PKG_USING_INA226 is not set -# CONFIG_PKG_USING_LIS2DH12 is not set -# CONFIG_PKG_USING_HS300X is not set -# CONFIG_PKG_USING_ZMOD4410 is not set -# CONFIG_PKG_USING_ISL29035 is not set -# CONFIG_PKG_USING_MMC3680KJ is not set -# CONFIG_PKG_USING_QMP6989 is not set -# CONFIG_PKG_USING_BALANCE is not set +# CONFIG_PKG_USING_SENSORS_DRIVERS is not set +# CONFIG_PKG_USING_REALTEK_AMEBA is not set # CONFIG_PKG_USING_SHT2X is not set # CONFIG_PKG_USING_SHT3X is not set -# CONFIG_PKG_USING_SHT4X is not set -# CONFIG_PKG_USING_AD7746 is not set # CONFIG_PKG_USING_ADT74XX is not set -# CONFIG_PKG_USING_MAX17048 is not set # CONFIG_PKG_USING_AS7341 is not set -# CONFIG_PKG_USING_CW2015 is not set +# CONFIG_PKG_USING_STM32_SDIO is not set +# CONFIG_PKG_USING_ESP_IDF is not set # CONFIG_PKG_USING_ICM20608 is not set -# CONFIG_PKG_USING_PAJ7620 is not set -# CONFIG_PKG_USING_STHS34PF80 is not set - -# -# touch drivers -# -# CONFIG_PKG_USING_GT9147 is not set -# CONFIG_PKG_USING_GT1151 is not set -# CONFIG_PKG_USING_GT917S is not set -# CONFIG_PKG_USING_GT911 is not set -# CONFIG_PKG_USING_FT6206 is not set -# CONFIG_PKG_USING_FT5426 is not set -# CONFIG_PKG_USING_FT6236 is not set -# CONFIG_PKG_USING_XPT2046_TOUCH is not set -# CONFIG_PKG_USING_CST816X is not set -# CONFIG_PKG_USING_CST812T is not set -# CONFIG_PKG_USING_REALTEK_AMEBA is not set # CONFIG_PKG_USING_BUTTON is not set # CONFIG_PKG_USING_PCF8574 is not set # CONFIG_PKG_USING_SX12XX is not set @@ -770,29 +697,45 @@ CONFIG_RT_USING_LDSO=y # CONFIG_PKG_USING_LEDBLINK is not set # CONFIG_PKG_USING_LITTLED is not set # CONFIG_PKG_USING_LKDGUI is not set +# CONFIG_PKG_USING_NRF5X_SDK is not set +# CONFIG_PKG_USING_NRFX is not set +# CONFIG_PKG_USING_WM_LIBRARIES is not set + +# +# Kendryte SDK +# +# CONFIG_PKG_USING_K210_SDK is not set +# CONFIG_PKG_USING_KENDRYTE_SDK is not set +# end of Kendryte SDK + # CONFIG_PKG_USING_INFRARED is not set # CONFIG_PKG_USING_MULTI_INFRARED 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 # CONFIG_PKG_USING_MOTIONDRIVER2RTT is not set +# CONFIG_PKG_USING_AD7746 is not set # CONFIG_PKG_USING_PCA9685 is not set -# CONFIG_PKG_USING_ILI9341 is not set # CONFIG_PKG_USING_I2C_TOOLS is not set # CONFIG_PKG_USING_NRF24L01 is not set +# CONFIG_PKG_USING_TOUCH_DRIVERS is not set +# CONFIG_PKG_USING_MAX17048 is not set # CONFIG_PKG_USING_RPLIDAR is not set # CONFIG_PKG_USING_AS608 is not set # CONFIG_PKG_USING_RC522 is not set # CONFIG_PKG_USING_WS2812B is not set +# CONFIG_PKG_USING_EMBARC_BSP is not set # CONFIG_PKG_USING_EXTERN_RTC_DRIVERS is not set # CONFIG_PKG_USING_MULTI_RTIMER is not set # CONFIG_PKG_USING_MAX7219 is not set # CONFIG_PKG_USING_BEEP is not set # CONFIG_PKG_USING_EASYBLINK is not set # CONFIG_PKG_USING_PMS_SERIES is not set +# CONFIG_PKG_USING_NUCLEI_SDK is not set # CONFIG_PKG_USING_CAN_YMODEM is not set # CONFIG_PKG_USING_LORA_RADIO_DRIVER is not set # CONFIG_PKG_USING_QLED is not set +# CONFIG_PKG_USING_PAJ7620 is not set # CONFIG_PKG_USING_AGILE_CONSOLE is not set # CONFIG_PKG_USING_LD3320 is not set # CONFIG_PKG_USING_WK2124 is not set @@ -806,6 +749,7 @@ CONFIG_RT_USING_LDSO=y # CONFIG_PKG_USING_VIRTUAL_SENSOR is not set # CONFIG_PKG_USING_VDEVICE is not set # CONFIG_PKG_USING_SGM706 is not set +# CONFIG_PKG_USING_STM32WB55_SDK is not set # CONFIG_PKG_USING_RDA58XX is not set # CONFIG_PKG_USING_LIBNFC is not set # CONFIG_PKG_USING_MFOC is not set @@ -815,25 +759,18 @@ CONFIG_RT_USING_LDSO=y # 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_LORA_MODEM_DRIVER 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 +# CONFIG_PKG_USING_CW2015 is not set # CONFIG_PKG_USING_RFM300 is not set # CONFIG_PKG_USING_IO_INPUT_FILTER is not set -# CONFIG_PKG_USING_LRF_NV7LIDAR is not set -# CONFIG_PKG_USING_AIP650 is not set -# CONFIG_PKG_USING_FINGERPRINT is not set -# CONFIG_PKG_USING_BT_ECB02C is not set -# CONFIG_PKG_USING_UAT is not set -# CONFIG_PKG_USING_ST7789 is not set -# CONFIG_PKG_USING_VS1003 is not set -# CONFIG_PKG_USING_X9555 is not set -# CONFIG_PKG_USING_SYSTEM_RUN_LED is not set -# CONFIG_PKG_USING_BT_MX01 is not set -# CONFIG_PKG_USING_RGPOWER is not set -# CONFIG_PKG_USING_SPI_TOOLS is not set +# CONFIG_PKG_USING_RASPBERRYPI_PICO_SDK is not set +# end of peripheral libraries and drivers # # AI packages @@ -847,16 +784,7 @@ CONFIG_RT_USING_LDSO=y # CONFIG_PKG_USING_ULAPACK is not set # CONFIG_PKG_USING_QUEST is not set # CONFIG_PKG_USING_NAXOS is not set -# CONFIG_PKG_USING_R_TINYMAIX is not set - -# -# Signal Processing and Control Algorithm Packages -# -# CONFIG_PKG_USING_FIRE_PID_CURVE is not set -# CONFIG_PKG_USING_QPID is not set -# CONFIG_PKG_USING_UKAL is not set -# CONFIG_PKG_USING_DIGITALCTRL is not set -# CONFIG_PKG_USING_KISSFFT is not set +# end of AI packages # # miscellaneous packages @@ -865,6 +793,7 @@ CONFIG_RT_USING_LDSO=y # # project laboratory # +# end of project laboratory # # samples: kernel and components samples @@ -873,6 +802,7 @@ CONFIG_RT_USING_LDSO=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 @@ -887,14 +817,14 @@ CONFIG_RT_USING_LDSO=y # CONFIG_PKG_USING_TETRIS is not set # CONFIG_PKG_USING_DONUT is not set # CONFIG_PKG_USING_COWSAY is not set -# CONFIG_PKG_USING_MORSE 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 # CONFIG_PKG_USING_MINILZO is not set # CONFIG_PKG_USING_QUICKLZ is not set # CONFIG_PKG_USING_LZMA is not set -# CONFIG_PKG_USING_RALARAM is not set # CONFIG_PKG_USING_MULTIBUTTON is not set # CONFIG_PKG_USING_FLEXIBLE_BUTTON is not set # CONFIG_PKG_USING_CANFESTIVAL is not set @@ -904,12 +834,14 @@ CONFIG_RT_USING_LDSO=y # 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 # CONFIG_PKG_USING_HELLO is not set # CONFIG_PKG_USING_VI is not set # CONFIG_PKG_USING_KI is not set # CONFIG_PKG_USING_ARMv7M_DWT is not set +# CONFIG_PKG_USING_UKAL is not set # CONFIG_PKG_USING_CRCLIB is not set # CONFIG_PKG_USING_LWGPS is not set # CONFIG_PKG_USING_STATE_MACHINE is not set @@ -920,7 +852,7 @@ CONFIG_RT_USING_LDSO=y # CONFIG_PKG_USING_SLCAN2RTT is not set # CONFIG_PKG_USING_SOEM is not set # CONFIG_PKG_USING_QPARAM is not set -# CONFIG_PKG_USING_CorevMCU_CLI is not set +# end of miscellaneous packages # # Arduino libraries @@ -928,29 +860,26 @@ CONFIG_RT_USING_LDSO=y # CONFIG_PKG_USING_RTDUINO is not set # -# Projects and Demos +# Projects # -# CONFIG_PKG_USING_ARDUINO_MSGQ_C_CPP_DEMO is not set -# CONFIG_PKG_USING_ARDUINO_SKETCH_LOADER_DEMO is not set # CONFIG_PKG_USING_ARDUINO_ULTRASOUND_RADAR is not set -# CONFIG_PKG_USING_ARDUINO_NINEINONE_SENSOR_SHIELD is not set # CONFIG_PKG_USING_ARDUINO_SENSOR_KIT is not set # CONFIG_PKG_USING_ARDUINO_MATLAB_SUPPORT is not set +# end of Projects # # Sensors # -# CONFIG_PKG_USING_ARDUINO_SENSOR_DEVICE_DRIVERS is not set -# CONFIG_PKG_USING_ARDUINO_ADAFRUIT_SENSOR is not set -# CONFIG_PKG_USING_ARDUINO_ADAFRUIT_SENSORLAB is not set +# CONFIG_PKG_USING_ARDUINO_SEEED_BMP280 is not set # CONFIG_PKG_USING_ARDUINO_ADAFRUIT_ADXL375 is not set # CONFIG_PKG_USING_ARDUINO_ADAFRUIT_VL53L0X is not set -# CONFIG_PKG_USING_ARDUINO_ADAFRUIT_VL53L1X is not set -# CONFIG_PKG_USING_ARDUINO_ADAFRUIT_VL6180X is not set -# CONFIG_PKG_USING_ARDUINO_ADAFRUIT_MAX31855 is not set +# CONFIG_PKG_USING_ARDUINO_SEEED_LIS3DHTR is not set +# CONFIG_PKG_USING_ARDUINO_SEEED_DHT is not set +# CONFIG_PKG_USING_ARDUINO_CAPACITIVESENSOR is not set +# CONFIG_PKG_USING_ARDUINO_ADAFRUIT_SENSOR is not set +# CONFIG_PKG_USING_ADAFRUIT_MAX31855 is not set # CONFIG_PKG_USING_ARDUINO_ADAFRUIT_MAX31865 is not set # CONFIG_PKG_USING_ARDUINO_ADAFRUIT_MAX31856 is not set -# CONFIG_PKG_USING_ARDUINO_ADAFRUIT_MAX6675 is not set # CONFIG_PKG_USING_ARDUINO_ADAFRUIT_MLX90614 is not set # CONFIG_PKG_USING_ARDUINO_ADAFRUIT_LSM9DS1 is not set # CONFIG_PKG_USING_ARDUINO_ADAFRUIT_AHTX0 is not set @@ -992,7 +921,7 @@ CONFIG_RT_USING_LDSO=y # CONFIG_PKG_USING_ARDUINO_ADAFRUIT_LIS3MDL is not set # CONFIG_PKG_USING_ARDUINO_ADAFRUIT_MLX90640 is not set # CONFIG_PKG_USING_ARDUINO_ADAFRUIT_MMA8451 is not set -# CONFIG_PKG_USING_ARDUINO_ADAFRUIT_MSA301 is not set +# CONFIG_PKG_USING_ADAFRUIT_MSA301 is not set # CONFIG_PKG_USING_ARDUINO_ADAFRUIT_MPL115A2 is not set # CONFIG_PKG_USING_ARDUINO_ADAFRUIT_BNO08X is not set # CONFIG_PKG_USING_ARDUINO_ADAFRUIT_BNO08X_RVC is not set @@ -1042,65 +971,26 @@ CONFIG_RT_USING_LDSO=y # CONFIG_PKG_USING_ARDUINO_ADAFRUIT_VEML6070 is not set # CONFIG_PKG_USING_ARDUINO_ADAFRUIT_VEML6075 is not set # CONFIG_PKG_USING_ARDUINO_ADAFRUIT_VEML7700 is not set -# CONFIG_PKG_USING_ARDUINO_SEEED_LIS3DHTR is not set -# CONFIG_PKG_USING_ARDUINO_SEEED_DHT is not set -# CONFIG_PKG_USING_ARDUINO_SEEED_ADXL335 is not set -# CONFIG_PKG_USING_ARDUINO_SEEED_ADXL345 is not set -# CONFIG_PKG_USING_ARDUINO_SEEED_BME280 is not set -# CONFIG_PKG_USING_ARDUINO_SEEED_BMP280 is not set -# CONFIG_PKG_USING_ARDUINO_SEEED_H3LIS331DL is not set -# CONFIG_PKG_USING_ARDUINO_SEEED_MMA7660 is not set -# CONFIG_PKG_USING_ARDUINO_SEEED_TSL2561 is not set -# CONFIG_PKG_USING_ARDUINO_SEEED_PAJ7620 is not set -# CONFIG_PKG_USING_ARDUINO_SEEED_VL53L0X is not set -# CONFIG_PKG_USING_ARDUINO_SEEED_ITG3200 is not set -# CONFIG_PKG_USING_ARDUINO_SEEED_SHT31 is not set -# CONFIG_PKG_USING_ARDUINO_SEEED_HP20X is not set -# CONFIG_PKG_USING_ARDUINO_SEEED_DRV2605L is not set -# CONFIG_PKG_USING_ARDUINO_SEEED_BBM150 is not set -# CONFIG_PKG_USING_ARDUINO_SEEED_HMC5883L is not set -# CONFIG_PKG_USING_ARDUINO_SEEED_LSM303DLH is not set -# CONFIG_PKG_USING_ARDUINO_SEEED_TCS3414CS is not set -# CONFIG_PKG_USING_ARDUINO_SEEED_MP503 is not set -# CONFIG_PKG_USING_ARDUINO_SEEED_BMP085 is not set -# CONFIG_PKG_USING_ARDUINO_SEEED_HIGHTEMP is not set -# CONFIG_PKG_USING_ARDUINO_SEEED_VEML6070 is not set -# CONFIG_PKG_USING_ARDUINO_SEEED_SI1145 is not set -# CONFIG_PKG_USING_ARDUINO_SEEED_SHT35 is not set -# CONFIG_PKG_USING_ARDUINO_SEEED_AT42QT1070 is not set -# CONFIG_PKG_USING_ARDUINO_SEEED_LSM6DS3 is not set -# CONFIG_PKG_USING_ARDUINO_SEEED_HDC1000 is not set -# CONFIG_PKG_USING_ARDUINO_SEEED_HM3301 is not set -# CONFIG_PKG_USING_ARDUINO_SEEED_MCP9600 is not set -# CONFIG_PKG_USING_ARDUINO_SEEED_LTC2941 is not set -# CONFIG_PKG_USING_ARDUINO_SEEED_LDC1612 is not set -# CONFIG_PKG_USING_ARDUINO_CAPACITIVESENSOR is not set +# end of Sensors # # Display # -# CONFIG_PKG_USING_ARDUINO_ADAFRUIT_GFX_LIBRARY is not set # CONFIG_PKG_USING_ARDUINO_U8G2 is not set -# CONFIG_PKG_USING_ARDUINO_TFT_ESPI is not set -# CONFIG_PKG_USING_ARDUINO_ADAFRUIT_ST7735 is not set -# CONFIG_PKG_USING_ARDUINO_ADAFRUIT_SSD1306 is not set -# CONFIG_PKG_USING_ARDUINO_ADAFRUIT_ILI9341 is not set -# CONFIG_PKG_USING_SEEED_TM1637 is not set +# end of Display # # Timing # -# CONFIG_PKG_USING_ARDUINO_RTCLIB is not set # CONFIG_PKG_USING_ARDUINO_MSTIMER2 is not set -# CONFIG_PKG_USING_ARDUINO_TICKER is not set -# CONFIG_PKG_USING_ARDUINO_TASKSCHEDULER is not set +# end of Timing # # Data Processing # # CONFIG_PKG_USING_ARDUINO_KALMANFILTER is not set # CONFIG_PKG_USING_ARDUINO_ARDUINOJSON is not set -# CONFIG_PKG_USING_ARDUINO_TENSORFLOW_LITE_MICRO is not set +# end of Data Processing # # Data Storage @@ -1111,23 +1001,18 @@ CONFIG_RT_USING_LDSO=y # # CONFIG_PKG_USING_ARDUINO_ADAFRUIT_PN532 is not set # CONFIG_PKG_USING_ARDUINO_ADAFRUIT_SI4713 is not set +# end of Communication # # Device Control # # CONFIG_PKG_USING_ARDUINO_ADAFRUIT_PCF8574 is not set # CONFIG_PKG_USING_ARDUINO_ADAFRUIT_PCA9685 is not set -# CONFIG_PKG_USING_ARDUINO_ADAFRUIT_TPA2016 is not set -# CONFIG_PKG_USING_ARDUINO_ADAFRUIT_DRV2605 is not set -# CONFIG_PKG_USING_ARDUINO_ADAFRUIT_DS1841 is not set -# CONFIG_PKG_USING_ARDUINO_ADAFRUIT_DS3502 is not set -# CONFIG_PKG_USING_ARDUINO_SEEED_PCF85063TP is not set +# end of Device Control # # Other # -# CONFIG_PKG_USING_ARDUINO_ADAFRUIT_MFRC630 is not set -# CONFIG_PKG_USING_ARDUINO_ADAFRUIT_SI5351 is not set # # Signal IO @@ -1140,10 +1025,78 @@ CONFIG_RT_USING_LDSO=y # CONFIG_PKG_USING_ARDUINO_ADAFRUIT_MCP3008 is not set # CONFIG_PKG_USING_ARDUINO_ADAFRUIT_MCP4725 is not set # CONFIG_PKG_USING_ARDUINO_ADAFRUIT_BD3491FS is not set +# end of Signal IO # # Uncategorized # +# end of Arduino libraries +# end of RT-Thread online packages + +# +# Privated Packages of RealThread +# +# CONFIG_PKG_USING_CODEC is not set +# CONFIG_PKG_USING_PLAYER is not set +# CONFIG_PKG_USING_MPLAYER is not set +# CONFIG_PKG_USING_PERSIMMON_SRC is not set +# CONFIG_PKG_USING_JS_PERSIMMON is not set +# CONFIG_PKG_USING_JERRYSCRIPT_WIN32 is not set + +# +# Network Utilities +# +# end of Network Utilities + +# CONFIG_PKG_USING_WICED is not set +# CONFIG_PKG_USING_CLOUDSDK is not set +# CONFIG_PKG_USING_POWER_MANAGER is not set +# CONFIG_PKG_USING_RT_OTA is not set +# CONFIG_PKG_USING_RTINSIGHT is not set +# CONFIG_PKG_USING_SMARTCONFIG is not set +# CONFIG_PKG_USING_RTX is not set +# CONFIG_RT_USING_TESTCASE is not set +# CONFIG_PKG_USING_NGHTTP2 is not set +# CONFIG_PKG_USING_AVS is not set +# CONFIG_PKG_USING_ALI_LINKKIT is not set +# CONFIG_PKG_USING_STS is not set +# CONFIG_PKG_USING_DLMS is not set +# CONFIG_PKG_USING_AUDIO_FRAMEWORK is not set +# CONFIG_PKG_USING_ZBAR is not set +# CONFIG_PKG_USING_MCF is not set +# CONFIG_PKG_USING_URPC is not set +# CONFIG_PKG_USING_DCM is not set +# CONFIG_PKG_USING_EMQ is not set +# CONFIG_PKG_USING_CFGM is not set +# CONFIG_PKG_USING_RT_CMSIS_DAP is not set +# CONFIG_PKG_USING_SMODULE is not set +# CONFIG_PKG_USING_SNFD is not set +# CONFIG_PKG_USING_UDBD is not set +# CONFIG_PKG_USING_BENCHMARK is not set +# CONFIG_PKG_USING_UBJSON is not set +# CONFIG_PKG_USING_DATATYPE is not set +# CONFIG_PKG_USING_FASTFS is not set +# CONFIG_PKG_USING_RIL is not set +# CONFIG_PKG_USING_WATCH_DCM_SVC is not set +# CONFIG_PKG_USING_WATCH_APP_FWK is not set +# CONFIG_PKG_USING_GUI_TEST is not set +# CONFIG_PKG_USING_PMEM is not set +# CONFIG_PKG_USING_LWRDP is not set +# CONFIG_PKG_USING_MASAN is not set +# CONFIG_PKG_USING_BSDIFF_LIB is not set +# CONFIG_PKG_USING_PRC_DIFF is not set + +# +# RT-Thread Smart +# +# CONFIG_PKG_USING_UKERNEL is not set +# end of RT-Thread Smart + +# CONFIG_PKG_USING_TRACE_AGENT is not set +# CONFIG_PKG_USING_DLOG is not set +# CONFIG_PKG_USING_EXT4 is not set +# end of Privated Packages of RealThread + CONFIG_BOARD_allwinnerd1s=y # CONFIG_ENABLE_FPU is not set # CONFIG_RT_USING_USERSPACE_32BIT_LIMIT is not set @@ -1167,6 +1120,8 @@ CONFIG_UART0_RX_USING_GPIOE3=y # CONFIG_BSP_USING_UART3 is not set # CONFIG_BSP_USING_UART4 is not set # CONFIG_BSP_USING_UART5 is not set +# end of General Purpose UARTs + # CONFIG_BSP_USING_WDT is not set # CONFIG_BSP_USING_RTC is not set # CONFIG_BSP_USING_I2C is not set @@ -1182,12 +1137,16 @@ CONFIG_BSP_USING_FS=y # Board extended module Drivers # # CONFIG_BSP_USING_RW007 is not set +# end of Board extended module Drivers +# end of General Drivers Configuration + CONFIG_RT_USING_SUNXI_HAL=y # # UART Devices # # CONFIG_DRIVERS_UART is not set +# end of UART Devices # # CCMU Devices @@ -1196,18 +1155,21 @@ CONFIG_DRIVERS_CCMU=y # CONFIG_DRIVERS_SUNXI_CLK is not set CONFIG_DRIVERS_SUNXI_CCU=y # CONFIG_HAL_TEST_CCU is not set +# end of CCMU Devices # # DMA Devices # CONFIG_DRIVERS_DMA=y # CONFIG_HAL_TEST_DMA is not set +# end of DMA Devices # # GPIO Devices # CONFIG_DRIVERS_GPIO=y # CONFIG_HAL_TEST_GPIO is not set +# end of GPIO Devices # # Video support for sunxi @@ -1259,12 +1221,14 @@ CONFIG_LCD_SUPPORT_INET_DSI_PANEL=y # CONFIG_LCD_SUPPORT_RT13QV005D is not set # CONFIG_LCD_SUPPORT_ST7789V_CPU is not set # CONFIG_LCD_SUPPORT_VVX07H005A10 is not set +# end of LCD panels select # # Display engine feature select # # CONFIG_DISP2_SUNXI_SUPPORT_SMBL is not set CONFIG_DISP2_SUNXI_SUPPORT_ENAHNCE=y +# end of Display engine feature select # # Soc and board select @@ -1280,12 +1244,16 @@ CONFIG_DISP2_SUNXI_SUPPORT_ENAHNCE=y # CONFIG_TFT_RGB is not set # CONFIG_HE0801A068_MIPI is not set # CONFIG_DEFAULT_LVDS is not set +# end of Board Select # # Soc Select # # CONFIG_ARCH_SUN8IW19 is not set # CONFIG_ARCH_SUN20IW1 is not set +# end of Soc Select +# end of Soc and board select +# end of Video support for sunxi # # SDMMC Devices @@ -1300,24 +1268,29 @@ CONFIG_SDIO_IRQ_SUPPORT=y # CONFIG_SD_TEST is not set CONFIG_SDC_DMA_BUF_SIZE=64 CONFIG_DRIVERS_SDC_CDPIN_PRESENT_VAL=0 +# end of SDMMC Devices # # SPI Devices # CONFIG_DRIVERS_SPI=y # CONFIG_HAL_TEST_SPI is not set +# end of SPI Devices # # TWI Devices # CONFIG_DRIVERS_TWI=y # CONFIG_HAL_TEST_TWI is not set +# end of TWI Devices # # G2D Devices # CONFIG_DRIVERS_G2D=y # CONFIG_HAL_TEST_G2D is not set +# end of G2D Devices + # CONFIG_DRIVERS_USB is not set # @@ -1325,9 +1298,11 @@ CONFIG_DRIVERS_G2D=y # CONFIG_DRIVERS_CE=y # CONFIG_HAL_TEST_CE is not set +# end of CE Devices # # EFUSE Devices # CONFIG_DRIVERS_EFUSE=y # CONFIG_HAL_TEST_EFUSE is not set +# end of EFUSE Devices diff --git a/bsp/allwinner/d1s/applications/mnt.c b/bsp/allwinner/d1s/applications/mnt.c index da9b95ec260..3811b000114 100644 --- a/bsp/allwinner/d1s/applications/mnt.c +++ b/bsp/allwinner/d1s/applications/mnt.c @@ -24,7 +24,7 @@ #define SD_CHECK_PIN GET_PIN(GPIO_PORT_G, GPIO_PIN_3) -int sd_check_thread_entry(void *p) +void sd_check_thread_entry(void *p) { rt_uint8_t old_sd_check = 0; @@ -38,7 +38,7 @@ int sd_check_thread_entry(void *p) else { rt_kprintf("Mount \"sd0p0\" on \"/\" fail\n"); - return -1; + return ; } /* 挂载sd1分区 */ @@ -105,7 +105,7 @@ int sd_check_thread_entry(void *p) rt_thread_delay(RT_TICK_PER_SECOND); } } - return 0; + return ; } int mnt_init(void) @@ -116,7 +116,7 @@ int mnt_init(void) rt_pin_mode(SD_CHECK_PIN, PIN_MODE_INPUT_PULLUP); - thread = rt_thread_create("sd", sd_check_thread_entry, NULL, 4096, 21, 10); + thread = rt_thread_create("sd", sd_check_thread_entry, NULL, RT_SYSTEM_WORKQUEUE_STACKSIZE, 21, 10); if (thread == NULL) { return -1; diff --git a/bsp/allwinner/d1s/ports/partition/partition.c b/bsp/allwinner/d1s/ports/partition/partition.c index 9b9ceb2c378..1c30d29e5f1 100644 --- a/bsp/allwinner/d1s/ports/partition/partition.c +++ b/bsp/allwinner/d1s/ports/partition/partition.c @@ -115,6 +115,18 @@ static rt_ssize_t partition_write(rt_device_t dev, return 0; } +#ifdef RT_USING_DEVICE_OPS +const static struct rt_device_ops _partition_ops = +{ + .init = partition_init, + .open = partition_open, + .close = partition_close, + .read = partition_read, + .write = partition_write, + .control = partition_control, +}; +#endif /* RT_USING_DEVICE_OPS */ + int rt_partition_init(const char* flash_device, const struct rt_partition* parts, rt_size_t num) { struct rt_device *device; @@ -148,12 +160,16 @@ int rt_partition_init(const char* flash_device, const struct rt_partition* parts /* register device */ part_dev->parent.type = RT_Device_Class_Block; +#ifndef RT_USING_DEVICE_OPS part_dev->parent.init = partition_init; part_dev->parent.open = partition_open; part_dev->parent.close = partition_close; part_dev->parent.read = partition_read; part_dev->parent.write = partition_write; part_dev->parent.control = partition_control; +#else + part_dev->parent.ops = &_partition_ops; +#endif /* RT_USING_DEVICE_OPS */ /* no private */ part_dev->parent.user_data = RT_NULL; diff --git a/bsp/allwinner/d1s/rtconfig.h b/bsp/allwinner/d1s/rtconfig.h index 032644d48f6..8c0fd9b38ea 100644 --- a/bsp/allwinner/d1s/rtconfig.h +++ b/bsp/allwinner/d1s/rtconfig.h @@ -1,9 +1,6 @@ #ifndef RT_CONFIG_H__ #define RT_CONFIG_H__ -/* Automatically generated file; DO NOT EDIT. */ -/* RT-Thread Project Configuration */ - /* RT-Thread Kernel */ #define RT_NAME_MAX 20 @@ -21,12 +18,18 @@ #define RT_USING_TIMER_SOFT #define RT_TIMER_THREAD_PRIO 4 #define RT_TIMER_THREAD_STACK_SIZE 16384 +#define RT_USING_CPU_USAGE_TRACER /* kservice optimization */ -#define RT_KSERVICE_USING_STDLIB -#define RT_KPRINTF_USING_LONGLONG +/* end of kservice optimization */ + +/* klibc optimization */ + +#define RT_KLIBC_USING_PRINTF_LONGLONG +/* end of klibc optimization */ #define RT_USING_DEBUG +#define RT_DEBUGING_ASSERT #define RT_DEBUGING_COLOR #define RT_DEBUGING_CONTEXT @@ -37,22 +40,28 @@ #define RT_USING_EVENT #define RT_USING_MAILBOX #define RT_USING_MESSAGEQUEUE +/* end of Inter-Thread communication */ /* Memory Management */ #define RT_PAGE_MAX_ORDER 11 -#define RT_USING_MEMPOOL -#define RT_USING_SMALL_MEM -#define RT_USING_SMALL_MEM_AS_HEAP +#define RT_USING_MEMHEAP +#define RT_MEMHEAP_FAST_MODE +#define RT_USING_MEMHEAP_AS_HEAP +#define RT_USING_MEMHEAP_AUTO_BINDING #define RT_USING_MEMTRACE #define RT_USING_HEAP +/* end of Memory Management */ #define RT_USING_DEVICE +#define RT_USING_DEVICE_OPS +#define RT_USING_SCHED_THREAD_CTX #define RT_USING_CONSOLE #define RT_CONSOLEBUF_SIZE 256 #define RT_CONSOLE_DEVICE_NAME "uart0" -#define RT_VER_NUM 0x50100 +#define RT_VER_NUM 0x50200 #define RT_USING_STDC_ATOMIC #define RT_BACKTRACE_LEVEL_MAX_NR 32 +/* end of RT-Thread Kernel */ #define ARCH_CPU_64BIT #define RT_USING_CACHE #define ARCH_MM_MMU @@ -103,7 +112,10 @@ #define RT_DFS_ELM_MAX_SECTOR_SIZE 512 #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_PTYFS +#define RT_USING_DFS_TMPFS #define RT_USING_PAGECACHE /* page cache config */ @@ -114,6 +126,8 @@ #define RT_PAGECACHE_HASH_NR 1024 #define RT_PAGECACHE_GC_WORK_LEVEL 90 #define RT_PAGECACHE_GC_STOP_LEVEL 70 +/* end of page cache config */ +/* end of DFS: device virtual file system */ #define RT_USING_FAL #define FAL_DEBUG_CONFIG #define FAL_DEBUG 1 @@ -121,25 +135,22 @@ /* Device Drivers */ +#define RT_USING_DEV_BUS #define RT_USING_DEVICE_IPC #define RT_UNAMED_PIPE_NUMBER 64 #define RT_USING_SYSTEM_WORKQUEUE -#define RT_SYSTEM_WORKQUEUE_STACKSIZE 4096 +#define RT_SYSTEM_WORKQUEUE_STACKSIZE 16384 #define RT_SYSTEM_WORKQUEUE_PRIORITY 23 #define RT_USING_SERIAL #define RT_USING_SERIAL_V2 -#define RT_USING_TTY #define RT_USING_NULL #define RT_USING_ZERO #define RT_USING_RANDOM #define RT_USING_RTC #define RT_USING_WDT -#define RT_USING_DEV_BUS #define RT_USING_PIN #define RT_USING_KTIME - -/* Using USB */ - +/* end of Device Drivers */ /* C/C++ and POSIX layer */ @@ -151,6 +162,8 @@ #define RT_LIBC_TZ_DEFAULT_HOUR 8 #define RT_LIBC_TZ_DEFAULT_MIN 0 #define RT_LIBC_TZ_DEFAULT_SEC 0 +/* end of Timezone and Daylight Saving Time */ +/* end of ISO-ANSI C layer */ /* POSIX (Portable Operating System Interface) layer */ @@ -171,12 +184,17 @@ /* Socket is in the 'Network' category */ +/* end of Interprocess Communication (IPC) */ +/* end of POSIX (Portable Operating System Interface) layer */ +/* end of C/C++ and POSIX layer */ /* Network */ +/* end of Network */ /* Memory protection */ +/* end of Memory protection */ /* Utilities */ @@ -186,6 +204,7 @@ #define RT_USING_ADT_BITMAP #define RT_USING_ADT_HASHMAP #define RT_USING_ADT_REF +/* end of Utilities */ #define RT_USING_LWP #define RT_LWP_MAX_NR 30 #define LWP_TASK_STACK_SIZE 16384 @@ -194,12 +213,21 @@ #define LWP_TID_MAX_NR 64 #define RT_LWP_SHM_MAX_NR 64 #define RT_USING_LDSO +#define LWP_USING_TERMINAL +#define LWP_PTY_MAX_PARIS_LIMIT 64 /* Memory management */ +/* end of Memory management */ + +/* Using USB legacy version */ + +/* end of Using USB legacy version */ +/* end of RT-Thread Components */ /* RT-Thread Utestcases */ +/* end of RT-Thread Utestcases */ /* RT-Thread online packages */ @@ -210,124 +238,153 @@ /* Marvell WiFi */ +/* end of Marvell WiFi */ /* Wiced WiFi */ - -/* CYW43012 WiFi */ - - -/* BL808 WiFi */ - - -/* CYW43439 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 */ /* JSON: JavaScript Object Notation, a lightweight data-interchange format */ +/* end of JSON: JavaScript Object Notation, a lightweight data-interchange format */ /* XML: Extensible Markup Language */ +/* end of XML: Extensible Markup Language */ +/* end of language packages */ /* multimedia packages */ /* 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 */ + +/* PainterEngine: A cross-platform graphics application framework written in C language */ + +/* end of PainterEngine: A cross-platform graphics application framework written in C language */ +/* end of multimedia packages */ /* tools packages */ +/* end of tools packages */ /* system packages */ /* enhanced kernel services */ +/* end of enhanced kernel services */ /* acceleration: Assembly language or algorithmic acceleration packages */ +/* end of acceleration: Assembly language or algorithmic acceleration packages */ /* CMSIS: ARM Cortex-M Microcontroller Software Interface Standard */ +/* end of 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 */ -/* HAL & SDK Drivers */ - -/* STM32 HAL & SDK Drivers */ - /* Kendryte SDK */ - -/* sensors drivers */ - - -/* touch drivers */ - +/* end of Kendryte SDK */ +/* end of peripheral libraries and drivers */ /* AI packages */ - -/* Signal Processing and Control Algorithm Packages */ - +/* end of AI packages */ /* miscellaneous packages */ /* project laboratory */ +/* end of project laboratory */ + /* 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 */ /* Arduino libraries */ -/* Projects and Demos */ +/* Projects */ +/* end of Projects */ /* Sensors */ +/* end of Sensors */ /* Display */ +/* end of Display */ /* Timing */ +/* end of Timing */ /* Data Processing */ +/* end of Data Processing */ /* Data Storage */ /* Communication */ +/* end of Communication */ /* Device Control */ +/* end of Device Control */ /* Other */ - /* Signal IO */ +/* end of Signal IO */ /* Uncategorized */ +/* end of Arduino libraries */ +/* end of RT-Thread online packages */ + +/* Privated Packages of RealThread */ + + +/* Network Utilities */ + +/* end of Network Utilities */ + +/* RT-Thread Smart */ + +/* end of RT-Thread Smart */ +/* end of Privated Packages of RealThread */ #define BOARD_allwinnerd1s #define __STACKSIZE__ 16384 @@ -340,29 +397,36 @@ #define BSP_USING_UART0 #define UART0_TX_USING_GPIOE2 #define UART0_RX_USING_GPIOE3 +/* end of General Purpose UARTs */ #define BSP_USING_SDMMC #define SD_CARD_CHECK #define BSP_USING_FS /* Board extended module Drivers */ +/* end of Board extended module Drivers */ +/* end of General Drivers Configuration */ #define RT_USING_SUNXI_HAL /* UART Devices */ +/* end of UART Devices */ /* CCMU Devices */ #define DRIVERS_CCMU #define DRIVERS_SUNXI_CCU +/* end of CCMU Devices */ /* DMA Devices */ #define DRIVERS_DMA +/* end of DMA Devices */ /* GPIO Devices */ #define DRIVERS_GPIO +/* end of GPIO Devices */ /* Video support for sunxi */ @@ -375,18 +439,24 @@ #define LCD_SUPPORT_WILLIAMLCD #define LCD_SUPPORT_LQ101R1SX03 #define LCD_SUPPORT_INET_DSI_PANEL +/* end of LCD panels select */ /* Display engine feature select */ #define DISP2_SUNXI_SUPPORT_ENAHNCE +/* end of Display engine feature select */ /* Soc and board select */ /* Board Select */ +/* end of Board Select */ /* Soc Select */ +/* end of Soc Select */ +/* end of Soc and board select */ +/* end of Video support for sunxi */ /* SDMMC Devices */ @@ -398,25 +468,31 @@ #define SDIO_IRQ_SUPPORT #define SDC_DMA_BUF_SIZE 64 #define DRIVERS_SDC_CDPIN_PRESENT_VAL 0 +/* end of SDMMC Devices */ /* SPI Devices */ #define DRIVERS_SPI +/* end of SPI Devices */ /* TWI Devices */ #define DRIVERS_TWI +/* end of TWI Devices */ /* G2D Devices */ #define DRIVERS_G2D +/* end of G2D Devices */ /* CE Devices */ #define DRIVERS_CE +/* end of CE Devices */ /* EFUSE Devices */ #define DRIVERS_EFUSE +/* end of EFUSE Devices */ #endif diff --git a/bsp/allwinner/libraries/drivers/sdmmc/drv_sdmmc.c b/bsp/allwinner/libraries/drivers/sdmmc/drv_sdmmc.c index 4b64354f834..fb4efde1b5c 100644 --- a/bsp/allwinner/libraries/drivers/sdmmc/drv_sdmmc.c +++ b/bsp/allwinner/libraries/drivers/sdmmc/drv_sdmmc.c @@ -8,6 +8,9 @@ * 2021-10-29 JasonHu first version */ +#define DBG_TAG "drv-sdmmc" +#include + #include #include #include @@ -36,10 +39,6 @@ #include /* statfs() */ #include "partition.h" -#define DBG_LEVEL DBG_LOG -#define DBG_SECTION_NAME "drv-sdmmc" -#include - #ifdef CONFIG_SUPPORT_SDMMC_CACHE #include "sdmmc_cache.h" #endif @@ -73,7 +72,7 @@ static int _register_blk_part_device(rt_device_t dev, const char *dev_name) /* NOTICE: get block geometry fisrt time here, then you can read/write sdmmc. */ struct dev_sdmmc *dev_sdmmc = (struct dev_sdmmc *)dev->user_data; - if (dev->control(dev, RT_DEVICE_CTRL_BLK_GETGEOME, &dev_sdmmc->geometry) != RT_EOK) + if (rt_dev_control(dev, RT_DEVICE_CTRL_BLK_GETGEOME, &dev_sdmmc->geometry) != RT_EOK) { LOG_E("device get geometry failed!"); return -RT_EIO; @@ -95,7 +94,7 @@ static int _register_blk_part_device(rt_device_t dev, const char *dev_name) return -RT_ENOMEM; } - if (dev->read(dev, 0, mbr_buf, 1) != 1) + if (rt_dev_read(dev, 0, mbr_buf, 1) != 1) { LOG_E("device read mbr 1-sector failure\n"); ret = -RT_ERROR; @@ -429,6 +428,18 @@ static rt_err_t sdmmc_control(rt_device_t dev, int cmd, void *args) return ret; } +#ifdef RT_USING_DEVICE_OPS +const static struct rt_device_ops _sdmmc_ops = +{ + .init = sdmmc_init, + .open = sdmmc_open, + .close = sdmmc_close, + .read = sdmmc_read, + .write = sdmmc_write, + .control = sdmmc_control +}; +#endif /* RT_USING_DEVICE_OPS */ + static int init_sdmmc_device(rt_device_t device, void *usr_data, char *dev_name) { int ret = -1; @@ -438,12 +449,17 @@ static int init_sdmmc_device(rt_device_t device, void *usr_data, char *dev_name) { return ret; } + +#ifndef RT_USING_DEVICE_OPS device->init = sdmmc_init; device->open = sdmmc_open; device->close = sdmmc_close; device->read = sdmmc_read; device->write = sdmmc_write; device->control = sdmmc_control; +#else + device->ops = &_sdmmc_ops; +#endif /* RT_USING_DEVICE_OPS */ device->user_data = usr_data; ret = rt_device_register(device, dev_name, RT_DEVICE_FLAG_RDWR); @@ -463,7 +479,7 @@ static int init_sdmmc_device(rt_device_t device, void *usr_data, char *dev_name) /* NOTICE: get block geometry fisrt time here, then you can read/write sdmmc. */ struct dev_sdmmc *dev_sdmmc = (struct dev_sdmmc *)device->user_data; - if (device->control(device, RT_DEVICE_CTRL_BLK_GETGEOME, &dev_sdmmc->geometry) != RT_EOK) + if (rt_dev_control(device, RT_DEVICE_CTRL_BLK_GETGEOME, &dev_sdmmc->geometry) != RT_EOK) { LOG_E("device get geometry failed!"); ret = -ENOSYS; diff --git a/bsp/allwinner/libraries/drivers/sdmmc/drv_sdmmc.h b/bsp/allwinner/libraries/drivers/sdmmc/drv_sdmmc.h index 47fd8112a4c..bd90196a4b7 100644 --- a/bsp/allwinner/libraries/drivers/sdmmc/drv_sdmmc.h +++ b/bsp/allwinner/libraries/drivers/sdmmc/drv_sdmmc.h @@ -27,4 +27,18 @@ struct dev_sdmmc void sd_mmc1_init(void); void sd_mmc1_deinit(void); +#ifdef RT_USING_DEVICE_OPS +#define rt_dev_has_control(dev) (dev)->ops->control +#define rt_dev_control(dev, cmd, args) (dev)->ops->control(dev, cmd, args) +#define rt_dev_read(dev, pos, buffer, size) (dev)->ops->read(dev, pos, buffer, size) +#define rt_dev_write(dev, pos, buffer, size) (dev)->ops->write(dev, pos, buffer, size) + +#else +#define rt_dev_has_control(dev) (dev)->control +#define rt_dev_control(dev, cmd, args) (dev)->control(dev, cmd, args) +#define rt_dev_read(dev, pos, buffer, size) (dev)->read(dev, pos, buffer, size) +#define rt_dev_write(dev, pos, buffer, size) (dev)->write(dev, pos, buffer, size) + +#endif + #endif diff --git a/bsp/allwinner/libraries/libos/src/os.c b/bsp/allwinner/libraries/libos/src/os.c index 29cc451eef0..9e00413c460 100644 --- a/bsp/allwinner/libraries/libos/src/os.c +++ b/bsp/allwinner/libraries/libos/src/os.c @@ -66,18 +66,6 @@ rt_weak int msleep(unsigned int msecs) return 0; } -void rt_hw_us_delay(rt_uint32_t us) -{ - uint64_t start, target; - uint64_t frequency; - - frequency = arch_timer_get_cntfrq(); - start = arch_counter_get_cntpct(); - target = frequency / 1000000ULL * us; - - while (arch_counter_get_cntpct() - start <= target) ; -} - rt_weak int usleep(unsigned int usecs) { int tickDiv = 1000 * (1000 / CONFIG_HZ); diff --git a/bsp/allwinner/libraries/sunxi-hal/hal/source/sdmmc/blkpart.c b/bsp/allwinner/libraries/sunxi-hal/hal/source/sdmmc/blkpart.c index 16778a5f365..a497ee2dcc1 100644 --- a/bsp/allwinner/libraries/sunxi-hal/hal/source/sdmmc/blkpart.c +++ b/bsp/allwinner/libraries/sunxi-hal/hal/source/sdmmc/blkpart.c @@ -9,6 +9,9 @@ #include #include #include + +#include + #define MIN(a, b) ((a) > (b) ? (b) : (a)) #define ALIGN_DOWN(x, a) __ALIGN_KERNEL((x) - ((a) - 1), (a)) #define __ALIGN_KERNEL(x, a) __ALIGN_KERNEL_MASK(x, (typeof(x))(a) - 1) @@ -247,7 +250,7 @@ rt_size_t part_read(rt_device_t dev, rt_off_t offset, void *data, rt_size_t size offset, blk->blk_bytes); pr_debug("step1: read page data from addr 0x%x\n", addr); - ret = spinor_dev->read(spinor_dev, addr / blk->page_bytes, page_buf, blk->page_bytes / blk->page_bytes); + ret = rt_dev_read(spinor_dev, addr / blk->page_bytes, page_buf, blk->page_bytes / blk->page_bytes); ret *= blk->page_bytes; if (ret != blk->blk_bytes) { @@ -272,7 +275,7 @@ rt_size_t part_read(rt_device_t dev, rt_off_t offset, void *data, rt_size_t size { uint32_t len = (size/blk->page_bytes)*blk->page_bytes; - ret = spinor_dev->read(spinor_dev, offset / blk->blk_bytes, (char *)data, len / blk->blk_bytes); + ret = rt_dev_read(spinor_dev, offset / blk->blk_bytes, (char *)data, len / blk->blk_bytes); ret *= blk->page_bytes; if (ret != len) { @@ -294,7 +297,7 @@ rt_size_t part_read(rt_device_t dev, rt_off_t offset, void *data, rt_size_t size pr_debug("last size %u not align %u, read them\n", size, blk->blk_bytes); pr_debug("step1: read page data from addr 0x%x\n", offset); - ret = spinor_dev->read(spinor_dev, offset / blk->blk_bytes, page_buf, blk->page_bytes / blk->page_bytes); + ret = rt_dev_read(spinor_dev, offset / blk->blk_bytes, page_buf, blk->page_bytes / blk->page_bytes); ret *= blk->page_bytes; if (ret != blk->page_bytes) { @@ -325,7 +328,7 @@ rt_size_t part_read(rt_device_t dev, rt_off_t offset, void *data, rt_size_t size int do_write_without_erase(rt_device_t dev, struct blkpart *blk, uint32_t addr, uint32_t size, char *buf) { - return dev->write(dev, addr, buf, size); + return rt_dev_write(dev, addr, buf, size); } static int do_erase_write_blk(rt_device_t dev, struct blkpart *blk, uint32_t addr, uint32_t size, char *buf) { @@ -355,7 +358,7 @@ static int do_erase_write_blk(rt_device_t dev, struct blkpart *blk, uint32_t add memset(&erase_sector, 0, sizeof(blk_dev_erase_t)); erase_sector.addr = align_addr; erase_sector.len = blk->blk_bytes; - ret = dev->control(dev, BLOCK_DEVICE_CMD_ERASE_SECTOR, &erase_sector); + ret = rt_dev_control(dev, BLOCK_DEVICE_CMD_ERASE_SECTOR, &erase_sector); if (ret) { free(read_buf); @@ -365,7 +368,7 @@ static int do_erase_write_blk(rt_device_t dev, struct blkpart *blk, uint32_t add memcpy(read_buf + (addr - align_addr), buf, blk->page_bytes); - ret = dev->write(dev, align_addr, read_buf, blk->blk_bytes); + ret = rt_dev_write(dev, align_addr, read_buf, blk->blk_bytes); free(read_buf); if (ret == blk->blk_bytes) { @@ -382,13 +385,13 @@ static int do_erase_write_blk(rt_device_t dev, struct blkpart *blk, uint32_t add memset(&erase_sector, 0, sizeof(blk_dev_erase_t)); erase_sector.addr = addr; erase_sector.len = size; - ret = dev->control(dev, BLOCK_DEVICE_CMD_ERASE_SECTOR, &erase_sector); + ret = rt_dev_control(dev, BLOCK_DEVICE_CMD_ERASE_SECTOR, &erase_sector); if (ret) { return -EIO; } - ret = dev->write(dev, addr, buf, size); + ret = rt_dev_write(dev, addr, buf, size); if (ret == size) { return size; @@ -466,7 +469,7 @@ rt_size_t _part_write(rt_device_t dev, rt_off_t offset, const void *data, rt_siz pr_debug("offset %u not align %u, fix them before align write\n", offset, blk->blk_bytes); pr_debug("step1: read page data from addr 0x%x\n", addr); - ret = spinor_dev->read(spinor_dev, addr / blk->blk_bytes, blk_buf, blk->blk_bytes / blk->blk_bytes); + ret = rt_dev_read(spinor_dev, addr / blk->blk_bytes, blk_buf, blk->blk_bytes / blk->blk_bytes); ret *= blk->blk_bytes; if (ret != blk->blk_bytes) { @@ -513,7 +516,7 @@ rt_size_t _part_write(rt_device_t dev, rt_off_t offset, const void *data, rt_siz pr_debug("step1: read page data from addr 0x%x\n", offset); memset(blk_buf, 0x00, sizeof(blk->blk_bytes)); - ret = spinor_dev->read(spinor_dev, offset / blk->blk_bytes, blk_buf, blk->blk_bytes); + ret = rt_dev_read(spinor_dev, offset / blk->blk_bytes, blk_buf, blk->blk_bytes); if (ret != blk->blk_bytes) { goto err; @@ -582,15 +585,15 @@ rt_err_t part_control(rt_device_t dev, int cmd, void *args) erase_sector->len = MIN(part->bytes - erase_sector->addr, erase_sector->len); erase_sector->addr = erase_sector->addr + part->off; - if (spinor_dev && spinor_dev->control) + if (spinor_dev && rt_dev_has_control(spinor_dev)) { - ret = spinor_dev->control(spinor_dev, BLOCK_DEVICE_CMD_ERASE_SECTOR, erase_sector); + ret = rt_dev_control(spinor_dev, BLOCK_DEVICE_CMD_ERASE_SECTOR, erase_sector); } break; case DEVICE_PART_CMD_GET_BLOCK_SIZE: - if (spinor_dev && spinor_dev->control) + if (spinor_dev && rt_dev_has_control(spinor_dev)) { - ret = spinor_dev->control(spinor_dev, BLOCK_DEVICE_CMD_GET_BLOCK_SIZE, args); + ret = rt_dev_control(spinor_dev, BLOCK_DEVICE_CMD_GET_BLOCK_SIZE, args); } else { @@ -604,9 +607,9 @@ rt_err_t part_control(rt_device_t dev, int cmd, void *args) case RT_DEVICE_CTRL_BLK_GETGEOME: geometry = (struct rt_device_blk_geometry *)args; memset(geometry, 0, sizeof(struct rt_device_blk_geometry)); - if (spinor_dev && spinor_dev->control) + if (spinor_dev && rt_dev_has_control(spinor_dev)) { - ret = spinor_dev->control(spinor_dev, RT_DEVICE_CTRL_BLK_GETGEOME, args); + ret = rt_dev_control(spinor_dev, RT_DEVICE_CTRL_BLK_GETGEOME, args); if (!ret) { geometry->sector_count = part->bytes / geometry->bytes_per_sector; diff --git a/bsp/cvitek/drivers/libraries/eth/dw_eth_mac.c b/bsp/cvitek/drivers/libraries/eth/dw_eth_mac.c index 20599c95bb8..61895837db6 100644 --- a/bsp/cvitek/drivers/libraries/eth/dw_eth_mac.c +++ b/bsp/cvitek/drivers/libraries/eth/dw_eth_mac.c @@ -672,7 +672,7 @@ int32_t cvi_eth_mac_read_frame(eth_mac_handle_t handle, uint8_t *frame, uint32_t \param[in] cb callback to handle ethernet event \return return ethernet handle if success */ -eth_mac_handle_t cvi_eth_mac_init(unsigned int base) +eth_mac_handle_t cvi_eth_mac_init(unsigned int *base) { gmac_dev_t *mac_dev = &gmac_instance[0]; struct dw_gmac_priv *priv, *priv_unalign; diff --git a/bsp/stm32/stm32f407-rt-spark/README_EN.md b/bsp/stm32/stm32f407-rt-spark/README_EN.md new file mode 100644 index 00000000000..d5b5fcc8f88 --- /dev/null +++ b/bsp/stm32/stm32f407-rt-spark/README_EN.md @@ -0,0 +1,119 @@ +# STM32F407 RT-Thread Spark Board BSP Introduction + +## Overview + +This document is a description of the BSP (Board Support Package) provided by the RT-Thread development team for the STM32F407 RT-Thread Spark Board. + +The main contents are as follows: + +- Introduction of Development Board Resources +- BSP Quick Start +- Advanced Usage + +By reading Quick Start Section, developers can quickly get started with the BSP and run RT-Thread on the board. In the Advanced Usage Section, more advanced features will be introduced to help developers utilize RT-Thread to drive more on-board resources. + +## Spark-1 Introduction + +The STM32F407 is a development board based on the ARM Cortex-M4 core from RT-THREAD, with a maximum main frequency of 168Mhz. The board has a wealth of on-board resources, which can fully utilize the performance of the STM32F407 chip. + +The appearance of the board is shown in the figure below: + +![board](figures/board.png) + +The development board commonly used **on-board resources** as follows: + +- MCU: STM32F407ZGT6, 168MHz, 1024KB FLASH, 192KB RAM. +- External FLASH: W25Q128 (SPI, 16MB) +- Common Peripherals + - LEDs: 2, LED_R (red, PF12), LED_B (green, PF11) + - Keys, 4, KEY_UP (both wake-up function, PIN: PC5), KEY_DOWN (PIN: PC1), KEY_LEFT (PIN: PC0), KEY_RIGHT (PIN: PC4) +- Common interfaces: USB to serial port, SD card interface, USB SLAVE, USB HOST +- Debugging interface, standard ST-LINK + +For more details about the board, please refer to the official document [Introduction to STM32 Spark-1 Development Board](https://www.rt-thread.org/document/site/#/rt-thread-version/rt-thread-standard/hw-board/spark-1/spark-1). + + +## Peripheral Support + +The BSP currently supports the following peripherals: +| **Onboard peripherals** | **Support** | **note** | +| :------------ | :----------: | :-----------------------------------: | +| USB to Serial(COM1) | Support | | +| COM2 | Support | Conflicts with Ethernet and PWM. Use CubeMX to reconfigure the UART2 pin if you want to use this peripheral. | +| COM3 | Support | | +| **On-chip peripherals** | **Supoort** | **Note** | +| UART | Support | UART1/2/3 | +| SPI | Support | SPI1/2/3 | +| ADC | Support | | +| RTC | Support | Support external crystal and internal low-speed clock | +| WDT | Support | | + +## Instructions for Use + +The instructions for use are divided into two sections as follows: + +- Quick Start + + This section is intended for newcomers to RT-Thread. Follow the simple steps to get the RT-Thread operating system running on the board and see the results. + +- Advanced Usage + + This section is for developers who want to use more of the board's resources with the RT-Thread operating system. By using the ENV tool to configure the BSP, you can enable more on-board resources and realize more advanced functions. + +### Quick Start + +This BSP provides developers with MDK5 and IAR projects and supports GCC development environment. The following is an example of how to get the system up and running using the MDK5 development environment. + +#### Hardware Connection + +Connect the board to the PC with a cable and turn on the power switch. + +#### Compile and Download + +Double click the project.uvprojx file to open the MDK5 project, compile and download the program to the development board. + +> The default configuration of the project is to use JLink to download the program. On the basis of connecting the development board via JLink, click the Download button to download the program to the development board. + +#### Running Result + +After successfully downloading the program, the system will run automatically. Observe the running effect of the LED on the development board, where the red LED is always on, the green LED will blink periodically. + +Connect the corresponding serial port of the development board to PC, open the corresponding serial port (115200-8-1-N) in the terminal tool, and reset the device, you can see the output information of RT-Thread. + + + +```bash + + \ | / +- RT - Thread Operating System + / | \ 5.0.1 build Jul 4 2023 07:49:10 + 2006 - 2022 Copyright by RT-Thread team +msh > +``` + +### Advanced Usage + +This BSP only enables GPIO and Serial1 by default. If you want to use more advanced functions such as SD card, Flash, etc., you need to configure the BSP by using ENV utility, the steps are as below: + +1. Open the env utility under bsp. + +2. Input `menuconfig` command to configure the project, save and exit after configuration. + +3. Enter the `pkgs --update` command to update the package. + +4. Enter the `scons --target=mdk5/iar` command to regenerate the project. + +For a more detailed description of this chapter, please refer to [STM32 Series BSP Peripheral Driver Tutorial](... /docs/STM32 Series BSP Peripheral Driver Tutorial.md). + +## Notes + +Not available at this time + +## Connection + +Maintainer: + +- [Supperthomas](https://github.com/supperthomas) + + + diff --git a/components/drivers/can/can.c b/components/drivers/can/can.c index 2ebab4afbc7..f10e05dc552 100644 --- a/components/drivers/can/can.c +++ b/components/drivers/can/can.c @@ -43,9 +43,9 @@ static rt_err_t rt_can_init(struct rt_device *dev) /* * can interrupt routines */ -rt_inline int _can_int_rx(struct rt_can_device *can, struct rt_can_msg *data, int msgs) +rt_inline rt_ssize_t _can_int_rx(struct rt_can_device *can, struct rt_can_msg *data, rt_ssize_t msgs) { - int size; + rt_ssize_t size; struct rt_can_rx_fifo *rx_fifo; RT_ASSERT(can != RT_NULL); size = msgs; @@ -54,7 +54,7 @@ rt_inline int _can_int_rx(struct rt_can_device *can, struct rt_can_msg *data, in RT_ASSERT(rx_fifo != RT_NULL); /* read from software FIFO */ - while (msgs) + while (msgs / sizeof(struct rt_can_msg) > 0) { rt_base_t level; #ifdef RT_CAN_USING_HDR diff --git a/components/drivers/serial/serial_tty.c b/components/drivers/serial/serial_tty.c index f75123eba2d..bbf61f8ae06 100644 --- a/components/drivers/serial/serial_tty.c +++ b/components/drivers/serial/serial_tty.c @@ -298,6 +298,16 @@ static int serial_tty_param(struct lwp_tty *tp, struct termios *t) RT_ASSERT(softc); serial = softc->parent; + if (!tty_opened(tp)) + { + /** + * skip configure on open since all configs are copied from the current + * configuration on device. So we don't bother to set it back to device + * again. + */ + return RT_EOK; + } + cfsetispeed(t, t->__c_ispeed); return rt_device_control(&(serial->parent), TCSETS, t); } diff --git a/components/drivers/serial/serial_v2.c b/components/drivers/serial/serial_v2.c index d7576dbed87..111bfbca01f 100644 --- a/components/drivers/serial/serial_v2.c +++ b/components/drivers/serial/serial_v2.c @@ -118,7 +118,11 @@ static int serial_fops_ioctl(struct dfs_file *fd, int cmd, void *args) return rt_device_control(device, cmd, args); } -static int serial_fops_read(struct dfs_file *fd, void *buf, size_t count) +#ifdef RT_USING_DFS_V2 +static ssize_t serial_fops_read(struct dfs_file *fd, void *buf, size_t count, off_t *pos) +#else +static ssize_t serial_fops_read(struct dfs_file *fd, void *buf, size_t count) +#endif { int size = 0; rt_device_t device; @@ -143,7 +147,11 @@ static int serial_fops_read(struct dfs_file *fd, void *buf, size_t count) return size; } -static int serial_fops_write(struct dfs_file *fd, const void *buf, size_t count) +#ifdef RT_USING_DFS_V2 +static ssize_t serial_fops_write(struct dfs_file *fd, const void *buf, size_t count, off_t *pos) +#else +static ssize_t serial_fops_write(struct dfs_file *fd, const void *buf, size_t count) +#endif { rt_device_t device; @@ -186,15 +194,12 @@ static int serial_fops_poll(struct dfs_file *fd, struct rt_pollreq *req) const static struct dfs_file_ops _serial_fops = { - serial_fops_open, - serial_fops_close, - serial_fops_ioctl, - serial_fops_read, - serial_fops_write, - RT_NULL, /* flush */ - RT_NULL, /* lseek */ - RT_NULL, /* getdents */ - serial_fops_poll, + .open = serial_fops_open, + .close = serial_fops_close, + .ioctl = serial_fops_ioctl, + .read = serial_fops_read, + .write = serial_fops_write, + .poll = serial_fops_poll, }; #endif /* RT_USING_POSIX_STDIO */ diff --git a/components/lwp/Kconfig b/components/lwp/Kconfig index 22cfbea47cf..d88a0b6a9d5 100644 --- a/components/lwp/Kconfig +++ b/components/lwp/Kconfig @@ -81,5 +81,6 @@ if RT_USING_LWP endif rsource "terminal/Kconfig" +rsource "vdso/Kconfig" endif diff --git a/components/lwp/SConscript b/components/lwp/SConscript index 5f4a618d480..84e9a0b5d0a 100644 --- a/components/lwp/SConscript +++ b/components/lwp/SConscript @@ -43,4 +43,5 @@ CPPPATH += ['./terminal/'] group = DefineGroup('lwP', src, depend = ['RT_USING_SMART'], CPPPATH = CPPPATH) +group = group + SConscript(os.path.join('vdso', 'SConscript')) Return('group') diff --git a/components/lwp/arch/aarch64/common/vdso.c b/components/lwp/arch/aarch64/common/vdso.c new file mode 100644 index 00000000000..960b78626f5 --- /dev/null +++ b/components/lwp/arch/aarch64/common/vdso.c @@ -0,0 +1,110 @@ +/* + * Copyright (c) 2006-2024 RT-Thread Development Team + * + * SPDX-License-Identifier: Apache-2.0 + * + * Change Logs: + * Date Author Notes + * 2024-07-04 rcitach init ver. + */ + +#include +#include +#include +#include + +#include "vdso.h" +#include "vdso_datapage.h" +#define DBG_TAG "vdso" +#define DBG_LVL DBG_INFO +#include + +enum vdso_abi { + VDSO_ABI_AA64, +}; +enum vvar_pages { + VVAR_DATA_PAGE_OFFSET, + VVAR_TIMENS_PAGE_OFFSET, + VVAR_NR_PAGES, +}; +struct vdso_abi_info { + const char *name; + const char *vdso_code_start; + const char *vdso_code_end; + unsigned long vdso_pages; + +}; + +static struct vdso_abi_info vdso_info[] = { + [VDSO_ABI_AA64] = { + .name = "vdso_aarch64", + .vdso_code_start = __vdso_text_start, + .vdso_code_end = __vdso_text_end, + }, +}; + +static union { + struct vdso_data data[CS_BASES]; + uint8_t page[ARCH_PAGE_SIZE]; +} vdso_data_store __page_aligned_data; +struct vdso_data *vdso_data = vdso_data_store.data; +int init_ret_flag = RT_EOK; + +static int __setup_additional_pages(enum vdso_abi abi, struct rt_lwp *lwp) +{ + RT_ASSERT(lwp != RT_NULL); + + int ret; + void *vdso_base = RT_NULL; + unsigned long vdso_data_len, vdso_text_len; + + vdso_data_len = VVAR_NR_PAGES * ARCH_PAGE_SIZE; + vdso_text_len = vdso_info[abi].vdso_pages << ARCH_PAGE_SHIFT; + + vdso_base = lwp_map_user_phy(lwp, RT_NULL, rt_kmem_v2p((void *)vdso_data), vdso_data_len, 0); + if(vdso_base != RT_NULL) + { + ret = RT_EOK; + } + else + { + ret = RT_ERROR; + } + vdso_base += vdso_data_len; + vdso_base = lwp_map_user_phy(lwp, vdso_base, rt_kmem_v2p((void *)vdso_info[abi].vdso_code_start), vdso_text_len, 0); + + lwp->vdso_vbase = vdso_base; + return ret; +} + +int arch_setup_additional_pages(struct rt_lwp *lwp) +{ + int ret; + if (init_ret_flag != RT_EOK) return -RT_ERROR; + ret = __setup_additional_pages(VDSO_ABI_AA64, lwp); + + return ret; +} + +static void __initdata(void) +{ + struct tm time_vdso = SOFT_RTC_VDSOTIME_DEFAULT; + vdso_data->realtime_initdata = timegm(&time_vdso); +} + +int validate_vdso_elf(void) +{ + if (rt_memcmp(vdso_info[VDSO_ABI_AA64].vdso_code_start, ELF_HEAD, ELF_HEAD_LEN)) { + LOG_E("vDSO is not a valid ELF object!"); + init_ret_flag = -RT_ERROR; + return -RT_ERROR; + } + vdso_info[VDSO_ABI_AA64].vdso_pages = ( + vdso_info[VDSO_ABI_AA64].vdso_code_end - + vdso_info[VDSO_ABI_AA64].vdso_code_start) >> + ARCH_PAGE_SHIFT; + + __initdata(); + return RT_EOK; +} +INIT_COMPONENT_EXPORT(validate_vdso_elf); diff --git a/components/lwp/arch/aarch64/common/vdso_data.c b/components/lwp/arch/aarch64/common/vdso_data.c new file mode 100644 index 00000000000..13c055ec56d --- /dev/null +++ b/components/lwp/arch/aarch64/common/vdso_data.c @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2006-2024 RT-Thread Development Team + * + * SPDX-License-Identifier: Apache-2.0 + * + * Change Logs: + * Date Author Notes + * 2024-07-04 rcitach init ver. + */ + +#include +#include +#include +#include +#include +#include + +void rt_vdso_update_glob_time(void) +{ + struct vdso_data *vdata = get_k_vdso_data(); + struct timespec *vdso_ts; + uint64_t initdata = vdata->realtime_initdata; + rt_vdso_write_begin(vdata); + + vdso_ts = &vdata[CS_HRES_COARSE].basetime[CLOCK_REALTIME]; + rt_ktime_boottime_get_ns(vdso_ts); + vdso_ts->tv_sec = initdata + vdso_ts->tv_sec; + + vdso_ts = &vdata[CS_HRES_COARSE].basetime[CLOCK_MONOTONIC]; + rt_ktime_boottime_get_ns(vdso_ts); + + vdata->cycle_last = rt_hw_get_cntpct_val(); + rt_vdso_write_end(vdata); +} diff --git a/components/lwp/lwp.h b/components/lwp/lwp.h index e2cf2e8bd72..24b4150270e 100644 --- a/components/lwp/lwp.h +++ b/components/lwp/lwp.h @@ -197,6 +197,10 @@ struct rt_lwp unsigned int asid; #endif struct rusage rt_rusage; + +#ifdef RT_USING_VDSO + void *vdso_vbase; +#endif }; @@ -373,6 +377,7 @@ void lwp_jobctrl_on_exit(struct rt_lwp *lwp); #define AT_RANDOM 25 #define AT_HWCAP2 26 #define AT_EXECFN 31 +#define AT_SYSINFO_EHDR 33 struct process_aux_item { diff --git a/components/lwp/lwp_elf.c b/components/lwp/lwp_elf.c index da698e36746..69021a496d5 100644 --- a/components/lwp/lwp_elf.c +++ b/components/lwp/lwp_elf.c @@ -25,6 +25,10 @@ #include #endif +#ifdef RT_USING_VDSO +#include +#endif + #define DBG_TAG "load.elf" #ifdef ELF_DEBUG_ENABLE #define DBG_LVL DBG_LOG @@ -607,6 +611,17 @@ static int elf_aux_fill(elf_load_info_t *load_info) ELF_AUX_ENT(aux_info, AT_CLKTCK, 0); ELF_AUX_ENT(aux_info, AT_SECURE, 0); +#ifdef RT_USING_VDSO + if(RT_EOK == arch_setup_additional_pages(load_info->lwp)) + { + ELF_AUX_ENT(aux_info, AT_SYSINFO_EHDR, (size_t)load_info->lwp->vdso_vbase); + } + else + { + LOG_W("vdso map error,VDSO currently only supports aarch64 architecture!"); + } +#endif + return 0; } diff --git a/components/lwp/vdso/Kconfig b/components/lwp/vdso/Kconfig new file mode 100644 index 00000000000..a10e0162718 --- /dev/null +++ b/components/lwp/vdso/Kconfig @@ -0,0 +1,5 @@ +menuconfig RT_USING_VDSO + bool "vDSO" + default y + depends on RT_USING_SMART + diff --git a/components/lwp/vdso/SConscript b/components/lwp/vdso/SConscript new file mode 100644 index 00000000000..addcdfc8409 --- /dev/null +++ b/components/lwp/vdso/SConscript @@ -0,0 +1,48 @@ +import os +import rtconfig +import subprocess +from building import * +Import('RTT_ROOT') + +group = [] + +cwd = GetCurrentDir() +CPPPATH = [cwd, cwd + "/kernel"] + +if not GetDepend(['RT_USING_VDSO']): + Return('group') + +if rtconfig.ARCH != "aarch64": + src = Glob('*.c') + group = DefineGroup('VDSO', src, depend = ['RT_USING_SMART','RT_USING_VDSO'], CPPPATH = CPPPATH) + Return('group') + +list = os.listdir(cwd) +src = Glob('kernel/*.c') +src +=Glob('kernel/*.S') + +if not os.path.exists(cwd + "/user/vdso.lds"): + Preprocessing("user/vdso.lds.S", ".lds", CPPPATH=[cwd]) + +#aarch64 vdso xmake +# vdso_file = os.path.join(cwd, 'usr', 'xmake.lua') +# command = ["xmake", "-F", vdso_file] +# clean = ["xmake", "clean"] + +vdso_file = os.path.join(cwd, 'user', 'SConstruct') +command = ["scons", "-f", vdso_file] +clean = ["scons", "-f", vdso_file, "--clean"] + +if not GetOption('clean'): + result = subprocess.run(command) +else: + result = subprocess.run(clean) + +if result.returncode == 0: + print("Command executed successfully") +else: + print("Command failed with exit code:", result.returncode) + exit(1) + +group = DefineGroup('VDSO', src, depend = ['RT_USING_SMART','RT_USING_VDSO'], CPPPATH = CPPPATH) +Return('group') diff --git a/components/lwp/vdso/kernel/vdso.h b/components/lwp/vdso/kernel/vdso.h new file mode 100644 index 00000000000..1cb3b44e8ca --- /dev/null +++ b/components/lwp/vdso/kernel/vdso.h @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2006-2024 RT-Thread Development Team + * + * SPDX-License-Identifier: Apache-2.0 + * + * Change Logs: + * Date Author Notes + * 2024-07-04 rcitach init ver. + */ + +#ifndef _VDSO_H +#define _VDSO_H + +#include +#include +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +extern char __vdso_text_start[]; +extern char __vdso_text_end[]; + +#define ELF_HEAD "\177ELF" +#define ELF_HEAD_LEN 4 +#define MAX_PAGES 5 + +#define __page_aligned_data __attribute__((section(".data.vdso.datapage"))) __attribute__((aligned(VDSO_PAGE_SIZE))) + +int arch_setup_additional_pages(struct rt_lwp *lwp); +void rt_vdso_update_glob_time(void); + +#ifdef __cplusplus +} +#endif + +#endif /* _VDSO_H */ diff --git a/components/lwp/vdso/kernel/vdso_data.h b/components/lwp/vdso/kernel/vdso_data.h new file mode 100644 index 00000000000..5d077e4a9ef --- /dev/null +++ b/components/lwp/vdso/kernel/vdso_data.h @@ -0,0 +1,48 @@ +/* + * Copyright (c) 2006-2024 RT-Thread Development Team + * + * SPDX-License-Identifier: Apache-2.0 + * + * Change Logs: + * Date Author Notes + * 2024-07-04 rcitach init ver. + */ + +#ifndef _VDSO_KDATA_H +#define _VDSO_KDATA_H + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +extern struct vdso_data *vdso_data; + +rt_inline +struct vdso_data *_get_k_vdso_data(void) +{ + return vdso_data; +} +#define get_k_vdso_data _get_k_vdso_data + +rt_inline +void rt_vdso_write_begin(struct vdso_data *vd) +{ + rt_atomic_add(&vd[CS_HRES_COARSE].seq, 1); + rt_atomic_add(&vd[CS_RAW].seq, 1); +} + +rt_inline +void rt_vdso_write_end(struct vdso_data *vd) +{ + rt_atomic_add(&vd[CS_HRES_COARSE].seq, 1); + rt_atomic_add(&vd[CS_RAW].seq, 1); +} + +#ifdef __cplusplus +} +#endif + +#endif /* _VDSO_KDATA_H */ diff --git a/components/lwp/vdso/kernel/vdso_text.S b/components/lwp/vdso/kernel/vdso_text.S new file mode 100644 index 00000000000..f9c1f8aa720 --- /dev/null +++ b/components/lwp/vdso/kernel/vdso_text.S @@ -0,0 +1,21 @@ +/* + * Copyright (c) 2006-2023, RT-Thread Development Team + * + * SPDX-License-Identifier: Apache-2.0 + * + * Change Logs: + * Date Author Notes + * 2024-07-04 rcitach init ver. + */ + +#include + + .globl __vdso_text_start, __vdso_text_end + .section .rodata + .balign VDSO_PAGE_SIZE +__vdso_text_start: + .incbin VDSO_PATH + .balign VDSO_PAGE_SIZE +__vdso_text_end: + + .previous diff --git a/components/lwp/vdso/user/SConstruct b/components/lwp/vdso/user/SConstruct new file mode 100644 index 00000000000..a7cee1127f6 --- /dev/null +++ b/components/lwp/vdso/user/SConstruct @@ -0,0 +1,39 @@ +import os +import sys +import subprocess + +arguments = sys.argv[2] +vdso_usr = os.path.dirname(arguments) +vdso_root = os.path.dirname(vdso_usr) + + +EXEC_PATH = os.getenv('RTT_EXEC_PATH') or '/usr/bin' +PREFIX = os.getenv('RTT_CC_PREFIX') or 'aarch64-none-elf-' + +CC = PREFIX + 'gcc' +CXX = PREFIX + 'g++' +CPP = PREFIX + 'cpp' +AS = PREFIX + 'gcc' +AR = PREFIX + 'ar' +LINK = PREFIX + 'gcc' + +DEVICE = ' -march=armv8-a -mtune=cortex-a53 -ftree-vectorize -ffast-math -funwind-tables -fno-strict-aliasing' +CXXFLAGS = DEVICE + ' -Wall -fdiagnostics-color=always' +AFLAGS = ' -x assembler-with-cpp' +CFLAGS = DEVICE + ' -Wall -Wno-cpp -std=gnu99 -fdiagnostics-color=always -fPIC -O2' +LFLAGS = DEVICE + ' -Bsymbolic -Wl,--gc-sections,-u,system_vectors -T {path}/vdso.lds'.format(path=vdso_usr) +CFLAGS += " -I {path} -I{path}/user".format(path=vdso_root) + +env = Environment(tools=['gcc', 'link'], + AS = AS, ASFLAGS = AFLAGS, + CC = CC, CFLAGS = CFLAGS, + CXX = CXX, CXXFLAGS = CXXFLAGS, + AR = AR, + LINK = LINK, LINKFLAGS = LFLAGS) +env.PrependENVPath('PATH', EXEC_PATH) + +src = os.path.join(vdso_usr,'vdso_sys.c') +target_name = 'librtos_vdso.so' +target = os.path.join(vdso_usr, "build", target_name) +shared_lib = env.SharedLibrary(target=target, source=src) +env.Default(shared_lib) diff --git a/components/lwp/vdso/user/vdso.lds.S b/components/lwp/vdso/user/vdso.lds.S new file mode 100644 index 00000000000..8b0038ee2dd --- /dev/null +++ b/components/lwp/vdso/user/vdso.lds.S @@ -0,0 +1,60 @@ +/* + * Copyright (c) 2006-2023, RT-Thread Development Team + * + * SPDX-License-Identifier: Apache-2.0 + * + * Change Logs: + * Date Author Notes + * 2024-07-04 rcitach init ver. + */ + +#include + +OUTPUT_FORMAT("elf64-littleaarch64", "elf64-littleaarch64", "elf64-littleaarch64") +OUTPUT_ARCH(aarch64) + +SECTIONS +{ + PROVIDE(_vdso_data = . - __VVAR_PAGES * VDSO_PAGE_SIZE); + . = SIZEOF_HEADERS; + + .hash : { *(.hash) } :text + .gnu.hash : { *(.gnu.hash) } + .dynsym : { *(.dynsym) } + .dynstr : { *(.dynstr) } + .gnu.version : { *(.gnu.version) } + .gnu.version_d : { *(.gnu.version_d) } + .gnu.version_r : { *(.gnu.version_r) } + + .dynamic : { *(.dynamic) } :text :dynamic + .rela.dyn : ALIGN(8) { *(.rela .rela*) } + + .rodata : { + *(.rodata*) + *(.got) + *(.got.plt) + *(.plt) + *(.plt.*) + *(.iplt) + *(.igot .igot.plt) + } :text + /DISCARD/ : { + *(.data .data.* .sdata*) + *(.bss .sbss .dynbss .dynsbss) + } +} + +PHDRS +{ + text PT_LOAD FLAGS(5) FILEHDR PHDRS; + dynamic PT_DYNAMIC FLAGS(4); +} + +VERSION +{ + LINUX_2.6.39 { + global: + __kernel_clock_gettime; + local: *; + }; +} diff --git a/components/lwp/vdso/user/vdso_sys.c b/components/lwp/vdso/user/vdso_sys.c new file mode 100644 index 00000000000..61da379f045 --- /dev/null +++ b/components/lwp/vdso/user/vdso_sys.c @@ -0,0 +1,95 @@ +/* + * Copyright (c) 2006-2024 RT-Thread Development Team + * + * SPDX-License-Identifier: Apache-2.0 + * + * Change Logs: + * Date Author Notes + * 2024-07-04 rcitach init ver. + */ + +#include +#include +#include +#include +#include + +#ifndef rt_vdso_cycles_ready +static inline bool rt_vdso_cycles_ready(uint64_t cycles) +{ + return true; +} +#endif + +#ifndef rt_vdso_get_ns +static inline +uint64_t rt_vdso_get_ns(uint64_t cycles, uint64_t last) +{ + return (cycles - last) * NSEC_PER_SEC / __arch_get_hw_frq(); +} +#endif + +static int +__rt_vdso_getcoarse(struct timespec *ts, clockid_t clock, const struct vdso_data *vdns) +{ + const struct vdso_data *vd; + const struct timespec *vdso_ts; + uint32_t seq; + uint64_t sec, last, ns, cycles; + + if (clock != CLOCK_MONOTONIC_RAW) + vd = &vdns[CS_HRES_COARSE]; + else + vd = &vdns[CS_RAW]; + + vdso_ts = &vd->basetime[clock]; + + do { + seq = rt_vdso_read_begin(vd); + cycles = __arch_get_hw_counter(vd->clock_mode, vd); + if (unlikely(!rt_vdso_cycles_ready(cycles))) + return -1; + ns = vdso_ts->tv_nsec; + last = vd->cycle_last; + ns += rt_vdso_get_ns(cycles, last); + sec = vdso_ts->tv_sec; + } while (unlikely(rt_vdso_read_retry(vd, seq))); + + ts->tv_sec = sec + __iter_div_u64_rem(ns, NSEC_PER_SEC, &ns); + ts->tv_nsec = ns; + + return 0; +} + +static inline int +__vdso_clock_gettime_common(const struct vdso_data *vd, clockid_t clock, + struct timespec *ts) +{ + u_int32_t msk; + + if (unlikely((u_int32_t) clock >= MAX_CLOCKS)) + return -1; + + msk = 1U << clock; + if (likely(msk & VDSO_REALTIME)) + return __rt_vdso_getcoarse(ts,CLOCK_REALTIME,vd); + else if (msk & VDSO_MONOTIME) + return __rt_vdso_getcoarse(ts,CLOCK_MONOTONIC,vd); + else + return ENOENT; +} + +static __maybe_unused int +rt_vdso_clock_gettime_data(const struct vdso_data *vd, clockid_t clock, + struct timespec *ts) +{ + int ret = 0; + ret = __vdso_clock_gettime_common(vd, clock, ts); + return ret; +} + +int +__kernel_clock_gettime(clockid_t clock, struct timespec *ts) +{ + return rt_vdso_clock_gettime_data(__arch_get_vdso_data(), clock, ts); +} diff --git a/components/lwp/vdso/user/vdso_sys.h b/components/lwp/vdso/user/vdso_sys.h new file mode 100644 index 00000000000..ecc7b366adf --- /dev/null +++ b/components/lwp/vdso/user/vdso_sys.h @@ -0,0 +1,153 @@ +/* + * Copyright (c) 2006-2024 RT-Thread Development Team + * + * SPDX-License-Identifier: Apache-2.0 + * + * Change Logs: + * Date Author Notes + * 2024-07-04 rcitach init ver. + */ + +#ifndef ASM_VDSO_SYS_H +#define ASM_VDSO_SYS_H + +#include +#include +#include +#include +#include + +#define __always_unused __attribute__((__unused__)) +#define __maybe_unused __attribute__((__unused__)) + +#define likely(x) __builtin_expect(!!(x), 1) +#define unlikely(x) __builtin_expect(!!(x), 0) + +#define arch_counter_enforce_ordering(val) do { \ + uint64_t tmp, _val = (val); \ + \ + asm volatile( \ + " eor %0, %1, %1\n" \ + " add %0, sp, %0\n" \ + " ldr xzr, [%0]" \ + : "=r" (tmp) : "r" (_val)); \ +} while (0) + +static inline uint64_t __arch_get_hw_counter() +{ + uint64_t res; + + __asm__ volatile("mrs %0, CNTVCT_EL0":"=r"(res)); + + arch_counter_enforce_ordering(res); + return res; +} + +static inline uint64_t __arch_get_hw_frq() +{ + uint64_t res; + + __asm__ volatile("mrs %0, CNTFRQ_EL0":"=r"(res)); + + arch_counter_enforce_ordering(res); + return res; +} + +static inline uint32_t +__iter_div_u64_rem(uint64_t dividend, uint32_t divisor, uint64_t *remainder) +{ + uint32_t ret = 0; + + while (dividend >= divisor) { + /* The following asm() prevents the compiler from + optimising this loop into a modulo operation. */ + __asm__("" : "+rm"(dividend)); + + dividend -= divisor; + ret++; + } + + *remainder = dividend; + + return ret; +} + +#define __RT_STRINGIFY(x...) #x +#define RT_STRINGIFY(x...) __RT_STRINGIFY(x) +#define rt_hw_barrier(cmd, ...) \ + __asm__ volatile (RT_STRINGIFY(cmd) " "RT_STRINGIFY(__VA_ARGS__):::"memory") + +#define rt_hw_isb() rt_hw_barrier(isb) +#define rt_hw_dmb() rt_hw_barrier(dmb, ish) +#define rt_hw_wmb() rt_hw_barrier(dmb, ishst) +#define rt_hw_rmb() rt_hw_barrier(dmb, ishld) +#define rt_hw_dsb() rt_hw_barrier(dsb, ish) + +#ifndef barrier +/* The "volatile" is due to gcc bugs */ +# define barrier() __asm__ __volatile__("": : :"memory") +#endif + +static inline void cpu_relax(void) +{ + __asm__ volatile("yield" ::: "memory"); +} + +#define __READ_ONCE_SIZE \ +({ \ + switch (size) { \ + case 1: *(__u8 *)res = *(volatile __u8 *)p; break; \ + case 2: *(__u16 *)res = *(volatile __u16 *)p; break; \ + case 4: *(__u32 *)res = *(volatile __u32 *)p; break; \ + case 8: *(__u64 *)res = *(volatile __u64 *)p; break; \ + default: \ + barrier(); \ + __builtin_memcpy((void *)res, (const void *)p, size); \ + barrier(); \ + } \ +}) + +static inline +void __read_once_size(const volatile void *p, void *res, int size) +{ + __READ_ONCE_SIZE; +} + +#define __READ_ONCE(x, check) \ +({ \ + union { typeof(x) __val; char __c[1]; } __u; \ + if (check) \ + __read_once_size(&(x), __u.__c, sizeof(x)); \ + smp_read_barrier_depends(); /* Enforce dependency ordering from x */ \ + __u.__val; \ +}) +#define READ_ONCE(x) __READ_ONCE(x, 1) + +extern struct vdso_data _vdso_data[CS_BASES] __attribute__((visibility("hidden"))); +static inline struct vdso_data *__arch_get_vdso_data(void) +{ + return _vdso_data; +} + +static inline uint32_t rt_vdso_read_begin(const struct vdso_data *vd) +{ + uint32_t seq; + + while (unlikely((seq = READ_ONCE(vd->seq)) & 1)) + cpu_relax(); + + rt_hw_rmb(); + return seq; +} + +static inline uint32_t rt_vdso_read_retry(const struct vdso_data *vd, + uint32_t start) +{ + uint32_t seq; + + rt_hw_rmb(); + seq = READ_ONCE(vd->seq); + return seq != start; +} + +#endif diff --git a/components/lwp/vdso/user/xmake.lua b/components/lwp/vdso/user/xmake.lua new file mode 100644 index 00000000000..c36448131f7 --- /dev/null +++ b/components/lwp/vdso/user/xmake.lua @@ -0,0 +1,58 @@ +/* + * Copyright (c) 2006-2023, RT-Thread Development Team + * + * SPDX-License-Identifier: Apache-2.0 + * + * Change Logs: + * Date Author Notes + * 2024-07-04 rcitach init ver. + */ + +toolchain("aarch64-smart-musleabi") + set_kind("standalone") + + local exec_path = os.getenv("RTT_EXEC_PATH") or "/opt/aarch64-linux-musleabi/bin/" + local sdkdir = exec_path .. "/../" + local incdir = os.curdir() .. "/../include" + local device = '-march=armv8-a -mtune=cortex-a53 -ftree-vectorize -ffast-math -funwind-tables -fno-strict-aliasing' + + set_bindir(exec_path) + set_sdkdir(sdkdir) + + set_toolset("sh", "aarch64-linux-musleabi-gcc") + on_load(function(toolchain) + toolchain:load_cross_toolchain() + toolchain:add("cxflags", device) + toolchain:add("cxflags", "-Wall -Wno-cpp -std=gnu99") + toolchain:add("cxflags", "-fdiagnostics-color=always") + toolchain:add("cxflags", "-O2") + toolchain:add("cxflags", "-I" .. incdir) + + toolchain:add("shflags", device) + toolchain:add("shflags", "-Wl,--gc-sections") + toolchain:add("shflags", "-u,system_vectors") + toolchain:add("shflags", "-T vdso.lds") + end) +toolchain_end() + +set_config("plat", "cross") +set_config("target_os", "rt-smart") +set_config("arch", "aarch64") + +rule("vdso_lds") + set_extensions(".lds.S") + on_buildcmd_file(function (target, batchcmds, sourcefile, opt) + local incdir = os.curdir() .. "/../include" + local targetfile = path.basename(sourcefile) + local prefix = os.getenv("RTT_CC_PREFIX=") or "aarch64-linux-musleabi-" + batchcmds:vrunv(prefix .. "gcc", {"-E", "-P", sourcefile, "-o", targetfile, "-I", incdir}) + end) + +target("rtos_vdso") + set_toolchains("aarch64-smart-musleabi") + add_rules("vdso_lds") + set_kind("shared") + add_files("vdso.lds.S") + add_files("vdso_sys.c") + set_targetdir("build") +target_end() diff --git a/components/lwp/vdso/vdso_config.h b/components/lwp/vdso/vdso_config.h new file mode 100644 index 00000000000..a65c1acf0fb --- /dev/null +++ b/components/lwp/vdso/vdso_config.h @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2006-2024 RT-Thread Development Team + * + * SPDX-License-Identifier: Apache-2.0 + * + * Change Logs: + * Date Author Notes + * 2024-07-04 rcitach init ver. + */ + +#ifndef __ASM_VDSO_H +#define __ASM_VDSO_H + +#ifdef __cplusplus +extern "C" { +#endif + +#define __VVAR_PAGES 2 +#define VDSO_PAGE_SHIFT 12 +#define VDSO_PAGE_SIZE (1 << VDSO_PAGE_SHIFT) + +#define BIT(nr) ((1) << (nr)) + +#ifndef read_barrier_depends +#define read_barrier_depends() do { } while (0) +#endif + +#ifndef smp_read_barrier_depends +#define smp_read_barrier_depends() read_barrier_depends() +#endif + +#define VDSO_PATH "../user/build/librtos_vdso.so" + +#ifdef __cplusplus +} +#endif + +#endif /* __ASM_VDSO_H */ diff --git a/components/lwp/vdso/vdso_datapage.h b/components/lwp/vdso/vdso_datapage.h new file mode 100644 index 00000000000..a8c95b9362e --- /dev/null +++ b/components/lwp/vdso/vdso_datapage.h @@ -0,0 +1,75 @@ +/* + * Copyright (c) 2006-2024 RT-Thread Development Team + * + * SPDX-License-Identifier: Apache-2.0 + * + * Change Logs: + * Date Author Notes + * 2024-07-04 rcitach init ver. + */ + +#ifndef _VDSO_DATAPAGE_H +#define _VDSO_DATAPAGE_H + +#include +#include +#include "vdso_config.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef signed char __s8; +typedef signed short __s16; +typedef signed int __s32; +typedef signed long __s64; + +typedef unsigned char __u8; +typedef unsigned short __u16; +typedef unsigned int __u32; +typedef unsigned long __u64; + +#define MAX_CLOCKS 16 + +#define VDSO_BASES (CLOCK_TAI + 1) +#define VDSO_REALTIME (BIT(CLOCK_REALTIME) | \ + BIT(CLOCK_REALTIME_COARSE)) +#define VDSO_MONOTIME (BIT(CLOCK_MONOTONIC) | \ + BIT(CLOCK_MONOTONIC_COARSE) | \ + BIT(CLOCK_MONOTONIC_RAW) | \ + BIT(CLOCK_BOOTTIME)) + +#define CS_HRES_COARSE 0 +#define CS_RAW 1 +#define CS_BASES (CS_RAW + 1) + +/* 2018-01-30 14:44:50 = RTC_TIME_INIT(2018, 1, 30, 14, 44, 50) */ +#define RTC_VDSOTIME_INIT(year, month, day, hour, minute, second) \ + {.tm_year = year - 1900, .tm_mon = month - 1, .tm_mday = day, .tm_hour = hour, .tm_min = minute, .tm_sec = second} + +#ifndef SOFT_RTC_VDSOTIME_DEFAULT +#define SOFT_RTC_VDSOTIME_DEFAULT RTC_VDSOTIME_INIT(2018, 1, 1, 0, 0 ,0) +#endif + +struct vdso_data { + uint32_t seq; + uint32_t clock_mode; + uint64_t realtime_initdata; + uint64_t cycle_last; + struct timespec basetime[VDSO_BASES]; +}; +typedef struct vdso_data *vdso_data_t; + +#define MSEC_PER_SEC 1000L +#define USEC_PER_MSEC 1000L +#define NSEC_PER_USEC 1000L +#define NSEC_PER_MSEC 1000000L +#define USEC_PER_SEC 1000000L +#define NSEC_PER_SEC 1000000000L +#define FSEC_PER_SEC 1000000000000000LL + +#ifdef __cplusplus +} +#endif + +#endif /* _VDSO_DATAPAGE_H */ diff --git a/components/lwp/vdso/vdso_weak.c b/components/lwp/vdso/vdso_weak.c new file mode 100644 index 00000000000..56f452cc877 --- /dev/null +++ b/components/lwp/vdso/vdso_weak.c @@ -0,0 +1,23 @@ +/* + * Copyright (c) 2006-2024 RT-Thread Development Team + * + * SPDX-License-Identifier: Apache-2.0 + * + * Change Logs: + * Date Author Notes + * 2024-07-04 rcitach init ver. + */ + +#include +#include +#include "vdso.h" + +rt_weak int arch_setup_additional_pages(struct rt_lwp *lwp) +{ + return -RT_ERROR; +} + +rt_weak void rt_vdso_update_glob_time(void) +{ + +} diff --git a/components/mm/mm_aspace.h b/components/mm/mm_aspace.h index ff1429c305e..8ce310804d8 100644 --- a/components/mm/mm_aspace.h +++ b/components/mm/mm_aspace.h @@ -49,7 +49,11 @@ typedef struct rt_aspace struct rt_mutex bst_lock; struct rt_mem_obj *private_object; + +#ifdef ARCH_USING_ASID rt_uint64_t asid; +#endif /* ARCH_USING_ASID */ + } *rt_aspace_t; typedef struct rt_varea diff --git a/libcpu/Kconfig b/libcpu/Kconfig index f036ea25a71..2c07f463c55 100644 --- a/libcpu/Kconfig +++ b/libcpu/Kconfig @@ -262,13 +262,17 @@ config ARCH_RISCV64 select ARCH_CPU_64BIT bool -if ARCH_RISCV64 - config ARCH_REMAP_KERNEL - bool - depends on RT_USING_SMART - help - Remapping kernel image to high virtual address region -endif +config ARCH_REMAP_KERNEL + bool + depends on RT_USING_SMART + help + Remapping kernel image to high virtual address region + +config ARCH_USING_ASID + bool + depends on RT_USING_SMART + help + Using ASID support from architecture config ARCH_IA32 bool diff --git a/libcpu/aarch64/cortex-a/entry_point.S b/libcpu/aarch64/cortex-a/entry_point.S index 315e331aac8..c0acacb2ca2 100644 --- a/libcpu/aarch64/cortex-a/entry_point.S +++ b/libcpu/aarch64/cortex-a/entry_point.S @@ -234,6 +234,10 @@ init_cpu_el: bic x0, x0, #(1 << 1) /* Disable Alignment check */ msr sctlr_el1, x0 + mrs x0, cntkctl_el1 + orr x0, x0, #(1 << 1) /* Set EL0VCTEN, enabling the EL0 Virtual Count Timer */ + msr cntkctl_el1, x0 + /* Avoid trap from SIMD or float point instruction */ mov x0, #0x00300000 /* Don't trap any SIMD/FP instructions in both EL0 and EL1 */ msr cpacr_el1, x0 diff --git a/libcpu/risc-v/t-head/c906/mmu.c b/libcpu/risc-v/t-head/c906/mmu.c index 89f5e501066..6c57c397700 100644 --- a/libcpu/risc-v/t-head/c906/mmu.c +++ b/libcpu/risc-v/t-head/c906/mmu.c @@ -43,6 +43,7 @@ static void *current_mmu_table = RT_NULL; volatile __attribute__((aligned(4 * 1024))) rt_ubase_t MMUTable[__SIZE(VPN2_BIT)]; +#ifdef ARCH_USING_ASID static rt_uint8_t ASID_BITS = 0; static rt_uint32_t next_asid; static rt_uint64_t global_asid_generation; @@ -109,6 +110,24 @@ void rt_hw_aspace_switch(rt_aspace_t aspace) asm volatile("sfence.vma x0,%0"::"r"(asid):"memory"); } +#define ASID_INIT() _asid_init() + +#else /* ARCH_USING_ASID */ + +#define ASID_INIT() + +void rt_hw_aspace_switch(rt_aspace_t aspace) +{ + uintptr_t page_table = (uintptr_t)rt_kmem_v2p(aspace->page_table); + current_mmu_table = aspace->page_table; + + write_csr(satp, (((size_t)SATP_MODE) << SATP_MODE_OFFSET) | + ((rt_ubase_t)page_table >> PAGE_OFFSET_BIT)); + rt_hw_tlb_invalidate_all_local(); +} + +#endif /* ARCH_USING_ASID */ + void *rt_hw_mmu_tbl_get() { return current_mmu_table; @@ -552,7 +571,7 @@ void rt_hw_mmu_setup(rt_aspace_t aspace, struct mem_desc *mdesc, int desc_nr) mdesc++; } - _asid_init(); + ASID_INIT(); rt_hw_aspace_switch(&rt_kernel_space); rt_page_cleanup(); @@ -601,13 +620,15 @@ void rt_hw_mem_setup_early(void) LOG_E("%s: not aligned virtual address. pv_offset %p", __func__, pv_off); RT_ASSERT(0); } + /** * identical mapping, * PC are still at lower region before relocating to high memory */ for (size_t i = 0; i < __SIZE(PPN0_BIT); i++) { - early_pgtbl[i] = COMBINEPTE(ps, PAGE_ATTR_RWX | PTE_G | PTE_V); + early_pgtbl[i] = COMBINEPTE(ps, PAGE_ATTR_RWX | PTE_G | PTE_V | PTE_CACHE | + PTE_SHARE | PTE_BUF | PTE_A | PTE_D); ps += L1_PAGE_SIZE; } @@ -621,7 +642,8 @@ void rt_hw_mem_setup_early(void) rt_size_t ve_idx = GET_L1(vs + 0x80000000); for (size_t i = vs_idx; i < ve_idx; i++) { - early_pgtbl[i] = COMBINEPTE(ps, PAGE_ATTR_RWX | PTE_G | PTE_V); + early_pgtbl[i] = COMBINEPTE(ps, PAGE_ATTR_RWX | PTE_G | PTE_V | PTE_CACHE | + PTE_SHARE | PTE_BUF | PTE_A | PTE_D); ps += L1_PAGE_SIZE; } diff --git a/libcpu/risc-v/t-head/c906/startup_gcc.S b/libcpu/risc-v/t-head/c906/startup_gcc.S index e9b7a3cf0c9..7f25564fb49 100644 --- a/libcpu/risc-v/t-head/c906/startup_gcc.S +++ b/libcpu/risc-v/t-head/c906/startup_gcc.S @@ -8,13 +8,16 @@ * 2018/10/01 Bernard The first version * 2018/12/27 Jesven Add SMP support * 2020/6/12 Xim Port to QEMU and remove SMP support + * 2024-06-30 Shell Support of kernel remapping */ #include #include -boot_hartid: .int - .global boot_hartid + .data + .global boot_hartid /* global varible rt_boot_hartid in .data section */ +boot_hartid: + .word 0xdeadbeef .global _start .section ".start", "ax" @@ -72,8 +75,6 @@ _start: li x31,0 /* set to disable FPU */ - li t0, SSTATUS_FS - csrc sstatus, t0 li t0, SSTATUS_SUM csrs sstatus, t0 @@ -86,8 +87,45 @@ _start: la sp, __stack_start__ li t0, __STACKSIZE__ add sp, sp, t0 - csrw sscratch, sp + /** + * sscratch is always zero on kernel mode + */ + csrw sscratch, zero call init_bss - call sbi_init - j primary_cpu_entry +#ifdef ARCH_MM_MMU + call rt_hw_mem_setup_early + call rt_kmem_pvoff + /* a0 := pvoff */ + beq a0, zero, 1f + + /* relocate pc */ + la x1, _after_pc_relocation + sub x1, x1, a0 + ret +_after_pc_relocation: + /* relocate gp */ + sub gp, gp, a0 + + /* relocate context: sp */ + la sp, __stack_start__ + li t0, __STACKSIZE__ + add sp, sp, t0 + + /* reset s0-fp */ + mv s0, zero + + /* relocate stvec */ + la t0, trap_entry + csrw stvec, t0 +1: +#endif + call sbi_init + call primary_cpu_entry + +_never_return_here: + j . + +.global _start_link_addr +_start_link_addr: + .dword __text_start diff --git a/src/clock.c b/src/clock.c index 6a2366a0ac9..34684d2885e 100644 --- a/src/clock.c +++ b/src/clock.c @@ -23,6 +23,10 @@ #include #include +#if defined(RT_USING_SMART) && defined(RT_USING_VDSO) +#include +#endif + #ifdef RT_USING_SMP #define rt_tick rt_cpu_index(0)->tick #else @@ -141,6 +145,10 @@ void rt_tick_increase(void) } #endif rt_timer_check(); + +#ifdef RT_USING_VDSO + rt_vdso_update_glob_time(); +#endif } /** diff --git a/tools/keil.py b/tools/keil.py index 2c9f239f1e2..8cd58c03994 100644 --- a/tools/keil.py +++ b/tools/keil.py @@ -87,12 +87,18 @@ def MDK4AddGroupForFN(ProjectFiles, parent, name, filename, project_path): if ProjectFiles.count(obj_name): name = basename + '_' + name ProjectFiles.append(obj_name) - file_name.text = name.decode(fs_encoding) + try: # python 2 + file_name.text = name.decode(fs_encoding) + except: # python 3 + file_name.text = name file_type = SubElement(file, 'FileType') file_type.text = '%d' % _get_filetype(name) file_path = SubElement(file, 'FilePath') + try: # python 2 + file_path.text = path.decode(fs_encoding) + except: # python 3 + file_path.text = path - file_path.text = path.decode(fs_encoding) return group diff --git a/tools/menukconfig.py b/tools/menukconfig.py index 337b60640a3..4c54e69b733 100644 --- a/tools/menukconfig.py +++ b/tools/menukconfig.py @@ -30,6 +30,17 @@ import hashlib import operator +# test kconfiglib is installed +try: + import kconfiglib +except ImportError as e: + print("Failed to import kconfiglib: " + str(e)) + print("") + print("You may need to install it using:") + print(" pip install kconfiglib") + print("") + sys.exit(1) + DEFAULT_RTT_PACKAGE_URL = 'https://github.com/RT-Thread/packages.git' # you can change the package url by defining RTT_PACKAGE_URL, ex: # export RTT_PACKAGE_URL=https://github.com/Varanda-Labs/packages.git