[ECOS] ARM Assembler problem

Andreas Bürgel ab@genologic.de
Tue Nov 28 06:53:00 GMT 2000


Hi,

I've got following problem with GNU arm-elf-as (Host: i686-linux,
Target: ARM7TDMI):
Consider the following piece of code (simple delay loop):

  ldr     r2, .WAIT
loop:        
  sub     r2, r2, #1
  cmp     r2, #0
  bne     loop
  ...
.WAIT:
  .word   0x1000000

After assembling with "arm-elf-as -marm7tdmi file.S"
I had a closer look to a.out with "arm-elf-objdump -d a.out" and found 
      ...  
2c:   e59f2038    ldr     r2, [pc, #38]   ; 6c <.WAIT>
 
00000030 <loop>:
30:   e2422001    sub     r2, r2, #1      ; 0x1
34:   e3520000    cmp     r2, #0  ; 0x0
38:   1afffffe    bne     38 <loop+0x8>     
      ...
As you can see the assembler computed a wrong target address (opcode
1afffffe at address 38). The offset should be -2 resulting in an opcode
of 1afffffc. If I use a hex-editor to change the opcode in the binary
image, the program works as expected.

Is there a special option I forgot or is the assembler buggy (resp.
built wrong). Thanks in advance.


More information about the Ecos-discuss mailing list