V2.31
This commit is contained in:
@@ -13,4 +13,4 @@ Series=CH32V203
|
||||
Description=ROM(byte): 64K, SRAM(byte): 20K, CHIP PINS: 32, GPIO PORTS: 27.\nWCH CH32V2 series of mainstream MCUs covers the needs of a large variety of applications in the industrial,medical and consumer markets. High performance with first-class peripherals and low-power,low-voltage operation is paired with a high level of integration at accessible prices with a simple architecture and easy-to-use tools.
|
||||
|
||||
PeripheralVersion=1.0
|
||||
MCU=CH32V203RBT6
|
||||
MCU=CH32V203RBT
|
||||
|
||||
@@ -100,6 +100,7 @@ LITE_OS_SEC_TEXT_MINOR VOID OsTskCycleStart(VOID)
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
/*****************************************************************************
|
||||
Function : OsTskCycleEnd
|
||||
Description: quit task and get cycle count
|
||||
@@ -132,6 +133,7 @@ LITE_OS_SEC_TEXT_MINOR VOID OsTskCycleEnd(VOID)
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
/*****************************************************************************
|
||||
Function : OsTskCycleEndStart
|
||||
Description: start task to get cycles count in current task ending
|
||||
|
||||
@@ -56,7 +56,7 @@
|
||||
*/
|
||||
/* Save caller registers */
|
||||
.macro SAVE_CONTEXT
|
||||
csrrw sp, CSR_MSCRATCH, sp /* 把中断栈给sp,并把线程栈存到mscratch */
|
||||
csrrw sp, CSR_MSCRATCH, sp
|
||||
/* Allocate stack space for context saving */
|
||||
#ifndef __riscv_32e
|
||||
addi sp, sp, -20*REGBYTES
|
||||
@@ -120,7 +120,7 @@
|
||||
/* De-allocate the stack space */
|
||||
addi sp, sp, 14*REGBYTES
|
||||
#endif /* __riscv_32e */
|
||||
csrrw sp, CSR_MSCRATCH, sp /* 退出后把线程栈给sp,把中断栈存入mscratch */
|
||||
csrrw sp, CSR_MSCRATCH, sp
|
||||
.endm
|
||||
|
||||
|
||||
@@ -155,7 +155,7 @@ irq_entry:
|
||||
/* Critical section with interrupts disabled */
|
||||
DISABLE_MIE
|
||||
/*************************/
|
||||
/* jal irq_handler */ /* 跳转到中断处理函数 */
|
||||
/* jal irq_handler */
|
||||
/*************************/
|
||||
la t0, g_intCount
|
||||
lw t1, 0(t0)
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
;/********************************** (C) COPYRIGHT *******************************
|
||||
;* File Name : startup_ch32v20x_D6.s
|
||||
;* Author : WCH
|
||||
;* Version : V1.0.1
|
||||
;* Date : 2024/01/31
|
||||
;* Description : CH32V203F6-CH32V203F8-CH32V203G6-CH32V203G8-CH32V203K8-CH32V203C6-CH32V203C8-CH32V203G8
|
||||
;* vector table for eclipse toolchain.
|
||||
;* Version : V1.0.2
|
||||
;* Date : 2025/10/21
|
||||
;* Description : CH32V203F6-CH32V203F8-CH32V203G6-CH32V203G8-CH32V203K8-CH32V203C6-CH32V203C8-CH32V203G8
|
||||
;* Startup File
|
||||
;*********************************************************************************
|
||||
;* Copyright (c) 2021 Nanjing Qinheng Microelectronics Co., Ltd.
|
||||
;* Attention: This software (modified or not) and binary are used for
|
||||
@@ -208,9 +208,9 @@ handle_reset:
|
||||
.option norelax
|
||||
la gp, __global_pointer$
|
||||
.option pop
|
||||
1:
|
||||
|
||||
la sp, _eusrstack
|
||||
2:
|
||||
|
||||
/* Load data section from flash to RAM */
|
||||
la a0, _data_lma
|
||||
la a1, _data_vma
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
;/********************************** (C) COPYRIGHT *******************************
|
||||
;* File Name : startup_ch32v20x_D8.s
|
||||
;* Author : WCH
|
||||
;* Version : V1.0.1
|
||||
;* Date : 2024/01/31
|
||||
;* Version : V1.0.2
|
||||
;* Date : 2025/10/21
|
||||
;* Description : CH32V203RB
|
||||
;* vector table for eclipse toolchain.
|
||||
;* Startup File
|
||||
;*********************************************************************************
|
||||
;* Copyright (c) 2021 Nanjing Qinheng Microelectronics Co., Ltd.
|
||||
;* Attention: This software (modified or not) and binary are used for
|
||||
@@ -225,9 +225,9 @@ handle_reset:
|
||||
.option norelax
|
||||
la gp, __global_pointer$
|
||||
.option pop
|
||||
1:
|
||||
|
||||
la sp, _eusrstack
|
||||
2:
|
||||
|
||||
/* Load data section from flash to RAM */
|
||||
la a0, _data_lma
|
||||
la a1, _data_vma
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
;/********************************** (C) COPYRIGHT *******************************
|
||||
;* File Name : startup_ch32v20x_D8W.s
|
||||
;* Author : WCH
|
||||
;* Version : V1.0.1
|
||||
;* Date : 2023/11/20
|
||||
;* Version : V1.0.2
|
||||
;* Date : 2025/10/21
|
||||
;* Description : CH32V208x
|
||||
;* vector table for eclipse toolchain.
|
||||
;* Startup File
|
||||
;*********************************************************************************
|
||||
;* Copyright (c) 2021 Nanjing Qinheng Microelectronics Co., Ltd.
|
||||
;* Attention: This software (modified or not) and binary are used for
|
||||
@@ -229,9 +229,9 @@ handle_reset:
|
||||
.option norelax
|
||||
la gp, __global_pointer$
|
||||
.option pop
|
||||
1:
|
||||
|
||||
la sp, _eusrstack
|
||||
2:
|
||||
|
||||
/* Load data section from flash to RAM */
|
||||
la a0, _data_lma
|
||||
la a1, _data_vma
|
||||
|
||||
@@ -185,11 +185,18 @@ LITE_OS_SEC_TEXT_INIT int main(void)
|
||||
void EXTI0_IRQHandler(void) __attribute__((interrupt()));
|
||||
void EXTI0_IRQHandler(void)
|
||||
{
|
||||
/* 中断栈使用的是原来调用main设置的值,将中断栈和线程栈分开,这样线程跳中断,中断函数如果嵌套深度较大,不至于
|
||||
* 线程栈被压满溢出,但是采用当前方式,线程进中断时,编译器保存到的16个caller寄存器任然压入线程栈,如果需要希
|
||||
* 望caller寄存器压入中断栈,则中断函数的入口和出口需要使用汇编,中间调用用户中断处理函数即可,详见los_exc.S
|
||||
* 中的ipq_entry例子
|
||||
* */
|
||||
/*
|
||||
*The interrupt stack uses the value originally set when calling main,
|
||||
*separating the interrupt stack from the thread stack. In this way,
|
||||
*if the interrupt function is nested to a large depth, the thread
|
||||
*stack will not be overloaded and overflow. However, in the current way,
|
||||
*when the thread enters the interrupt, the 16 caller registers saved by
|
||||
*the compiler are still pushed onto the thread stack.If you want the caller
|
||||
*register to be pushed onto the interrupt stack, the entry and exit of the
|
||||
*interrupt function need to use assembly language, and the user interrupt
|
||||
*handling function can be called in the middle. For details,
|
||||
*see the ipq_entry example in los_exc.S
|
||||
* */
|
||||
GET_INT_SP();
|
||||
HalIntEnter();
|
||||
if(EXTI_GetITStatus(EXTI_Line0)!=RESET)
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
* Version : V1.0.0
|
||||
* Date : 2021/06/06
|
||||
* Description : CH32V20x Device Peripheral Access Layer System Source File.
|
||||
* For HSE = 32Mhz (CH32V208x/CH32V203RBT6)
|
||||
* For HSE = 32Mhz (CH32V208x/CH32V203RBT)
|
||||
* For HSE = 8Mhz (other CH32V203x)
|
||||
*********************************************************************************
|
||||
* Copyright (c) 2021 Nanjing Qinheng Microelectronics Co., Ltd.
|
||||
|
||||
Reference in New Issue
Block a user