我试图在TCM上设置ARM cortex R5f处理器堆栈来测量处理器性能。但是每次栈被访问时,处理器进入中止处理程序。
当我在地址0x41000000 (BTCM)上写数据时,我没有错误。
我得到了以下状态寄存器:
CP15_DFSR = 0x800
SD axi_decode_errorRW: write_access_abort
CP15_IFSR = x0000
SD axi_decode_error
CP15_DFAR = 0x40FFFFF4
保存发生同步中止时的故障地址。
BTCM配置
; The Cortex-R5 has
; 4K BTCM from 0x41000000 to 0x41000FFF
MRC p15, 0, r0, c9, c1, 0 ; Read BTCM Region Register
; r0 now contains ATCM size in bits [6:2]
BFC r0,#12,#20
ORR r0, r0, #1 ; Enable it
LDR r1, =||Image$$BTCM$$Base||
ORR r0, r0, r1 ; Set BTCM base address
MCR p15, 0, r0, c9, c1, 0 ; Write BTCM Region Register
微处理器配置
; Region - BTCM
ADD r1, r1, #1
MCR p15, 0, r1, c6, c2, 0 ; Set memory region number register
LDR r2, =||Image$$BTCM$$Base||
MCR p15, 0, r2, c6, c1, 0 ; Set region base address register
LDR r2, =0x0 :OR: (Region_4K << 1) :OR: Region_Enable
MCR p15, 0, r2, c6, c1, 2 ; Set region size & enable register
LDR r2, =0x0 :OR: (Full_Access << 8) :OR: Normal_nShared
MCR p15, 0, r2, c6, c1, 4 ; Set region access control register
配置堆栈
MOV R1, 0x4100000 ;------------------------ set stack @ in BTCM ------------------- 0x41001000
ADD R1, R1, 0x1000
; Set up UNDEF registers
mov r0, #ARM_MODE_UNDEF:OR:I_BIT:OR:F_BIT
msr CPSR_cxsf, r0
mov r13,r1
mov r14, #0
msr spsr_cxsf, r6
sub r1,r1,#UNDEF_STACK_SIZE
; Set up ABORT registers
mov r0, #ARM_MODE_ABORT:OR:I_BIT:OR:F_BIT
msr CPSR_cxsf, r0
mov r13,r1
mov r14, #0
msr spsr_cxsf, r6
sub r1,r1,#ABORT_STACK_SIZE
; Set up Fast Interrupt registers
mov r0, #ARM_MODE_FIQ:OR:I_BIT:OR:F_BIT
msr CPSR_cxsf, r0
mov r13,r1
mov r8, #0
mov r9, #0
mov r10, #0
mov r11, #0
mov r12, #0
mov r14, #0
msr spsr_cxsf, r6
sub r1,r1,#FIQ_STACK_SIZE
; Set up Interrupt registers
mov r0, #ARM_MODE_IRQ:OR:I_BIT:OR:F_BIT
msr CPSR_cxsf, r0
mov r13,r1
mov r14, #0
msr spsr_cxsf, r6
sub r1,r1,#IRQ_STACK_SIZE
; Set up supervisor registers
mov r0, #ARM_MODE_SVC:OR:I_BIT:OR:F_BIT
msr CPSR_cxsf, r0
mov r13,r1
mov r14, #0
msr spsr_cxsf, r6
sub r1,r1,#SVC_STACK_SIZE
; Set up System registers
mov r0, #ARM_MODE_SYS:OR:I_BIT:OR:F_BIT
msr CPSR_cxsf, r0
mov r13,r1
mov r14, #0
跳转到主目录
B main
要么您的总"STACK_SIZE"常量大于TCM,要么您的程序使用了超过STACK_SIZE的字节,并且超出了分配给它的空间。