This guide breaks down into two parts:
Setting up a ps2dev environment, for those who want to try this without ps2dev experience
Setting up CodeBlocks to compile ps2dev projects, works for Cygwin, MinGW, or precompiled toolchain users
What you need for CodeBlocks
Get the latest nightly build
These dlls are listed in each nightly build release thread: mingwm10.7z wxmsw26u_gcc_cb_wx2.6.3p2.7z
What you need for ps2dev environment
Download MinGW-5.0.2.exe, it's an installer like Cygwin's
I have MSYS-1.0.11-2004.04.30-1.exe, which was the latest MSYS installer snapshot.
This has all the commandline tools, make, sh, tar, gawk, sed, generally used in buildscripts/makefiles.
ps2dev-project template, http://homebrew.thewaffleiron.net/ragna ... project.7z
This is a simple CodeBlocks project file for setting up ps2 projects, you should copy it into the same dir as a project's main Makefile
A Subversion client to download ps2sdk/usb_mass
I used RapidSVN, http://rapidsvn.tigris.org/
Setting up a ps2dev environment
Run MinGW-5.0.2.exe, it will go online to check the latest version of MinGW
Click Next, select a mirror near you in the list, select download and install Click Next
Click either Current or Candidate, Click Next
You want the MinGW base tools, and G++ checked, Click Next, and it will start downloading
Install to C:\MinGW
Install MSYS to C:\msys not C:\msys\1.0
Continue with the post-install, so put y and hit Enter.
Hit y and Enter when it asks if you have MinGW installed.
c:/mingw for your MinGW installation, Hit Enter to continue
The colors for the terminal are set in msys.bat.
You can change LightYellow/Navy to Black/LightGrey so it resembled a more normal terminal window.
You can also add -norxvt to the MSYS shortcut on the desktop to start off with just a simple shell.
Compile or Install a precompiled toolchain to /c/ps2dev or /opt/ps2dev
Open up C:\msys\etc\profile and paste the following at the bottom:
This sets MSYS's environment up with all the ps2dev dependent variables for compiling with ps2sdk.
Setting up CodeBlocks
Extract the latest nightly build, mingwm10.7z, and wxmsw26u_gcc_cb_wx2.6.3p2.7z into C:\Program Files\CodeBlocks
Right click codeblocks.exe and click Send To->Desktop (create shortcut), if you want, you can rename the shortcut CodeBlocks.
Start CodeBlocks, if you get the following error
"Can not enumerate files in directory: 'C:\Documents and Settings\<username>\Application Data\codeblocks/share/codeblocks/plugins' (error 3: the system can not find the file specified.)"
You just need to create that plugins folder.
You can go to Settings->Environment, and enable file associations, if you want.
If you wish to retain your file associations for source files. Click Manage... and just have .cbp and .workspace checked before doing anything
Go to Settings-> Environment
Scroll down to Environment variables and click on the icon
Add the following:
Value: C:/ps2dev (for Cygwin users, change that to your ps2dev dir) it needs forward /'s
Click the Add now (or Set now) button, Click OK
Go to Settings-> Compiler and debugger settings
Select GNU GCC Compiler in the dropdown box at the top, and click the Copy button.
Put PS2 GCC Compiler in the Input box and click OK.
Select the PS2 GCC Compiler in the dropdown list
For MinGW users, CodeBlocks has all the MinGW directories configured by default
For Cygwin users, http://wiki.codeblocks.org/index.php?ti ... n_Compiler
The programs should be setup like this (both MinGW and Cygwin):
C Compiler: gcc.exe (or mingw-gcc.exe)
C++ Compiler: g++.exe (or mingw-g++.exe)
Linker for dynamic libs: g++.exe (or mingw-g++.exe)
Linker for static libs: ar.exe
Resource compiler: windres.exe
Make program: make.exe
Additional Paths tab
Cygwin users can change those to their relevant paths, they don't need C:\msys\bin
Example project setup:
Get the usb_mass source from ps2dev's subversion repository, this was my test project as it had separate iop and ee projects.
Copy the ps2dev.cbp into the ee folder. For any ps2 project, you want the .cbp file in the same directory as the main makefile for the project, as it keeps the same relative paths in CodeBlocks when you do that.
You can rename it to mass_example.cbp, then doubleclick it
Configuring project for compiling:
Right-click the project, ps2dev, in Codeblocks, click Properties, replace the ps2dev title with whatever you want, I chose mass_example.
Right-clik the project, click Add files recursively... and select the ee dir (should already be selected since that's whare the .cbp is). Make sure all the source files are checked, plus the Makefile
You should now see:
Code: Select all
-#usb_mass - Sources mass_example.c mass_rpc.c + Headers + Others
Right-click the Project name and click Build, you should get some warning messages, but it should complete without errors. Cygwin users/Cygwin-based toolchain users, if there are no line numbers or filenames with the warning messages, please read below.
You can also put a fresh copy of ps2dev.cbp into the iop folder, add the files recursively from the iop folder, click Build, it will compile, too.
Cygwin-hosted toolchain users
For those with Cygwin or those with a toolchain from a cygwin-hosted ps2dev environment installer (needs cygwin1.dll), CodeBlocks' regex's didn't capture GCC's output correctly for me
If, when compiling mass_example, the warnings in the Build messages box do not have line numbers or file names listed, then do the following:
Open CodeBlocks, go to Settings-> Compiler and debugger settings
Select the PS2 GCC Compiler from the dropdown list
Click the Other tab, click Advanced options..., you will get a warning about the ramifications of changing things and asks if you wish to continue, make sure you have the PS2 GCC Compiler selected, and click Yes
Click the Output Parsing tab
For the following, you need to replace the regex's with ones that can parse the cygwin-hosted gcc output. The messages under Testing: are example warnings/errors. Paste them into the Test string box, you should get a dialog with everything parsed correctly.
Code: Select all
Click Compiler warning Replace ([ \tA-Za-z0-9_:+/\.-]+):([0-9]+):[ \t]([Ww]arning:[ \t].*) with ([ \tA-Za-z0-9_:+/\.-]+)\(([0-9]+)\)[ \t]:[ \t]([Ww]arning:[ \t].*) Testing main.c:38: warning: implicit declaration of function `InitPS2' main.c(38) : warning: implicit declaration of function `InitPS2' Click Compiler error Replace ([ \tA-Za-z0-9_:+/\.-]+):([0-9]+):[ \t](.*) with ([ \tA-Za-z0-9_:+/\.-]+)\(([0-9]+)\)[ \t]:[ \t](.*) Testing: init.c:80: parse error before '*' token init.c(80) : parse error before '*' token Click Linker error (lib not found) Replace .*(ld.exe):[ \t](cannot find.*) with .*(ld):[ \t](cannot find.*) Testing: C:\ps2dev\ee\bin\..\lib\gcc-lib\ee\3.2.2\..\..\..\..\ee\bin\ld.exe: cannot find -ldmkit /cygdrive/c/ps2dev/ee/bin/../lib/gcc-lib/ee/3.2.2/../../../../ee/bin/ld: cannot find -ldmkit
Get the latest ps2sdk's source from ps2dev's svn repository.
Ok, I've spent a few days creating this guide, I'm pretty sure I've caught anything that might mess CodeBlocks up with setting it up with a ps2dev environment on any platform. As for Linux users, there is an Ubuntu edgy nightly build, but I'm not familiar with it, but you can probably figure out how to set it up from this guide.