The address that the value of a global variable is stored is in Code flash memory ,not in SRAM

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

The address that the value of a global variable is stored is in Code flash memory ,not in SRAM

跳至解决方案
2,408 次查看
ycgxy1650601
Contributor III

hi:

As shown in the figure,There are two program debug diagrams(wrong version and Correct version).   The two versions of the program are similar,the only difference is at F red box.  The wrong version is the first figure,The correct version is the second figure.   The error appears at C ( D) red box.(C red box is expressed by assembly, D red box is expressed in C language;the two are the same. )

     The location of the error is the value of the global variable USART2_RX_STA ,in the first figure.   The value of the global variable is stored in the address that R29 points to ,in the first figure.The address (R29 000020E4)that R29 points to is in the Code flash memory region in the first figure; It is error.   The address (R30 40001348)that R30 points to is in the SRAM region in the second figure; It is correct. 

   The only difference between the two programs is at F, Why does the error version of the program go wrong ? Why is the value of a global variable stored USART2_RX_STA in the Code flash memory region ?  The actual value is error and fixed.  But The values you see through the debug window are correct (E red box).(The code is attached,  software version: CodeWarrior IDE 2.10)

4连续发送3次有问题.JPG4.1.JPG

memory map.JPG

thank you

标签 (1)
0 项奖励
1 解答
2,353 次查看
stanish
NXP Employee
NXP Employee

Hello,

Thank you for your report.

I haven't tried to reproduce but I'd suggest you to compile your project using the latest compiler version.

Please try to install CodeWarrior for MCUs v11.x evaluation version (https://www.nxp.com/webapp/swlicensing/sso/downloadSoftware.sp?catid=CWX-MCU-PROED-EX_11-1) 

Create a new project in project wizard and copy/paste the source code that reproduces the problem from your original project.

Do you still observe the issue?

Thanks&Regards,

Stan

在原帖中查看解决方案

0 项奖励
2 回复数
2,354 次查看
stanish
NXP Employee
NXP Employee

Hello,

Thank you for your report.

I haven't tried to reproduce but I'd suggest you to compile your project using the latest compiler version.

Please try to install CodeWarrior for MCUs v11.x evaluation version (https://www.nxp.com/webapp/swlicensing/sso/downloadSoftware.sp?catid=CWX-MCU-PROED-EX_11-1) 

Create a new project in project wizard and copy/paste the source code that reproduces the problem from your original project.

Do you still observe the issue?

Thanks&Regards,

Stan

0 项奖励
2,337 次查看
ycgxy1650601
Contributor III

Hi stanish:

Thank you for your reply.

There seems to be something wrong with your download link. I downloaded the new CW version from other link. My Download link:https://www.nxp.com.cn/design/software/development-software/codewarrior-development-tools/codewarrio... 

Is the version OK?

And  I created a new project in project wizard and copy/paste the source code , all going well.

The problem is solved.

Thank you

0 项奖励