Win32 native Toolchain for PSPSDK

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

Moderators: cheriff, TyRaNiD

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

Win32 native Toolchain for PSPSDK

Post by Heimdall »

-- Start of Editing

To keep it simple, the native SDK can be downloaded from here:

http://minpspw.sourceforge.net

No Cygwin or MSys required. It contains:

* Latest GCC
* Latest Newlib
* Documentation
* Popular dev libraries (DevPaks)

To get into MinPSPW you can use either Visual Studio, Eclipse or your favourite IDE.

If you like Eclipse have a look at this eBook (still in early alpha stage of development): http://minpspw.sourceforge.net/files/pspeclipse.pdf

-- End of Editing

Hi guys,

I've been playing around with the PSPSDK and found it quite boring to have to build it and use the cygwin POSIX emulation layer. I tried DevKitPro and the SDK is "quite old", almost 1 year.

So I decided to build it using both projects with the following ideas in mind:

* No need for any bash/shell use only the current DOS box from Win32
* Prefer ps2dev.org GCC/NEWLIB/BINUTILS patches to anyone else
* Make it compatible with Eclipse CDT

I managed to get it working, you can get the full details on my blog.

Or for the impatient:

http://sourceforge.net/project/showfile ... _id=223830

With this option, on a windows machine with XP and no cygwin and no c/c++ compiler you just install the installer and eclipse CDT, after you start eclipse set your "compiler invocation command" to psp-gcc et voilá

you have auto complete, syntax validation and build from the default makefiles.

Cheers[/i]
Last edited by Heimdall on Thu Jan 29, 2009 1:34 am, edited 2 times in total.
User avatar
jean
Posts: 489
Joined: Sat Jan 05, 2008 2:44 am

Post by jean »

Speaking of IDEs, I'm still for netbeans...coding C/C++ with netbeans 6 is like stealing candies from a child without an arm...Eclipse was the first java based cross-platform IDE, but by now it's slow (don't tell me it isn't if you use it on a core duo II...) and generally speaking seems to be put togheter with glue and tape... only annoying thing about netbeans is its loooong startup time if you have some advanced modules installed....
PS: anyway, thanks a lot...i would have done something like this since a year, but never got time....Will surely try it!
Heimdall
Posts: 245
Joined: Thu Nov 10, 2005 1:29 am
Location: Netherlands
Contact:

Post by Heimdall »

I use both NetBeans and Eclipse, and yes Netbeans looks much much better but for some reason I feel that C++ development is easier on Eclipse mostly because the code complete works better, so when i'm typing Eclipse gives me better help since I'm kind of noob on the PSPSDK API.

About speed, i kind of cheat on it, I have the latest JRE 1.6.0_04 running on a ramdrive and launch the IDE using that JRE so the responsiveness is higher than loading everything from the HDD.

This means that you need some extra ram of course.

My specs are (it's a laptop):

Windows Media Center 2005
1.83GHz Intel Core Duo T2400
1GB PC4200 DDR2 RAM
160GB hard disk
256MB nVidia GeForce Go 7400 graphics

The script builds the cross compiler and the SDK in less than 90 minutes. I started it last night during a movie on TV and it finished before the movie.

I tryed it on a DELL Latitude D620 with 2GB of RAM and Windows XP Pro and I get the same results. Although Netbeans on this one sucks, i guess it's because of it's video card driver...

Anyway, since the compiler runs from the command line, using it with Netbeans C++ should be easy... i guess...
BlackShark
Posts: 11
Joined: Fri Mar 02, 2007 5:06 pm
Contact:

Post by BlackShark »

hey, is there any special instructions for getting this to work with Dev-C++?
im getting the, "/lib/build.mak: No such file or directory."
error.
Programmer van der C
Heimdall
Posts: 245
Joined: Thu Nov 10, 2005 1:29 am
Location: Netherlands
Contact:

Post by Heimdall »

I never used Dev-C++ make sure you have a env variable called PSPSDK that points to %your install dir%/psp/sdk and that %your install dir%/bin is in your path.

Then try to run the makefile from a dos shell.

Note however that the makefiles were changed, all usages of the psp-path utility were removed because the make tool is not able to launch it.

In other words were you had:
PSPSDK.*=.*$(shell psp-config --pspsdk-path)

you should comment because the included build.mak will use a env var instead

i used a sed script to fix it like this:

cat $1 | sed 's/PSPSDK.*=.*$(shell psp-config --pspsdk-path)/# PSPSDK MUST BE AN ENV VAR/' > $1
BlackShark
Posts: 11
Joined: Fri Mar 02, 2007 5:06 pm
Contact:

Post by BlackShark »

Heimdall wrote:I never used Dev-C++ make sure you have a env variable called PSPSDK that points to %your install dir%/psp/sdk and that %your install dir%/bin is in your path.

Then try to run the makefile from a dos shell.

Note however that the makefiles were changed, all usages of the psp-path utility were removed because the make tool is not able to launch it.

In other words were you had:
PSPSDK.*=.*$(shell psp-config --pspsdk-path)

you should comment because the included build.mak will use a env var instead

i used a sed script to fix it like this:

cat $1 | sed 's/PSPSDK.*=.*$(shell psp-config --pspsdk-path)/# PSPSDK MUST BE AN ENV VAR/' > $1
that did it, thanks :)
Programmer van der C
Heimdall
Posts: 245
Joined: Thu Nov 10, 2005 1:29 am
Location: Netherlands
Contact:

