Re: BX LR vs MOV PC,LR
- From: "Karl Olsen" <kro@xxxxxxxxxxxxxxxxxxxx>
- Date: Sun, 9 Apr 2006 10:25:45 +0200
Al Borowski <al.borowski@xxxxxxxxx> wrote:
Hi all,
I'm just starting out with the WinARM GCC toolchain for a Philips
LPC2138 microcontroller. I've hacked up one of the example projects so
it builds as follows:
==========
Assembling: crt0.S
arm-elf-gcc -c -mcpu=arm7tdmi-s -I. -x assembler-with-cpp -DROM_RUN
-Wa,-adhlns=
crt0.lst,-gdwarf-2 crt0.S -o crt0.o
Compiling C: main.c
arm-elf-gcc -c -mcpu=arm7tdmi-s -I. -gdwarf-2 -DROM_RUN -Os -Wall
-Wcast-ali
n -Wcast-qual -Wimplicit -Wpointer-arith -Wswitch -Wredundant-decls
-Wreturn-t
pe -Wshadow -Wunused -Wa,-adhlns=main.lst -I./inc -I./conf -MD -MP
-MF .dep/ma
n.o.d -Wstrict-prototypes -Wmissing-declarations -Wmissing-prototypes
-Wnested-
xterns -std=gnu99 main.c -o main.o
Linking: main.elf
arm-elf-gcc -mcpu=arm7tdmi-s -I. -gdwarf-2 -DROM_RUN -Os -Wall
-Wcast-align -
Wcast-qual -Wimplicit -Wpointer-arith -Wswitch -Wredundant-decls
-Wreturn-type
-Wshadow -Wunused -Wa,-adhlns=crt0.lst -I./inc -I./conf -MD -MP -MF
.dep/main.e
lf.d crt0.o main.o --output main.elf -nostartfiles
-Wl,-Map=main.map,--c
ref -lc -lnewlib-lpc -lm -lc -lgcc -lstdc++ -TLPC2138-ROM.ld
=================
Unless I'm missing something obvious, there is no Thumb or
Thumb-Interworking support here. So why do my functions return with BX
LR instead of MOV PC,LR? If both work, is one preferred over the
other? Are they the same speed?
They are the same size and the same speed (three clocks plus MAM
waitstates). I have seen that gcc 3.4 uses MOV PC,LR while gcc 4.0 uses BX
LR. I guess it doesn't really matter which one is used.
Karl Olsen
.
- Follow-Ups:
- Re: BX LR vs MOV PC,LR
- From: Wilco Dijkstra
- Re: BX LR vs MOV PC,LR
- References:
- BX LR vs MOV PC,LR
- From: Al Borowski
- BX LR vs MOV PC,LR
- Prev by Date: BX LR vs MOV PC,LR
- Next by Date: Question abt INSTRUCTION CACHE AND DATA CACHE
- Previous by thread: BX LR vs MOV PC,LR
- Next by thread: Re: BX LR vs MOV PC,LR
- Index(es):
Relevant Pages
|