PDA

View Full Version : PSP Dev Tutorials - Setting up the Development Environment



wraggster
August 20th, 2005, 10:57
Lesson 01
Setting up the Development Environment
How to get the toolchain and PSPSDK up and running with CYGWIN on a windows machine. The complete newbie's guide.
This is the first installment in a series of tutorials focussed on getting a novice programmer well on his way to developing his own homebrew applications for the Sony Playstation Portable (PSP). If you are reading this, congratulations, you have hurdled one of the biggest obstacles for a programmer. Likely the most difficult thing about programming is getting started. Well, by starting to read this tutorial, you are well on your way.

The first step to creating your own program is getting your environment set up. This environment is how you will convert the source code you write into a compiled file formatted for execution on you PSP. We will be setting up two important tools on our system.

The first of these tools is called CYGWIN. It is basically a Linux emulator for windows. It will create a simulated Linux environment on your computer so that you can run native Linux applications. This may sound intimidating, but don't worry, it's very simple to use.

The second thing you'll need is the toolchain. This is the key to programming for the PSP. It will set up everything you need, from header files, to libraries, to the compiler itself, to the sample programs. Once you have this installed, you will be nearly ready to create your first program.

Now for the part we've all been waiting for: the installation.

The first step is to install CYGWIN. You can download the install file from the CYGWIN website here. After it has finished downloading, open up the executable. You will see a splash screen; click next. Now you will be asked what you want to do. Select the default option of "Install from Internet," and hit the next button. Now you will be prompted where you want to install CYGWIN. Change the install directory to "C:/cygwin" if it is not set as such already (where C: is your local hard drive). Leave the other options set to their defaults and hit next. Now you will be asked where you want to save the installation files. What you select here doesn't really matter, but I suggest putting them someplace where you will be able to find them and delete them after the installation is complete. Once you have selected a suitable location, click next. The next screen will ask about your network settings, if you don't use a proxy (or don't know what a proxy is), just click next on this screen. If it doesn't work, go back and try letting it use Internet Explorer's settings. Now you should be presented with a list of servers to download the installation files from. Any one of these will do, so select one, and then click on next. Now it will download the package list, this could take a few minutes, depending on your connection speed. Once it is done, click on "view" at the top to view the packages available for you to install. You will need the following:
autoconf2.1
automake1.9
gcc
gcc-g++
make
patchutils
subversion
wget
You can select them by clicking where it says "skip." "Skip" should then change to a version number. Don't worry if other packages are selected; packages that are required by CYGWIN or by other packages you select will be automatically set to install. When you are finished, click next. CYGWIN will now download and install the selected packages. This will quite possibly take a while, so go watch a TV show or do some web surfing while you wait. After the install has finished, you are ready to install the toolchain.

Now, we are going to install the toolchain into our CYGWIN environment. To set up our environment, we will need to run CYGWIN first. So, either from the start menu, or from "C:/cygwin," run a CYGWIN bash shell (cygwin.bat). This will open up a command line. Once you see "yourusername@yourcomputername ~" you may close the window; your environment has successfully set up. To download the latest toolchain, go here. It should be at the very bottom of the page. At the time of writing, the latest toolchain file is dated 20050725. Download this file. When it is finished, use Winrar to extract the file contents to "C:/cygwin/home/user," where "user" is your username.

The toolchain needs a bit of customization to work with CYGWIN, so fire up Wordpad, and open "C:/cygwin/home/user/psptoolchain/toolchain.sh" and do a "Find and Replace" to replace all instances of "gmake" with "make" and all instances of "gpatch" to "patch" and then save the file. Now it's time to install, so open up your CYGWIN bash shell again. Now it's time to introduce you to the Linux command line. You should see a "$" at the beginning of the line. This means that you are running the shell in user mode, as opposed to root (or admin) mode. This is of little importance in CYGWIN, but if you ever use an actual Linux command line, this is an important thing to notice.

We now need to change directories to where we extracted the toolchain. Type "ls" in the bash shell; this stands for list. It will give us an output of all of the files in our current directory (this is similar to "dir" in a Windows command line). Now you should see a folder named "psptoolchain," this is where we want to go. So type "cd psptoolchain" and hit enter. CD stands for change directory, and it will (obviously) switch the current operating directory). Now do a quick "ls" again, and you will see the files in this folder. The one that we want is "toolchain.sh." To execute this file, type "./toolchain.sh" and hit enter. In Linux, "." means the current directory, and ".." means the parent directory, so this command means to execute "toolchain.sh," which is in the current directory. The toolchain.sh script will do the rest, for you. This can take up to several hours, depending on the specifications of your machine. For a frame of reference, my 3.0GHz Pentium 4 took about three hours to run the entire script, so be patient.

Now for the last step. We have to tell CYGWIN where it can find the PSPSDK (which the toolchain just installed) and the toolchain. To do this, we need to change "C:/cygwin/cygwin.bat" to include the paths. So, close CYGWIN, and navigate Explorer to "C:/cygwin" and right click on cygwin.bat. Select "Edit" and a Notepad window should appear with the following:
@echo off