Post by Heimdall »

I've updated the installer, it is now a big 27mb installer (made out of 3 sfx winrar files) and you have the full thing now:

* Latest GCC Cross Compiler SVN check at 20080218
* Latest PSPSDK SVN check at 20080218
* PSPLINKUSB built under Cygwin (still working on native build)
* SDK Docs
* GCC Docs

I had to split the installer because of the hosting site limits the file size to 10mb.

Once you run the installer you should be able to start building your psp apps.

get it here: http://sourceforge.net/project/showfile ... _id=223830

PSPLink native will take some time because there are some dependencies such as: ncurses, readline and pthreads that need to be addressed.
Last edited by Heimdall on Tue Apr 08, 2008 6:46 pm, edited 1 time in total.
Heimdall
Posts: 245
Joined: Thu Nov 10, 2005 1:29 am
Location: Netherlands
Contact:

Post by Heimdall »

A simple tutorial on how to use the devkit with eclipse is here:
http://www.jetcube.eu/archives/2008/02/entry_72.html
nbollom
Posts: 6
Joined: Tue Feb 19, 2008 10:45 pm

make: Nothing to be done for `all'.

Post by nbollom »

Heimdall

I followed the instructions from the tutorial but eclipse doesn't build my project. The output window is showing:

Code: Select all

**** Build of configuration Default for project Hello World ****

make all 
make: Nothing to be done for `all'.
I checked the makefile and saw the following line:

Code: Select all

# PSPSDK MUST BE AN ENV VAR
include $(PSPSDK)/lib/build.mak
I checked the environment variables and PSPSDK is an env var and points to the correct location. Is there any other settings in Eclipse that I need to setup?
Heimdall
Posts: 245
Joined: Thu Nov 10, 2005 1:29 am
Location: Netherlands
Contact:

Post by Heimdall »

Sorry about that I made something wrong on the screenshots.

You should create a C project, the select the Makefile Project folder (not the Hello World, this was the problem) and on the right you get to choose -- Other Toolchain --.

Once you open your project no Hello World.c file exists, only the files from the samples and if your eclipse is setup to build automatically (it is by default) you should get this output:

Code: Select all

**** Build of configuration Default for project Hello World ****

make all 
psp-gcc -I. -IC:\pspsdk\psp\sdk/include -O2 -G0 -Wall -D_PSP_FW_VERSION=150   -c -o main.o main.c
psp-gcc -I. -IC:\pspsdk\psp\sdk/include -O2 -G0 -Wall -D_PSP_FW_VERSION=150  -L. -LC:\pspsdk\psp\sdk/lib   main.o  -lpspdebug -lpspdisplay -lpspge -lpspctrl -lpspsdk -lc -lpspnet -lpspnet_inet -lpspnet_apctl -lpspnet_resolver -lpsputility -lpspuser -lpspkernel -o template.elf
psp-fixup-imports template.elf
mksfo 'Template' PARAM.SFO
psp-strip template.elf -o template_strip.elf
pack-pbp EBOOT.PBP PARAM.SFO NULL  \
		NULL NULL NULL  \
		NULL  template_strip.elf NULL
