void checkFlag(void)
{
int i;
unsigned char *pc = (unsigned char *)0x0007d000;
unsigned int *pram = (unsigned int *)0x40000000;
unsigned int *webup = (unsigned int *)0x00003800;
unsigned int *app = (unsigned int *)0x00040000;
//上面这条代码,执行后不能正常赋值,如果把上面这条和下面这条位置换一下,一样还是上面这个位置的代码不能正常赋值,但其他位置的均可正常赋值,下面是反汇编代码,大家帮忙看看
unsigned int *uartaddr = (unsigned int *)0x00001000;
.....
反汇编:
0x00000000 EBFFFFFF BL checkFlag(0x00000004)
9: {
10: int i;
0x00000004 E92D47F0 STMDB R13!,{R4-R10,R14}
11: unsigned char *pc = (unsigned char *)0x0007d000;
0x00000008 E3A05A7D MOV R5,#0x0007D000
12: unsigned int *pram = (unsigned int *)0x40000000;
0x0000000C E3A07101 MOV R7,#0x40000000
13: unsigned int *webup = (unsigned int *)0x00003800;
14:
0x00000010 E3A08B0E MOV R8,#0x00003800
15: unsigned int *app = (unsigned int *)0x00040000; ;就这个位置的代码不能正常赋值
0x00000014 BAB0F784 BLT 0xFEC3DE2C
16: unsigned int *uartaddr = (unsigned int *)0x00001000;
0x00000018 E3A06A01 MOV R6,#0x00001000
int i;
unsigned char *pc = (unsigned char *)0x0007d000;
unsigned int *pram = (unsigned int *)0x40000000;
unsigned int *webup = (unsigned int *)0x00003800;
unsigned int *app = (unsigned int *)0x00040000;
unsigned int *uartaddr = (unsigned int *)0x00001000; //当我把这句和上句位置对调后,如下:
int i; //行1
unsigned char *pc = (unsigned char *)0x0007d000; //行2
unsigned int *pram = (unsigned int *)0x40000000; //行3
unsigned int *webup = (unsigned int *)0x00003800; //行4
unsigned int *uartaddr = (unsigned int *)0x00001000; //行5 //这句放上来,反而赋值不成功
unsigned int *app = (unsigned int *)0x00040000; //而这句又赋值成功了
现在还没找到问题,我只好找了个临时解决的办法:
我又定义了一个 没用的变量:
unsigned int *temp = (unsigned int *)0x00003800; //把它放在 行4 的下一行,它不能赋值,但它后面的变量都能正常赋值了。