C:
chdir C:\cygwin\bin

bash --login -i

Change this to:
@echo off

C:
chdir C:\cygwin\bin

set path=%path%;C:/cygwin/usr/local/pspdev/bin
set PSPSDK=C:/cygwin/usr/local/pspdev

bash --login -i
Now you're ready to go! If you have source code that you want to compile, go into that directory with "cd" and type "make" and it should give you an eboot.pbp that you can put on your PSP. If not, check out Lesson 02 to learn how to create your own simple application for the PSP.

If you have enjoyed this tutorial and have a spare buck or two, please consider donating to the author.
Tutorial written by Brad Dwyer (aka Yeldarb). Copyright 2005.

fa_sa23
August 26th, 2005, 13:51
HI, Excellent tutorial but where can I find the toolchain in which webpage
ThakU

ataribob
August 30th, 2005, 19:04
http://milhouse.blogsome.com/

They have a real nice program. 43 meg but it at least has a nice help menu on the comand functions you select.
Perfect programming windows envio for the PSP

auto ajustable Window of projects In addition this version brings all the necessary one to be able to begin to program, since this distribution is made up of: - PSPide C++ 1.0.8.30: IDE of development for PSP - PSPsdk Beta 1.0: SDK of PSP created by scene - Kxploit 0.3: Creator of "licenses" to be able to execute programs in PSP.

MIRROR OF UNLOADINGS (Installation of 45 Mb): 1. From www.MegaUpload.com 2, From www.PSPupdates.com

jimjamjahaa
September 28th, 2005, 20:40
http://ps2dev.org/psp/Tools

is where to get the toolchain. the time it takes to execute toolchain.sh is dependant on your internet connection speed, not your processor speed. eta 13 minutes for me on 1mbit/sec broadband with bittorrent and messenger on the go :)

so far so good with this tutorial.... cant wait till suse 10.0 is released so i can get in to real linux again, i have been waiting for it for ages.

edit: maybe i spoke too soon, it seems it is dependant on cpu power too

Heran_Bago
September 30th, 2005, 00:52
Downloading it and setting it up are different. If you're having trouble telling the difference between the two... sorry.

chronos
September 30th, 2005, 05:50
Hi, I'm new to PSP development, so I hope you guys can give me some help. I followed the above instructions and successfully installed CYGWIN with the necessary components. I then proceeded to run the cygwin bash shell (cygwin.bat). After that, I tried to look for the /home/user directory but I couldn't find it.

I ran the bash shell again to see the path that it starts up in and found that it's in C:\Documents and Settings\myname\ instead.

Did I do something wrong?

In any case, I proceeded to copy the psptoolchain directory into C:\Documents and Settings\myname\ and started the toolchain.sh script. It seems to run fine... after 2 hours, it suddenly stopped with the following errors:
./toolchain.sh: line 239: cd: pspsdk: No such file or directory
./toolchain.sh: line 242: ./bootstrap: No such file or directory
ERROR RUNNING PSPSDK BOOSTRAP

P/S: I am installing on a Windows XP SP2 machine and cygwin net release setup program version 2.510.2.2

Any help with this is very much appreciated. Thank you.

Edited: After researching on the error, it appears to me that my internet connection might be blocking svn access. I'll try again when I get home. Thanks.


Regards,
chronos

Heran_Bago
October 2nd, 2005, 23:16
http://forums.ps2dev.org/viewtopic.php?t=2544&sid=ee3cea471f7e7e78aa451a28e4d0b44c
(re)install automake and autoconf

That's the forum you might consider going to for pspsdk related stuff.

Mechz
October 9th, 2005, 01:36
Hah, the first time I downloaded this it was connecting at 2KBps... Then after waiting two days it stopped all together. Man was I pissed. I tried again a few minutes ago... and it finished under 30 seconds. The point of this post? If you're connecting at less than 40Kps, cancel and try again.

mog
October 13th, 2005, 06:06
awesome guide!
just thought i'd add a few things i had trouble with...

1. error messages (something about "flex");
i ran the cygwin setup again and installed the flex package.

2. toolchain.sh script wouldn't download files from ftp sites (probably firewall); so i downloaded through web browser (filenames & versions need be same as in toolchain.sh) and placed files in /home/user directory. After this i ran the toolchain again but used "./psptoolchain/toolchain.sh -b-g-n-p" as this will skip trying to re-download the files and go straight to installing them.

3. half-way thru installing binutils/gcc/etc i got fatal error messages; needed to move the 4 .patch files from psptoolchain folder to /home/user directory.

after this i managed to get it installed, with no fatal error messages. :D

shiftybill
December 25th, 2005, 10:01
heya

ive been trying to install this, i have gotten a few errors and used google to fix them but i cant find anything on this "error building newlib"

any help would be appreciated

thx in advance

http://www.freewebs.com/shifthouse/ERROR%20BUILDING%20NEWLIB.JPG

i finally git i tto work, what i did was reinstall the toolchain from scratch

