本帖最后由 z_no1 于 2015-8-27 17:46 编辑
我想在RL-ARM - RTX的用户模式下用NVIC_SystemReset()函数,用就进HardFault_Handler()了,说是这个要在特权模式下用,我照网上说的把SWI_TABLE.S拷到项目里,【网上说的地址是\Keil\ARM\RV30\RTL\Kernel\SRC文件夹中,可我MDK470下就没有这个目录啊,在C:\Keil\ARM\RL\RTX\SRC\ARM里找了一个,】
AREA SWI_TABLE, CODE, READONLY
EXPORT SWI_Count
SWI_Cnt EQU (SWI_End-SWI_Table)/4
SWI_Count DCD SWI_Cnt
IMPORT __SWI_0
IMPORT __SWI_1
IMPORT __SWI_2
IMPORT __SWI_3
IMPORT __SWI_4
IMPORT __SWI_5
IMPORT __SWI_6
IMPORT __SWI_7
; Import user SWI functions here.
; IMPORT __SWI_8
EXPORT SWI_Table
SWI_Table
DCD __SWI_0 ; SWI 0 used by RTX
DCD __SWI_1 ; SWI 1 used by RTX
DCD __SWI_2 ; SWI 2 used by RTX
DCD __SWI_3 ; SWI 3 used by RTX
DCD __SWI_4 ; SWI 4 used by RTX
DCD __SWI_5 ; SWI 5 used by RTX
DCD __SWI_6 ; SWI 6 used by RTX
DCD __SWI_7 ; SWI 7 used by RTX
; Insert user SWI functions here. SWI 0..7 are used by RTX Kernel.
; DCD __SWI_8 ; user SWI function
SWI_End
END
////////////////////////
我把_SWI_8的两个注释去掉,编译,则提示:
.\Obj\debug.axf: Error: L6218E: Undefined symbol __SWI_0 (referred from swi_table.o).
.\Obj\debug.axf: Error: L6218E: Undefined symbol __SWI_1 (referred from swi_table.o).
.\Obj\debug.axf: Error: L6218E: Undefined symbol __SWI_2 (referred from swi_table.o).
.\Obj\debug.axf: Error: L6218E: Undefined symbol __SWI_3 (referred from swi_table.o).
.\Obj\debug.axf: Error: L6218E: Undefined symbol __SWI_4 (referred from swi_table.o).
.\Obj\debug.axf: Error: L6218E: Undefined symbol __SWI_5 (referred from swi_table.o).
.\Obj\debug.axf: Error: L6218E: Undefined symbol __SWI_6 (referred from swi_table.o).
.\Obj\debug.axf: Error: L6218E: Undefined symbol __SWI_7 (referred from swi_table.o).
我试着把_swi_0到7注释掉,
/////////////////
AREA SWI_TABLE, CODE, READONLY
EXPORT SWI_Count
SWI_Cnt EQU (SWI_End-SWI_Table)/4
SWI_Count DCD SWI_Cnt
; IMPORT __SWI_0
; IMPORT __SWI_1
; IMPORT __SWI_2
; IMPORT __SWI_3
; IMPORT __SWI_4
; IMPORT __SWI_5
; IMPORT __SWI_6
; IMPORT __SWI_7
; Import user SWI functions here.
IMPORT __SWI_8
EXPORT SWI_Table
SWI_Table
; DCD __SWI_0 ; SWI 0 used by RTX
; DCD __SWI_1 ; SWI 1 used by RTX
; DCD __SWI_2 ; SWI 2 used by RTX
; DCD __SWI_3 ; SWI 3 used by RTX
; DCD __SWI_4 ; SWI 4 used by RTX
; DCD __SWI_5 ; SWI 5 used by RTX
; DCD __SWI_6 ; SWI 6 used by RTX
; DCD __SWI_7 ; SWI 7 used by RTX
; Insert user SWI functions here. SWI 0..7 are used by RTX Kernel.
DCD __SWI_8 ; user SWI function
SWI_End
END
////////////////////////////////
void __swi(8) stm_reset(void);
void __SWI_8 (void)
{
NVIC_SystemReset(); //复位
//led_comm_on();
}
错误提示没了,可我编译运行发现,程序有跳到这个位置,但 就是不运行。我把复位命令换成点灯这个不需要特权模式的命令,也是没反应。系统就像是跳过这段的代码了一样。
大家看下是什么问题啊?
在这之前是可以正常运行的。
现在我把 #define OS_RUNPRIV 1 设置成特权模式就可以了,但如果我要在用户模式下用该怎么设置啊?
|