Dear All How can I force the compiler to not generate the "BX LR" for the return function. I also set the option --ARM_only(in compiler + assembler + linker) but this is not useful and I have this code at last in axf file. my target in Keil is set to ARM7TDMI (I can not set my target to ARM7 or any other target without Thumb) so what can we do to prevent generate "BX LR"?
I am not sure you can do what you wish for
why not? The BX is not ARM_only instruction so the compiler must not generate it when in ARM_only mode??!!
Check this out:
newsgroups.derkeiler.com/.../msg00031.html
There is likely to be plenty more if you were to consider looking!
Thanks, but how can I tell the linker to substitute the "BX LR" with "MOV PC,LR" ?
upload.wikimedia.org/.../300px-Paris_Tuileries_Garden_Facepalm_statue.jpg
Use assembler.
How can I use assembler options to do this?
infocenter.arm.com/.../index.jsp
Specifically: Note
You must use a BX lr instruction at the end of the ARM subroutine to return to the caller. You cannot use the MOV pc,lr instruction to return in this situation because it does not cause the required change of state.
Note that the linked document is describing calling ARM code from Thumb. So it is only relevant if the startup code (and the C RTL) is using Thumb mode.
What really is important is that running a program that interfaces a Thumb-mode CRTL really must be compiled to play nice with Thumb-mode code. Look at your map file for all your nice CRTL functions you use - they have odd or even address? Any veneers to access them?
Note that the linked document is describing calling ARM code from Thumb
Note that as I previously described , I do not have Thumb mode and want to have only ARM instructions in my final code
The ARM7TDMI supports the instruction BX LR when in ARM mode. Look at the ARM instruction summary (as opposed the the Thumb instruction summary) and you will see that it mentions BX{cond} Rn.
What exactly do you think your problem is? It is clearly not what your problem really is. I will not waste any more time on you. Goodbye.