Skip to content

Commit 95e82ec

Browse files
authored
[bsp][wch] Configure fast interrupts by QingKe core- #12004
1 parent 22293ce commit 95e82ec

27 files changed

Lines changed: 1087 additions & 1424 deletions

File tree

‎bsp/wch/risc-v/ch32v103r-evt/.config‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1426,6 +1426,7 @@ CONFIG_RT_LIBC_TZ_DEFAULT_SEC=0
14261426

14271427
CONFIG_SOC_RISCV_FAMILY_CH32=y
14281428
CONFIG_SOC_RISCV_SERIES_CH32V1=y
1429+
CONFIG_WCH_QINGKE_V3A=y
14291430

14301431
#
14311432
# Hardware Drivers Config

‎bsp/wch/risc-v/ch32v103r-evt/rtconfig.h‎

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -61,19 +61,19 @@
6161

6262
/* end of rt_strnlen options */
6363
/* end of klibc options */
64-
#define RT_NAME_MAX 12
65-
#define RT_CPUS_NR 1
64+
#define RT_NAME_MAX 12
65+
#define RT_CPUS_NR 1
6666
#define RT_ALIGN_SIZE 8
6767
#define RT_THREAD_PRIORITY_32
6868
#define RT_THREAD_PRIORITY_MAX 32
69-
#define RT_TICK_PER_SECOND 1000
69+
#define RT_TICK_PER_SECOND 1000
7070
#define RT_USING_HOOK
7171
#define RT_HOOK_USING_FUNC_PTR
7272
#define RT_USING_IDLE_HOOK
7373
#define RT_IDLE_HOOK_LIST_SIZE 4
7474
#define IDLE_THREAD_STACK_SIZE 256
7575
#define RT_USING_TIMER_SOFT
76-
#define RT_TIMER_THREAD_PRIO 4
76+
#define RT_TIMER_THREAD_PRIO 4
7777
#define RT_TIMER_THREAD_STACK_SIZE 512
7878

7979
/* kservice options */
@@ -101,10 +101,10 @@
101101
/* end of Memory Management */
102102
#define RT_USING_DEVICE
103103
#define RT_USING_CONSOLE
104-
#define RT_CONSOLEBUF_SIZE 128
104+
#define RT_CONSOLEBUF_SIZE 128
105105
#define RT_CONSOLE_DEVICE_NAME "uart1"
106106
#define RT_USING_CONSOLE_OUTPUT_CTL
107-
#define RT_VER_NUM 0x50300
107+
#define RT_VER_NUM 0x50300
108108
#define RT_BACKTRACE_LEVEL_MAX_NR 32
109109
/* end of RT-Thread Kernel */
110110
#define RT_USING_HW_ATOMIC
@@ -115,12 +115,12 @@
115115
#define RT_USING_COMPONENTS_INIT
116116
#define RT_USING_USER_MAIN
117117
#define RT_MAIN_THREAD_STACK_SIZE 2048
118-
#define RT_MAIN_THREAD_PRIORITY 10
118+
#define RT_MAIN_THREAD_PRIORITY 10
119119
#define RT_USING_MSH
120120
#define RT_USING_FINSH
121121
#define FINSH_USING_MSH
122-
#define FINSH_THREAD_NAME "tshell"
123-
#define FINSH_THREAD_PRIORITY 20
122+
#define FINSH_THREAD_NAME "tshell"
123+
#define FINSH_THREAD_PRIORITY 20
124124
#define FINSH_THREAD_STACK_SIZE 1024
125125
#define FINSH_USING_HISTORY
126126
#define FINSH_HISTORY_LINES 5
@@ -153,17 +153,15 @@
153153

154154
#define RT_LIBC_USING_LIGHT_TZ_DST
155155
#define RT_LIBC_TZ_DEFAULT_HOUR 8
156-
#define RT_LIBC_TZ_DEFAULT_MIN 0
157-
#define RT_LIBC_TZ_DEFAULT_SEC 0
156+
#define RT_LIBC_TZ_DEFAULT_MIN 0
157+
#define RT_LIBC_TZ_DEFAULT_SEC 0
158158
/* end of Timezone and Daylight Saving Time */
159159
/* end of ISO-ANSI C layer */
160160

161161
/* POSIX (Portable Operating System Interface) layer */
162162

163-
164163
/* Interprocess Communication (IPC) */
165164

166-
167165
/* Socket is in the 'Network' category */
168166

169167
/* end of Interprocess Communication (IPC) */
@@ -195,7 +193,6 @@
195193

196194
/* IoT - internet of things */
197195

198-
199196
/* Wi-Fi */
200197

201198
/* Marvell WiFi */
@@ -356,7 +353,6 @@
356353

357354
/* Arduino libraries */
358355

359-
360356
/* Projects and Demos */
361357

362358
/* end of Projects and Demos */
@@ -401,6 +397,7 @@
401397
/* end of RT-Thread online packages */
402398
#define SOC_RISCV_FAMILY_CH32
403399
#define SOC_RISCV_SERIES_CH32V1
400+
#define WCH_QINGKE_V3A
404401

