Some lines of code not assembling in release mode.

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Some lines of code not assembling in release mode.

1,312 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by AndreiS on Thu Mar 05 12:48:13 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.

Thanks,
0 Kudos
Reply
2 Replies

1,296 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by AndreiS on Thu Mar 05 14:39:10 MST 2015
Thank you very much.  Off to do some studying as its apparent I didn't fully understand how to use volatile.
0 Kudos
Reply

1,296 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by lpcxpresso-support on Thu Mar 05 13:12:51 MST 2015
Missing 'volatile' keyword probably...

http://www.lpcware.com/content/faq/lpcxpresso/compiler-optimization

[ Release build typically compiles with -Os]

Regards,
LPCXpresso Support
0 Kudos
Reply