[0]        408 bytes | PARAM.SFO
[1]          0 bytes | NULL
[2]          0 bytes | NULL
[3]          0 bytes | NULL
[4]          0 bytes | NULL
[5]          0 bytes | NULL
[6]      79004 bytes | template_strip.elf
[7]          0 bytes | NULL
rm2 -f template_strip.elf
If you copy the EBOOT to your PSP it will say... Hello World

I'll update the screenshoots and the tutorial text...

Thanks for checking!
nbollom
Posts: 6
Joined: Tue Feb 19, 2008 10:45 pm

Post by nbollom »

Ive created a new makefile project (not the hello world) but now I get this error:

Code: Select all

**** Build of configuration Default for project HelloWorld ****


(Exec error:Launching failed)
Any Ideas
Heimdall
Posts: 245
Joined: Thu Nov 10, 2005 1:29 am
Location: Netherlands
Contact:

Post by Heimdall »

please show me the content of your makefile. the makefile must follow the rules of the pspsdk. For example, i'm trying to port plib to the psp this is my makefile for the utilities module:

Code: Select all

TARGET_LIB	=	libplibul.a
HEADERS		=	ul.h \
				ulRTTI.h
OBJS		=	ul.o \
				ulClock.o \
				ulError.o \
				ulLinkedList.o \
				ulList.o \
				ulRTTI.o

PSP_FW_VERSION=399

INCDIR =
CFLAGS = -O2 -G0 -Wall
CXXFLAGS = -fno-exceptions -fno-rtti
ASFLAGS =

LIBDIR =
LDFLAGS =

include $(PSPSDK)/lib/build.mak

%.o: %.cxx
	$&#40;CXX&#41; $&#40;CXXFLAGS&#41; -c -o $@ $<
	
install&#58; $&#40;TARGET_LIB&#41;
	-$&#40;MKDIR&#41; -p $&#40;PSPSDK&#41;/extra/include/plib
	-$&#40;CP&#41; $&#40;HEADERS&#41; $&#40;PSPSDK&#41;/extra/include/plib
	-$&#40;MKDIR&#41; -p $&#40;PSPSDK&#41;/extra/lib
	-$&#40;CP&#41; $&#40;TARGET_LIB&#41; $&#40;PSPSDK&#41;/extra/lib

all&#58; $&#40;TARGET_LIB&#41; install
I added a special rule for .cxx files which are C++ files and weren't handled by default by the top level include makefile. But this is to build a static library, then I've a demo eboot that is built with this:

Code: Select all

TARGET = test_dir
OBJS = test_dir.o
LIBS = -lplibul -lstdc++

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

LIBDIR = $&#40;PSPSDK&#41;/extra/lib
LDFLAGS =

EXTRA_TARGETS = EBOOT.PBP
PSP_EBOOT_TITLE = $&#40;TARGET&#41;

include $&#40;PSPSDK&#41;/lib/build.mak

%.o&#58; %.cxx
	$&#40;CXX&#41; $&#40;CXXFLAGS&#41; -c -o $@ $<
	
install&#58; $&#40;EXTRA_TARGETS&#41;
	-$&#40;MKDIR&#41; -p ../../bin/$&#40;TARGET&#41;
	-$&#40;CP&#41; $&#40;EXTRA_TARGETS&#41; ../../bin/$&#40;TARGET&#41;
I've been using these makefile on eclipse and they work for me... of course you need to update them to your needs... include libs, headers, code...
Heimdall
Posts: 245
Joined: Thu Nov 10, 2005 1:29 am
Location: Netherlands
Contact:

This toolchain and Visual Studio

Post by Heimdall »

If you prefer to use Visual Studio Instead you can, as usual make a makefile project and add unzip the file: optional-VS-make.zip from http://www.box.net/shared/7hp779s4kc to your sdk\bin

The vsmake is a batch file that uses sed as shown here in the forum to convert GCC output to MSCC style so the IDE understands it.

I'll pack this as a optional installation component it in the next release.
KickinAezz
Posts: 328
Joined: Sun Jun 03, 2007 10:05 pm

Post by KickinAezz »

Maybe, you and Oopo can collaborate and make this even better :)

--

Is there anyway to use these commands in Makefile?

The $PSPDIR variables donot work. I created a env variable called PSPDIR.
install: $(TARGET_LIB)
@echo "Installing libz into $(PSPDIR)"
@mkdir -p $(PSPDIR)/include $(PSPDIR)/lib
@cp zlib.h zconf.h $(PSPDIR)/include
@cp libz.a $(PSPDIR)/lib
@echo "Done"
and

