This tutorial shows you how to use the PRC-Tools to create a simple Palm OS application. It is the second of two possible tutorials that you can read through. The PRC-Tools development environment has a great price (its free) and it well loved by many a C programmer. Just like CodeWarrior, we have made sure that you can easily use it in conjunction with the source code and examples in the rest of the book (all the code has been compiled within both environments).
Here is what this PRC-Tools tutorial describes:
A brief description of what PRC-Tools includes (which tools you install and use)
how to install PRC-Tools (this includes instructions for Windows, x86 Linux, Mac OS X, then for Unix). This is by far and away the most complicated portion of this tutorial.
how to use a sample project (O'Reilly starter) that makes everything easier to do
creating a new project
making a PRC file
The most important things are:
GNU C Compiler (GCC), which compiles C/C++ code to Motorola 68K. It also functions as a linker.
This builds a PRC file from the code and the resources.
A source-level debugger.
After we cover installation for all platforms, we will deal with creating a project.
The official distribution location for PRC-Tools is http://prc-tools.sourceforge.net. Complete instructions are found at http://prc-tools.sourceforge.net/install/cygwin.html. As you are following the instructions, make sure that you select to install all four of the following packages: prc-tools, prc-tools-htmldocs, pilrc, and make.
The official distribution location for PRC-tools is http://prc-tools.sourceforge.net. If you are using an x86 RPM-based Linux, you can follow the directions at http://prc-tools.sourceforge.net/install/rpm.html.
Complete instructions are found at http://www.zenonez.com/prctoolsx/.
The official distribution location for PRC-tools is http://prc-tools.sourceforge.net. Our instructions are for installing PRC-tools 2.1, the latest version at the time this was written.
Here are the instructions for installation.
The PRC-Tools is the development environment itself.
Otherwise, you'll need to do a build from the source. Download, uncompress and build: http://prdownloads.sourceforge.net/prc-tools/prc-tools-2.1.tar.gz
The SDK contains the headers and libraries needed for Palm OS development.
Download the 4.0 SDK from: www.palmos.com/dev/tools/sdk40.html
Download "Palm OS SDK Core Components"
Uncompress the tar file with:
cd /opt/palmdev tar -zxf sdk40-core.tar.gz |
Remove the unneeded files and rename to the needed directory names:
rm -rf Documentation "Palm OS SDK Licenses" mv "Palm OS Support" sdk-4.0 cd sdk-4.0 mv Incs include mv "GCC Libraries" lib |
This 4.0 SDK is now installed as /opt/palmdev/sdk-4.0. To make that the default (used if no specific SDK is specified), execute:
cd /opt/palmdev palmdev-prep --default 4.0 |
PilRC is the resource compiler; the last piece needed for development.
Install PilRC. The current version is 2.9. Download pilrc_src.tgz from: www.ardiri.com/palm/download.php?file=pilrc_src.tgz Download it to /usr/local/src (or some other desired location).
Uncompress it with:
tar -zxf pilrc_src.tgz |
The line endings for the files are DOS-style. This can cause problems for compilers. Fix it by changing the files to Unix-style line endings with this script:
cd pilrc-2.8 for fnam in *.* do tr -d '\r' < $fnam > /tmp/foo cat /tmp/foo > $fnam done |
There's a problem with a declaration of strdup in pilrc.c. Comment out its declaration:
//char *strdup(const char *s); |
Now, you're ready to build and make:
./configure make pilrc |
Install by copying to /usr/local/bin (or some directory of your choice):
cp pilrc /usr/local/bin |
This section of the tutorial is for for users of PRC-Tools on all platforms.
We know our job is to make things as simple as possible for you. As a result, we imagine that when you create a new project you would like it to be as easy as can be expected. So, presto, we have made life easier. We've created a new, very simple project that has the correct structure of a Palm OS application, but that doesn't actually do very much. That way, it's easier to use as the basis of a new application.
Download this project from: www.calliopeinc.com/stationery.html.
Duplicate the OReillyStationery directory:
cp -r OReillyStationery MyProject |
Build the project by doing a make:
cd MyProject make |
The result can be found in the GCC/OReillyStarter.prc.
To change the output file, edit the Makefile, changing the value of the APP variable:
APP=MyProject |
In addition, rename the .def file
mv OReillyStarter.def MyProject.def |
Now, when you make, the resulting prc can be found in GCC/MyProject.prc
If you'd like to build without debugging, change the CFLAGS definition in the Makefile from:
CFLAGS = -palmos4.0 $(DEBUGCFLAGS) |
to:
CFLAGS = -palmos4.0 $(RELEASECFLAGS) |