Win32 native Toolchain for PSPSDK

Discuss the development of new homebrew software, tools and libraries.

Moderators: cheriff, TyRaNiD

Post Reply
User avatar
jean
Posts: 489
Joined: Sat Jan 05, 2008 2:44 am

Post by jean »

...actually i'm doing both....but i somehow feel that "right" and "wrong" should not depend on "easy" or "difficult"...
KickinAezz
Posts: 328
Joined: Sun Jun 03, 2007 10:05 pm

Post by KickinAezz »

Manual solution for now to compile stubs with psp-gcc using this toolchain itself.
psp-gcc -I. -Id:/PSPSdk/psp/sdk/include -O2 -G0 -g -Wall -c -o myKutils.o myKutils.S
Atleast I donot have to switch to cygwin back and forth!
Intrigued by PSP system Since December 2006.
Use it more for Development than for Gaming.
hlide
Posts: 739
Joined: Sun Sep 10, 2006 2:31 am

Post by hlide »

KickinAezz wrote:Manual solution for now to compile stubs with psp-gcc using this toolchain itself.
psp-gcc -I. -Id:/PSPSdk/psp/sdk/include -O2 -G0 -g -Wall -c -o myKutils.o myKutils.S
Atleast I donot have to switch to cygwin back and forth!
i'm wondering if adding :

Code: Select all

%.o : %.S
	$&#40;AS&#41; $&#40;ASFLAGS&#41; -c -o $@ $<
in build.mak and build-prx.mak (\pspsdk\psp\sdk\lib), may help too.
KickinAezz
Posts: 328
Joined: Sun Jun 03, 2007 10:05 pm

Post by KickinAezz »

hlide wrote:
KickinAezz wrote:Manual solution for now to compile stubs with psp-gcc using this toolchain itself.
psp-gcc -I. -Id:/PSPSdk/psp/sdk/include -O2 -G0 -g -Wall -c -o myKutils.o myKutils.S
Atleast I donot have to switch to cygwin back and forth!
i'm wondering if adding :

Code: Select all

%.o &#58; %.S
	$&#40;AS&#41; $&#40;ASFLAGS&#41; -c -o $@ $<
in build.mak and build-prx.mak (\pspsdk\psp\sdk\lib), may help too.
Gives me :

Code: Select all

D&#58;/PSPSdk/psp/sdk/lib/build.mak&#58;207&#58; *** multiple target patterns.  Stop.
Intrigued by PSP system Since December 2006.
Use it more for Development than for Gaming.
mrlinx
Posts: 9
Joined: Thu Mar 20, 2008 3:24 am

Post by mrlinx »

Just what I needed. Thank You!
ne0h
Posts: 386
Joined: Thu Feb 21, 2008 2:15 am

Post by ne0h »

Excuse me, but i've try to compile the source of the M33 Psar Dumper, but
I reiceve this error:

unrecognized opcode `stub_start "pspPSAR",0x40090000,0x00020005'
unrecognized opcode `stub_func 0x56C924E1,pspPSARInit'
unrecognized opcode `stub_func 0x9C91DD9D,pspPSARGetNextFile'
unrecognized opcode `stub_end'

The file ext is .S not .s, i haven't find the stub.S file, where can I find it?
and there are other file needed for "compile" .S files?

Makefile:

Code: Select all

TARGET = newpsardump
OBJS = main.o pspPSAR.o pspDecrypt.o

INCDIR = ../include
CFLAGS = -O2 -G0 -Wall
CXXFLAGS = $&#40;CFLAGS&#41; -fno-exceptions -fno-rtti
ASFLAGS = $&#40;CFLAGS&#41; -c

LIBDIR = ../lib
LDFLAGS = 
LIBS = -lpsppower

PSP_FW_VERSION = 271

EXTRA_TARGETS = EBOOT.PBP
PSP_EBOOT_TITLE = NEW PSAR DUMPER

BUILD_PRX = 1

include $&#40;PSPSDK&#41;/lib/build.mak
I've the Heimdall win32 dev-kit v.0.4
Please, help...
User avatar
jean
Posts: 489
Joined: Sat Jan 05, 2008 2:44 am