./configure ?

Oh, And I use cmd.exe
Intrigued by PSP system Since December 2006.
Use it more for Development than for Gaming.
Heimdall
Posts: 245
Joined: Thu Nov 10, 2005 1:29 am
Location: Netherlands
Contact:

Post by Heimdall »

First things first! Oopo is not responsible for my builds, I just use his excellent work to patch the core GCC, NEWLIB and BINUTILS to allow us to build binaries that run on the PSP. He works on *nix environments and I prefer windows for development, although most of the cool GNU tools are not available so therefore I had to gather ports from the internet and assemble them in a simple installation package.

Second! You can use any commands you like in the makefile as long they exist in your machine. If you pay attention to my modified makefiles you'll see that I've replaced rm by $(RM) and cp by $(CP) and mkdir by $(MKDIR). This wasn't an accident it was intentional because if you open a DOS prompt and type: cp that command doesn't exist and rm and mkdir exist but behave differently.

To surpass this problem I've included native ports of cp, rm, mkdir and sed under the name cp2 rm2 mkdir2 and sed2 and that's why you have the weird names $(...) on the makefiles.

Third: ./configure well my friend you're out of luck there! that script is generated by auto tools that are very *nix shell dependent, it would be crazy to try to convert that script to a DOS batch.

Now the good news:

How to fix your makefile sample: piece of cake!

Code: Select all

install&#58; $&#40;TARGET_LIB&#41;
@echo "Installing libz into $&#40;PSPDIR&#41;"
@$&#40;MKDIR&#41; -p $&#40;PSPDIR&#41;/include $&#40;PSPDIR&#41;/lib
@$&#40;CP&#41; zlib.h zconf.h $&#40;PSPDIR&#41;/include
@$&#40;CP&#41; libz.a $&#40;PSPDIR&#41;/lib
@echo "Done" 
and in your DOS box type:

Code: Select all

SET PSPDIR=F&#58;/PSP
make install
voilá!

And now even more complicated :) how to work with autotools!

basically you only need a shell so you need to download 4 files from the mingw website www.mingw.org:

This is a shell for your windows but it is badly outdated i recommend you to install to C:\msys and not to C:\msys\1.0

Code: Select all

MSYS-1.0.11-2004.04.30-1.exe
Then download the following files and decompress them over the msys installation: e.g. (C:\msys)

Code: Select all

MSYS-1.0.11-20071204.tar.bz2
bash-3.1-MSYS-1.0.11-snapshot.tar.bz2
coreutils-5.97-MSYS-1.0.11-snapshot.tar.bz2
You should have now a lame M icon in your desktop if you start it you have a shell that is able to run your ./configure scripts and compile using the SDK.

But remember this is not so easy for beginners and there are lots of reports that msys doesn't work properly on windows vista that's why it was never my goal to include it on my builds.
Heimdall
Posts: 245
Joined: Thu Nov 10, 2005 1:29 am
Location: Netherlands
Contact:

Post by Heimdall »

At the time of this post I'm uploading a new build 0.3 (from last night) it includes:

* Visual Studio Support
* PSPLink now works (i broke the cygwin1.dll when strip it to reduce size)
* USB driver for the debugger

Get it from the my public box:

http://sourceforge.net/project/showfile ... _id=223830

I'll add some extra info on my blog later today

http://www.jetcube.eu
Last edited by Heimdall on Tue Apr 08, 2008 6:47 pm, edited 1 time in total.
nbollom
Posts: 6
Joined: Tue Feb 19, 2008 10:45 pm

Post by nbollom »

Heimdall,

Is there any chance of creating a tutorial for setting up a psp project in Visual Studio.
Heimdall
Posts: 245
Joined: Thu Nov 10, 2005 1:29 am
Location: Netherlands
Contact:

Post by Heimdall »

I just added a Tutorial on how to use it under Visual Studio C++ Express 2008. Under other VS should be quite similar.

http://www.jetcube.eu/

However the latest installed has corrupted Makefiles for the examples, i guess my HDD is dieing i'll try to fix it a make a new release soon.
Heimdall
Posts: 245
Joined: Thu Nov 10, 2005 1:29 am
Location: Netherlands
Contact:

Post by Heimdall »

I'm uploading a new build 0.4 this time with good samples Makefiles.

