Page 1 of 1

I can't call any function

Posted: Sat Oct 29, 2005 11:25 pm
by Flamaros
Hi I am a newbie and I am french.
I have set an environment for developping on my computer and now I try to test some code on the PS2 but can't can't call a function, but the others operations do not cause an error.

I have try to exucte code like this :

Code: Select all


void test()
{
}

int main()
{
  int var;

  var = 2*5;
  for &#40;var = 0; var < 100; var++&#41;
     ;
  test&#40;&#41;;
  return 0;
&#125;


When I don't call function test() TV stay on naplink screen (I can see status of cable and computer connection), but when I call the test() function I have an error screen with many adresse (I don't understand this screen).

I use the Makefile of the star simulation (the first exemple in the tutorials)


PS : I use NapClient with an usb cable.

Posted: Mon Oct 31, 2005 7:33 pm
by Flamaros
I have try to compile without any lib this code but there no effect, I have always the same error :

Code: Select all

Naplink Exception Handler

Exception error &#58; address Error &#40;store&#41;
Status&#58; 70030C13 EPC&#58; 0040015C  BadVaddr&#58; 81FFFFD0

...

Someone knows how can I analyse this screen?

I have remove -fnonnull-objects CFLAGS option in Makefile because I have the massage "cc1: unrecognized option "-fnonnull-objects", my probleme can come to here?

Posted: Mon Oct 31, 2005 7:47 pm
by EEUG
...you can try to generate ".map" file, which will contain memory addresses of your data and functions. Then you can compare value of EPC from the exception dump with these addresses to see where approximately the program crashed. ".map" file can be generated by adding this: "-Xlinker -Map -Xlinker <map_filename>" to the linker's command line...

Posted: Mon Oct 31, 2005 7:50 pm
by Drakonite
Er... and if your function isn't a pointless empty function?

Posted: Mon Oct 31, 2005 8:13 pm
by Flamaros
Here you can see my Makefile

Code: Select all

PS2LIB		=	/usr/ps2dev
LIBDIR		=	$&#40;PS2LIB&#41;/ee/lib
INCLUDES	=	-I$&#40;PS2LIB&#41;/common/include -I$&#40;PS2LIB&#41;/ee/include -I/usr/include

SRC		=	hello.c\
#			my_nprintf.c\
#			hw.s

OBJS		=	$&#40;SRC&#58;.c=.o&#41;

LCFILE		=	linkfile

LIBS		=	#-lc -lm -lkernel -lmc -lsyscall -ldebug

PREFIX		=	ee
AS		=	$&#40;PREFIX&#41;-gcc
CC		=	$&#40;PREFIX&#41;-gcc
CPP		=	cpp
LD		=	$&#40;PREFIX&#41;-gcc
DVPASM		=	$&#40;PREFIX&#41;-dvp-as
OBJDUMP		=	$&#40;PREFIX&#41;-objdump
RM		=	/bin/rm -f

#CFLAGS      =	-O2 -EL -pipe -Wall -Wa,-al -fno-common -Wall -mips3 -mcpu=r5900 -ffreestanding -fnonnull-objects -fno-builtin -fshort-double -nostartfiles -mlong64 -mhard-float -mno-abicalls -c
CFLAGS		=	-O2 -EL -pipe -Wall -Wa,-al -fno-common -Wall -mips3 -mcpu=r5900 -ffreestanding -fno-builtin -fshort-double -nostartfiles -mlong64 -mhard-float -mno-abicalls -c
CXXFLAGS	=	-O2 -Wall -Wa,-al -fno-exceptions -fno-common
LDFLAGS		=	-Wl,-Map,$&#40;TARGET&#41;.map -L$&#40;LIBDIR&#41;

.SUFFIXES	&#58;	.c .s .cc .dsm

all		&#58;	starsim.elf

starsim.elf	&#58;	$&#40;OBJS&#41;
			$&#40;LD&#41; -o $@ -T $&#40;LCFILE&#41; $&#40;OBJS&#41; $&#40;LDFLAGS&#41; $&#40;LIBS&#41;

crt0.o		&#58;
			$&#40;AS&#41; $&#40;CFLAGS&#41; crt0.S -o $@ > $*.lst

.s.o		&#58;
			$&#40;AS&#41; $&#40;CFLAGS&#41; $&#40;INCLUDES&#41; $< -o $@ > $*.lst

.S.o		&#58;
			$&#40;AS&#41; $&#40;CFLAGS&#41; $&#40;INCLUDES&#41; $< -o $@ > $*.lst

.c.o		&#58;
			$&#40;CC&#41; $&#40;CFLAGS&#41; $&#40;INCLUDES&#41; -c $< -o $*.o > $*.lst

.cc.o		&#58;
			$&#40;CC&#41; $&#40;CXXFLAGS&#41; $&#40;INCLUDES&#41; -c $< -o $*.o > $*.lst

clean		&#58;
			$&#40;RM&#41; *.o *~ *.map *.lst core *.dis *.elf


I now, I am trying to recompile ee-gcc

Posted: Mon Oct 31, 2005 8:26 pm
by EEUG
@Drakonite: then at least there's some hint about actual location of the problem :). In case of SMS it helped me a lot...

Posted: Mon Oct 31, 2005 8:40 pm
by Flamaros
Finally I have install the packsetup (http://ps2dev.org/ps2/Tools/Toolchain/P ... _for_Win32) but I have always the same error and all sample that i have compile crash. And after the Error screen I need reboot manually the PS2 because the Napclient reset have no effect (stay on a black screen).

Posted: Mon Oct 31, 2005 9:29 pm
by Flamaros
The only one sample that I can compile is pad_exemple.elf, but if I add a return before the end the programme crash.

And know I try to understand why I can't call just a printf.

I need to do something special to init or close the CPU or anything else?
I need to do something with my .elf file before use napclient?