update Demo-Build/RISC-V32/readme.txt.

Signed-off-by: 零中断延迟的RTOS <cosyos@139.com>
This commit is contained in:
零中断延迟的RTOS
2026-08-03 03:39:25 +00:00
committed by Gitee
parent b97cb04ac6
commit 3c5921822b
+16 -3
View File
@@ -11,9 +11,12 @@ RISC-V32 之系统构建
3、CosyOS 采用了自研先进技术,可实现 CH32V 全程开启硬件压栈。
该技术为纯软件实现,不依赖特定硬件(0x804->bit5),V103、203 等
皆可完美支持。所以,如果您的处理器支持硬件压栈,千万不要忘记开启。
如果开启硬件压栈,中断函数的声明原则等同裸机。即如果最大硬件压栈
深度为3级,需要将低优先级的三级中断声明为硬件压栈,高优先级的中断
声明为软件压栈
如果开启硬件压栈,用户应注意以下两个问题:
(1)处理器需要仅工作在机器模式
可在启动文件中,配置 mstatus 的 MPP 为 3 来实现
(2)中断函数的声明原则等同裸机
即如果最大硬件压栈深度为3级,需要将低优先级的三级中断声明为
硬件压栈,高优先级的中断声明为软件压栈。
移植流程(以 MRS2 为例)
@@ -139,4 +142,14 @@ void SysTick_Handler(void)
tCosyTick_Handler();
}
/* 例程-使能硬件压栈并仅为机器模式 */
handle_reset:
/* Enable interrupt nesting and hardware stack */
// HWSTKOVEN, PMTCFG, INESTEN, HWSTKEN
li t0, (1 << 4) | (3 << 2) | (1 << 1) | 1
csrw 0x804, t0
/* Enable floating point and global interrupt, configure privileged mode */
// FS, MPP, MPIE, MIE
li t0, (3 << 13) | (3 << 11) | (1 << 7) | (1 << 3)
csrw mstatus, t0