lpc54628 keil optimization problem

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

lpc54628 keil optimization problem

2,483 次查看
omeraygor
Contributor I

Hi,

i have lpc54628 development board. i am developing code over it. So my problem is about optimization.

Using keil software to write code. But there are very big problem. Without optimization, the codes doesnt work. But when i opened optmization, on the debugger jumps another location that is not in my code sequence. 

i attached my settings. 

i am working firsty arm compiler 6. i dont know what can i do about this? any help please. 

0 项奖励
回复
4 回复数

2,415 次查看
omeraygor
Contributor I

hi,

thanks your advice. i am checking code again. same of code is working good and debugging correctly. can be about header files?

0 项奖励
回复

2,411 次查看
converse
Senior Contributor V

No, it is not header files. Most common reasons (but not the only possibilities) are

- not using the volatile keyword on a variable that is modified on mainline code and interrupt handler

- using a delay loop (e.g. for(int i=0; i<1000; i++) that gets optimised away

0 项奖励
回复

2,470 次查看
frank_m
Senior Contributor III

> But when i opened optmization, on the debugger jumps another location that is not in my code sequence. 

This is a common effect with optimized code. There is no one-to-one relation between C source lines and assembler instructions anymore, and lines or variables are removed (optimized out). Don't get confused with single-stepping your code.

First check if the code behaves correctly, i.e. according to your intended functionality.

If not, you might need to rework your code, as Converse suggested.

0 项奖励
回复

2,477 次查看
converse
Senior Contributor V

Most likely a problem in your code. See this FAQ and read the section on Optimised code fails to execute correctly (although written for gcc, the same advice applies).

 

https://community.nxp.com/t5/LPCXpresso-IDE-FAQs/Compiler-Optimization/m-p/468819

0 项奖励
回复