lpc54628 keil optimization problem

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

lpc54628 keil optimization problem

1,178件の閲覧回数
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 返答(返信)

1,110件の閲覧回数
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 件の賞賛
返信

1,106件の閲覧回数
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 件の賞賛
返信

1,165件の閲覧回数
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 件の賞賛
返信

1,172件の閲覧回数
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 件の賞賛
返信