Delay Subroutine LPC2148 Assembly

Hi Experts,

I have just started with ARM assembly, I have written a program in assembly for toggling GPIO. The issue that I am facing is that the code works when I use several "nop" in place of "bl delay". The code goes below:

.equ IODIR0, 0xE0028008
.equ IOCLR0, 0xE002800C
.equ IOSET0, 0xE0028004

delay:
   mov r0, #10 
dowaitloop:
   subs r0,#1
   bne dowaitloop
   bx lr  

MOV r3, #0xFFFFFFFF
LDR r4, =IODIR0
LDR r1, =IOCLR0
LDR r2, =IOSET0

str r3, [r4]

loop:
    str r3, [r1]
    bl delay
    str r3, [r2]
    bl delay
b loop

 

 

Commands that I execute to compile:
arm-none-eabi-as -gcoff -o blinky.o blinky.s
arm-none-eabi-ld -e0x00000000 -Ttext=0x00000000 -o blinky.elf blinky.o

arm-none-eabi-objcopy -Oihex blinky.elf blinky.hex

More questions in this forum