PrizmSDK Setup Guide

From WikiPrizm
Jump to navigationJump to search

This page has not been completed. Parts may be missing or reorganized before completed. Information is provided as-is and may have errors.

The PrizmSDK is a community-created SDK for writing C/C++ programs for the Casio Prizm. Casio, as of now, has shown no plans of making and releasing an official SDK. The PrizmSDK contains headers, libraries, scripts, and a build system for developing programs using GCC.

This article will highlight the steps needed to setup the SDK.

Getting the SDK

Firstly, the latest PrizmSDK packages are available here. This SDK contains Windows binaries for GCC and the needed development files for compiling for the Prizm.

If you're migrating from the "Mini SDK" or attempting to compile old programs, see SDK Compatibility for details on what you'll need to do.

Setting Up the SDK on Windows

The PrizmSDK works out-of-the-box on Windows. Unpack the compressed folder to any location on your computer, such as your My Documents folder. Although you need each of the directories within the compressed archive to build add-ins for the Prizm, you will be primarily working within the projects/ folder. To start, duplicate the projects/default/ folder as projects/yourproject, changing yourproject to the name of your project. You'll want to make sure there's a make.bat file that contains something like this:

..\..\bin\make.exe %*

Next, rename the default.c to yourproject.c, again using the actual name of your project (which should be all letters, numbers, and underscores with no spaces). Finally, edit the Makefile to your preferences. It should contain the following:


If you wish to use a bitmap icon, you'll also need something like this in the Makefile

MKG3AFLAGS=-i uns:yourproject_u.bmp -i sel:yourproject_s.bmp -n basic:YourProject

Here, yourproject_u.bmp is the unselected icon image, yourproject_s.bmp is the selected icon, and YourProject is the name of the add-in to be displayed. See the Icon Design Guidelines for more information on creating add-in icons.

When you are ready to build your project, simply double-click the make.bat file. It will pause so that you can examine any errors or warnings, then close.

Setting Up the SDK on Linux

The SDK only comes, as of v0.3, with pre-built Windows binaries. In order to compile .g3a's using a native compiler, GCC must be built from source.

Arch Linux

For Arch users, there are packages in the AUR that provide the necessary toolchain:

  • cross-sh3eb-elf-binutils
  • cross-sh3eb-elf-gcc
  • mkg3a

Install them as you would any other AUR package. From there, you will need to configure the SDK package to use your compiler, although the directory given below is not the one needed with the AUR packages. You'll have to find it yourself until someone documents what it should be.

Other Distributions

For other distributions that do not provide packages for SuperH GCC and binutils, you will need to compile the toolchain yourself.

Getting the Needed Packages

In order to build a compiler, you must grab a GCC package (non-core) and a binutils package. I have tested using the binutils-2.22 release and the gcc-4.6.2 release packages.

Setting up the Build Environment

For building the needed packages, /usr/src/ will be used for building and /usr/local/cross/ will be used for output. For this guide, please preserve your shell session.

Firstly, open up your preferred terminal emulator. Navigate to /usr/src/, creating it if not already made, and change the mode of src/ for global read/write access. Also while root, create /usr/local/cross.

$ cd /usr
$ su
# chmod a+rw src
# mkdir /usr/local/cross
# exit
$ cd src
$ touch a

If you were able to run touch a without problems, then you have access to the src folder. Next, you will set up the build structure in the src/ folder.

$ mkdir build-gcc build-binutils

You should have the two folders created. Extract the two downloaded packages into /usr/src/, named gcc and binutils. You should have two folders, /usr/src/gcc and /usr/src/binutils with the extracted files in them.

The build-* folders are used for all of the temporary files generated when building these packages. If you build in gcc/ and make a mistake and mess up the build system, you must remove it and extract again. If you make a mistake in build-gcc, then you just have to delete and remake the build-gcc folder because all of the Makefiles and temp files are only placed in the build folders.

Compiling binutils

Continuing from your already existing terminal session, go into the build-binutils folder and begin configuring your build with

$ cd build-binutils
$ ../binutils/./configure --target=sh3eb-elf --prefix=/usr/local/cross --disable-nls

If you have any missing headers errors, search and install the missing files. The exact way to do so depends on a per-distro basis.

Once the configure succeeds, you may proceed to build binutils and install using

$ make
$ make install

Compiling GCC

Now that binutils have been properly set up and installed, you can proceed to building GCC. Verify that you downloaded the gcc-x.x.x package and not the gcc-core-x.x.x (or others). Do not forget to do this step or else the configuring will fail:

export PATH=$PATH:/usr/local/cross/bin

Once the above is done, proceed to configure GCC by continuing from above:

$ cd /usr/src/build-gcc
$ ../gcc/./configure --target=sh3eb-elf --prefix=/usr/local/cross --disable-nls --enable-languages=c,c++ --without-headers

Most likely, you will have errors for missing headers. Install all of the and reconfigure if needed. Once configuring completes, start building the specific components of gcc using:

$ make all-gcc
$ make install-gcc

You now have GCC installed, but libgcc hasn't been built. You can build and install it using:

$ make all-target-libgcc
$ make install-target-libgcc

Compiling mkg3a

mkg3a is a tool used in the PrizmSDK to take the binary ELF output and package it into a .g3a that can be sent to the Prizm. The SDK comes with a Windows version, but a linux build can be done. In order to build a stable release, grab 0.2a and extract it, location does not matter. Make sure that you have cmake installed on your system before proceeding.

In the terminal session, navigate to the mkg3a directory and run

$ cmake .

This will create the needed Makefiles. You can proceed to build and install using:

$ make
$ su -c 'make install'

Enter your root password when prompted to when installing.

Configuring the PrizmSDK

In your PrizmSDK directory, edit the prizm_rules under common/ and modify the PREFIX... line to read:

PREFIX := /usr/local/cross/bin/sh3eb-elf-

Once everything above has been completed, you should be able to use projects/example/ as a starting point for making your projects. Try creating a simple program and test-build in order to verify that your installation was correct.