405402
/* Hardware Drivers Config */
406403

‎bsp/wch/risc-v/ch32v203c-evt-r0/.config‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -368,13 +368,15 @@ CONFIG_RT_LIBC_TZ_DEFAULT_SEC=0
368368
CONFIG_PKG_USING_CH32V20x_SDK=y
369369
CONFIG_PKG_CH32V20x_SDK_PATH="/packages/peripherals/hal-sdk/wch/ch32v20x_sdk"
370370
# CONFIG_PKG_USING_CH32V20x_SDK_V202 is not set
371-
CONFIG_PKG_USING_CH32V20x_SDK_LATEST_VERSION=y
372-
CONFIG_PKG_CH32V20x_SDK_VER="latest"
371+
CONFIG_PKG_USING_CH32V20x_SDK_V205=y
372+
# CONFIG_PKG_USING_CH32V20x_SDK_LATEST_VERSION is not set
373+
CONFIG_PKG_CH32V20x_SDK_VER="v2.5"
373374
# end of WCH HAL & SDK Drivers
374375

375376
CONFIG_SOC_RISCV_FAMILY_CH32=y
376377
CONFIG_SOC_RISCV_SERIES_CH32V2=y
377378
CONFIG_SOC_RISCV_SERIES_CH32V20x_D6=y
379+
CONFIG_WCH_QINGKE_V4B=y
378380

379381
#
380382
# Hardware Drivers Config

‎bsp/wch/risc-v/ch32v203c-evt-r0/README.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ CH32V203C8T6-EVT-R0 是 WCH 推出的一款基于 RISC-V 内核的开发板,
3030

3131
1. [下载 WCH 编译工具链](https://github.com/NanjingQinheng/sdk-toolchain-RISC-V-GCC-WCH)
3232
2. 下载 Env 工具 [最新版本](https://github.com/RT-Thread/env-windows/releases)
33-
3. 将 [CH32V20x-SDK-for-RTT](https://github.com/kaidegit/CH32V20x-SDK-for-RTT) clone 到 `packages/CH32V20x-SDK-for-RTT`
33+
3. 在当前 BSP 目录下执行 `pkgs --update`,下载配置中指定的 CH32V20x SDK v2.5
3434
4. 在当前 BSP 目录下执行 `scons --exec-path=工具链的bin目录`
3535
5. 编译完成之后会生成 **rtthread.bin** 文件。默认只打开 GPIO 和 UART1。
3636

‎bsp/wch/risc-v/ch32v203c-evt-r0/SConstruct‎

Lines changed: 0 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -46,41 +46,6 @@ else:
4646
SDK_LIB = libraries_path_prefix
4747
Export('SDK_LIB')
4848

49-
def _allow_ch32v20x_d6_in_sdk_package():
50-
"""Official CH32V20x-SDK-for-RTT ships a D8W startup file and Exit()s on D6.
51-
CH32V203C8T6 is D6. Keep the SDK peripherals and use board/startup_ch32v20x_D6.S.
52-
Only that package is edited, and only while Exit() is still present, so a
53-
D8W tree or an already patched file is left untouched.
54-
"""
55-
import re
56-
candidates = [
57-
os.path.join(SDK_ROOT, 'packages', 'CH32V20x-SDK-for-RTT', 'SConscript'),
58-
os.path.join(libraries_path_prefix, 'ch32v20x_sdk-latest', 'SConscript'),
59-
]
60-
for sc in candidates:
61-
if not os.path.isfile(sc):
62-
continue
63-
with open(sc, 'r', encoding='utf-8') as f:
64-
text = f.read()
65-
if 'Exit()' not in text or 'SOC_RISCV_SERIES_CH32V20x_D6' not in text:
66-
continue
67-
if not re.search(r'^import os\b', text, re.M):
68-
text = 'import os\n' + text
69-
patched, n = re.subn(
70-
r"if GetDepend\(\['SOC_RISCV_SERIES_CH32V20x_D6'\]\):.*?\n Exit\(\)\n",
71-
"if GetDepend(['SOC_RISCV_SERIES_CH32V20x_D6']):\n"
72-
" CPPDEFINES.append(\"CH32V20x_D6\")\n",
73-
text,
74-
count=1,
75-
flags=re.S,
76-
)
77-
if n == 0 or patched == text:
78-
continue
79-
with open(sc, 'w', encoding='utf-8', newline='\n') as f:
80-
f.write(patched)
81-
82-
_allow_ch32v20x_d6_in_sdk_package()
83-
8449
# prepare building environment
8550
objs = PrepareBuilding(env, RTT_ROOT, has_libcpu=False)
8651

‎bsp/wch/risc-v/ch32v203c-evt-r0/board/SConscript‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ cwd = GetCurrentDir()
1010
src = Split('''
1111
board.c
1212
software_irq.c
13-
startup_ch32v20x_D6.S
1413
''')
1514

1615
path = [cwd]

0 commit comments

Comments
 (0)