PrizmSDK Setup Guide
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.
- 1 Getting the SDK
- 2 Setting Up the SDK on Windows
- 3 Setting Up the SDK on Linux
Getting the SDK
Firstly, the PrizmSDK package is available here. There's also a fork of PrizmSDK which is more up-to-date that can be downloaded from here. These versions should be compatible. This SDK contains Windows binaries for GCC (the compiler) 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 %* pause
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:
... CSOURCES=yourproject.c ... BIN=yourproject.bin
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.
For Arch users, there are packages in the AUR that provide the necessary toolchain:
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.
For other distributions that do not provide packages for SuperH GCC and binutils, you will need to compile the toolchain yourself. If you have gcc compilation problems, check this topic.
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 (note: you should better use gcc-4.6.3, see ) release packages. Note the above versions are those originally tested by the author there is nothing wrong with using the latest version. If you are having trouble compiling binutils please add --disable-werror when you run ./configure
In addition to these core source packages, you must ensure that you have the required development headers installed on your system. Make sure that you have the development packages for:
Also, make sure that you have the following packages installed as well:
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.
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
Helpful hint: If you have a multicore CPU with RAM to spare, you can speed up builds by using `make -j` instead of `make` for this guide.
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:
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
Another way to compile
The above method will get the job done. However, it is easier to just run this command. Note: before running this, please create a folder where you want the GNU toolchain to be installed, and replace InsertPathHere with the full path of the directory. For instance, you could replace InsertPathHere with $HOME/casio-gcc. The above guide ran as root, but that is not necessary if you are going to be installing this in a folder that the current user has sufficient permissions to access.
tar -xf binu* && tar -xf gcc* && export PREFIX=InsertPathHere && export PATH=$PATH:$PREFIX/bin && export TARGET=sh3eb-elf && export CFLAGS="-O2 -pipe -s -fomit-frame-pointer -ffunction-sections -fdata-sections" && export CXXFLAGS=$CFLAGS && export LDFLAGS="-Wl,--gc-sections" && mkdir build-binutils && cd build-binutils && ../binutils-2.*/configure --disable-werror --target=$TARGET --prefix=$PREFIX --disable-nls --disable-tls --disable-libssp && make && make install && cd .. && mkdir build-gcc && cd build-gcc && ../gcc-4.*/configure --target=$TARGET --prefix=$PREFIX --enable-sjlj-exceptions --disable-hosted-libstdcxx --with-gnu-as --with-gnu-ld --enable-languages=c,c++ --disable-nls --disable-tls --disable-libssp --disable-threads --disable-shared --disable-__cxa_atexit && make all-gcc && make install-gcc && make all-target-libgcc && make install-target-libgcc
mkg3a (not to be confused with the PrizmSDK itself) is a tool used in the PrizmSDK to take the binary ELF output and the icons and package them into a .g3a that can be sent to the Prizm calculator. The SDK comes with a Windows version, but a Linux build can be done. In order to build a stable release, download mkg3a 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.
I get this error when trying to build gcc/libgcc: (Linux)
checking for suffix of object files... configure: error: in `/usr/src/build-gcc/sh3eb-elf/libgcc': "configure: error: cannot compute suffix of object files: cannot compile "
This is caused by the configure script not finding the binaries made by binutils.
- Make sure that you ran export PATH=$PATH:/usr/local/cross/bin before doing ./configure [rest of the parameters]
- If you do have the path adjusted, verify that you do have binaries like sh3eb-elf-as, sh3eb-elf-ld, etc in /usr/local/cross/bin. If not, do make install again in your build-binutils folder.
- If you know that the binaries are there, you can run them when they are in your $PATH, but it still fails, make a thread on Cemetech's Prizm subforum.
Configuring the PrizmSDK
In your PrizmSDK directory, edit the prizm_rules under common/ and modify the PREFIX... line to read ONE of the two of the following, depending on where your cross-compiler toolchain is:
PREFIX := /usr/local/cross/bin/sh3eb-elf- PREFIX := /usr/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.