|
List Info
Thread: arm assembler for scratchbox?
|
|
| arm assembler for scratchbox? |

|
2007-07-13 05:23:50 |
|
hello everyone, i need to compile some little assembly code for an ARM PXA-270 processor running with instruction set V5TE. i have written arm assembly in the past but using the armulator on a windows machine.
since i have developed most of the application software for this arm processor using scratchbox and its toolchains, i would like to know if there is an assembler for scrachbox, like armasm or whatever else..
i have found the executable 'arm-linux-as'; and tried to do a compile of a simple hello world program as 'arm-linux-as
hello.s, but it failed miserably:
the program was
; Exercise 1: A simple program to print
; Hello World! in the console window
;
AREA helloW, CODE, READONLY ; declare code area
SWI_WriteC EQU &0 ; output character in r0
SWI_Exit EQU &11 ; finish program
ENTRY ; code entry point
START ADR r1, TEXT ; r1 -> "Hello World!"
LOOP LDRB r0, [r1], #1 ; get the next byte
CMP r0, #0 ; check for 'null' character
SWINE SWI_WriteC ; if not end, print ..
BNE LOOP ; .. and loop back
SWI SWI_Exit ; end of execution
TEXT = "Hello World!", &0a, &0d,
0 ; string + CR + LF + null
END and the compilation errors i got were:
[sbox-DEHTARGET: ~] > arm-linux-as hello.s
hello.s: Assembler messages: hello.s:0: Warning: end of file not at end of a line; newline inserted
hello.s:1: Error: bad instruction `exercise 1:A simple program to print' hello.s:2: Error: bad instruction `hello World!in the console window';
hello.s:4: Error: bad instruction `area helloW,CODE,READONLY' hello.s:4: Error: bad instruction `declare code area'
hello.s:5: Error: bad instruction `swi_writec EQU&0' hello.s:5: Error: bad instruction `output character in r0'
hello.s:6: Error: bad instruction `swi_exit EQU&11' hello.s:6: Error: bad instruction `finish program9;
hello.s:7: Error: bad instruction `entry'; hello.s:7: Error: bad instruction `code entry point'
hello.s:8: Error: bad instruction `start ADR r1,TEXT9; hello.s:8: Error: bad instruction `r1 ->"Hello World!"'
hello.s:9: Error: bad instruction `loop LDRB r0,[r1],#1' hello.s:9: Error: bad instruction `get the next byte'
hello.s:10: Error: bad instruction `check for 110ull32character'; hello.s
:11: Error: bad instruction `if not end,print ..' hello.s:12: Error: unknown pseudo-op: `..'
hello.s:13: Error: bad instruction `end of execution' hello.s:15: Error: bad expression
hello.s:15: Warning: rest of line ignored; first ignored character is `H' hello.s:15: Error: bad instruction `string +CR+LF+null'
hello.s:16: Error: bad instruction `end'
i am using: the core and libs is 0.9.8 with toolchain 'arm-gcc-3.3.4-glibc-2.3.2
cross'...
thank you in advance for your help nass
|
| Re: arm assembler for scratchbox? |

|
2007-07-13 21:57:59 |
On 13/07/07 13:23 +0300, )( sS wrote:
> i would like to know if there is an assembler for
scrachbox, like armasm or
> whatever else..
You seem to have already found the assembler of the
toolchain, now all you
need to do is to find some example code, linux kernel
definitely has some,
look for .S files under arch/arm. Those should give you an
idea what the
assembler expects. Alternatively compile some C code with -S
and look at
the output.
/lauri
_______________________________________________
Scratchbox-users mailing list
Scratchbox-users lists.scratchbox.org
http://lists.scratchbox.org/cgi-bin/mailman
/listinfo/scratchbox-users
|
|
| Re: arm assembler for scratchbox? |

|
2007-07-16 05:00:42 |
|
hm ok so i did look into the kernel/arch/arm/lib directory and found some .S assembler files. i tried to compile a simple one strchr.S , the instructions and the whole arm layout seem fairly different from the ones i had used in the past. anyway the source doesn't seem like a main program, rather a low level procedure that can be accessed from other codes..
by the assembler can't compile it (even as if - i didnt touch it)
[sbox-DEHTARGET: ~/linux-2.6.12.2/arch/arm/lib] > arm-linux-as strchr.S strchr.S: Assembler messages:
strchr.S:17: Error: bad instruction `entry(strchr)' strchr.S:26: Error: bad instruction `retinstr(mov,pc,lr)'
any ideas why? is there any tutorial page for the arm , because i haven't found any...
nass
On 7/14/07, Lauri Leukkunen < lle rahina.org">lle rahina.org> wrote:
On 13/07/07 13:23 +0300, )( sS wrote: > i would like to know if there is an assembler for scrachbox, like armasm or > whatever else..
You seem to have already found the assembler of the toolchain, now all you
need to do is to find some example code, linux kernel definitely has some, look for .S files under arch/arm. Those should give you an idea what the assembler expects. Alternatively compile some C code with -S and look at
the output.
/lauri _______________________________________________ Scratchbox-users mailing list Scratchbox-users lists.scratchbox.org">Scratchbox-users lists.scratchbox.org
http://lists.scratchbox.org/cgi-bin/mailman/listinfo/scratchbox-users
|
| Re: arm assembler for scratchbox? |

|
2007-07-16 06:01:57 |
don't feed them to arm-linux-as, use arm-linux-gcc instead.
It'll run
it through the pre-processor. Try compiling a hello world
with -S
switch to see what it should look like.
/lauri
On 7/16/07, )( sS <athanasios.silis gmail.com> wrote:
> hm ok so i did look into the kernel/arch/arm/lib
directory and found some .S
> assembler files.
> i tried to compile a simple one strchr.S , the
instructions and the whole
> arm layout seem fairly different from the ones i had
used in the past.
> anyway the source doesn't seem like a main program,
rather a low level
> procedure that can be accessed from other codes..
>
> by the assembler can't compile it (even as if - i didnt
touch it)
>
> [sbox-DEHTARGET: ~/linux-2.6.12.2/arch/arm/lib] >
arm-linux-as strchr.S
> strchr.S: Assembler messages:
> strchr.S:17: Error: bad instruction `entry(strchr)'
> strchr.S:26: Error: bad instruction
`retinstr(mov,pc,lr)'
>
> any ideas why? is there any tutorial page for the arm ,
because i haven't
> found any...
> nass
>
>
> On 7/14/07, Lauri Leukkunen <lle rahina.org> wrote:
> >
> > On 13/07/07 13:23 +0300, )( sS wrote:
> > > i would like to know if there is an assembler
for scrachbox, like armasm
> or
> > > whatever else..
> >
> > You seem to have already found the assembler of
the toolchain, now all you
> > need to do is to find some example code, linux
kernel definitely has some,
> > look for .S files under arch/arm. Those should
give you an idea what the
> > assembler expects. Alternatively compile some C
code with -S and look at
> > the output.
> >
> > /lauri
> > _______________________________________________
> > Scratchbox-users mailing list
> > Scratchbox-users lists.scratchbox.org
> >
> http://lists.scratchbox.org/cgi-bin/mailman
/listinfo/scratchbox-users
> >
>
>
> _______________________________________________
> Scratchbox-users mailing list
> Scratchbox-users lists.scratchbox.org
> http://lists.scratchbox.org/cgi-bin/mailman
/listinfo/scratchbox-users
>
>
_______________________________________________
Scratchbox-users mailing list
Scratchbox-users lists.scratchbox.org
http://lists.scratchbox.org/cgi-bin/mailman
/listinfo/scratchbox-users
|
|
| Re: arm assembler for scratchbox? |

|
2007-07-16 06:42:42 |
|
i did use the -S option.. i got the output and i deleted things that i thought were irrelevant and reprogrammed the instruction i wanted: basically i ended up with:
.text .global main main:
mov pc, #0
doing that compiles fine: [sbox-DEHTARGET: ~] > arm-linux-as doreset.s -o doreset.o [sbox-DEHTARGET: ~] >
but linking raises a warning:
[sbox-DEHTARGET: ~] > arm-linux-ld
doreset.o -o doresetLD /scratchbox/compilers/arm-gcc-3.3.4-glibc-2.3.2/bin/sbox-arm-linux-ld: warning: cannot find entry symbol _start; defaulting to 00008074 [sbox-DEHTARGET: ~] > file doresetLD doresetLD: ELF 32-bit LSB executable, ARM, version 1 (ARM), statically linked, not stripped
anyhow in the end i used what you just told me
[sbox-DEHTARGET: ~] > arm-linux-gcc -Wall doreset.s -o doreset [sbox-DEHTARGET: ~] > file doreset doreset: ELF 32-bit LSB executable, ARM, version 1 (ARM), for GNU/Linux
2.0.0, dynamically linked (uses shared libs), not stripped [sbox-DEHTARGET: ~] >
and it compiled / linked fine... when i try to run it though it produces a seg.fault. but thats beyond the scope of this list
thank you once again for your help nass
On 7/16/07, Lauri Leukkunen < lle rahina.org">lle rahina.org> wrote:
don't feed them to arm-linux-as, use arm-linux-gcc instead. It'll run it through the pre-processor. Try compiling a hello world with -S
switch to see what it should look like.
/lauri
On 7/16/07, )( sS < athanasios.silis gmail.com">athanasios.silis gmail.com> wrote: > hm ok so i did look into the kernel/arch/arm/lib directory and found some .S
> assembler files. > i tried to compile a simple one strchr.S , the instructions and the whole > arm layout seem fairly different from the ones i had used in the past. > anyway the source doesn't seem like a main program, rather a low level
> procedure that can be accessed from other codes.. > > by the assembler can't compile it (even as if - i didnt touch it) > > [sbox-DEHTARGET: ~/linux-
2.6.12.2/arch/arm/lib] > arm-linux-as strchr.S > strchr.S: Assembler messages: > strchr.S:17: Error: bad instruction `entry(strchr)' > strchr.S:26: Error: bad instruction `retinstr(mov,pc,lr)'
> > any ideas why? is there any tutorial page for the arm , because i haven't > found any... > nass > > > On 7/14/07, Lauri Leukkunen < lle rahina.org">lle rahina.org
> wrote: > > > > On 13/07/07 13:23 +0300, )( sS wrote: > > > i would like to know if there is an assembler for scrachbox, like armasm > or > > > whatever else.. > >
> > You seem to have already found the assembler of the toolchain, now all you > > need to do is to find some example code, linux kernel definitely has some, > > look for .S files under arch/arm. Those should give you an idea what the
> > assembler expects. Alternatively compile some C code with -S and look at > > the output. > > > > /lauri > > _______________________________________________ > > Scratchbox-users mailing list
> > Scratchbox-users lists.scratchbox.org">Scratchbox-users lists.scratchbox.org > > > http://lists.scratchbox.org/cgi-bin/mailman/listinfo/scratchbox-users
> > > > > _______________________________________________ > Scratchbox-users mailing list > Scratchbox-users lists.scratchbox.org">Scratchbox-users lists.scratchbox.org
> http://lists.scratchbox.org/cgi-bin/mailman/listinfo/scratchbox-users > > _______________________________________________
Scratchbox-users mailing list Scratchbox-users lists.scratchbox.org">Scratchbox-users lists.scratchbox.org http://lists.scratchbox.org/cgi-bin/mailman/listinfo/scratchbox-users
|
[1-5]
|
|