[bsp] [ESP32_C3] 移除无用的文件 | remove useless files
This commit is contained in:
parent
70a8d1d465
commit
7da73c8f01
|
@ -10,6 +10,7 @@ CONFIG_RT_NAME_MAX=8
|
|||
# CONFIG_RT_USING_ARCH_DATA_TYPE is not set
|
||||
# CONFIG_RT_USING_AMP is not set
|
||||
# CONFIG_RT_USING_SMP is not set
|
||||
CONFIG_RT_CPUS_NR=1
|
||||
CONFIG_RT_ALIGN_SIZE=8
|
||||
# CONFIG_RT_THREAD_PRIORITY_8 is not set
|
||||
CONFIG_RT_THREAD_PRIORITY_32=y
|
||||
|
@ -62,18 +63,13 @@ CONFIG_RT_USING_SMALL_MEM_AS_HEAP=y
|
|||
# CONFIG_RT_USING_MEMTRACE is not set
|
||||
# CONFIG_RT_USING_HEAP_ISR is not set
|
||||
CONFIG_RT_USING_HEAP=y
|
||||
|
||||
#
|
||||
# Kernel Device Object
|
||||
#
|
||||
CONFIG_RT_USING_DEVICE=y
|
||||
# CONFIG_RT_USING_DEVICE_OPS is not set
|
||||
# CONFIG_RT_USING_DM is not set
|
||||
# CONFIG_RT_USING_INTERRUPT_INFO is not set
|
||||
CONFIG_RT_USING_CONSOLE=y
|
||||
CONFIG_RT_CONSOLEBUF_SIZE=256
|
||||
CONFIG_RT_CONSOLE_DEVICE_NAME="uart"
|
||||
CONFIG_RT_VER_NUM=0x50002
|
||||
CONFIG_RT_VER_NUM=0x50100
|
||||
# CONFIG_RT_USING_STDC_ATOMIC is not set
|
||||
# CONFIG_RT_USING_CACHE is not set
|
||||
# CONFIG_RT_USING_HW_ATOMIC is not set
|
||||
|
@ -115,6 +111,7 @@ CONFIG_FINSH_USING_OPTION_COMPLETION=y
|
|||
#
|
||||
# Device Drivers
|
||||
#
|
||||
# CONFIG_RT_USING_DM is not set
|
||||
CONFIG_RT_USING_DEVICE_IPC=y
|
||||
CONFIG_RT_UNAMED_PIPE_NUMBER=64
|
||||
CONFIG_RT_USING_SYSTEM_WORKQUEUE=y
|
||||
|
@ -140,7 +137,6 @@ CONFIG_RT_USING_PIN=y
|
|||
# CONFIG_RT_USING_MTD_NOR is not set
|
||||
# CONFIG_RT_USING_MTD_NAND is not set
|
||||
# CONFIG_RT_USING_PM is not set
|
||||
# CONFIG_RT_USING_FDT is not set
|
||||
# CONFIG_RT_USING_RTC is not set
|
||||
# CONFIG_RT_USING_SDIO is not set
|
||||
# CONFIG_RT_USING_SPI is not set
|
||||
|
@ -209,10 +205,6 @@ CONFIG_RT_LIBC_TZ_DEFAULT_SEC=0
|
|||
# CONFIG_RT_USING_SAL is not set
|
||||
# CONFIG_RT_USING_NETDEV is not set
|
||||
# CONFIG_RT_USING_LWIP is not set
|
||||
# CONFIG_RT_USING_LWIP141 is not set
|
||||
# CONFIG_RT_USING_LWIP203 is not set
|
||||
# CONFIG_RT_USING_LWIP212 is not set
|
||||
# CONFIG_RT_USING_LWIP_LATEST is not set
|
||||
# CONFIG_RT_USING_AT is not set
|
||||
|
||||
#
|
||||
|
@ -226,7 +218,11 @@ CONFIG_RT_LIBC_TZ_DEFAULT_SEC=0
|
|||
# CONFIG_RT_USING_ADT is not set
|
||||
# CONFIG_RT_USING_RT_LINK is not set
|
||||
# CONFIG_RT_USING_VBUS is not set
|
||||
# CONFIG_RT_USING_KTIME is not set
|
||||
|
||||
#
|
||||
# Memory management
|
||||
#
|
||||
# CONFIG_RT_USING_MEMBLOCK is not set
|
||||
|
||||
#
|
||||
# RT-Thread Utestcases
|
||||
|
@ -603,6 +599,7 @@ CONFIG_PKG_FREERTOS_WRAPPER_VER="latest"
|
|||
# CONFIG_PKG_USING_BALANCE 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
|
||||
|
@ -706,6 +703,7 @@ CONFIG_PKG_ESP_IDF_VER="latest"
|
|||
# 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_SPI_TOOLS is not set
|
||||
|
||||
#
|
||||
|
@ -960,6 +958,7 @@ CONFIG_PKG_ESP_IDF_VER="latest"
|
|||
#
|
||||
# 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
|
||||
|
@ -996,7 +995,6 @@ CONFIG_PKG_ESP_IDF_VER="latest"
|
|||
#
|
||||
# CONFIG_PKG_USING_ARDUINO_ADAFRUIT_MFRC630 is not set
|
||||
# CONFIG_PKG_USING_ARDUINO_ADAFRUIT_SI5351 is not set
|
||||
# CONFIG_PKG_USING_ARDUINO_RTCLIB is not set
|
||||
|
||||
#
|
||||
# Signal IO
|
||||
|
|
|
@ -1,10 +0,0 @@
|
|||
{
|
||||
"version": "0.2.0",
|
||||
"configurations": [
|
||||
{
|
||||
"type": "espidf",
|
||||
"name": "Launch",
|
||||
"request": "launch"
|
||||
}
|
||||
]
|
||||
}
|
|
@ -1,26 +0,0 @@
|
|||
{
|
||||
"C_Cpp.intelliSenseEngine": "Tag Parser",
|
||||
"idf.adapterTargetName": "esp32c3",
|
||||
"idf.openOcdConfigs": [
|
||||
"board/esp32c3-builtin.cfg"
|
||||
],
|
||||
"idf.portWin": "COM7",
|
||||
"idf.flashType": "UART",
|
||||
"files.associations": {
|
||||
"panic_internal.h": "c",
|
||||
"rtthread.h": "c",
|
||||
"bitset": "c",
|
||||
"chrono": "c",
|
||||
"algorithm": "c",
|
||||
"rtdebug.h": "c",
|
||||
"rtservice.h": "c",
|
||||
"rtdef.h": "c",
|
||||
"rtconfig.h": "c",
|
||||
"thread": "c",
|
||||
"rthw.h": "c",
|
||||
"typeinfo": "c",
|
||||
"serial.h": "c",
|
||||
"timer.h": "c"
|
||||
},
|
||||
"RTT_Studio.Build.Parallel_Jobs": "4"
|
||||
}
|
|
@ -1,300 +0,0 @@
|
|||
{
|
||||
"version": "2.0.0",
|
||||
"tasks": [
|
||||
{
|
||||
"label": "Build - Build project",
|
||||
"type": "shell",
|
||||
"command": "${config:idf.pythonBinPath} ${config:idf.espIdfPath}/tools/idf.py build",
|
||||
"windows": {
|
||||
"command": "${config:idf.pythonBinPathWin} ${config:idf.espIdfPathWin}\\tools\\idf.py build",
|
||||
"options": {
|
||||
"env": {
|
||||
"PATH": "${env:PATH};${config:idf.customExtraPaths}"
|
||||
}
|
||||
}
|
||||
},
|
||||
"options": {
|
||||
"env": {
|
||||
"PATH": "${env:PATH}:${config:idf.customExtraPaths}"
|
||||
}
|
||||
},
|
||||
"problemMatcher": [
|
||||
{
|
||||
"owner": "cpp",
|
||||
"fileLocation": [
|
||||
"relative",
|
||||
"${workspaceFolder}"
|
||||
],
|
||||
"pattern": {
|
||||
"regexp": "^\\.\\.(.*):(\\d+):(\\d+):\\s+(warning|error):\\s+(.*)$",
|
||||
"file": 1,
|
||||
"line": 2,
|
||||
"column": 3,
|
||||
"severity": 4,
|
||||
"message": 5
|
||||
}
|
||||
},
|
||||
{
|
||||
"owner": "cpp",
|
||||
"fileLocation": "absolute",
|
||||
"pattern": {
|
||||
"regexp": "^[^\\.](.*):(\\d+):(\\d+):\\s+(warning|error):\\s+(.*)$",
|
||||
"file": 1,
|
||||
"line": 2,
|
||||
"column": 3,
|
||||
"severity": 4,
|
||||
"message": 5
|
||||
}
|
||||
}
|
||||
],
|
||||
"group": {
|
||||
"kind": "build",
|
||||
"isDefault": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"label": "Set ESP-IDF Target",
|
||||
"type": "shell",
|
||||
"command": "${command:espIdf.setTarget}",
|
||||
"problemMatcher": {
|
||||
"owner": "cpp",
|
||||
"fileLocation": "absolute",
|
||||
"pattern": {
|
||||
"regexp": "^(.*):(//d+):(//d+)://s+(warning|error)://s+(.*)$",
|
||||
"file": 1,
|
||||
"line": 2,
|
||||
"column": 3,
|
||||
"severity": 4,
|
||||
"message": 5
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"label": "Clean - Clean the project",
|
||||
"type": "shell",
|
||||
"command": "${config:idf.pythonBinPath} ${config:idf.espIdfPath}/tools/idf.py fullclean",
|
||||
"windows": {
|
||||
"command": "${config:idf.pythonBinPathWin} ${config:idf.espIdfPathWin}\\tools\\idf.py fullclean",
|
||||
"options": {
|
||||
"env": {
|
||||
"PATH": "${env:PATH};${config:idf.customExtraPaths}"
|
||||
}
|
||||
}
|
||||
},
|
||||
"options": {
|
||||
"env": {
|
||||
"PATH": "${env:PATH}:${config:idf.customExtraPaths}"
|
||||
}
|
||||
},
|
||||
"problemMatcher": [
|
||||
{
|
||||
"owner": "cpp",
|
||||
"fileLocation": [
|
||||
"relative",
|
||||
"${workspaceFolder}"
|
||||
],
|
||||
"pattern": {
|
||||
"regexp": "^\\.\\.(.*):(\\d+):(\\d+):\\s+(warning|error):\\s+(.*)$",
|
||||
"file": 1,
|
||||
"line": 2,
|
||||
"column": 3,
|
||||
"severity": 4,
|
||||
"message": 5
|
||||
}
|
||||
},
|
||||
{
|
||||
"owner": "cpp",
|
||||
"fileLocation": "absolute",
|
||||
"pattern": {
|
||||
"regexp": "^[^\\.](.*):(\\d+):(\\d+):\\s+(warning|error):\\s+(.*)$",
|
||||
"file": 1,
|
||||
"line": 2,
|
||||
"column": 3,
|
||||
"severity": 4,
|
||||
"message": 5
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"label": "Flash - Flash the device",
|
||||
"type": "shell",
|
||||
"command": "${config:idf.pythonBinPath} ${config:idf.espIdfPath}/tools/idf.py -p ${config:idf.port} -b ${config:idf.flashBaudRate} flash",
|
||||
"windows": {
|
||||
"command": "${config:idf.pythonBinPathWin} ${config:idf.espIdfPathWin}\\tools\\idf.py flash -p ${config:idf.portWin} -b ${config:idf.flashBaudRate}",
|
||||
"options": {
|
||||
"env": {
|
||||
"PATH": "${env:PATH};${config:idf.customExtraPaths}"
|
||||
}
|
||||
}
|
||||
},
|
||||
"options": {
|
||||
"env": {
|
||||
"PATH": "${env:PATH}:${config:idf.customExtraPaths}"
|
||||
}
|
||||
},
|
||||
"problemMatcher": [
|
||||
{
|
||||
"owner": "cpp",
|
||||
"fileLocation": [
|
||||
"relative",
|
||||
"${workspaceFolder}"
|
||||
],
|
||||
"pattern": {
|
||||
"regexp": "^\\.\\.(.*):(\\d+):(\\d+):\\s+(warning|error):\\s+(.*)$",
|
||||
"file": 1,
|
||||
"line": 2,
|
||||
"column": 3,
|
||||
"severity": 4,
|
||||
"message": 5
|
||||
}
|
||||
},
|
||||
{
|
||||
"owner": "cpp",
|
||||
"fileLocation": "absolute",
|
||||
"pattern": {
|
||||
"regexp": "^[^\\.](.*):(\\d+):(\\d+):\\s+(warning|error):\\s+(.*)$",
|
||||
"file": 1,
|
||||
"line": 2,
|
||||
"column": 3,
|
||||
"severity": 4,
|
||||
"message": 5
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"label": "Monitor: Start the monitor",
|
||||
"type": "shell",
|
||||
"command": "${config:idf.pythonBinPath} ${config:idf.espIdfPath}/tools/idf.py -p ${config:idf.port} monitor",
|
||||
"windows": {
|
||||
"command": "${config:idf.pythonBinPathWin} ${config:idf.espIdfPathWin}\\tools\\idf.py -p ${config:idf.portWin} monitor",
|
||||
"options": {
|
||||
"env": {
|
||||
"PATH": "${env:PATH};${config:idf.customExtraPaths}"
|
||||
}
|
||||
}
|
||||
},
|
||||
"options": {
|
||||
"env": {
|
||||
"PATH": "${env:PATH}:${config:idf.customExtraPaths}"
|
||||
}
|
||||
},
|
||||
"problemMatcher": [
|
||||
{
|
||||
"owner": "cpp",
|
||||
"fileLocation": [
|
||||
"relative",
|
||||
"${workspaceFolder}"
|
||||
],
|
||||
"pattern": {
|
||||
"regexp": "^\\.\\.(.*):(\\d+):(\\d+):\\s+(warning|error):\\s+(.*)$",
|
||||
"file": 1,
|
||||
"line": 2,
|
||||
"column": 3,
|
||||
"severity": 4,
|
||||
"message": 5
|
||||
}
|
||||
},
|
||||
{
|
||||
"owner": "cpp",
|
||||
"fileLocation": "absolute",
|
||||
"pattern": {
|
||||
"regexp": "^[^\\.](.*):(\\d+):(\\d+):\\s+(warning|error):\\s+(.*)$",
|
||||
"file": 1,
|
||||
"line": 2,
|
||||
"column": 3,
|
||||
"severity": 4,
|
||||
"message": 5
|
||||
}
|
||||
}
|
||||
],
|
||||
"dependsOn": "Flash - Flash the device"
|
||||
},
|
||||
{
|
||||
"label": "OpenOCD: Start openOCD",
|
||||
"type": "shell",
|
||||
"presentation": {
|
||||
"echo": true,
|
||||
"reveal": "never",
|
||||
"focus": false,
|
||||
"panel": "new"
|
||||
},
|
||||
"command": "openocd -s ${command:espIdf.getOpenOcdScriptValue} ${command:espIdf.getOpenOcdConfigs}",
|
||||
"windows": {
|
||||
"command": "openocd.exe -s ${command:espIdf.getOpenOcdScriptValue} ${command:espIdf.getOpenOcdConfigs}",
|
||||
"options": {
|
||||
"env": {
|
||||
"PATH": "${env:PATH};${config:idf.customExtraPaths}"
|
||||
}
|
||||
}
|
||||
},
|
||||
"options": {
|
||||
"env": {
|
||||
"PATH": "${env:PATH}:${config:idf.customExtraPaths}"
|
||||
}
|
||||
},
|
||||
"problemMatcher": {
|
||||
"owner": "cpp",
|
||||
"fileLocation": "absolute",
|
||||
"pattern": {
|
||||
"regexp": "^(.*):(\\d+):(\\d+):\\s+(warning|error):\\s+(.*)$",
|
||||
"file": 1,
|
||||
"line": 2,
|
||||
"column": 3,
|
||||
"severity": 4,
|
||||
"message": 5
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"label": "adapter",
|
||||
"type": "shell",
|
||||
"command": "${config:idf.pythonBinPath}",
|
||||
"isBackground": true,
|
||||
"options": {
|
||||
"env": {
|
||||
"PATH": "${env:PATH}:${config:idf.customExtraPaths}",
|
||||
"PYTHONPATH": "${command:espIdf.getExtensionPath}/esp_debug_adapter/debug_adapter"
|
||||
}
|
||||
},
|
||||
"problemMatcher": {
|
||||
"background": {
|
||||
"beginsPattern": "\bDEBUG_ADAPTER_STARTED\b",
|
||||
"endsPattern": "DEBUG_ADAPTER_READY2CONNECT",
|
||||
"activeOnStart": true
|
||||
},
|
||||
"pattern": {
|
||||
"regexp": "(\\d+)-(\\d+)-(\\d+)\\s(\\d+):(\\d+):(\\d+),(\\d+)\\s-(.+)\\s(ERROR)",
|
||||
"file": 8,
|
||||
"line": 2,
|
||||
"column": 3,
|
||||
"severity": 4,
|
||||
"message": 9
|
||||
}
|
||||
},
|
||||
"args": [
|
||||
"${command:espIdf.getExtensionPath}/esp_debug_adapter/debug_adapter_main.py",
|
||||
"-e",
|
||||
"${workspaceFolder}/build/${command:espIdf.getProjectName}.elf",
|
||||
"-s",
|
||||
"${command:espIdf.getOpenOcdScriptValue}",
|
||||
"-ip",
|
||||
"localhost",
|
||||
"-dn",
|
||||
"${config:idf.adapterTargetName}",
|
||||
"-om",
|
||||
"connect_to_instance"
|
||||
],
|
||||
"windows": {
|
||||
"command": "${config:idf.pythonBinPathWin}",
|
||||
"options": {
|
||||
"env": {
|
||||
"PATH": "${env:PATH};${config:idf.customExtraPaths}",
|
||||
"PYTHONPATH": "${command:espIdf.getExtensionPath}/esp_debug_adapter/debug_adapter"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
|
@ -1,5 +0,0 @@
|
|||
cmake_minimum_required(VERSION 3.16)
|
||||
set(COMPONENTS esptool_py main)
|
||||
include($ENV{IDF_PATH}/tools/cmake/project.cmake)
|
||||
set(freertos_root /Users/tangyi/rt-thread/bsp/ESP32_C3/packages/FreeRTOS_Wrapper-latest/FreeRTOS)
|
||||
project(rtthread)
|
|
@ -1,8 +0,0 @@
|
|||
#
|
||||
# This is a project Makefile. It is assumed the directory this Makefile resides in is a
|
||||
# project subdirectory.
|
||||
#
|
||||
|
||||
PROJECT_NAME := rtthread
|
||||
|
||||
include $(IDF_PATH)/make/project.mk
|
|
@ -42,13 +42,13 @@ Each peripheral supporting condition for this BSP is as follows:
|
|||
| GPIO | Support | |
|
||||
| UART | Support | Using LUATOS_ESP32C3 development board requires connecting serial port to USB chip UART0_TX and UART0_RX (such as CP2102) |
|
||||
| JTAG debug | Support | ESP32C3 usb-linked development boards can be debugged |
|
||||
| WIFI | Partial support | There are currently some problems, such as `rt_mq_recive` cannot be used in ISR, etc., and we are still trying to solve it |
|
||||
| BLE | Partially supported | There are currently some problems, such as running errors caused by the same `PC` and `SP` pointers after `NimBLE` is started for a period of time |
|
||||
| WIFI | Partial support | There are currently some problems, such as `rt_mq_recive` cannot be used in ISR, etc. |
|
||||
| BLE | Partially supported | There are currently some problems, such as `NimBLE` running errors after starting for a while |
|
||||
| GDBStub | Support | You can use the GDB provided by ESP-IDF by turning on the `BSP_ENABLE_GDBSTUB` switch, which will enter GDB mode after a chip error |
|
||||
|
||||
Note:
|
||||
|
||||
1. WIFI and BLE cannot be enabled at the same time. When using the BLE driver, be sure to turn off the `RT_USING_WIFI` and `LWIP` switches in `menuconfig`. In addition, due to limited personal abilities and lack of debugging equipment, there are problems with the operation of WIFI and BLE drivers. If you can solve it, please contact me [timwcx@qq.com](mailto:timwcx@qq.com), I will be grateful.
|
||||
1. WIFI and BLE cannot be enabled at the same time. When using the BLE driver, be sure to turn off the `RT_USING_WIFI` and `LWIP` switches in `menuconfig`. In addition, due to limited capabilities and lack of debugging equipment, there are problems with WIFI and BLE driver operation. If it can be solved, please contact [timwcx@qq.com](mailto:timwcx@qq.com).
|
||||
|
||||
2. The BLE driver only supports `NimBLE` and is provided by the `bluetooth` component in `esp-idf`. To use the BLE driver, please refer to `bsp/ESP32_C3/packages/ESP-IDF-latest/examples/bluetooth/nimble` Sample program, please note that the `esp_timer_init()` function must be called to initialize the clock driver before calling the `NimBLE` related interface.
|
||||
|
||||
|
|
|
@ -49,13 +49,13 @@
|
|||
| GPIO | 支持 | |
|
||||
| UART | 支持 | 使用LUATOS_ESP32C3开发板需要在UART0_TX和UART0_RX连接串口转USB芯片(如CP2102)|
|
||||
| JTAG调试 | 支持 | ESP32C3采用USB方式和PC链接的开发板可以调试 |
|
||||
| WIFI | 部分支持 | 目前存在一些问题,例如不能在ISR中使用`rt_mq_recive`等,还在尝试解决中 |
|
||||
| BLE | 部分支持 | 目前存在一些问题,例如`NimBLE`启动一段时间后`PC`和`SP`指针相同导致运行错误 |
|
||||
| WIFI | 部分支持 | 目前存在一些问题,例如不能在ISR中使用`rt_mq_recive`等 |
|
||||
| BLE | 部分支持 | 目前存在一些问题,例如`NimBLE`启动一段时间后运行错误 |
|
||||
| GDBStub | 支持 | 通过开启`BSP_ENABLE_GDBSTUB`开关即可使用ESP-IDF所提供的GDB,其会在芯片出错后进入GDB模式 |
|
||||
|
||||
注:
|
||||
|
||||
1、WIFI和BLE不能同时启用,在使用BLE驱动时注意在`menuconfig`中关闭`RT_USING_WIFI`和`LWIP`开关。另外由于个人能力有限且缺乏调试设备,WIFI和BLE驱动运行都有问题,如果可以解决联系我[timwcx@qq.com](mailto:timwcx@qq.com),本人感激不尽。
|
||||
1、WIFI和BLE不能同时启用,在使用BLE驱动时注意在`menuconfig`中关闭`RT_USING_WIFI`和`LWIP`开关。另外由于能力有限且缺乏调试设备,WIFI和BLE驱动运行都有问题,如果可以解决联系[timwcx@qq.com](mailto:timwcx@qq.com)。
|
||||
|
||||
2、BLE驱动仅支持`NimBLE`,并且由`esp-idf`中的`bluetooth`组件提供,使用BLE驱动可以参考`bsp/ESP32_C3/packages/ESP-IDF-latest/examples/bluetooth/nimble`下的样例程序,注意在调用`NimBLE`相关接口之前要调用`esp_timer_init()`函数初始化时钟驱动。
|
||||
|
||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 13 KiB |
Binary file not shown.
Before Width: | Height: | Size: 16 KiB |
Binary file not shown.
Before Width: | Height: | Size: 20 KiB |
|
@ -1,50 +0,0 @@
|
|||
idf_component_register(
|
||||
SRCS
|
||||
../../../libcpu/risc-v/common/cpuport.c
|
||||
../../../libcpu/risc-v/common/context_gcc.S
|
||||
../../../components/drivers/ipc/completion.c
|
||||
../../../components/drivers/ipc/dataqueue.c
|
||||
../../../components/drivers/ipc/pipe.c
|
||||
../../../components/drivers/ipc/ringblk_buf.c
|
||||
../../../components/drivers/ipc/ringbuffer.c
|
||||
../../../components/drivers/ipc/waitqueue.c
|
||||
../../../components/drivers/ipc/workqueue.c
|
||||
../../../components/drivers/misc/pin.c
|
||||
../../../components/drivers/serial/serial.c
|
||||
../drivers/drv_uart.c
|
||||
../drivers/board.c
|
||||
../drivers/drv_gpio.c
|
||||
../../../components/finsh/shell.c
|
||||
../../../components/finsh/msh.c
|
||||
../../../components/finsh/msh_parse.c
|
||||
../../../components/finsh/cmd.c
|
||||
../../../src/clock.c
|
||||
../../../src/components.c
|
||||
../../../src/device.c
|
||||
../../../src/idle.c
|
||||
../../../src/ipc.c
|
||||
../../../src/irq.c
|
||||
../../../src/kservice.c
|
||||
../../../src/mem.c
|
||||
../../../src/mempool.c
|
||||
../../../src/object.c
|
||||
../../../src/scheduler.c
|
||||
../../../src/thread.c
|
||||
../../../src/timer.c
|
||||
main.c
|
||||
|
||||
INCLUDE_DIRS
|
||||
../../../libcpu/risc-v/common
|
||||
../../../components/drivers/include
|
||||
../drivers
|
||||
../../../components/finsh
|
||||
..
|
||||
../../../include
|
||||
)
|
||||
|
||||
target_link_libraries(${COMPONENT_LIB}
|
||||
INTERFACE "-u __rt_init_rt_work_sys_workqueue_init"
|
||||
INTERFACE "-u __rt_init_rt_hw_uart_init"
|
||||
INTERFACE "-u __rt_init_rt_hw_pin_init"
|
||||
INTERFACE "-u __rt_init_finsh_system_init"
|
||||
)
|
|
@ -7,6 +7,7 @@
|
|||
* Date Author Notes
|
||||
* 2022-04-24 supperthomas first version
|
||||
* 2022-06-02 supperthomas fix version
|
||||
* 2023-10-20 WCX1024979076 add wifi application
|
||||
*/
|
||||
|
||||
#include <rtthread.h>
|
||||
|
@ -21,8 +22,8 @@ int main(void)
|
|||
#ifdef BSP_USING_BLE
|
||||
extern void app_main(void);
|
||||
esp_timer_init();
|
||||
app_main(); //该函数为esp-wifi样例程序入口
|
||||
#endif
|
||||
app_main(); //该函数为nimble样例程序入口
|
||||
#endif /* BSP_USING_BLE */
|
||||
|
||||
#ifdef RT_USING_WIFI
|
||||
/* set wifi work mode */
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
/* RT-Thread Kernel */
|
||||
|
||||
#define RT_NAME_MAX 8
|
||||
#define RT_CPUS_NR 1
|
||||
#define RT_ALIGN_SIZE 8
|
||||
#define RT_THREAD_PRIORITY_32
|
||||
#define RT_THREAD_PRIORITY_MAX 32
|
||||
|
@ -36,14 +37,11 @@
|
|||
#define RT_USING_SMALL_MEM
|
||||
#define RT_USING_SMALL_MEM_AS_HEAP
|
||||
#define RT_USING_HEAP
|
||||
|
||||
/* Kernel Device Object */
|
||||
|
||||
#define RT_USING_DEVICE
|
||||
#define RT_USING_CONSOLE
|
||||
#define RT_CONSOLEBUF_SIZE 256
|
||||
#define RT_CONSOLE_DEVICE_NAME "uart"
|
||||
#define RT_VER_NUM 0x50002
|
||||
#define RT_VER_NUM 0x50100
|
||||
|
||||
/* RT-Thread Components */
|
||||
|
||||
|
@ -110,6 +108,9 @@
|
|||
/* Utilities */
|
||||
|
||||
|
||||
/* Memory management */
|
||||
|
||||
|
||||
/* RT-Thread Utestcases */
|
||||
|
||||
|
||||
|
|
|
@ -1,600 +0,0 @@
|
|||
From 92402217b821c8da7e2a188352f095caaf0818d1 Mon Sep 17 00:00:00 2001
|
||||
From: tangzz98 <tangz98@outlook.com>
|
||||
Date: Tue, 13 Sep 2022 18:05:44 -0400
|
||||
Subject: [PATCH 1/2] Add config for RT-Thread
|
||||
|
||||
---
|
||||
Kconfig | 4 +
|
||||
components/driver/deprecated/i2s_legacy.c | 4 +
|
||||
components/driver/uart.c | 4 +
|
||||
components/esp_system/crosscore_int.c | 5 +-
|
||||
.../esp_system/ld/esp32c3/sections.ld.in | 37 ++++
|
||||
.../port/arch/riscv/expression_with_stack.c | 8 +
|
||||
components/esp_system/startup.c | 9 +
|
||||
components/esp_system/task_wdt.c | 4 +
|
||||
components/esp_timer/src/esp_timer.c | 2 +
|
||||
components/freertos/CMakeLists.txt | 50 ++++-
|
||||
.../freertos_tasks_c_additions.h | 6 +-
|
||||
components/riscv/vectors.S | 179 ++++++++++++++++++
|
||||
12 files changed, 309 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/Kconfig b/Kconfig
|
||||
index c86ebeaaef..56d062b2db 100644
|
||||
--- a/Kconfig
|
||||
+++ b/Kconfig
|
||||
@@ -101,6 +101,10 @@ mainmenu "Espressif IoT Development Framework Configuration"
|
||||
bool
|
||||
default "y" if IDF_TARGET="linux"
|
||||
|
||||
+ config IDF_RTOS_RTTHREAD
|
||||
+ bool "RT-THREAD SELECT"
|
||||
+ default "n"
|
||||
+
|
||||
config IDF_FIRMWARE_CHIP_ID
|
||||
hex
|
||||
default 0x0000 if IDF_TARGET_ESP32
|
||||
diff --git a/components/driver/deprecated/i2s_legacy.c b/components/driver/deprecated/i2s_legacy.c
|
||||
index 2e36ab2608..92edf9d2bb 100644
|
||||
--- a/components/driver/deprecated/i2s_legacy.c
|
||||
+++ b/components/driver/deprecated/i2s_legacy.c
|
||||
@@ -1600,7 +1600,11 @@ esp_err_t i2s_driver_install(i2s_port_t i2s_num, const i2s_config_t *i2s_config,
|
||||
i2s_obj->i2s_queue = xQueueCreate(queue_size, sizeof(i2s_event_t));
|
||||
ESP_GOTO_ON_FALSE(i2s_obj->i2s_queue, ESP_ERR_NO_MEM, err, TAG, "I2S queue create failed");
|
||||
*((QueueHandle_t *) i2s_queue) = i2s_obj->i2s_queue;
|
||||
+#if !defined CONFIG_IDF_RTOS_RTTHREAD
|
||||
ESP_LOGD(TAG, "queue free spaces: %d", uxQueueSpacesAvailable(i2s_obj->i2s_queue));
|
||||
+#else
|
||||
+ ESP_LOGD(TAG, "queue free spaces: %lu", uxQueueSpacesAvailable(i2s_obj->i2s_queue));
|
||||
+#endif
|
||||
} else {
|
||||
i2s_obj->i2s_queue = NULL;
|
||||
}
|
||||
diff --git a/components/driver/uart.c b/components/driver/uart.c
|
||||
index b68b2900e1..63c9841380 100644
|
||||
--- a/components/driver/uart.c
|
||||
+++ b/components/driver/uart.c
|
||||
@@ -1603,7 +1603,11 @@ esp_err_t uart_driver_install(uart_port_t uart_num, int rx_buffer_size, int tx_b
|
||||
uart_pattern_queue_reset(uart_num, UART_PATTERN_DET_QLEN_DEFAULT);
|
||||
if (uart_queue) {
|
||||
*uart_queue = p_uart_obj[uart_num]->event_queue;
|
||||
+#if !defined CONFIG_IDF_RTOS_RTTHREAD
|
||||
ESP_LOGI(UART_TAG, "queue free spaces: %d", uxQueueSpacesAvailable(p_uart_obj[uart_num]->event_queue));
|
||||
+#else
|
||||
+ ESP_LOGI(UART_TAG, "queue free spaces: %lu", uxQueueSpacesAvailable(p_uart_obj[uart_num]->event_queue));
|
||||
+#endif
|
||||
}
|
||||
} else {
|
||||
ESP_LOGE(UART_TAG, "UART driver already installed");
|
||||
diff --git a/components/esp_system/crosscore_int.c b/components/esp_system/crosscore_int.c
|
||||
index 4aae2a2540..8a9079de64 100644
|
||||
--- a/components/esp_system/crosscore_int.c
|
||||
+++ b/components/esp_system/crosscore_int.c
|
||||
@@ -95,13 +95,14 @@ static void IRAM_ATTR esp_crosscore_isr(void *arg) {
|
||||
if (my_reason_val & REASON_PRINT_BACKTRACE) {
|
||||
esp_backtrace_print(100);
|
||||
}
|
||||
-
|
||||
+#ifdef CONFIG_ESP_TASK_WDT
|
||||
if (my_reason_val & REASON_TWDT_ABORT) {
|
||||
extern void task_wdt_timeout_abort_xtensa(bool);
|
||||
/* Called from a crosscore interrupt, thus, we are not the core that received
|
||||
* the TWDT interrupt, call the function with `false` as a parameter. */
|
||||
task_wdt_timeout_abort_xtensa(false);
|
||||
}
|
||||
+#endif
|
||||
#endif // CONFIG_IDF_TARGET_ARCH_XTENSA
|
||||
}
|
||||
|
||||
@@ -171,7 +172,9 @@ void IRAM_ATTR esp_crosscore_int_send_print_backtrace(int core_id)
|
||||
esp_crosscore_int_send(core_id, REASON_PRINT_BACKTRACE);
|
||||
}
|
||||
|
||||
+#ifdef CONFIG_ESP_TASK_WDT
|
||||
void IRAM_ATTR esp_crosscore_int_send_twdt_abort(int core_id) {
|
||||
esp_crosscore_int_send(core_id, REASON_TWDT_ABORT);
|
||||
}
|
||||
#endif
|
||||
+#endif
|
||||
diff --git a/components/esp_system/ld/esp32c3/sections.ld.in b/components/esp_system/ld/esp32c3/sections.ld.in
|
||||
index d6670bf759..1d51ffeea0 100644
|
||||
--- a/components/esp_system/ld/esp32c3/sections.ld.in
|
||||
+++ b/components/esp_system/ld/esp32c3/sections.ld.in
|
||||
@@ -178,6 +178,26 @@ SECTIONS
|
||||
_noinit_end = ABSOLUTE(.);
|
||||
} > dram0_0_seg
|
||||
|
||||
+ .stack :
|
||||
+ {
|
||||
+ . = ALIGN(8);
|
||||
+ __STACKSIZE__ = 40960;
|
||||
+ __stack_start__ = .;
|
||||
+ *(.stack*)
|
||||
+ . += __STACKSIZE__;
|
||||
+ __stack_cpu0 = .;
|
||||
+ __stack_end__ = .;
|
||||
+ } > dram0_0_seg
|
||||
+ PROVIDE( __rt_rvstack = __stack_end__);
|
||||
+
|
||||
+ .heap :
|
||||
+ {
|
||||
+ . = ALIGN(8);
|
||||
+ __HEAPSIZE__ = 40960;
|
||||
+ __heap_start__ = .;
|
||||
+ . += __HEAPSIZE__;
|
||||
+ __heap_end__ = .;
|
||||
+ } > dram0_0_seg
|
||||
+
|
||||
/* Shared RAM */
|
||||
.dram0.bss (NOLOAD) :
|
||||
{
|
||||
@@ -218,6 +238,17 @@ SECTIONS
|
||||
*(.fini)
|
||||
*(.gnu.version)
|
||||
|
||||
+ /* section information for finsh shell */
|
||||
+ . = ALIGN(8);
|
||||
+ __fsymtab_start = .;
|
||||
+ KEEP(*(FSymTab))
|
||||
+ __fsymtab_end = .;
|
||||
+ . = ALIGN(8);
|
||||
+ __vsymtab_start = .;
|
||||
+ KEEP(*(VSymTab))
|
||||
+ __vsymtab_end = .;
|
||||
+ . = ALIGN(8);
|
||||
+
|
||||
/** CPU will try to prefetch up to 16 bytes of
|
||||
* of instructions. This means that any configuration (e.g. MMU, PMS) must allow
|
||||
* safe access to up to 16 bytes after the last real instruction, add
|
||||
@@ -318,6 +349,12 @@ SECTIONS
|
||||
_esp_system_init_fn_array_start = ABSOLUTE(.);
|
||||
KEEP (*(SORT_BY_INIT_PRIORITY(.esp_system_init_fn.*)))
|
||||
_esp_system_init_fn_array_end = ABSOLUTE(.);
|
||||
+ /* section information for initial. */
|
||||
+ . = ALIGN(4);
|
||||
+ __rt_init_start = .;
|
||||
+ KEEP(*(SORT(.rti_fn*)))
|
||||
+ __rt_init_end = .;
|
||||
+ . = ALIGN(4);
|
||||
_rodata_end = ABSOLUTE(.);
|
||||
/* Literals are also RO data. */
|
||||
_lit4_start = ABSOLUTE(.);
|
||||
diff --git a/components/esp_system/port/arch/riscv/expression_with_stack.c b/components/esp_system/port/arch/riscv/expression_with_stack.c
|
||||
index 07d22bf3aa..5eac5a88f8 100644
|
||||
--- a/components/esp_system/port/arch/riscv/expression_with_stack.c
|
||||
+++ b/components/esp_system/port/arch/riscv/expression_with_stack.c
|
||||
@@ -18,6 +18,8 @@
|
||||
#include "freertos/FreeRTOS.h"
|
||||
#include "freertos/portmacro.h"
|
||||
|
||||
+#if !defined CONFIG_IDF_RTOS_RTTHREAD
|
||||
+
|
||||
static portMUX_TYPE shared_stack_spinlock = portMUX_INITIALIZER_UNLOCKED;
|
||||
static void *current_task_stack = NULL;
|
||||
|
||||
@@ -46,9 +48,12 @@ static StackType_t *esp_switch_stack_setup(StackType_t *stack, size_t stack_size
|
||||
return ((StackType_t *)adjusted_top_of_stack);
|
||||
}
|
||||
|
||||
+#endif
|
||||
+
|
||||
|
||||
void esp_execute_shared_stack_function(SemaphoreHandle_t lock, void *stack, size_t stack_size, shared_stack_function function)
|
||||
{
|
||||
+#if !defined CONFIG_IDF_RTOS_RTTHREAD
|
||||
assert(lock);
|
||||
assert(stack);
|
||||
assert(stack_size > 0 && stack_size >= CONFIG_ESP_MINIMAL_SHARED_STACK_SIZE);
|
||||
@@ -70,4 +75,7 @@ void esp_execute_shared_stack_function(SemaphoreHandle_t lock, void *stack, size
|
||||
portEXIT_CRITICAL(&shared_stack_spinlock);
|
||||
|
||||
xSemaphoreGive(lock);
|
||||
+#else
|
||||
+ function();
|
||||
+#endif
|
||||
}
|
||||
diff --git a/components/esp_system/startup.c b/components/esp_system/startup.c
|
||||
index 0feda4e9f5..b1752d91a0 100644
|
||||
--- a/components/esp_system/startup.c
|
||||
+++ b/components/esp_system/startup.c
|
||||
@@ -72,6 +72,10 @@
|
||||
#include "esp_psram.h"
|
||||
#include "esp_private/esp_psram_extram.h"
|
||||
#endif
|
||||
+
|
||||
+#if CONFIG_IDF_RTOS_RTTHREAD
|
||||
+#include "rtthread.h"
|
||||
+#endif
|
||||
/***********************************************/
|
||||
|
||||
#include "esp_private/startup_internal.h"
|
||||
@@ -266,6 +270,11 @@ static void do_core_init(void)
|
||||
app CPU, and when that is not up yet, the memory will be inaccessible and heap_caps_init may
|
||||
fail initializing it properly. */
|
||||
heap_caps_init();
|
||||
+#if CONFIG_IDF_RTOS_RTTHREAD && defined RT_USING_HEAP
|
||||
+ extern int __heap_start__;
|
||||
+ extern int __heap_end__;
|
||||
+ rt_system_heap_init((void *)&__heap_start__, (void *)&__heap_end__);
|
||||
+#endif
|
||||
|
||||
// When apptrace module is enabled, there will be SEGGER_SYSVIEW calls in the newlib init.
|
||||
// SEGGER_SYSVIEW relies on apptrace module
|
||||
diff --git a/components/esp_system/task_wdt.c b/components/esp_system/task_wdt.c
|
||||
index 58d1247bf0..60330edf8a 100644
|
||||
--- a/components/esp_system/task_wdt.c
|
||||
+++ b/components/esp_system/task_wdt.c
|
||||
@@ -29,6 +29,8 @@
|
||||
#include "esp_private/eh_frame_parser.h"
|
||||
#endif // CONFIG_ESP_SYSTEM_USE_EH_FRAME
|
||||
|
||||
+#if CONFIG_ESP_TASK_WDT
|
||||
+
|
||||
#if CONFIG_IDF_TARGET_ARCH_RISCV && !CONFIG_ESP_SYSTEM_USE_EH_FRAME
|
||||
/* Function used to print all the registers pointed by the given frame .*/
|
||||
extern void panic_print_registers(const void *frame, int core);
|
||||
@@ -784,3 +786,5 @@ esp_err_t esp_task_wdt_status(TaskHandle_t task_handle)
|
||||
|
||||
return ret;
|
||||
}
|
||||
+
|
||||
+#endif
|
||||
diff --git a/components/esp_timer/src/esp_timer.c b/components/esp_timer/src/esp_timer.c
|
||||
index 3ca19f642f..78779a08b3 100644
|
||||
--- a/components/esp_timer/src/esp_timer.c
|
||||
+++ b/components/esp_timer/src/esp_timer.c
|
||||
@@ -460,10 +460,12 @@ out:
|
||||
return ESP_ERR_NO_MEM;
|
||||
}
|
||||
|
||||
+#if !defined CONFIG_IDF_RTOS_RTTHREAD
|
||||
ESP_SYSTEM_INIT_FN(esp_timer_startup_init, BIT(0), 100)
|
||||
{
|
||||
return esp_timer_init();
|
||||
}
|
||||
+#endif
|
||||
|
||||
esp_err_t esp_timer_deinit(void)
|
||||
{
|
||||
diff --git a/components/freertos/CMakeLists.txt b/components/freertos/CMakeLists.txt
|
||||
index 78a8e4ae4e..5cd54494f6 100644
|
||||
--- a/components/freertos/CMakeLists.txt
|
||||
+++ b/components/freertos/CMakeLists.txt
|
||||
@@ -6,7 +6,36 @@ endif()
|
||||
|
||||
idf_build_get_property(target IDF_TARGET)
|
||||
|
||||
-if(CONFIG_FREERTOS_SMP)
|
||||
+if(CONFIG_IDF_RTOS_RTTHREAD)
|
||||
+ set(freertos_root "../../../FreeRTOS_Wrapper-latest/FreeRTOS")
|
||||
+ set(srcs
|
||||
+ "${freertos_root}/portable/esp-idf/riscv/port.c")
|
||||
+
|
||||
+ set(include_dirs
|
||||
+ "${freertos_root}/include"
|
||||
+ esp_additions/include
|
||||
+ esp_additions/include/freertos
|
||||
+ "${freertos_root}/portable/esp-idf/riscv/include")
|
||||
+
|
||||
+ set(private_include_dirs
|
||||
+ "${freertos_root}/portable/esp-idf/riscv/include/freertos")
|
||||
+
|
||||
+ list(APPEND srcs
|
||||
+ "${freertos_root}/portable/esp-idf/port_common.c"
|
||||
+ "${freertos_root}/portable/esp-idf/port_rt.c"
|
||||
+ "${freertos_root}/event_groups.c"
|
||||
+ "${freertos_root}/queue.c"
|
||||
+ "${freertos_root}/tasks.c"
|
||||
+ "${freertos_root}/timers.c"
|
||||
+ "${freertos_root}/list.c"
|
||||
+ "FreeRTOS-openocd.c"
|
||||
+ "esp_additions/freertos_v8_compat.c")
|
||||
+
|
||||
+ list(APPEND private_include_dirs
|
||||
+ "${freertos_root}/include/freertos"
|
||||
+ "esp_additions/private_include")
|
||||
+
|
||||
+elseif(CONFIG_FREERTOS_SMP)
|
||||
set(ldfragments linker_smp.lf)
|
||||
if(CONFIG_IDF_TARGET_ARCH_XTENSA)
|
||||
set(srcs
|
||||
@@ -133,11 +162,19 @@ else()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
+if(CONFIG_IDF_RTOS_RTTHREAD)
|
||||
+idf_component_register(SRCS "${srcs}"
|
||||
+ INCLUDE_DIRS ${include_dirs}
|
||||
+ PRIV_INCLUDE_DIRS ${private_include_dirs}
|
||||
+ PRIV_REQUIRES soc esp_pm)
|
||||
+else()
|
||||
idf_component_register(SRCS "${srcs}"
|
||||
INCLUDE_DIRS ${include_dirs}
|
||||
PRIV_INCLUDE_DIRS ${private_include_dirs}
|
||||
LDFRAGMENTS "${ldfragments}"
|
||||
+ REQUIRES main
|
||||
PRIV_REQUIRES soc esp_pm)
|
||||
+endif()
|
||||
|
||||
idf_component_get_property(COMPONENT_DIR freertos COMPONENT_DIR)
|
||||
|
||||
@@ -153,6 +190,16 @@ if(CONFIG_FREERTOS_DEBUG_OCDAWARE)
|
||||
idf_build_set_property(COMPILE_OPTIONS "-DconfigENABLE_FREERTOS_DEBUG_OCDAWARE=1" APPEND)
|
||||
endif()
|
||||
|
||||
+if(CONFIG_IDF_RTOS_RTTHREAD)
|
||||
+set_source_files_properties(
|
||||
+ tasks.c
|
||||
+ event_groups.c
|
||||
+ timers.c
|
||||
+ queue.c
|
||||
+ PROPERTIES COMPILE_DEFINITIONS
|
||||
+ _ESP_FREERTOS_INTERNAL
|
||||
+ )
|
||||
+else()
|
||||
set_source_files_properties(
|
||||
tasks.c
|
||||
event_groups.c
|
||||
@@ -162,6 +209,7 @@ set_source_files_properties(
|
||||
PROPERTIES COMPILE_DEFINITIONS
|
||||
_ESP_FREERTOS_INTERNAL
|
||||
)
|
||||
+endif()
|
||||
|
||||
# The freertos component provides the `start_app` and `start_app_other_cores`
|
||||
# if it is included in the build. It then calls `app_main`
|
||||
diff --git a/components/freertos/esp_additions/private_include/freertos_tasks_c_additions.h b/components/freertos/esp_additions/private_include/freertos_tasks_c_additions.h
|
||||
index f5ecdbb5a9..96fc4f73ce 100644
|
||||
--- a/components/freertos/esp_additions/private_include/freertos_tasks_c_additions.h
|
||||
+++ b/components/freertos/esp_additions/private_include/freertos_tasks_c_additions.h
|
||||
@@ -34,8 +34,9 @@
|
||||
struct _reent *__getreent(void)
|
||||
{
|
||||
// No lock needed because if this changes, we won't be running anymore.
|
||||
- TCB_t *pxCurTask = xTaskGetCurrentTaskHandle();
|
||||
struct _reent *ret;
|
||||
+#if !defined CONFIG_IDF_RTOS_RTTHREAD
|
||||
+ TCB_t *pxCurTask = xTaskGetCurrentTaskHandle();
|
||||
if (pxCurTask == NULL) {
|
||||
// No task running. Return global struct.
|
||||
ret = _GLOBAL_REENT;
|
||||
@@ -43,6 +44,9 @@ struct _reent *__getreent(void)
|
||||
// We have a task; return its reentrant struct.
|
||||
ret = &pxCurTask->xNewLib_reent;
|
||||
}
|
||||
+#else
|
||||
+ ret = _GLOBAL_REENT;
|
||||
+#endif
|
||||
return ret;
|
||||
}
|
||||
#endif // configUSE_NEWLIB_REENTRANT == 1
|
||||
diff --git a/components/riscv/vectors.S b/components/riscv/vectors.S
|
||||
index 9b868280db..23236f3d8d 100644
|
||||
--- a/components/riscv/vectors.S
|
||||
+++ b/components/riscv/vectors.S
|
||||
@@ -10,6 +10,9 @@
|
||||
#include "soc/soc_caps.h"
|
||||
#include "sdkconfig.h"
|
||||
|
||||
+#define STORE sw
|
||||
+#define LOAD lw
|
||||
+#define REGBYTES 4
|
||||
|
||||
.equ SAVE_REGS, 32
|
||||
.equ CONTEXT_SIZE, (SAVE_REGS * 4)
|
||||
@@ -210,6 +213,8 @@ _return_from_exception:
|
||||
*/
|
||||
.global _interrupt_handler
|
||||
.type _interrupt_handler, @function
|
||||
+#ifndef CONFIG_IDF_RTOS_RTTHREAD
|
||||
+
|
||||
_interrupt_handler:
|
||||
/* Start by saving the general purpose registers and the PC value before
|
||||
* the interrupt happened. */
|
||||
@@ -308,3 +313,177 @@ _interrupt_handler:
|
||||
/* exit, this will also re-enable the interrupts */
|
||||
mret
|
||||
.size _interrupt_handler, .-_interrupt_handler
|
||||
+#else
|
||||
+_interrupt_handler:
|
||||
+ /* 此时CPU的sp = from_thread->sp */
|
||||
+ /* 注意: 在这里,并没有将mepc的值赋值为from_thread栈中的epc,但后面会赋值 */
|
||||
+ addi sp, sp, -32 * REGBYTES /* sp = sp - 32 * 4 栈指针向下偏移32个寄存器长度,用来将CPU的寄存器保存到from_thread的栈中*/
|
||||
+ STORE x1, 1 * REGBYTES(sp) /* 将CPU的x1寄存器,即ra寄存器,保存到from_thread->栈中 */
|
||||
+
|
||||
+ li t0, 0x80 /* t0 = 0x80 */
|
||||
+ STORE t0, 2 * REGBYTES(sp) /* mstatus = t0, 即关闭全局中断 */
|
||||
+
|
||||
+ /* 将 CPU 的其他寄存器的值,保存到from_thread的任务栈中 */
|
||||
+ STORE x4, 4 * REGBYTES(sp)
|
||||
+ STORE x5, 5 * REGBYTES(sp)
|
||||
+ STORE x6, 6 * REGBYTES(sp)
|
||||
+ STORE x7, 7 * REGBYTES(sp)
|
||||
+ STORE x8, 8 * REGBYTES(sp)
|
||||
+ STORE x9, 9 * REGBYTES(sp)
|
||||
+ STORE x10, 10 * REGBYTES(sp)
|
||||
+ STORE x11, 11 * REGBYTES(sp)
|
||||
+ STORE x12, 12 * REGBYTES(sp)
|
||||
+ STORE x13, 13 * REGBYTES(sp)
|
||||
+ STORE x14, 14 * REGBYTES(sp)
|
||||
+ STORE x15, 15 * REGBYTES(sp)
|
||||
+ STORE x16, 16 * REGBYTES(sp)
|
||||
+ STORE x17, 17 * REGBYTES(sp)
|
||||
+ STORE x18, 18 * REGBYTES(sp)
|
||||
+ STORE x19, 19 * REGBYTES(sp)
|
||||
+ STORE x20, 20 * REGBYTES(sp)
|
||||
+ STORE x21, 21 * REGBYTES(sp)
|
||||
+ STORE x22, 22 * REGBYTES(sp)
|
||||
+ STORE x23, 23 * REGBYTES(sp)
|
||||
+ STORE x24, 24 * REGBYTES(sp)
|
||||
+ STORE x25, 25 * REGBYTES(sp)
|
||||
+ STORE x26, 26 * REGBYTES(sp)
|
||||
+ STORE x27, 27 * REGBYTES(sp)
|
||||
+ STORE x28, 28 * REGBYTES(sp)
|
||||
+ STORE x29, 29 * REGBYTES(sp)
|
||||
+ STORE x30, 30 * REGBYTES(sp)
|
||||
+ STORE x31, 31 * REGBYTES(sp)
|
||||
+
|
||||
+ /* 备份 CPU 的 sp (这时,CPU的sp其实就是from thread的sp指针) 寄存器的值到 s0 寄存器中,下面会使用s0,恢复 CPU 的寄存器 */
|
||||
+ move s0, sp /* s0 = sp */
|
||||
+
|
||||
+ /* 在中断函数中,中断函数中调用的C函数,需要使用 sp, 这里,在中断函数中,使用的 sp 为,系统的栈资源 */
|
||||
+ /* switch to interrupt stack */
|
||||
+ la sp, __stack_end__ /* sp = _sp */
|
||||
+
|
||||
+ /* interrupt handle */
|
||||
+ /* 注意: 在调用C函数之前,比如sp的值为0x30001000, 在执行完C函数后,sp的值还是会变成 0x30001000 */
|
||||
+ call rt_interrupt_enter /* 执行所有的中断函数前,调用该函数 */
|
||||
+
|
||||
+ csrr s1, mcause
|
||||
+ csrr s2, mstatus
|
||||
+
|
||||
+ /* Save the interrupt threshold level */
|
||||
+ la t0, INTERRUPT_CORE0_CPU_INT_THRESH_REG
|
||||
+ lw s3, 0(t0)
|
||||
+
|
||||
+ li t2, 0x7fffffff
|
||||
+ and t1, s1, t2 /* t1 = mcause & mask */
|
||||
+ slli t1, t1, 2 /* t1 = mcause * 4 */
|
||||
+ la t2, INTC_INT_PRIO_REG(0)
|
||||
+ add t1, t2, t1 /* t1 = INTC_INT_PRIO_REG + 4 * mcause */
|
||||
+ lw t2, 0(t1) /* t2 = INTC_INT_PRIO_REG[mcause] */
|
||||
+ addi t2, t2, 1 /* t2 = t2 +1 */
|
||||
+ sw t2, 0(t0) /* INTERRUPT_CORE0_CPU_INT_THRESH_REG = t2 */
|
||||
+ fence
|
||||
+
|
||||
+ li t0, 0x8
|
||||
+ csrrs t0, mstatus, t0
|
||||
+
|
||||
+ /* call the C dispatcher */
|
||||
+ mv a0, sp /* argument 1, stack pointer */
|
||||
+ mv a1, s1 /* argument 2, interrupt number (mcause) */
|
||||
+ /* mask off the interrupt flag of mcause */
|
||||
+ li t0, 0x7fffffff
|
||||
+ and a1, a1, t0
|
||||
+ jal _global_interrupt_handler
|
||||
+
|
||||
+ li t0, 0x8
|
||||
+ csrrc t0, mstatus, t0
|
||||
+
|
||||
+ /* restore the interrupt threshold level */
|
||||
+ la t0, INTERRUPT_CORE0_CPU_INT_THRESH_REG
|
||||
+ sw s3, 0(t0)
|
||||
+ fence
|
||||
+
|
||||
+ call rt_interrupt_leave /* 执行所有的中断函数后,调用该函数 */
|
||||
+
|
||||
+ /* 上面,将保存执行中断服务函数之前的CPU的sp寄存器到了s0所指向的位置处,当执行完中断服务函数,需要将之前的CPU寄存器,恢复一下,此时sp又变成了from thread的sp了 */
|
||||
+ move sp, s0 /* sp = s0 */
|
||||
+
|
||||
+ /* 下面两句话,相当于将 rt_thread_switch_interrupt_flag 值,赋值给了s2 */
|
||||
+ /* 将 rt_thread_switch_interrupt_flag 的地址值,赋值给 s0 寄存器*/
|
||||
+ la s0, rt_thread_switch_interrupt_flag /* s0 = &rt_thread_switch_interrupt_flag */
|
||||
+ /* 将 s0 所指向的地址处的内容,取出来,赋值给 s2 寄存器,其实就是将 rt_thread_switch_interrupt_flag 的值,赋值给了 s2 寄存器*/
|
||||
+ lw s2, 0(s0) /* s2 = *s0 = rt_thread_switch_interrupt_flag */
|
||||
+
|
||||
+ /* 如果 s2的值,即 rt_thread_switch_interrupt_flag 值,如果不为0,则需要继续执行下一条指令,如果为0,则需要跳转到 spurious_interrupt 标号处 执行 */
|
||||
+ /* 如果 s2的值等于0,rt_thread_switch_interrupt_flag等于0, 则不需要在中断处理函数中,进行上下文切换,反之则需要 */
|
||||
+ /* 如果不需要上下文切换, */
|
||||
+
|
||||
+ /* 在这里,跳转到 spurious_interrupt的话,是不会进行上下文切换的,因为,此时CPU的sp指针还是from线程的*/
|
||||
+ beqz s2, spurious_interrupt /* if (s2 == 0) goto spurious_interrupt; else 执行下一条语句*/
|
||||
+
|
||||
+ /* 需要上下文切换: 主要目的是将CPU的sp指针,赋值为to_thread的sp */
|
||||
+
|
||||
+ /* 将 s0 所执向的地址的内容设置为0, 也就是,将变量 rt_thread_switch_interrupt_flag 赋值为了 0 */
|
||||
+ /* s0存放的值是 rt_thread_switch_interrupt_flag 变量的地址*/
|
||||
+ sw zero, 0(s0) /* *s0 = 0; 也就是 rt_thread_switch_interrupt_flag = 0 */
|
||||
+ /* 将 mepc 的值,赋值给 a0 寄存器,mepc 的值是,跳转到中断函数执行之前的 PC 指针 */
|
||||
+ /* 这时的mpec其实,还是from线程,在跳转到中断执行前的一个PC地址 */
|
||||
+ csrr a0, mepc /* a0 = mepc */
|
||||
+
|
||||
+ /* 将 mpec 的值写回到freom thread任务栈中的 epc 中,待后续,恢复from线程时,使用 */
|
||||
+ STORE a0, 0 * REGBYTES(sp) /* from_thread->sp->epc = a0 ,中断入口处*/
|
||||
+
|
||||
+ /* 将from_thread的sp指针,赋值为CPU的sp指针 */
|
||||
+ la s0, rt_interrupt_from_thread /* s0 = &rt_interrupt_from_thread 注意: rt_interrupt_from_thread = &(from_thread->sp) */
|
||||
+ LOAD s1, 0(s0) /* s1 = rt_interrupt_from_thread,也就是s1 = &(from_thread->sp) */
|
||||
+ STORE sp, 0(s1) /* from_thread->sp = sp*/
|
||||
+
|
||||
+ /* 接下来,需要开始恢复CPU的sp为to_thread的sp了 */
|
||||
+ la s0, rt_interrupt_to_thread /* s0 = &rt_interrupt_to_thread 注意: rt_interrupt_to_thread = &(to_thred->sp)*/
|
||||
+ LOAD s1, 0(s0) /* s1 = rt_interrupt_to_thread, 也就是s1 = &(to_thred->sp) */
|
||||
+ LOAD sp, 0(s1) /* sp = (to_thred->sp)*/
|
||||
+
|
||||
+ /* 将CPU的 mepc设置为to_thred的mepc,待中断退出,执行mret指令后,将从该地址开始执行 */
|
||||
+ LOAD a0, 0 * REGBYTES(sp) /* a0 = to_thread的mepc的值*/
|
||||
+ csrw mepc, a0 /* mepc = a0 */
|
||||
+
|
||||
+
|
||||
+spurious_interrupt:
|
||||
+ LOAD x1, 1 * REGBYTES(sp)
|
||||
+
|
||||
+ /* Remain in M-mode after mret */
|
||||
+ li t0, 0x00001800
|
||||
+ csrs mstatus, t0
|
||||
+ LOAD t0, 2 * REGBYTES(sp)
|
||||
+ csrs mstatus, t0
|
||||
+
|
||||
+ LOAD x4, 4 * REGBYTES(sp)
|
||||
+ LOAD x5, 5 * REGBYTES(sp)
|
||||
+ LOAD x6, 6 * REGBYTES(sp)
|
||||
+ LOAD x7, 7 * REGBYTES(sp)
|
||||
+ LOAD x8, 8 * REGBYTES(sp)
|
||||
+ LOAD x9, 9 * REGBYTES(sp)
|
||||
+ LOAD x10, 10 * REGBYTES(sp)
|
||||
+ LOAD x11, 11 * REGBYTES(sp)
|
||||
+ LOAD x12, 12 * REGBYTES(sp)
|
||||
+ LOAD x13, 13 * REGBYTES(sp)
|
||||
+ LOAD x14, 14 * REGBYTES(sp)
|
||||
+ LOAD x15, 15 * REGBYTES(sp)
|
||||
+ LOAD x16, 16 * REGBYTES(sp)
|
||||
+ LOAD x17, 17 * REGBYTES(sp)
|
||||
+ LOAD x18, 18 * REGBYTES(sp)
|
||||
+ LOAD x19, 19 * REGBYTES(sp)
|
||||
+ LOAD x20, 20 * REGBYTES(sp)
|
||||
+ LOAD x21, 21 * REGBYTES(sp)
|
||||
+ LOAD x22, 22 * REGBYTES(sp)
|
||||
+ LOAD x23, 23 * REGBYTES(sp)
|
||||
+ LOAD x24, 24 * REGBYTES(sp)
|
||||
+ LOAD x25, 25 * REGBYTES(sp)
|
||||
+ LOAD x26, 26 * REGBYTES(sp)
|
||||
+ LOAD x27, 27 * REGBYTES(sp)
|
||||
+ LOAD x28, 28 * REGBYTES(sp)
|
||||
+ LOAD x29, 29 * REGBYTES(sp)
|
||||
+ LOAD x30, 30 * REGBYTES(sp)
|
||||
+ LOAD x31, 31 * REGBYTES(sp)
|
||||
+
|
||||
+ addi sp, sp, 32 * REGBYTES
|
||||
+ mret
|
||||
+ .size _interrupt_handler, .-_interrupt_handler
|
||||
+#endif
|
||||
\ No newline at end of file
|
||||
--
|
||||
2.32.0 (Apple Git-132)
|
||||
|
||||
|
||||
From 394259fb2164e513abd4f0d23d88da92c2a2ac9e Mon Sep 17 00:00:00 2001
|
||||
From: tangzz98 <tangz98@outlook.com>
|
||||
Date: Fri, 23 Sep 2022 00:12:13 -0400
|
||||
Subject: [PATCH 2/2] Specify freertos_root in project CMakeLists.txt
|
||||
|
||||
---
|
||||
components/freertos/CMakeLists.txt | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/components/freertos/CMakeLists.txt b/components/freertos/CMakeLists.txt
|
||||
index 5cd54494f6..33c901c187 100644
|
||||
--- a/components/freertos/CMakeLists.txt
|
||||
+++ b/components/freertos/CMakeLists.txt
|
||||
@@ -7,7 +7,7 @@ endif()
|
||||
idf_build_get_property(target IDF_TARGET)
|
||||
|
||||
if(CONFIG_IDF_RTOS_RTTHREAD)
|
||||
- set(freertos_root "../../../FreeRTOS_Wrapper-latest/FreeRTOS")
|
||||
+ message(${freertos_root})
|
||||
set(srcs
|
||||
"${freertos_root}/portable/esp-idf/riscv/port.c")
|
||||
|
||||
--
|
||||
2.32.0 (Apple Git-132)
|
||||
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue