ps3 Tutorial 001
ps3 Tutorial 001
Lesson 1
SDK Installation and Compiling
Playstation 3 Development
Sam Serrels and Benjamin Kenwright1 *
Abstract
A beginners guide to getting started with programming and developing on the Sony Playstation 3 (PS3). This article gives a brief
introduction for students on setting up the development kit (DevKit) and working with the console specific tools and software.
Keywords
Sony, PS3, PlayStation, Setup, Windows, Target Manager, ELF, PPU, SPU, Programming, ProDG, Visual Studio
1 Edinburgh Napier University, School of Computer Science, United Kingdom: [email protected]
Contents
Introduction 2
1 Development Tools 2
1.1 Playstation 3 Software Development Kit (SDK) . . . . . 2
1.2 Application Specific Interface (API) . . . . . . . . . . . . . 2
1.3 Sony Playstation 3 Development Kit (DevKit) . . . . . . 2
2 Installing and Setting-up 2
3 Compiling Basic Example 3
4 Conclusion 4
Acknowledgements 4
References 5
Getting Started Sony’s Playstation 3 (PS3) development tools Components The Playstation 3 development lessons are di-
support the ANSI C/C++ coding standard. Hence, it’s straight- vided into subsequent parts. The article lessons give the students
forward to compile and run programs for the PS3. This article a chance to work within a commercial console environment. In
introduces the fundamental tools and software necessary to con- addition, it allows the students to port their games/applications
nect, compile, and debug your programs on the PS3. The lessons to the PS3. The different lessons include:
are intended to give step-by-step explanations in conjunction • Setting-Up and Installing
with screen-captures and code samples to get the students up to • Running and Debugging on the PS3
speed quickly on developing on the PS3. • Graphics
Lesson 1
SDK Installation and Compiling — 2/5
• Input (i.e., Controller) Visual studio intergration issues Visual studio must be ran
• Sound at least once prior to installing the PS3 SDK + VSI20XX.exe.
• SPU and PPU The Visual studio integration must be installed after the main
SDK. When opening an existing project with visual studio,
1. Development Tools double check the build configurations. Even with a successful
install, sometimes VS will default to a win32 build configu-
You need access to the following tools: ration, even in a PS3 project. The VSI installers can inly be
• Microsoft Windows (x32 or x64) used with the specified version of visual studio, they are not
• Microsoft Visual Studio 2010 or 2013 backwards compatible
• Sony’s Playstation 3 Software Development Kit (SDK) - • VSI2010.msi (5.42mb md5: c90a5c2aa06...)
available from ps3-edu.scedev.net. • VSI2013.msi (10.3mb md5: f4e2491b466...)
• Sony’s Playstation 3 Development Kit (DevKit)
1.2 Application Specific Interface (API)
1.1 Playstation 3 Software Development Kit (SDK)
The PS3 SDK provides a set of console specific libraries that are
The Sony PS3 SDK provides documentation, compilers, and
used to compile and run your PS3 executable. Within the PS3
the tools required to deploy and debug on the Playstation 3
SDK you will find a vast assortment of documentation on the
development kit.
different APIs. This includes information on the six Synergistic
Which SDK Version? The different SDK installers install Processing Units (SPUs) that give the PS3 hardware specific
different versions of the PS3 SDK. You will want to use the speed-ups. Understanding and exploiting the six Synergistic
most recent version, however an older verion may be required Processing Units (SPUs) requires skill and creativity if you
in some situations, so the various installer are listed below: intent to exploit the full computational power of the PS3.
• 2011-06PS3SDKOfflineInstaller.exe - version 3xx - 1.81gb
Documentation After the SDK install, your primary loca-
- md5: 01fae94cce9277c1d5e2819ba3d84607
tion of samples and documents is the ”C:/usr/local/cell” di-
• 2011-10PS3SDKOfflineInstaller.exe - version 3xx - 1.86gb
rectory, you should create a short-cut to this as you will be
- md5: 49e2a7941b459360bc5d0b493b3867c1
visiting it often. The best source of information is the main
• 2012-02PS3SDKOfflineInstaller.exe - version 400 - 1.96gb
”PS3 SDKDoc e” doc, located in ”cell/SDK doc/en/chm”.
- md5: e372f0bb50887526f81fb32032d9bbb4
• 2012-10PS3SDKOfflineInstaller.exe - version 420 - 1.42gb ProDG Target Manager (TM) You connect to your PS3 De-
- md5: bf4aa4be1f31ae641b178533396982d2 vKit and debug your program through the ProDG Target Man-
• 2014PS3SDKOfflineInstaller.exe - Version 450 - 1.44gb - ager (TM) and Debugger. The ProDG TM allows you to con-
md5: 53882f02b3ee20439f88ccbdeeee2b6f nect to the PS3 remotely (i.e., via the IP address), copy the
Note: When running the PS3 SDK installer, ensure that the executable across, launch the executable (i.e., even without the
extraction path does not contain any ampersands (&). debugger), take screenshots, and view the terminal output (e.g.,
Compilers The processor inside the PS3 is based on the cell raw text output as you would do with your desktop text output -
broadband architecture, rather than the standard x86 archi- such as, puts(..) and printf(..) shown in Listing 1).
tecture that your desktop computer uses. This means that a ProDG Debugger The ProDG Debugger runs on the devel-
compiler that supports the cell architecture must be used, the opment pc at the same time as your application on the devkit.
SDK comes with two: The SN systems compiler (SNC) and It can be used to inspect the state of the processing hardware,
the SCE GCC compiler (GCC). Compiled executables have the with data readouts like: the stack contents, registers, memory
extension ’.self’ - for signed elf. locations and process/thread states. If there is an error in your
GCC The GNU Compiler Collection(GCC) is a collection of application, this is where it would be detected. (Figure 2)
cross platform compilers for various programming languages.
The SCE GCC compiler inherits from this standard and behaves 1.3 Sony Playstation 3 Development Kit (DevKit)
just like any gcc compiler, but with PS3 support. The SN sys- The Sony Playstation 3 DevKit plays normal games similar to
tems compiler is based on GCC at its foundation, but it takes a a retail PS3 console. However, the PS3 DevKit possesses vari-
more Playstation 3 specific path, resulting in theoretically better ous hardware enhancements. For example, extra memory, i.e.,
performing code. The baseline is: GCC is more compatible 512MB instead of the 256MB retail units and custom firmware
with existing code, SNC produces optimised code at the cost of (e.g., see Figure 1).
compatibility.
2. Installing and Setting-up
Visual studio integration With the compilers and linkers
available in the SDK you could build and deploy with com- We give a step-by-step guide to getting the PS3 SDK installed
mand line scripts, or you could use Visual Studio. Visual studio and having you connect and be able to run an executable on the
integration come in the form of a separate installer from SN PS3 dev kit.
systems (VSI2013.exe / VSI2010.exe). This installer adds the 1. Install Visual Studio 2010 or 2013, run it once, then close it.
functionality to easily create, deploy and debug ps3 projects 2. Run PS3 SDK Installer (see Figure 5)
from within Visual Studio. 3. Install the required version of the Visual studio Integration
www.napier.ac.uk/games/
Lesson 1
SDK Installation and Compiling — 3/5
Listing 1. Echo.c
1 #include <stdio.h>
2 #include <stdlib.h>
3
4 int main(void)
5 {
6 char ch = ’\0’;
7
8 puts(”EchoTTY: Hit Q to quiet!\n”);
9
10 do
Figure 2. ProDG Debugger - Used to inspect the inner 11 {
workings of the processors as the application is running 12 int n = fread((void∗) &ch, 1 sizeof(ch), stdin);
13 if ( n&& ch!=EOF)
14 putchar(ch);
15 } while (ch != ’Q’ );
(VSI20XX.msi)) 16
4. Add the PS3 DevKit IP to your Target Manager (Figure 7) 17 puts(”EchoTTY: Quitting!\n”);
18 return EXIT SUCCESS;
5. Right click on the PS3 IP in your Target Manager and select 19 }
Connect (e.g., Figure 8)
6. Connected and ready to compile and run your compiled
programs on your PS3 DevKit Executable Output You won’t see any sexy graphics on screen
when you run the TTYEcho program. In fact, the screen will
Connected At this point, you should be able to connect to remain black. However, after you launch the executable in the
the PS3 DevKit remotely via the IP address. You can restart the Target Manager. Still within the Target Manager, select the
PS3 or launch executables via the Target Manager. Furthermore, ‘TTY’ output window. You will see the PS3 load the executable
when you run an executable on the PS3 you can capture text and then print out the text ‘EchoTTY: Hit Q to quit!’ - proving
output via the tty window or take screenshots on-the-fly. your code has executed on the PS3. The program is now sitting
and waiting for the input in the while loop (as shown in Listing
3. Compiling Basic Example 1).
Congratulations - you have successfully compiled and run
An uncomplicated PS3 project inside the SDK you can open and your first PS3 program. You are now ready to move forwards
compile quickly to check that your installation is correct and that and start compiling more complex programs to take advantage
you can compile and generate a PS3 executable is the ‘TTYE- of graphics, sound, and the controller input.
cho’ project (i.e., in folder: “C:/Program Files (x86)/SN System-
s/PS3/examples/TTY/TTYEcho/”). Within this directory you
should find a ‘TTYEcho.vcxproj’ and ‘TTYEcho vs2010.sln’.
Open the project in Visual Studio (e.g., open Visual Studio 2012,
select open project, then navigate to the folder TTYEcho and
open the project). If your PS3 SDK software installed correctly,
the project should open within Visual Studio without a problem.
Errors If you encounter this error message:
”Platform ’PS3’ referenced in the project file ’xxx’ cannot be
found. Please make sure you have it installed under ’%VCTar- Figure 3. Error Opening PS3 Project Within Visual
getsPath% \Platforms \PS3’” Then the sdk has not intergrated Studio - Wrong version of the PS3 SDK and Visual Studio.
into Visual Studio correctly. Find and run VSI2010.msi C:\Program Files (x86)\SN
If you encouter the error message: ‘The selected file is a solu- Systems\PS3\examples\TTY\TTYEcho\TTYEcho.vcxproj:
tion file, but was created by a newer version of this application warning : Platform ’PS3’ referenced in the project file ’Echo’
and cannot be opened’. cannot be found. Please make sure you have it installed under
TTYEcho Once you’ve opened the project you can see it has ’\%VCTargetsPath%\Platforms\PS3’.
a single ‘.c’ file called ‘Echo.c’, as shown in Listing 1. The
www.napier.ac.uk/games/
Lesson 1
SDK Installation and Compiling — 4/5
www.napier.ac.uk/games/
Lesson 1
SDK Installation and Compiling — 5/5
www.napier.ac.uk/games/