Hello

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

Hello

405 次查看
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by 010hnoor on Thu May 14 02:59:39 MST 2015
Hello,
I am using the free edition (v7.5.0 build254) and my baby steps at learning this stuff is working well when I do a debug build. However, when I change to release mode the behavior of my code change (verified with scope) and in the disassembler I can see lines of code missing (see attached). For example the following two lines of code are only compiled once, but used several times:

i = 2500;
while(i) i--;

For example, in the attached screenshot lines 86, 92, and 99 (my "delays") are not in the disassembly. They are present in a debug build. Any help would be greatly appreciated.
标签 (1)
0 项奖励
2 回复数

395 次查看
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by R2D2 on Thu May 14 03:06:36 MST 2015
Is i volatile?

http://www.lpcware.com/content/faq/lpcxpresso/compiler-optimization
0 项奖励

395 次查看
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by lpcxpresso-support on Thu May 14 03:05:42 MST 2015
For an explanation of why your code is being removed, please read this FAQ
http://www.lpcware.com/content/faq/lpcxpresso/compiler-optimization

Especially the section on "Optimized code fails to execute correctly".

The solution is to use "volatile" in your definition of i.
0 项奖励