正确的读取答案应该是 0x1210 但是读取到的数值是 0x1212
#define D12Cmd *(volatile U8 *)(0x2000001) #define D12Dat *(volatile U8 *)(0x2000000) #define D12Dat1 *(volatile U8 *)(0x2000002)
U32 D12RdChipId() { U32 tmp; D12Cmd = 0xfd; tmp = D12Dat; tmp = tmp<<8; tmp+=D12Dat; //D12Dat 读取失败 return tmp; } 0x0000009c: e3a010fd .... MOV r1,#0xfd 0x000000a0: e3a00780 .... MOV r0,#0x2000000 0x000000a4: e5c01001 .... STRB r1,[r0,#1] 0x000000a8: e5d01000 .... LDRB r1,[r0,#0] 0x000000ac: e1a01401 .... MOV r1,r1,LSL #8 0x000000b0: e5d00000 .... LDRB r0,[r0,#0] 0x000000b4: e0800001 .... ADD r0,r0,r1 0x000000b8: e1a0f00e .... MOV pc,r14
但是我程序给为这样 第二起读取地址是*(volatile U8 *)(0x2000002) 可以读到0x1210 U32 D12RdChipId() { U32 tmp; D12Cmd = 0xfd; tmp = D12Dat; tmp = tmp<<8; tmp+=D12Dat1; //D12Dat1 读取成功 return tmp; } 0x0000009c: e3a010fd .... MOV r1,#0xfd 0x000000a0: e3a00780 .... MOV r0,#0x2000000 0x000000a4: e5c01001 .... STRB r1,[r0,#1] 0x000000a8: e5d01000 .... LDRB r1,[r0,#0] 0x000000ac: e1a01401 .... MOV r1,r1,LSL #8 0x000000b0: e5d00002 .... LDRB r0,[r0,#2] 0x000000b4: e0800001 .... ADD r0,r0,r1 0x000000b8: e1a0f00e .... MOV pc,r14
|