#define VECTOR_RAM ((unsigned int *)0x40000000) #define VECTOR_ROM ((unsigned int *)0x00000000)
__swi(0x00) void SWI_Task(void);
void SWI_Exception(void) { while(1); } int main() { volatile unsigned int *RamAddr,*RomAddr; int i; RamAddr = VECTOR_RAM; RomAddr = VECTOR_ROM; for(i=0;i<16;i++)//拷贝中断向量表 { *RamAddr = *RomAddr; RamAddr++; RomAddr++; } MEMMAP = 0x2; RamAddr = (unsigned int *)0x40000028; *RamAddr = (unsigned int )SWI_Exception;//修改SWI中断向量 SWI_Task();//执行SWI中断 while(1); } AREA vectors,CODE,READONLY ENTRY ;interrupt vectors ;中断向量表 Reset LDR PC, ResetAddress LDR PC, UndefineAddress LDR PC, SWI_Address LDR PC, PrefetchAddress LDR PC, AbortAddress NOP LDR PC, [PC,#-0xFF0] LDR PC, FIQ_Address
ResetAddress DCD Reset_Handler UndefineAddress DCD Undefine_Handler SWI_Address DCD SWI_Handler PrefetchAddress DCD Prefetch_Handler AbortAddress DCD Abort_Handler FIQ_Address DCD FIQ_Handler
SWI_Handler B SWI_Handler
RO_base =0 RW_base=0x40000000
问题:为什么remap 之后执行SWI软件指令,还是跳转到SWI_Handler,而不是到SWI_Exception()呢? |