EmbDev.net

Forum: ARM programming with GCC/GNU tools Creating .elf from assembler


Author: Jimmy (Guest)
Posted on:

Rate this post
0 useful
not useful
Hello,

I am trying to create an .elf file from ARM assembly code needed for 
ARMulator.

But whenever I try to compile the code with arm-elf-gcc, I get a 'bad 
instruction' error for every sing line, but compiling the code under 
keil makes no problem.

The code:
   AREA    test, CODE, READWRITE
SWI_Exit    EQU &11
     ENTRY
    ADR    r0, A
  MOV    r1, #15
  STR    r1, [r0]
  SWI    SWI_Exit
A  =    0
  END

Neither arm-elf-gcc -o arm.elf arm.s
nor arm-elf-gcc -mthumb -Bstatic arm.s -o arm.elf
as suggested on the ARMulator's site are working.

I am already so desperate, as I can't find any proper tutorial or any 
more information on that.
So I would very much appreciate ur guys help, as I also need that for my 
uni coursework.

Cheers,
Jimmy

Author: Krapao (Guest)
Posted on:

Rate this post
0 useful
not useful
arm-elf-gcc (to be more specific the GNU Assembler) has another syntax 
than Keil Assembler. You would need to rewrite this KEIL assembler 
source code. Starting points are of course the Keil User Manual and the 
GNU Assembler Manual (gas).

Keil:
http://www.keil.com/support/man/docs/armasm/armasm...
http://www.keil.com/support/man/docs/armasm/armasm...

gas:
http://sourceware.org/binutils/docs/as/

The line
> AREA test, CODE, READWRITE
will translate in something like
.section test, "awx"
or
.section .test, "awx"
If you look in such kind of code, you will find examples in the net e.g.
http://www.zap.org.au/elec2041-cdrom/unsw/elec2041...
that you can use as starter.

Hint: In order to have a section test, you need the proper linker 
control script with the memory layout as well! IMHO it's much easier to 
look for an assembler tutorial with usage of the GNU toolchain than 
struggling with two unkowns - Keil/GNU translation and ARM learning.

Reply

Entering an e-mail address is optional. If you want to receive reply notifications by e-mail, please log in.

Rules — please read before posting

  • Post long source code as attachment, not in the text
  • Posting advertisements is forbidden.

Formatting options

  • [c]C code[/c]
  • [avrasm]AVR assembler code[/avrasm]
  • [code]code in other languages, ASCII drawings[/code]
  • [math]formula (LaTeX syntax)[/math]




Bild automatisch verkleinern, falls nötig
Note: the original post is older than 6 months. Please don't ask any new questions in this thread, but start a new one.