Post by jean »

.s (or.S) files ARE the stubs themselves... when you specify a ".o" as a target, the compiler sees if there's a ".c" ".cpp" or a ".s" to make specified target object that lately will be linked with the others. The compiler will seek for functions in sources or stubs: a stub is something that says "dear compiler, i know where to find such a function, don't seek elsewhere" mainly because it's a sort of pointer to firmware's or your module's functions. So, if you have

Code: Select all

OBJS = main.o pspPSAR.o pspDecrypt.o 
then probably you have a main.c; the other 2 can be either .c or .s (i never played with that code, sorry)...from your message error it's likely that you need a "pspPSAR.s"...but again, i've never played with that code myself.
In modern custom firmwares, kernel functions like those needed to dump a PSAR are to be put in a kernel prx. To build a program that will make use of that prx (statically linked ), its stub is needed. So when bulding a program subdivided between main trunk and modules, you have to compile prxes FIRST, then copy all "yourprxname.s" in the folder of main program and THEN build it.
If someone has a direct experience, then i'll let him answer more indeep. Good luck.

jean
ne0h
Posts: 386
Joined: Thu Feb 21, 2008 2:15 am

Post by ne0h »

Excuse me for my english but i've don't understand, how to resolve?
hlide
Posts: 739
Joined: Sun Sep 10, 2006 2:31 am

Post by hlide »

Some notes :

Code: Select all

file.s
    Assembler code.
file.S
file.sx
    Assembler code which must be preprocessed.
since MINGW PSPSDK cannot distinguish .s and .S, rename .S files with .sx may work.

Otherwise, i was looking for a way to force preprocessor when assembling : two solutions.

First solution, in your own Makefile, replace :

Code: Select all

ASFLAGS = ...
with

Code: Select all

ASFLAGS= ... -c -x assembler-with-cpp
Second solution, so you don't need to modify your makefiles,
in "pspsdk\psp\sdk\lib\build.mak" (build-prx.mak too), replace :

Code: Select all

ASFLAGS  &#58;= $&#40;CFLAGS&#41; $&#40;ASFLAGS&#41;
with

Code: Select all

ASFLAGS  &#58;= $&#40;CFLAGS&#41; $&#40;ASFLAGS&#41; -c -x assembler-with-cpp
It works for me
ne0h
Posts: 386
Joined: Thu Feb 21, 2008 2:15 am

Post by ne0h »

I've resolve with:

Code: Select all

ASFLAGS  &#58;= $&#40;CFLAGS&#41; $&#40;ASFLAGS&#41; -c -x assembler-with-cpp
But i haven't the file "pspstub.s", where I can find it?
hlide
Posts: 739
Joined: Sun Sep 10, 2006 2:31 am

Post by hlide »

ne0h wrote:I've resolve with:

Code: Select all

ASFLAGS  &#58;= $&#40;CFLAGS&#41; $&#40;ASFLAGS&#41; -c -x assembler-with-cpp
But i haven't the file "pspstub.s", where I can find it?
no idea, the solutions I gave here were for assembling EXISTING .S files, not for CREATING them :).

... Reading your earlier post ...

i don't understand your problem. The errors you gave shows that you have a .S file which was assembled WITHOUT being preprocessed. But this file needs to be preprocessed before being assembled. What I gave as solution should allow this file to be assembled AFTER being processed. So you shouldn't have any problem now if you use one of my solutions.
ne0h
Posts: 386
Joined: Thu Feb 21, 2008 2:15 am

Post by ne0h »

no no, in the file .S there are:

#include "pspstub.s"

but is not included in the original source!
hlide
Posts: 739
Joined: Sun Sep 10, 2006 2:31 am

Post by hlide »

ne0h wrote:no no, in the file .S there are:

#include "pspstub.s"

but is not included in the original source!

sheeeh ! this file is a PSPSDK file ! which means YOU DON'T NEED TO HAVE this file in your project since it is already provided in PSPSDK.
ne0h
Posts: 386
Joined: Thu Feb 21, 2008 2:15 am

