| View previous topic :: View next topic |
| Author |
Message |
JorDy
Joined: 11 Dec 2005 Posts: 121
|
Posted: Sun May 07, 2006 9:55 am Post subject: assembly help |
|
|
the compiler keeps returning these errors wheni try to compile my functions.s
file with my main c file
functions.s:
| Code: |
#include "r5900_regs.h"
.set noreorder
.text
.global notarealfnc
.ent notarealfnc
notarealfnc:
lw v0, 0x00(t0)
addiu v0, v0 4
sw v0, _addr
jr ra
nop
.end notarealfnc
|
ive defined my function in the c source as "extern void notarealfnc(void);" but the compiler throws out these errors, the only command it likes is a nop:
| Code: | $ make
ee-as -G0 functions.s -o functions.o
functions.s: Assembler messages:
functions.s:0: Warning: end of file not at end of a line; newline inserted
functions.s:10: Error: illegal operands `lw v0,0x00(t0)'
functions.s:11: Error: illegal operands `addiu v0,v0 4'
functions.s:12: Error: illegal operands `sw v0,_addr'
functions.s:13: Error: illegal operands `jr ra'
make: *** [functions.o] Error 1
|
thnx in advance |
|
| Back to top |
|
 |
jbit Site Admin

Joined: 28 May 2005 Posts: 293 Location: København, Danmark
|
Posted: Sun May 07, 2006 7:50 pm Post subject: |
|
|
Unless I'm forgetting something, gas (ee-as) can't use "#include", since it doesn't invoke the CPP (C Preprocessor), ".include" does work though.
You can of course use ee-gcc to compile a .S or .s file though, if you want to use CPP directives. (hint: r5900_regs.h probably requires you do this)
Hope this helps. |
|
| Back to top |
|
 |
Saotome

Joined: 03 Apr 2004 Posts: 182
|
Posted: Sun May 07, 2006 8:44 pm Post subject: |
|
|
...and if that doesn't work (I'm not saying that it shouldn't)
you could try to put a "$" before the register names (i.e. "addiu $t0,$t0,1"), thats how I solved the problem ;) _________________ infj |
|
| Back to top |
|
 |
JorDy
Joined: 11 Dec 2005 Posts: 121
|
Posted: Sun May 07, 2006 10:13 pm Post subject: |
|
|
| thanks alot guys the $ did help but my addiu also didnt like me using register names for some reason so i had to use the register numbers |
|
| Back to top |
|
 |
ooPo Site Admin
Joined: 17 Jan 2004 Posts: 2032 Location: Canada
|
Posted: Mon May 08, 2006 2:54 pm Post subject: |
|
|
| Quote: | > I tried to #include the .h file in the assembley file and feed it to
> the c preprocessor. The output had the #include file data in it, so
> 'as' choked.
Use gcc to preprocess the assembly, like so:
gcc -c foo.S
Both .S and .s are assembler. By convention, .S is assembly source that
needs to be preprocessed. Otherwise, gcc doesn't care. |
http://sourceware.org/ml/crossgcc/1997/msg00002.html
There's also an include file in ps2sdk somewhere that maps the register numbers to register names. |
|
| Back to top |
|
 |
|