http://sourceforge.net/project/showfile ... _id=223830
Last edited by Heimdall on Tue Apr 08, 2008 6:47 pm, edited 1 time in total.
nbollom
Posts: 6
Joined: Tue Feb 19, 2008 10:45 pm

Post by nbollom »

Thanks for the tutorial Heimdall it works great.

One other question I have is how does one build/add libraries to the toolchain for use in a psp program (i.e. zlib and libpng)
egorive
Posts: 24
Joined: Thu Jun 22, 2006 11:50 pm

newbee

Post by egorive »

Hi I want to try this because i think is great!! but I would like to know if it is any problem to keep the cywin+dev-c++ environment and make your instalation. Thanks and sorry if I am asking a silly thing.
Heimdall
Posts: 245
Joined: Thu Nov 10, 2005 1:29 am
Location: Netherlands
Contact:

Post by Heimdall »

nbollom i have to look first, maybe it would be nice to create devpaks with those libs already compiled. In theory all those libs that on the makefiles do not require any posix commands (aka cygwin stuff) it should build out of the box but remember to remove any occurrence of:

PSPSDK=$(psp-path ...)

or add relative paths to any other variable that uses the command psp-path.

If your lib needs autotools... (aka ./configure && make && make install) use the info on the previous post where i explain how to install msys.


egorive you can keep everything you have from cygwin note however that you should not have any component from the cygwin in your path when you run my toolchain because it might interfere with my binaries, but i never tried that before...

if there are enough requests :) i might starting the devpak project as simple addons to the SDK with the most popular libs. Of course I'll release my patches under a BSD (free) license on my blog www.jetcube.eu and the binaries on my box... but not until next week :)
Heimdall
Posts: 245
Joined: Thu Nov 10, 2005 1:29 am
Location: Netherlands
Contact:

DEVPAKs for the win32 native compiler

Post by Heimdall »

Hi guys,

As a proof of concept I just created 2 dev paks for my win32 native compiler sdk. You can find then on my box. Currently I have a devpak for ZLIB and another for LIBPNG.

The devpaks installers validade if you have the SDK installed and also that you have the required dependencies.

I'll slowly port the libs to devpaks...
Heimdall
Posts: 245
Joined: Thu Nov 10, 2005 1:29 am
Location: Netherlands
Contact:

Post by Heimdall »

I added more devpaks:

pspgl and SDL
kasikeeper
Posts: 36
Joined: Thu Nov 29, 2007 7:08 pm

Post by kasikeeper »

Your are the best.For so long I had been waiting for a precompiled sdk like this. Keep on supporting this, please!

Can you compile the freestyle library for using the psp fonts? That'd be great.

Thanks so much for your work!
nbollom
Posts: 6
Joined: Tue Feb 19, 2008 10:45 pm

Post by nbollom »

Heimdall,

The SDK and devpaks are great and the tutorials very helpful.

One thing though with the Visual Studio tutorial:

When setting up the project (build, rebuild, clean commands, etc) if people also point the "Include Search Path" to the "($PSPSDK)\psp\sdk\include" directory all the methods/variables defined in the psp toolkit headers will show up with intellisense.

Possibly the devkits as well if you install the headers to that directory.
Heimdall
Posts: 245
Joined: Thu Nov 10, 2005 1:29 am
Location: Netherlands
Contact:

Post by Heimdall »

kasikeeper as i said i'll keep building the devpacks "slowwwly" because i haven't much free time :) It's not hard it is just time consuming... I'll take a look at the freestyle lib next...


nbollom thanks for your tip, I'm not a expert on Visual Studio :) That's why i started with Eclipse CDT on this thread...

and the devkits are installed into %your_pspsdk_install_path%\psp\include they are the default install path and i try to keep the changes as minimal as possible so if you code with my devkit or with the official toolchain the compiler behaves the same.

As an teaser for the next release, I managed to create a simple man (unix manual pages) reader using groff and some batch files that I'll include so you can read the compiler manual in case you find yourself in trouble and some of the devpacks also have a manual in that format, so you can look there first before googling for the answer.

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

Post by Heimdall »

A new devpak! freetype: as usual get them all at:

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

Post by Heimdall »

skyclad monkey
Posts: 1
Joined: Wed Feb 27, 2008 9:01 am

Post by skyclad monkey »

Thanks Heimdall.

This is exactly what I have been looking for!
I have got it working with Textpad as my IDE in minutes.

Thanks for all your hard work its greatly appreciated.
Post Reply