各位大侠,我将代码段放置在FLASH中,将异常向量表映射到SRAM时,通过H-JTAG在线调试时候程序能运行正常。而复位之后程序却运行不起来,请问可能是什么原因?
硬件条件是:
外部FLASH:0x8000,0000 - 0x801F,FFFF
内部SRAM: 0X4000,0000 - 0x4000,3FFF
相关代码是:
(1)StartUP.s
启动初始化启动代码StartUp.s文件中:
;/*--------------------------------------------------------------------------
;-- 代码区
;--------------------------------------------------------------------------*/
CODE32
AREA Start, CODE, READONLY
ENTRY
Reset_Handler
LDR PC,=Instruct_2 ;重映射!!
Instruct_2
LDR R0,=MEMMAP
LDR R1,=0x02
STR R1,[R0] ;中断向量从内部RAM重映射
````
上电时通过以上代码将异常向量表映射到SRAM的0x4000,0000-0x4000,0032.
(2)vector.s
异常向量表文件vector.s:
AREA vect, CODE, READONLY
ENTRY
LDR PC,Reset_AddR
LDR PC,Undefined_AddR
LDR PC,SWI_AddR
LDR PC,Prefetch_AddR
LDR PC,Abort_AddR
DCD 0xB9205F80
LDR PC,[PC, #-0xff0]
LDR PC,FIQ_AddR
Reset_AddR DCD Reset_Handler
Undefined_AddR DCD Undefined_Handler
SWI_AddR DCD SWI_Handler
Prefetch_AddR DCD Prefetch_Handler
Abort_AddR DCD Abort_Handler
Nouse DCD 0
IRQ_AddR DCD 0
FIQ_AddR DCD FIQ_Handler
Undefined_Handler
B .
SWI_Handler
B .
Prefetch_Handler
B .
Abort_Handler
B .
FIQ_Handler
B .
(3) ExFlashRam.scf
分散加载文件:
ERAM_LOAD 0x80000000
{
ERAM_EXE 0x80000000
{
StartUP.o(Start,+First)
*(+RO)
}
REMAP_ISR 0x40000000
{
vector.o(vect,+First)
* (+RW,+ZI)
}
STACK 0x40001000 UNINIT
{
StackHeap.o(Stack)
}
HEAP 0x40003000 UNINIT
{
StackHeap.o(Heap)
}
}
请大侠指点。 |