0% found this document useful (0 votes)
416 views

ps3 Tutorial 001

This document provides an overview of setting up development tools and compiling a basic example for programming on the Sony PlayStation 3. It discusses installing the PlayStation 3 Software Development Kit (SDK) and development kit (DevKit), using the included compilers and APIs, and debugging programs using the ProDG Target Manager and Debugger. The document is intended as a beginner's guide for students to get started with PS3 development.

Uploaded by

Hamsti Bamsti
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
416 views

ps3 Tutorial 001

This document provides an overview of setting up development tools and compiling a basic example for programming on the Sony PlayStation 3. It discusses installing the PlayStation 3 Software Development Kit (SDK) and development kit (DevKit), using the included compilers and APIs, and debugging programs using the ProDG Target Manager and Debugger. The document is intended as a beginner's guide for students to get started with PS3 development.

Uploaded by

Hamsti Bamsti
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

Online Technical Article, January 2014

Edinburgh Napier University - Playstation 3 Development

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

Introduction Figure 1. PS3 Development Kit - Sony PlayStation 3


About the Edinburgh Napier University Game Technology
Development Kit DECR-1000A - What is so good about a PS3
Playstation 3 Development Lessons Edinburgh Napier Uni-
DevKit over a PS3 Debug/Test console? For one thing, you can
versity Game Technology Lab is one of the leading game teach- debug code as if you were running it on your PC, furthermore,
ing and research groups in the UK - offering students cutting you can dump/debug the PS3 Hypervisor and Kernel.
edge facilities that include Sony’s commercial development kits.
Furthermore, within the Edinburgh Napier Game Technology
group are experienced developers to assist those students aspir- Additional Reading In addition to the lesson tutorials, we
ing to releasing their own games for PlayStation. Student have would recommend reading a number of books on Playstation 3
constant access to he Sony DevKits and encourage enthusiastic development and cross-platform coding, such as, Cell Program-
students to design and build their own games and applications ming for the PS3 [3], Vector Maths and Optimisation for the
during their spare time. PS3 [1], and Cross-Platform Development in C++ [2].

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

source code is uncomplicated and conforms to the basic ‘C’


standard. When you compile the program you should get ‘Build
Scceeded’. Navigating to the project directory, you will notice
a folder called ‘PS3 PPU Debug’. Within this directory you
should notice the compiled files, such as Echo.o, TTYEcho.log.
However, most importantly, you should see ‘Echo.ppu.self’,
which is the executable you copy and launch on the PS3 using
the Target Manager.

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

Figure 4. Error Opening PS3 Project With Wrong


Version of Visual Studio - Wrong version of the PS3 SDK
and Visual Studio.

Figure 6. PS3 Tools - After PS3 installer has finished, you


should notice extra options within the start menu.

7 printf(”Buffer Address:\t0x%.8X\n”, fbOffsetFront+0←-


xC0000000);
8 printf(”Display Width:\t%d\n”, resolution.width);
9 printf(”Display Height:\t%d\n”, resolution.height);
10 printf(”Color Pitch:\t%d\n”, colorPitch/←-
BYTES PER PIXEL);
11 printf(”===========================\n”);
12 }

Figure 5. Installing PS3 SDK -


Listing 3. Output from Listing 2
1 ===========================
4. Conclusion 2 Buffer ID: 0x00000000
3 Buffer Address: 0xC0000000
In summary, if everything went well, you should be setup and 4 Display Width: 720
ready for developing on Sony’s Playstation 3. The PS3 SDK and 5 Display Height: 480
6 Color Pitch: 768
Visual Studio integration should be working. You should have 7 ===========================
successfully compiled and launched a ‘signed’ PS3 executable
on the PS3 DevKit and viewed the TTY output in the Target
.self File Format The ’signed’ elf (i.e., .self) PS3 executable
Manager.
format specification is available online for those that want to
investigate the low-level details. For example, the first seven
Appendix bytes of a compiled ’.self’ executable if you open it in a hex-
editor are: ’SCE0000’.
Task Manager
Screen Captures If you’re are not able to touch the PS3 stdio and stdlib All of the standard C/C++ libraries have
physically, you can still connect and execute your program been ported across to the PS3 - hence, it’s very easy to port
remotely. Furthermore, if you want you can take still video across basic C/C++ code to the PS3 (e.g, sprint, fopen, write,
capture images of the screen using the Task Manager (e.g., puts).
Figure 9).
Acknowledgements
Listing 2. The Target Manager screen capture facility needs
to know the PS3 graphical output parameters (e.g., dimensions We would like to thank all the reviewers for taking time out
and colour pitch). We can determine this in code using the of their busy schedules to provide valuable and constructive
following code snippet. feedback to make this article more concise, informative, and
correct. However, we would be pleased to hear your views on
1 {
2 cellGcmSetDisplayBuffer(0, fbOffsetFront, colorPitch, ←- the following:
resolution.width, resolution.height); • Is the article clear to follow?
3 • Are the examples and tasks achievable?
4 #define BYTES PER PIXEL 4
5 printf(”===========================\n”); • Do you understand the objects?
6 printf(”Buffer ID:\t0x%.8X\n”,0); • Did we missed anything?

www.napier.ac.uk/games/
Lesson 1
SDK Installation and Compiling — 5/5

Figure 9. Task Manager Capture -

Figure 7. PS3 Tools - Target Manager: Start - SCE -


Playstation(R)3 Development Tools - Target Manager

Figure 8. PS3 Tools - You connect via the PS3 IP address


(e.g., 146.176.165.238). You can see the PS3 IP address if you
reset the PS3 in debug mode - it should display on the screen. Figure 10. Task Manager Folder -

• Any surprises? References


The lessons provide a basic introduction for getting started [1] James Leiterman. Vector games math processors (wordware
with Sony’s Playstation 3 console development. So if you game math library) (isbn:978-1556229213), 2011. 1
can provide any advice, tips, or hints during from your own [2]
exploration of PS3 development, that you think would be in- Syd Logan. Cross-platform development in c++: Build-
dispensable for a student’s learning and understanding, please ing mac os x, linux, and windows applications (isbn:978-
don’t hesitate to contact us so that we can make amendments 0321246424), 2007. 1
and incorporate them into future tutorials. [3] Matthew Scarpino. Programming the cell processor: For
games, graphics, and computational proccessing (isbn: 978-
0136008866), 2011. 1
Recommended Reading
Programming the Cell Processor: For Games, Graphics, and
Computation, Matthew Scarpino, ISBN: 978-0136008866
Vector Games Math Processors (Wordware Game Math Li-
brary), James Leiterman, ISBN: 978-1556229213
Clean Code: A Handbook of Agile Software Craftsmanship,
Robert C. Martin, ISBN: 978-0132350884

www.napier.ac.uk/games/

You might also like