Post by ne0h »

I've resolved with reinstall the sdk! Tanks so much at all!
phobox
Posts: 127
Joined: Mon Mar 24, 2008 6:22 pm

Post by phobox »

How can I update the pspsdk in this win32 toolchain? Is it possible through the svn or I do need to wait a new update from Heimdall?
Ciao! from Italy
Heimdall
Posts: 245
Joined: Thu Nov 10, 2005 1:29 am
Location: Netherlands
Contact:

Post by Heimdall »

To update you have 2 options:

1st wait for me to have some free time and build a nice installer for you ;-)
2nd download the toolchain script from my site, http://www.jetcube.eu/projects/gcc/pspt ... 080311.zip, read the read me and get the build environment with the stuff i wrote there, for a more detailed build environment just digg on the blog it is the same build env i used for porting a linux game engine (raydium) to windows and run the script and wait about 2hr (deppends on your machine) and you'll have the same result.

Cheers!
phobox
Posts: 127
Joined: Mon Mar 24, 2008 6:22 pm

Post by phobox »

I think I'll wait for a nice installer for us ;-)

thanks
Ciao! from Italy
Heimdall
Posts: 245
Joined: Thu Nov 10, 2005 1:29 am
Location: Netherlands
Contact:

Post by Heimdall »

In the experimental folder there is a 0.6.3 build with the latest SVN changes from yesterday.

It is on experimental because I got 2 bash errors building but I think it should be ok. I'll try to build it again tonight and tag it as release 0.7.

http://sourceforge.net/project/showfile ... _id=223830
Last edited by Heimdall on Tue Apr 08, 2008 6:49 pm, edited 1 time in total.
Heimdall
Posts: 245
Joined: Thu Nov 10, 2005 1:29 am
Location: Netherlands
Contact:

Post by Heimdall »

build 0.7 is out:

these were the changes:

* Removed the dependency on groff, less, cp, mkdir, rm on the script,
now they are downloaded from the internet
* Added patch for GCC to accept: -mpreferred-stack-boundary=#
* update to SVN 2377
* PS2DEV toolchain patches are downloaded from the internet, so no
need to keep then sync with this TC
* Update usbpsplink to latest SVN
* No input required during all TC script, all configs are
- SourceForge MIRROR url
- SVN host for PS2DEV
- target dir (e.g. c:/pspsdk)

get it from the usual places:

http://www.jetcube.eu (sources)
http://sourceforge.net/project/showfile ... _id=223830 (binaries)
Last edited by Heimdall on Tue Apr 08, 2008 6:49 pm, edited 1 time in total.
KickinAezz
Posts: 328
Joined: Sun Jun 03, 2007 10:05 pm

Post by KickinAezz »

Heimdall wrote:build 0.7 is out:

these were the changes:

* Removed the dependency on groff, less, cp, mkdir, rm on the script,
now they are downloaded from the internet
* Added patch for GCC to accept: -mpreferred-stack-boundary=#
* update to SVN 2377
* PS2DEV toolchain patches are downloaded from the internet, so no
need to keep then sync with this TC
* Update usbpsplink to latest SVN
* No input required during all TC script, all configs are
- SourceForge MIRROR url
- SVN host for PS2DEV
- target dir (e.g. c:/pspsdk)

get it from the usual places:

http://www.jetcube.eu (sources)
http://www.box.net/shared/icfh8q944s#1:12897153 (binaries)
One of the Precompiled Toolchains out there! Thank you.
Intrigued by PSP system Since December 2006.
Use it more for Development than for Gaming.
ne0h
Posts: 386
Joined: Thu Feb 21, 2008 2:15 am

Post by ne0h »

Very good work Heimdall,
tanks, tanks, tanks and tanks!
phobox
Posts: 127
Joined: Mon Mar 24, 2008 6:22 pm

Post by phobox »

hi,
what does this mean?

PS2DEV toolchain patches are downloaded from the internet, so no
need to keep then sync with this TC

