MPC5605B sdata issue

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

MPC5605B sdata issue

787 次查看
曾经怀念
Contributor II

Hi all,

 

      I create two project. one run in flash, the other run in ram.

 

and copy the ram prj .bin file  to flash prj uint16_t array, and running it

(lcf : internal_ram  org = 0x40000000, len = 0x2000

         stack               org = 0x40004000, len = 0x1000)

main(void)

{

  

   (* function)()   /* jump to ram prj mian addr 0x40006382 */

 

//would not come back here

   while(1)

   {

         

    }

}

in ram prj

(lcf: internal_ram: org = 0x40006000, len = 0x8000

        stack:              org = 0x4000E000, len = 0x1000)

main(void)

{

uint16_t uiDummyRead;

const uint16_t uiDataSize = sizeof( A ) / sizeof( B );

 

while (1)

{

   uiDummyRead = uiDataSize ;

}

 

}

 

download flash prj and running,  found that the uiDataSize is wrong, and the @uiDataSize is 0x400003bc

this addr is the flash prj's sdata addr

.sdata2 400003bc 00000000 00002800 00005000 00005000  0

the ram flash prj's sdata addr

.sdata2 40006854 00000000 00000710 0               00000000

 

so i change the type of uiDataSize to rodata, then the problem solved.

const uint16_t __attribute__((section(".rodata")))uiDataSize = sizeof( A ) / sizeof( B );

 

what is the cause of the problem????

Original Attachment has been moved to: Test_Prj.rar

标记 (3)
0 项奖励
回复
0 回复数