Am 12/20/2010 02:32 PM, schrieb Kenan Özdemir:
>
> Hi,
>  
> somehow my code is not working. Recently I tried to figure out, why
> there are these unexpected jumps in my programcode. After a look at
> the Disassembly, I found something strange..
>  
> My first lines in main are these:
>  
> int a = 1;
> int i  = 1;
>  
> and the Disassembly says for these two lines:
>  
>
> *int a = 1;*
>
> *0x00400106 <main()+6>: ldrb.w r4, [r1], #1*
>
> *0x0040010a <main()+10>: subs r0, r0, r4*
>
> *int i = 1;*
>
> *0x0040010c <main()+12>: beq.n 0x4000fa <frame_dummy+22>*
>
> *0x0040010e <main()+14>: pop {r4}*
>
> *0x00400110 <main()+16>: bx lr*
>  
> why do I have this jump in int i = 1 ??
Probably because the compiler optimized the i=1 away completely, as the
value is never used. Optimization may also lead to small differences in
the mapping between source code line number and assembler code.

If you want line-accurate debugging, it may be necessary to turn off
compiler opzimization (-O0) completely.

BTW: "bx lr" looks like the code is returning from main() - which it
should never do in an embedded environment.

cu
Michael

_______________________________________________
Openocd-development mailing list
Openocd-development@lists.berlios.de
https://lists.berlios.de/mailman/listinfo/openocd-development

Reply via email to