首页 > 代码库 > arm:jlink调试和直接烧写运行的不同 [mdk s3c2440]

arm:jlink调试和直接烧写运行的不同 [mdk s3c2440]

1、对全局变量的初始化。

2、还没发现的事例。

 

/*************************************************/

先上连接文件sct

LR_ROM1 0x30000000 0x00010000  {    ; load region size_region  ER_ROM1 0x30000000 0x00010000  {  ; load address = execution address   *.o (RESET, +First)   *(InRoot$$Sections)   .ANY (+RO)  }  RW_RAM1 0x30010000 0x02000000  {  ; RW data   .ANY (+RW +ZI)  }  RW_IRAM1 0x40000000 0x00001000  {   .ANY (+RW +ZI)  }}

1、对全局变量的初始化 。

本身MDK对已初始化的全局变量的初始化就不对。

没法用。

代码:

int gr_a = 1 ;int gr_b ;int const gr_c = 11;static int gr_s = 22;void variable_test(){    Uart_Printf( "int gr_a = 1 ; gr_a = %d\n", gr_a);    Uart_Printf( "int gr_b ; gr_b = %d\n", gr_a);    Uart_Printf( "int const gr_c; gr_c = %d\n", gr_c);    Uart_Printf( "static int gr_s; gr_s = %d\n", gr_s);        Uart_Printf( "&gr_a = %08x\n", &gr_a);    Uart_Printf( "&gr_b = %08x\n", &gr_b);    Uart_Printf( "&gr_c = %08x\n", &gr_c);    Uart_Printf( "&gr_s = %08x\n", &gr_s);}

jlink运行时现象(不是每次都不同,具体原因查不出来):

int gr_a = 1 ; gr_a = 0int gr_b ; gr_b = 0int const gr_c; gr_c = 11static int gr_s; gr_s = 0&gr_a = 30010038&gr_b = 30010064&gr_c = 30009244 //.ro&gr_s = 3001003c

烧写运行时现象:已初始化的全局和静态变量被设为 ~0 .

int gr_a = 1 ; gr_a = -1  int gr_b ; gr_b = -1int const gr_c; gr_c = 11static int gr_s; gr_s = -1 &gr_a = 30010038&gr_b = 30010064&gr_c = 30009244&gr_s = 3001003c

 

arm:jlink调试和直接烧写运行的不同 [mdk s3c2440]