karma
January 2nd, 2006, 15:09
i still have the same problem as shiftybill, and repeating installation from scratch does not help me. (just after isolating the functions that cause the error the things work but you know...this is not the right manners :) )
Currently i'm trying to get pspdev environment work on a gentoo linux box.
Oh...i got some other installation tips like...
"no: no such file or directory"
that probably means that configure script was not able to find some psp exec binary but i cant figure out how to fix this.
any clue? tnx for attention.

TheEmulatorGuy
January 8th, 2006, 06:42
GRR! It's been running for 3 HOURS and I get this:

http://img463.imageshack.us/img463/4570/grr9hx.png

Please, help me! I really do not want to start over... it takes so long... I followed all of the instructions exactly as they were meant to be... why has this happened?

Jorde907
January 8th, 2006, 07:54
i'm getting an CC1.exe error after it runs for about 15minutes? how do i fix this :(

Zephyroth_drgs
January 25th, 2006, 02:26
To download the latest toolchain, go here.

where can i download it?

1Shadowbane
January 25th, 2006, 19:05
where do you download the programs??

crazyjohn
January 26th, 2006, 07:09
How much is 'from scratch'?
Im getting exactly the same error as you. "ERROR BUILDING NEWLIB"
So Im running the toolchain script again and it didnt have to redownload it (7kbps--- wouldnt want to do that again). I really hope this works. Does anyone know what causes this?

****EDIT****
It happened again, maybe I should start over completely but it all just takes so flippin long!! AAAGHHH Stupid slow internet!! NOOO! Please if anyone knows whats wrong can they tell me.

****EDIT2***
Toolchain is running now. I redownloaded everything so hopefully itll work this time. The first time i was using an older version of the toolchain so maybe that was the problem. You can download the latest version from http://www.oopo.net/consoledev/ (or go to www.ps2dev.org and follow the links to that page) my version is 20060120 (non experimental version). There's a bit of a trick to extracting it tho. Inside the .tar file you download is a single file with no extension. Extract this file, give it the extension .zip and then extract that. Everything should be there.

***EDIT3***READ THIS IF YOUR HAVING TROUBLE
Ok it worked so heres what I did different the second time round. I made sure I had the newest version (currently 20060120) of the toolchain, availiable at http://www.oopo.net/consoledev/
When installing Cygwin I installed everything under the devel section and selected wget from the web section.
I didnt use my pc whilst the script was running - this probably has no effect but hey, I sure as hell didnt want to have to do it... AGAIN!!

So best of luck to the rest of you and I hope I can contribut something to the communty in the not too distant future.

ultros
February 22nd, 2006, 01:09
hm, i'd like to setup the toolchain, but i have absolutely no experience with linux. I'm using Cygwin right now.
i tried to follow this tutorial: http://www.scriptscribbler.com/psp/tutorials/lesson01.htm
but some (minor) problems occurred:

- i installed cygwin
- i downloaded the lates toolchain (psptoolchain-20060120.tgz)
- extracted it in c:\cygwin\home\myname

and now, i want to set it up, the tutorial, as well as the readme in the toolchain says:

Basically, you run the toolchain script:

## Make the script executable.
chmod a+x ./toolchain.sh

## Run the script.
./toolchain.sh

but if i do so, the cygwin-command line window says "ERROR: please make sure you have 'patch' installed."

hm...how can i install this patch?
in this directory, there are 4 files, containing the word 'patch':
- newlib-1.13.0.patch
- gcc-4.0.2.patch
- gdb-6.3.patch
- binutils-2.16.1.patch

what do i have to do now? how can i install a patch and wich one?

any help is welcome and please make sure, i have never even seen any linux before today ;)

benh
March 24th, 2006, 21:58
I dont get the bit about when u set up the enviromentwhere do u run the cygwin bash shell from its not clear enoughplease could you explain it in detail please

yaustar
March 24th, 2006, 23:46
Now, we are going to install the toolchain into our CYGWIN environment. To set up our environment, we will need to run CYGWIN first. So, either from the start menu, or from "C:/cygwin," run a CYGWIN bash shell (cygwin.bat). This will open up a command line. If you are going to miss little details like this, then you going to have one hell of a time trying to set up this development environemt.

jbaricuda
August 31st, 2007, 22:13
hi i cannot install toolchain. i downloaded it and extracted it to c:cygwin/home/mike/psptoolchain

i opened up cygwin and did the following


Mike@comp ~
$ ls
psptoolchain

Mike@comp ~
$ cd psptoolchain

Mike@comp ~ /psptoolchain
$ ls
build depends patches readme.txt script toolchain-sudo.sh toolchain.sh

Mike@comp ~ /psptoolchain
$"./toolchain.sh"
ERROR: SET $PSPDEV before continuing.
../depends/check-pspdev.sh: Failed.

Mike@comp ~ /psptoolchain
$

help would be great thanks

yaustar
August 31st, 2007, 22:34
ERROR: SET $PSPDEV before continuing.
QFE. You need to add this environment path in Windows to point to where your pspdev folder is on your computer.