W90P950的初始化代码中的一部分,用ADS1.2编译加载到W90P950的板上。用AXD的Disassembly和Source code对比,发现一个奇怪的现象:
Disassembly窗口中的内容:
Reset_Go [0xe59f041c] ldr r0,0x00008424 ; = #0xb8002124
00008004 [0xe3e01000] mvn r1,#0
00008008 [0xe5801000] str r1,[r0,#0]
0000800c [0xe10f0000] mrs r0,cpsr
00008010 [0xe38000c0] orr r0,r0,#0xc0
00008014 [0xe121f000] msr cpsr_c,r0
00008018 [0xe59f0400] ldr r0,0x00008420 ; = #0xeafffffe
0000801c [0xe5900000] ldr r0,[r0,#0]
00008020 [0xe3e01eff] mvn r1,#0xff0
00008024 [0xe0011000] and r1,r1,r0
00008028 [0xe3a00080] mov r0,#0x80
0000802c [0xe1811000] orr r1,r1,r0
00008030 [0xe59f03e0] ldr r0,0x00008418 ; = #0xe3a00018
00008034 [0xe5801000] str r1,[r0,#0]
00008038 [0xe59f03e4] ldr r0,0x00008424 ; = #0xb8002124
0000803c [0xe5900000] ldr r0,[r0,#0]
00008040 [0xe3a01e80] mov r1,#0x800
00008044 [0xe1500001] cmp r0,r1
00008048 [0x1a0000e0] bne Reset_Handler
实际的源程序:
ROM_Start EQU 0xA0000000 ; Base address of ROM after remapping
AIC_MDCR EQU 0xB8002124 ; W90P910 AIC Mask Disable Control Register
Clk_Skew EQU 0xB0001700 ; W90P910 clock skew control register
EBI_Ctrl EQU 0xB0001000 ; W90P910 EBI Controle register
SDRAM_config0 EQU 0xB0001008 ; W90P910 SDCONF0
ROM_CFGx EQU 0xB0001004 ; W90P910 ROMCONF
;--- Marked by cmn, [2005/07/04]
;CAHCON EQU 0xFFF02000 ; W90N740 Cache control register
;IDREG EQU 0xFFF00000 ; W90N740 CHIP ID
;PLLCON EQU 0xFFF00008 ; PLL Control Register
KEEP
ENTRY
EXPORT Reset_Go
Reset_Go
; Disable Interrupt, This is for safe ...
LDR r0, =AIC_MDCR
LDR r1, =0xFFFFFFFF
STR r1, [r0]
MRS r0, CPSR
ORR r0, r0, #0xC0
MSR CPSR_c, r0
; Speed up boot rom access timing in case mask ROM gives it s safer value
LDR r0, =ROM_CFGx
LDR r0, [r0]
LDR r1, =0xFFFFF00F
AND r1, r1, r0
LDR r0, =0x80
ORR r1, r1, r0
LDR r0, =ROM_CFGx
STR r1, [r0]
; Check if the system had been initialized
LDR r0, =SDRAM_config0
LDR r0, [r0]
LDR r1, =0x800
CMP r0, r1
;BNE %FT0
BNE Reset_Handler
颜色相同的就是一一对应的源代码和汇编代码。
问题下面这两句代码执行的结果是正确的:
LDR r0, =AIC_MDCR Reset_Go [0xe59f041c] ldr r0,0x00008424 ; = #0xb8002124
LDR r0, =SDRAM_config0 00008038 [0xe59f03e4] ldr r0,0x00008424 ; = #0xb8002124
而这两句执行的结果是错误的?
LDR r0, =ROM_CFGx 00008018 [0xe59f0400] ldr r0,0x00008420 ; = #0xeafffffe
LDR r0, =ROM_CFGx 00008030 [0xe59f03e0] ldr r0,0x00008418 ; = #0xe3a00018
内存中的内容:
0x00008410 E3A01000 E5810000 E3A00018 EF123446
0x00008420 EAFFFFFE B8002124 B0001004 B0001000
如果后面这两句的汇编代码中,很奇怪的现象: 同样的源代码,可汇编后的结果就不一样. 另外,汇编以后的立即数地址明显是错误的,正确的应该是 0x00008428, 而不是0x00008418.
Why?
我的ADS是买W90P710开发板时附带光盘里带的,是ADS1.2 builder number 848. |