Compiling and Debugging on Code::Blocks with psplink

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

Moderators: cheriff, TyRaNiD

Post Reply
reizencroft
Posts: 7
Joined: Fri Jul 04, 2008 12:12 am

Compiling and Debugging on Code::Blocks with psplink

Post by reizencroft »

I refuse to use eclipse as my IDE in ubuntu. Yeah, psplinkusb works on it, but it really can’t compensate the uber slowness of it(Sorry, I don’t have enough dough to buy a faster pc). The best IDE for me is Source Insigh but its for windows, so I often have it to run on wine but some of its outstanding factors doesn’t come out when on wine.So I use Code::Blocks when I’m on ubuntu, simply because it’s the only IDE that works for me and the one that gives me the greatest satisfaction but not as great as SI in windows. So I insisted in making the psplinkusb work on it, and after long hours of trial and errors, I managed it got to work. BWAHAHAHAHA. What bliss, but enough introduction and here’s how I made it work.

1st Part: Compiling on IDE.(Thanks to J.F.’s post on how to build using Code::Blocks from ps2dev.org forum)

1. Create a new empty project.
2. Enter a project title.
3. For the “Folder to create project in”, use the button to browse for desired folder location. To compile properly, the Makefile should be here.
4. Enter a “Project Filename”.
5. Edit the “Resulting filename” so that the *.cbp file is also located to where the Makefile is. Click “Next”, then “Finish”.
6. The project is done. On the Management panel, right click the project and select “Properties”.
7. In the “Project Settings” tab, edit the “Makefile” so that it is the name of your makefile, and check the “This is a custom Makefile”. click the “OK” button.
8. On the “Management” panel, right click the project and select “Build Options”. Select the project on the left panel.
9. Go to the “Make” command tab, there will be four fields. on these fields remove the “$target” from all the fields.
10. Paste the following before the “$make” on all fields:

Code: Select all

export PSPDEV=”/usr/local/pspdev” && export PSPSDK=”$PSPDEV/psp/sdk” && export PSPPATH=”$PSPDEV/bin:$PSPDEV/psp/bin:$PSPSDK/bin” && export PATH=”$PATH:$PSPPATH” && export PKG_CONFIG_PATH=”$PSPDEV/psp/lib/pkgconfig” &&
11. Just to make sure, click the Release on the left panel, then repeat step 9. then Click OK.
12. Add your files by “Add files..” or “Add files recursively”. You can now build your projects.

2nd Part. Debugging.

1. Wait a sec. Just before you build, edit your makefile first.
2. on the CFLAGS, append -g.
3. After the ASFLAGS, insert BUILD_PRX=1. Save it and build your eboot.
4. On the menu click “Settings”, then “Compiler and Debugger”.
5. On the “Global Compiler Settings”, On the “Toolchain Executables” tab, set the “Compiler’s installation directory” to “/usr/local/pspdev”.
6. On the 5 fields below, append “psp-” on all these fields.
7. On the “Debugger Settings” section, “Debugger Initialization commands”, enter “file XX.elf” where XX is the name of elf file on your current project. You need to change these every time you change projects/eboots depending on the elf file.
8. Click OK.
9. Open up again your project’s “Properties”.
10. Move to the Debugger’s tab, select target, which is “Release”.
11. Set “Connection Type” to TCP/IP.
12. Set IP address to 127.0.0.1 and port to 1001.
13. This assumes that you had psplink already setup. If not google it.
14. Run psplink on your psp, usbhostfs_pc and pspsh on your terminal.
15. On pspsh, enter debug ./XX.prx, where XX is your file.
16. Set your breakpoints and start debugging.

Happy Coding and debugging. =D

This can also be found here
J.F.
Posts: 2906
Joined: Sun Feb 22, 2004 11:41 am

Post by J.F. »

Very nice. I'll have to try setting up psplinkusb sometime.
pspZorba
Posts: 156
Joined: Sat Sep 22, 2007 11:45 am
Location: NY

Post by pspZorba »

thanks reizencroft.
I have no more excuse to not setup psplinkusb !
--pspZorba--
NO to K1.5 !
hlide
Posts: 739
Joined: Sun Sep 10, 2006 2:31 am

Re: Compiling and Debugging on Code::Blocks with psplink

Post by hlide »

Ok, big thanks to reizencroft for some tips :

I'm using Code::Blocks and Heimdall's PSPSDK for a project.

1. Edit your makefile first to append -g to CFLAGS add BUILD_PRX=1. Save it and build your eboot.
2. On the menu click “Settings > Compiler and Debugger > Global Compiler Settings > Toolchain Executables” tab, set the “Compiler’s installation directory” to the directory when you install Heimdall's PSPSDK.
3. On the 5 fields below, append “psp-” on all these fields.
4. Open up again your project’s “Properties”.
5. Move to "Debugger" tab, select target, which is “Release”.
6. In "Remote connection" tab, set “Connection Type” to TCP/IP and set IP address and port to nothing.
7. In "Additional commands" tab, add two lines in "Before connection" : "file <yourfile>.elf" and "target remote :10001".
8. Click OK.
9. Run psplink on your psp, usbhostfs_pc and pspsh on your terminal.
10. On pspsh, enter debug ./XX.prx, where XX is your file.
11. Set your breakpoints and start debugging, then "Continue".
12. Now you can debug your source through Code::Block debugger.
Post Reply