Discuss the development of software, tools, libraries and anything else that helps make ps2dev happen.
Moderators: cheriff , Herben
JorDy
Posts: 121 Joined: Sun Dec 11, 2005 8:45 am
Post
by JorDy » Sun May 07, 2006 9:55 am
the compiler keeps returning these errors wheni try to compile my functions.s
file with my main c file
functions.s:
Code: Select all
#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: Select all
$ 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
jbit
Site Admin
Posts: 293 Joined: Sat May 28, 2005 3:11 am
Location: København, Danmark
Contact:
Post
by jbit » Sun May 07, 2006 7:50 pm
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.
Saotome
Posts: 182 Joined: Sat Apr 03, 2004 3:45 am
Post
by Saotome » Sun May 07, 2006 8:44 pm
...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
JorDy
Posts: 121 Joined: Sun Dec 11, 2005 8:45 am
Post
by JorDy » Sun May 07, 2006 10:13 pm
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
ooPo
Site Admin
Posts: 2023 Joined: Sat Jan 17, 2004 9:56 am
Location: Canada
Contact:
Post
by ooPo » Mon May 08, 2006 2:54 pm
> 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.