and this?

SVN host for PS2DEV
Ciao! from Italy
Heimdall
Posts: 245
Joined: Thu Nov 10, 2005 1:29 am
Location: Netherlands
Contact:

Post by Heimdall »

It means that before i had the binaries for the rm, cp and mkdir included with my source distribution, but in case you don't trust me (you are entitled to it) i now download them from the sourceforge projects during the build of the toolchain, this way you don't blame me if they don't work right :)

The second thing was, that on my toolchain scripts i used to pack the svn code from ps2dev.org, again and to avoid having to keep synchronizing all the time, I now also download them from the SVN repository.

If your internet connection is free you can use the SVN protocol and connect directly to ps2dev.org or if you're in a restrictive place you can use jim's http svn replication.

Any other questions let me know!
Heimdall
Posts: 245
Joined: Thu Nov 10, 2005 1:29 am
Location: Netherlands
Contact:

Post by Heimdall »

hilde, ne0h, jean, KickinAezz and anyone else i might have forgotten:

The problem with .S and .s files *IS NOT* related to GCC, it is all related to the gnu make port on windows, it seems that version 3.80 and 3.81 and even the latest snapshot from mingw is faulty, however 3.79 seems to work fine, for a quick fix download 3.79 from here:

http://downloads.sourceforge.net/mingw/ ... g_mirror=1

and replace the make.exe from your pspsdk\bin folder with the make.exe inside the tar.gz

I'll test if the samples compile with this version without any problem and if they do, i'll start packing this one instead of 3.81.
ne0h
Posts: 386
Joined: Thu Feb 21, 2008 2:15 am

Post by ne0h »

For this problem i've resolved with put this line in the makefile:

Code: Select all

ASFLAGS  &#58;= $&#40;CFLAGS&#41; $&#40;ASFLAGS&#41; -c -x assembler-with-cpp
I've try to replace the make.exe in the pspsdk\bin folder but my compiler give me the same errors!
I've integrate the pspsdk with Dev-C++ (Bloodshed), Eclipse is better?
However tanks Heimdall!
Heimdall
Posts: 245
Joined: Thu Nov 10, 2005 1:29 am
Location: Netherlands
Contact:

Post by Heimdall »

ne0h wrote:I've try to replace the make.exe in the pspsdk\bin folder but my compiler give me the same errors!
Since i've no idea what exactly is your specific problem with asm files, I tryed to reproduce the error with minifire asm demo from TyRaNiD.

