我正在尝试在 TCM 上设置 ARM cortex R5f 处理器堆栈来测量处理器性能。但是每次访问堆栈时,处理器都会转到中止处理程序。
当我在地址 0x41000000 (BTCM) 上写入数据时,我没有收到任何错误。
我得到了以下状态寄存器:
CP15_DFSR = 0x800
SD axi_decode_error RW : 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