forums.ps2dev.org Forum Index forums.ps2dev.org
Homebrew PS2, PSP & PS3 Development Discussions
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Setting Up Code::Blocks + Psp Toolchain

 
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Development
View previous topic :: View next topic  
Author Message
IronAvatar



Joined: 25 Nov 2006
Posts: 23

PostPosted: Sat Nov 25, 2006 10:01 pm    Post subject: Setting Up Code::Blocks + Psp Toolchain Reply with quote

Setting up Code::Blocks to work with PSPDEV is a bit of a breeze really. But there are one or two gotchas that sort of had me scratching my head in frustration, so I thought I might write a small tutorial.

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


5. Select the Other tab and click on the Advanced Options button.
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


10 Click on OK and the toolchain is now ready to use.

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


There are probably some redundant libraries in that list, but I haven't bothered to check which ones. I'll add a more minimal list in the future.

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.
Back to top
View user's profile Send private message
noxa



Joined: 05 Aug 2006
Posts: 39

PostPosted: Sun Dec 03, 2006 10:57 am    Post subject: Reply with quote

Cool! I had been using a combination of cygwin and Visual Studio to do things, but this is a little nicer. If you do come up with the kxploit stuff please post it up (maybe this thread should be sticky?)
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Development All times are GMT + 10 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group