Skip to content

Commit 06c070d

Browse files
authored
Merge pull request #68 from pspdev/improve-debugging-page
Improve headers and debugging page
2 parents 29ebac1 + d1b7650 commit 06c070d

11 files changed

+99
-74
lines changed

basic_programs.md

+3-1
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ More libgu examples can be found <a href="https://github.com/pspdev/pspsdk/tree/
123123

124124
</details>
125125

126-
## Controller
126+
## Input
127127
{: .fs-6 .fw-700 }
128128

129129
![](images/controls.png)
@@ -377,9 +377,11 @@ Documentation for SDL2_ttf can be found <a href="https://wiki.libsdl.org/SDL2_tt
377377
</details>
378378

379379
## More Examples
380+
{: .fs-6 .fw-700 }
380381

381382
More examples on how to use specific functions offered in the PSPDEV toolchain can be found [here](https://github.com/pspdev/pspsdk/tree/master/src/samples). Additional documentation on these functions can be found [here](https://pspdev.github.io/pspsdk/).
382383

383384
## Debugging
385+
{: .fs-6 .fw-700 }
384386

385387
When making changes to the example programs listed above, you might run into errors or even crashes. To learn how to figure out what went wrong, check out the [debugging](debugging.html) page.

contributing.md

+2
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ nav_order: 7
1010
There are many ways to contribute to our efforts to make developing homebrew for the PlayStation Portable (PSP) easier for everyone. The first step would be to [join our Discord](https://discord.gg/bePrj9W) or use our [GitHub Discussions](https://github.com/pspdev/pspdev/discussions)!
1111

1212
## Ways to contribute
13+
{: .fs-6 .fw-700 }
1314

1415
Before making any contribution, it's best to talk about what you want to do on [Discord](https://discord.gg/bePrj9W). After that, here are some places you can look to contribute:
1516

@@ -21,6 +22,7 @@ Before making any contribution, it's best to talk about what you want to do on [
2122
Pull requests are always welcome!
2223

2324
## Where can I find the code?
25+
{: .fs-6 .fw-700 }
2426

2527
The PSPDEV toolchain is build using quite a few different repositories which each add their own piece to the system. If you just want to build everything at once, the [pspdev repository](https://github.com/pspdev/pspdev) is the place to go.
2628

debugging.md

+43-66
Original file line numberDiff line numberDiff line change
@@ -10,78 +10,48 @@ nav_order: 4
1010
When developing for the Playstation Portable (PSP), you may run into crashes or code that does not quite work like expected. Figuring out what is going in is called debugging. This page will cover how to do that.
1111

1212
## PSPLINK
13+
{: .fs-6 .fw-700 }
1314

14-
PSPLINK is THE tool to use for debugging on the PSP. It is an application which allows you to run and debug programs for the PSP from your PC through USB.
15+
PSPLINK is THE tool to use for testing code on the PSP. It is an application which allows you to run and debug programs for the PSP from your PC through USB without requiring data to be transferred to the PSP. Setting it up for use requires different action for the PSP and the PC.
1516

16-
### Setting up PSPLINK
17-
18-
Each system involved in the use of PSPLINK requires a bit of setup for it to work. This includes both PSP and PC. Below are instructions for both.
19-
20-
#### PSP
17+
### Setting PSPLINK up on the PSP
18+
{: .fs-4 .fw-700 }
2119

2220
Download the latest version of PSPLINK for the PSP [here](https://github.com/pspdev/psplinkusb/releases/download/latest/psplink.zip) and extract it in ``ms0:/PSP/GAME`` on the PSP memory card.
2321

24-
#### PC
25-
26-
Depending on the operating system used the setup on PC is different. Follow the on below which is relevant to your system.
27-
28-
##### Windows
29-
30-
On Windows a driver needs to be installed before PSPLINK can be used. To do this take the following steps:
31-
32-
1. Make sure the programs `usbhostfs_pc` and `pspsh` are available in cmd. Otherwise download them [here](https://github.com/pspdev/psplinkusb/releases/download/latest/pspsh-windows.zip).
33-
2. Start PSPLINK on the Playstation Portable and connect it to the computer through USB.
34-
3. Download [Zadig](https://zadig.akeo.ie/) and start it. It will ask if you want to run it as administrator, click yes.
35-
4. In Zadig, click on `options` -> `List All Devices`.
36-
5. Select the entry `"PSP" type B` from the dropdown list.
37-
6. Left of driver, select the `libusb-win32` driver. Then click install.
38-
7. Wait for the installation to finish, then disconnect the USB cable from the PSP.
39-
40-
Now PSPLINK can be used with Windows. See below how to do that.
41-
42-
##### Linux
22+
### Setting PSPLINK up on the PC
23+
{: .fs-4 .fw-700 }
4324

44-
With Linux PSPLINK will work without making any changes, but it will require using sudo for the `usbhostfs_pc` command. To make it work without sudo, a udev rule can be added.
25+
Depending on the operating system used the setup on PC is different. Pick the setup guide for your system here:
4526

46-
To make using PSPLINK without sudo create file called `/etc/udev/rules.d/50-psplink.rules` (for example with `sudo nano /etc/udev/rules.d/50-psplink.rules`) and add the following content:
47-
48-
```
49-
SUBSYSTEM=="usb", ATTR{idVendor}=="054c", ATTR{idProduct}=="01c9", SYMLINK+="psp", MODE="0666"
50-
```
51-
52-
Save this, in Nano this can be done with Ctrl+O and pressing enter. The run the following command:
53-
54-
```
55-
sudo udevadm control --reload
56-
```
27+
- [Windows](psplink/windows.html)
28+
- [Linux](psplink/linux.html)
5729

58-
Now PSPLINK can be used without sudo. See below how to do that.
30+
MacOS should not require any additional setup.
5931

6032
### Using PSPLINK
33+
{: .fs-4 .fw-700 }
6134

6235
To be able to use PSPLINK with Playstation Portable homebrew, the homebrew will need to be build into an unencrypted ``.prx`` file. This can be done by running CMake like `psp-cmake -DBUILD_PRX=1 .` or if you're using a Makefile by adding `BUILD_PRX=1` to it. Then build the homebrew.
6336

64-
In the build directory, open a terminal and run the following program:
65-
66-
```
67-
usbhostfs_pc
68-
```
69-
70-
Keep this running!
71-
72-
Then open another terminal window and run the following there:
73-
74-
```
75-
pspsh
76-
```
77-
78-
Now we can simply start our homebrew on the PSP by running the following command in the pspsh window:
79-
80-
```
81-
./myhomebrew.prx
82-
```
83-
84-
Replace myhomebrew with the name of the `.prx` file which was generated.
37+
After having done all of the above, PSPLINK can be used using the following steps:
38+
39+
1. Connect the PSP with a USB cable to the computer.
40+
2. Launch the PSPLINK homebrew on the PSP. The PSP is now waiting for input from the PC.
41+
3. In the build directory of the homebrew you wish to test, open a terminal and run the following:
42+
```sh
43+
usbhostfs_pc
44+
```
45+
Keep this running!
46+
4. Then open another terminal window and run the following there:
47+
```sh
48+
pspsh
49+
```
50+
5. Now you can simply start our homebrew on the PSP by running the following command in the pspsh window:
51+
```sh
52+
./myhomebrew.prx
53+
```
54+
Replace myhomebrew with the name of the `.prx` file which was generated. Now the PSP should be running your project!
8555

8656
When you're done with the current build, just run `reset`, rebuild the homebrew and try again.
8757
@@ -92,12 +62,13 @@ Options available can be found when using the `help` command, but here are some
9262
- `poweroff` for shutting down the PSP.
9363
9464
### Getting Basic Crash Information
65+
{: .fs-4 .fw-700 }
9566
9667
When a crash happens a crash log will be shown with a hint of what might have happened at the top and some additional info. If you wish to figure out where the crash happened, only the address is needed.
9768
9869
To figure out where the crash happened, open another terminal in the build directory and use the address shown by PSPLINK in the following command:
9970
100-
```
71+
```sh
10172
psp-addr2line -e myhomebrew address
10273
```
10374
@@ -107,23 +78,27 @@ If no result is returned, make sure to build with the `-g` or `-g3` option and w
10778
10879
The information received from `psp-addr2line` will be limited and not always useful, for more information you'll have to use a debugger as described below.
10980

110-
### Using a Debugger
81+
## Using a Debugger
82+
{: .fs-6 .fw-700 }
11183

112-
When using `psp-addr2line` is not enough to figure out what is going on, the best way to debug will be by using an actual debugger called GDB. PSPLINK allows you to enable access to `psp-gdb` which comes bundles with the PSPDEV toolchain.
84+
When using `psp-addr2line` is not enough to figure out what is going on, the best way to debug will be by using an actual debugger called GDB, which comes bundled with the PSPDEV toolchain as the `psp-gdb` command. PSPLINK allows this debugger to connect directly to the PSP.
11385

114-
#### Preparation
86+
### Preparation
87+
{: .fs-4 .fw-700 }
11588

11689
Prepare a separate terminal for `usbhostfs_pc`, `pspsh` and `psp-gdb`. Open all of them in the directory in which your compiled `.prx` and the `elf` (PSP binary) files are located.
11790

118-
##### 1. usbhostfs_pc
91+
#### 1. usbhostfs_pc
92+
{: .fs-2 .fw-700 }
11993

12094
Run `usbhostfs_pc` on your terminal dedicated for `usbhostfs_pc` and you will see the `waiting for device...` status.
12195

12296
Now start the PSPLINK app on your PSP and connect the USB cable. You should see the `connected to device` status in the terminal, which means success.
12397

12498
**Do not close this terminal after that.**
12599

126-
##### 2. pspsh
100+
#### 2. pspsh
101+
{: .fs-2 .fw-700 }
127102

128103
Run `pspsh` on your terminal dedicated for `pspsh` and you will see the `host0:/>`. Now run `debug file.prx`, and it will display something like this:
129104

@@ -136,7 +111,8 @@ host0:/> Loaded host0:/<file.prx> - UID 0x0408A763, Entry 0x088040AC
136111

137112
It means the debugger is succesfully loaded. You can type `reset` if there's something wrong with your GDBServer.
138113
139-
##### 3. psp-gdb
114+
#### 3. psp-gdb
115+
{: .fs-2 .fw-700 }
140116
141117
In a new terminal run `psp-gdb file -q` and you will see something like this:
142118
@@ -176,5 +152,6 @@ Here are a few useful commands for getting around in psp-gdb:
176152
You can type `help` for more information about the psp-gdb commands.
177153
178154
## Done
155+
{: .fs-6 .fw-700 }
179156
180157
Now you know how to debug your code. Make sure to check out the [Tips and Tricks](tips_tricks.html) section to get most out of your PSP development experience.

installation.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ nav_order: 2
55
---
66

77
# Installation
8-
{: .fs-10 .fw-700 .text-center }
8+
{: .fs-8 .fw-700 .text-center }
99

1010
Pick the installation guide for your system:
1111

installation/docker.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ nav_exclude: true
55
---
66

77
# Installation on Docker
8-
{: .fs-10 .fw-700 .text-center }
8+
{: .fs-8 .fw-700 .text-center }
99

1010
## Docker
1111
{: .fs-6 .fw-700 }

installation/fedora.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ nav_exclude: true
55
---
66

77
# Installation on Fedora
8-
{: .fs-10 .fw-700 .text-center }
8+
{: .fs-8 .fw-700 .text-center }
99

1010
## Dependencies
1111
{: .fs-6 .fw-700 }

installation/macos.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ nav_exclude: true
55
---
66

77
# Installation on MacOS
8-
{: .fs-10 .fw-700 .text-center }
8+
{: .fs-8 .fw-700 .text-center }
99

1010
## Dependencies
1111
{: .fs-6 .fw-700 }

installation/ubuntu.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ nav_exclude: true
55
---
66

77
# Installation on Ubuntu/Debian
8-
{: .fs-10 .fw-700 .text-center }
8+
{: .fs-8 .fw-700 .text-center }
99

1010
## Dependencies
1111
{: .fs-6 .fw-700 }

installation/windows.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@ nav_exclude: true
55
---
66

77
# Installation on Windows
8-
{: .fs-10 .fw-700 .text-center }
8+
{: .fs-8 .fw-700 .text-center }
99

1010
## Windows Subsystem for Linux (WSL)
11-
{: .fs-4 .fw-700 }
11+
{: .fs-6 .fw-700 }
1212

1313
On Windows the PSPDEV toolchain is run on Ubuntu running on Microsoft's WSL. This is very easy to set up and will offer us the full power of Linux from a Windows machine.
1414

psplink/linux.md

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
---
2+
title: Setting up PSPLINK on Linux
3+
layout: home
4+
nav_exclude: true
5+
---
6+
7+
# Setting up PSPLINK on Linux
8+
{: .fs-8 .fw-700 .text-center }
9+
10+
With Linux PSPLINK will work without making any changes, but it will require using sudo for the `usbhostfs_pc` command. To make it work without sudo, a udev rule can be added.
11+
12+
To make using PSPLINK without sudo create file called `/etc/udev/rules.d/50-psplink.rules` (for example with `sudo nano /etc/udev/rules.d/50-psplink.rules`) and add the following content:
13+
14+
```
15+
SUBSYSTEM=="usb", ATTR{idVendor}=="054c", ATTR{idProduct}=="01c9", SYMLINK+="psp", MODE="0666"
16+
```
17+
18+
Save this, in Nano this can be done with Ctrl+O and pressing enter. The run the following command:
19+
20+
```
21+
sudo udevadm control --reload
22+
```
23+
24+
Now PSPLINK can be used without sudo. Continue with the instructions on the [Debugging](../debugging.html) page.

psplink/windows.md

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
---
2+
title: Setting up PSPLINK on Windows
3+
layout: home
4+
nav_exclude: true
5+
---
6+
7+
# Setting up PSPLINK on Windows
8+
{: .fs-8 .fw-700 .text-center }
9+
10+
On Windows a driver needs to be installed before PSPLINK can be used. To do this take the following steps:
11+
12+
1. Make sure the programs `usbhostfs_pc` and `pspsh` are available in cmd. Otherwise download them [here](https://github.com/pspdev/psplinkusb/releases/download/latest/pspsh-windows.zip).
13+
2. Start PSPLINK on the Playstation Portable and connect it to the computer through USB.
14+
3. Download [Zadig](https://zadig.akeo.ie/) and start it. It will ask if you want to run it as administrator, click yes.
15+
4. In Zadig, click on `options` -> `List All Devices`.
16+
5. Select the entry `"PSP" type B` from the dropdown list.
17+
6. Left of driver, select the `libusb-win32` driver. Then click install.
18+
7. Wait for the installation to finish, then disconnect the USB cable from the PSP.
19+
20+
Now PSPLINK can be used with Windows. Continue with the instructions on the [Debugging](../debugging.html) page.

0 commit comments

Comments
 (0)