I am using the Win32 build of the PSP toolchain from http://www.pspprogramming.com as it saves all the faffing around with the Cygwin bash shell. It also includes a percompiled version of the latest PSPDEV sdk, making life that little bit easier during setup.
STEP 1 - INSTALLATION
1. Get Code::Blocks from http://www.codeblocks.org
2. Download the latest Win32 toolchain from http://www.pspprogramming.com
3. It might be a good idea to copy your cygwin1.dll from your Cygwin installation to the pspdev/bin folder to avoid possible version conflicts.
STEP 2 - COMPILER INSTALLATION
1. In the menu Settings->Compiler click on the Copy button to copy the settings for the default compiler.
2. Click on the Rename button and call it something like "PSP Toolchain". You can make this the default compiler by clicking the Set as defaultp button if you so wish.
3. Select the Programs tab below set the compilers installation directory. For example, my installation directory is D:\sdk\psp\pspdev
4. Set the programs used to:
- C Compiler: psp-gcc.exe
C++ Compiler: psp-g++.exe
Linker for dynamic libs: psp-g++.exe
Linker for static libs: psp-ar.exe
6. After clicking on the Yes button of the dialog that comes up, click on the Link object files to static library item in the Available commands list
7. There are two lines in the Command line macro: text box below the list. Change the ranlib in the second line to psp-ranlib.
8. Click on OK to bring you back to the Compilers dialog.
9. Click on the Directories tab and add the the include directories and linker directories. A an exmaple, my include and linker folders look like the following:
- D:\sdk\psp\pspdev\include
D:\sdk\psp\pspdev\psp\include
D:\sdk\psp\pspdev\psp\sdk\include
D:\sdk\psp\pspdev\lib
D:\sdk\psp\pspdev\psp\lib
D:\sdk\psp\pspdev\psp\sdk\lib
SETTING UP PROJECTS
1. Create the project as a win32 console project
2. Click on the menu Project->Build Options
3. Make sure that the Selected compiler combo box is the name you have set as the tool-chain. If not, change it
4. In the linker tab, add your libraries. Link order is very important, so for my C++ projects I have them in this order.
- libg.a
libm.a
libstdc++.a
libsupc++.a
libg.a
libpsprtc.a
libpspuser.a
libpsputility.a
libpspdebug.a
libpsplibc.a
libpspgum.a
libpspvfpu.a
libpspgu.a
libpspge.a
libpspdisplay_driver.a
libpspdisplay.a
libpspge_driver.a
libpspsdk.a
lbpsppower.a
libpsppower_driver.a
libpspgum_vfpu.a
libpspkernel.a
For non-C++ projects, you can remove the libstdc++.a and libsupc++.a libraries.
4. If you are writting a C++ project, then add the -fno-exceptions command in the Commands tab, along with any other compiler switches. This is VERY important as psplink won't load your executeable if exceptions are enabled, and in all probability it won't load as an EPBOOT either.
5. In the Projects->Propeties dialog, click on the Targets tab and change the output filename extenstion to .elf instead of exe.
You should be ready at this point to start writting a program that will build to an elf and can be run using PSPLINK.
Because I've only just started PSP deving as of yesterday, I haven't gotten round to adding a post-build step for the kxploit or building an EPBOOT. But I'll add this later if somebody else doesn't do it before me.
I hope that you find this usefull.