forums.ps2dev.org Forum Index forums.ps2dev.org
Homebrew PS2, PSP & PS3 Development Discussions
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

I can't call any function

 
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PS2 Development
View previous topic :: View next topic  
Author Message
Flamaros



Joined: 29 Oct 2005
Posts: 5

PostPosted: Sat Oct 29, 2005 11:25 pm    Post subject: I can't call any function Reply with quote

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:


void test()
{
}

int main()
{
  int var;

  var = 2*5;
  for (var = 0; var < 100; var++)
     ;
  test();
  return 0;
}




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.
Back to top
View user's profile Send private message
Flamaros



Joined: 29 Oct 2005
Posts: 5

PostPosted: Mon Oct 31, 2005 7:33 pm    Post subject: Reply with quote

I have try to compile without any lib this code but there no effect, I have always the same error :
Code:

Naplink Exception Handler

Exception error : address Error (store)
Status: 70030C13 EPC: 0040015C  BadVaddr: 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?
Back to top
View user's profile Send private message
EEUG



Joined: 13 May 2005
Posts: 136
Location: The Netherlands

PostPosted: Mon Oct 31, 2005 7:47 pm    Post subject: Reply with quote

...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...
Back to top
View user's profile Send private message
Drakonite
Site Admin


Joined: 17 Jan 2004
Posts: 989

PostPosted: Mon Oct 31, 2005 7:50 pm    Post subject: Reply with quote

Er... and if your function isn't a pointless empty function?
_________________
Shoot Pixels Not People!
Makeshift Development
Back to top
View user's profile Send private message Visit poster's website
Flamaros



Joined: 29 Oct 2005
Posts: 5

PostPosted: Mon Oct 31, 2005 8:13 pm    Post subject: Reply with quote

Here you can see my Makefile

Code:

PS2LIB      =   /usr/ps2dev
LIBDIR      =   $(PS2LIB)/ee/lib
INCLUDES   =   -I$(PS2LIB)/common/include -I$(PS2LIB)/ee/include -I/usr/include

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

OBJS      =   $(SRC:.c=.o)

LCFILE      =   linkfile

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

PREFIX      =   ee
AS      =   $(PREFIX)-gcc
CC      =   $(PREFIX)-gcc
CPP      =   cpp
LD      =   $(PREFIX)-gcc
DVPASM      =   $(PREFIX)-dvp-as
OBJDUMP      =   $(PREFIX)-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,$(TARGET).map -L$(LIBDIR)

.SUFFIXES   :   .c .s .cc .dsm

all      :   starsim.elf

starsim.elf   :   $(OBJS)
         $(LD) -o $@ -T $(LCFILE) $(OBJS) $(LDFLAGS) $(LIBS)

crt0.o      :
         $(AS) $(CFLAGS) crt0.S -o $@ > $*.lst

.s.o      :
         $(AS) $(CFLAGS) $(INCLUDES) $< -o $@ > $*.lst

.S.o      :
         $(AS) $(CFLAGS) $(INCLUDES) $< -o $@ > $*.lst

.c.o      :
         $(CC) $(CFLAGS) $(INCLUDES) -c $< -o $*.o > $*.lst

.cc.o      :
         $(CC) $(CXXFLAGS) $(INCLUDES) -c $< -o $*.o > $*.lst

clean      :
         $(RM) *.o *~ *.map *.lst core *.dis *.elf




I now, I am trying to recompile ee-gcc
Back to top
View user's profile Send private message
EEUG



Joined: 13 May 2005
Posts: 136
Location: The Netherlands

PostPosted: Mon Oct 31, 2005 8:26 pm    Post subject: Reply with quote

@Drakonite: then at least there's some hint about actual location of the problem :). In case of SMS it helped me a lot...
Back to top
View user's profile Send private message
Flamaros



Joined: 29 Oct 2005
Posts: 5

PostPosted: Mon Oct 31, 2005 8:40 pm    Post subject: Reply with quote

Finally I have install the packsetup (http://ps2dev.org/ps2/Tools/Toolchain/PS2Dev_Environment_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).
Back to top
View user's profile Send private message
Flamaros



Joined: 29 Oct 2005
Posts: 5

PostPosted: Mon Oct 31, 2005 9:29 pm    Post subject: Reply with quote

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?
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PS2 Development All times are GMT + 10 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group