With the original make it fails because it replaces the name main.S with main.s when invoking psp-gcc and it gives errors, with 3.79 the name is correct and it compiles and builds the EBOOT perfectly (well only after adding the true command to the SDK whick basically is a simple int main() { return 0;} C app.

Can you please send a sample project with the error so i can try to investigate it further.

Thanks!
Heimdall
Posts: 245
Joined: Thu Nov 10, 2005 1:29 am
Location: Netherlands
Contact:

Post by Heimdall »

ne0h,

I've downloaded the m33 psar dumper and build it with SDK 0.7 and new make.exe and this is my output:

Code: Select all

Microsoft Windows XP &#91;Versão 5.1.2600&#93;
&#40;C&#41; Copyright 1985-2001 Microsoft Corp.

C&#58;\Documents and Settings\Paulo>cd\

C&#58;\>cd gdk\M33_NEWPSARDUMPER

C&#58;\gdk\M33_NEWPSARDUMPER>cd src\main

C&#58;\gdk\M33_NEWPSARDUMPER\src\main>make
psp-gcc -I../include -I. -IC&#58;/pspsdk/psp/sdk/include -O2 -G0 -Wall -D_PSP_FW_VER
SION=271   -c -o main.o main.c
psp-gcc -I../include -I. -IC&#58;/pspsdk/psp/sdk/include -O2 -G0 -Wall -I../include
-I. -IC&#58;/pspsdk/psp/sdk/include -O2 -G0 -Wall -c   -c -o pspPSAR.o pspPSAR.S
psp-gcc -I../include -I. -IC&#58;/pspsdk/psp/sdk/include -O2 -G0 -Wall -I../include
-I. -IC&#58;/pspsdk/psp/sdk/include -O2 -G0 -Wall -c   -c -o pspDecrypt.o pspDecrypt
.S
psp-gcc -I../include -I. -IC&#58;/pspsdk/psp/sdk/include -O2 -G0 -Wall -D_PSP_FW_VER
SION=271  -L../lib -L. -LC&#58;/pspsdk/psp/sdk/lib -specs=C&#58;/pspsdk/psp/sdk/lib/prxs
pecs -Wl,-q,-TC&#58;/pspsdk/psp/sdk/lib/linkfile.prx   main.o pspPSAR.o pspDecrypt.o
 C&#58;/pspsdk/psp/sdk/lib/prxexports.o -lpsppower -lpspdebug -lpspdisplay -lpspge -
lpspctrl -lpspsdk -lc -lpspnet -lpspnet_inet -lpspnet_apctl -lpspnet_resolver -l
psputility -lpspuser -lpspkernel -o newpsardump.elf
psp-fixup-imports newpsardump.elf
psp-prxgen newpsardump.elf newpsardump.prx
mksfo 'NEW PSAR DUMPER' PARAM.SFO
pack-pbp EBOOT.PBP PARAM.SFO NULL  \
        NULL NULL NULL  \
        NULL  newpsardump.prx NULL
&#91;0&#93;        408 bytes | PARAM.SFO
&#91;1&#93;          0 bytes | NULL
&#91;2&#93;          0 bytes | NULL
&#91;3&#93;          0 bytes | NULL
&#91;4&#93;          0 bytes | NULL
&#91;5&#93;          0 bytes | NULL
&#91;6&#93;      95806 bytes | newpsardump.prx
&#91;7&#93;          0 bytes | NULL

C&#58;\gdk\M33_NEWPSARDUMPER\src\main>
and the Makefile was untouched:

Code: Select all

TARGET = newpsardump
OBJS = main.o pspPSAR.o pspDecrypt.o

INCDIR = ../include
CFLAGS = -O2 -G0 -Wall
CXXFLAGS = $&#40;CFLAGS&#41; -fno-exceptions -fno-rtti
ASFLAGS = $&#40;CFLAGS&#41; -c

LIBDIR = ../lib
LDFLAGS = 
LIBS = -lpsppower

PSP_FW_VERSION = 271

EXTRA_TARGETS = EBOOT.PBP
PSP_EBOOT_TITLE = NEW PSAR DUMPER

BUILD_PRX = 1

PSPSDK=$&#40;shell psp-config --pspsdk-path&#41;
include $&#40;PSPSDK&#41;/lib/build.mak
Can you confirm you're using the correct make (just for the sake of it), this is what shows on my system:

Code: Select all

C&#58;\gdk\M33_NEWPSARDUMPER\src\main>make --version
GNU Make version 3.79.1, by Richard Stallman and Roland McGrath.
Built for mingw32
Copyright &#40;C&#41; 1988, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 2000
        Free Software Foundation, Inc.
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE.

Report bugs to <bug-make@gnu.org>.


C&#58;\gdk\M33_NEWPSARDUMPER\src\main>
Cheers!
ne0h
Posts: 386
Joined: Thu Feb 21, 2008 2:15 am

Post by ne0h »

Yes the output version is the same, but i haven't your last SDK! I've the 0.4 version, excuse me but i can't update it yet becuse i'ven't the ADSL, now i've the modem 56k connection and download 30 MB of data it was too slow!
However when i've downloaded your lastest SDK, if the compiler give me the same error i'll contact you! Excuse me for the bad english!
snowsquirrel
Posts: 51
Joined: Sun Feb 24, 2008 3:36 am

Post by snowsquirrel »

Any chance of gdb or insight making it into this?
~S
Heimdall
Posts: 245
Joined: Thu Nov 10, 2005 1:29 am
Location: Netherlands
Contact:

Post by Heimdall »

gdb 6.7 is included! :)
Post Reply