|
|
Jim Weller |
export MYPALMDIR=/root/palm
export MYARCHIVEDIR=$MYPALMDIR/archive
export PATH=/usr/local/palm/bin:$PATH
mkdir /usr/local/palmdev
mkdir /usr/local/palm
cd $MYPALMDIR
tar -xzf $MYARCHIVEDIR/sdk35.tar.gz
mv Palm\ OS \ 3.5\ Support/ /usr/local/palmdev/sdkpalmos-3.5
cd /usr/local/palmdev/sdkpalmos-3.5
mv Incs include
cd $MYPALMDIR
mkdir src
cd src
tar -xzf $MYARCHIVEDIR/binutils-2.9.1.tar.gz
tar -xzf $MYARCHIVEDIR/gcc-2.95.2.tar.gz
tar -xzf $MYARCHIVEDIR/gdb-4.18.tar.gz
tar -xzf $MYARCHIVEDIR/prc-tools-2.0.tar.gz
cat prc-tools-2.0/{binutils-2.9.1,gcc-2.95.2,gdb-4.18}.palmos.diff | patch -p0
cd prc-tools-2.0/
ln -s ../binutils-2.9.1 binutils
ln -s ../gcc-2.95.2 gcc
ln -s ../gdb-4.18 gdb
cd ..
mkdir build
cd build
mkdir empty
../prc-tools-2.0/configure \
--target=m68k-palmos; \
--enable-languages=c,c++ \
--with-headers=`pwd`/empty \
--sharedstatedir=/usr/local/palmdev \
--prefix=/usr/local/palm --with-build-sdk=3.5 \
--exec-prefix=/usr/local/palm;
make all-install
|
Assuming all goes as expected. You'll have the SDK stuff in /usr/local/palmdev and then platform specific tools (m68k-palmos-gcc,m68k-palmos-c++,m68k-palmos-ranlib, etc.) in /usr/local/palm. Now put /usr/local/palm/bin in your permanent path (edit .bashrc,.cshrc, profile etc.).
[top]4. A Hello World Program
Now you can compile a hello proggie.
I had to hack up all the demos from the HOWTOs after reading the SDK header files. The header names, primitive types, and compiler tool's names are incorrect for version 3.5 of the PalmOS © SDK in the HOWTO samples. Plus, it appears that the Examples that come with the SDK all have zero length resource files (e.g. SampleCalculator.rsrc). I compiled the packages, but they crashed on the emulator.
Save the below snippet in a text file called hello.c .
hello.c
#include <PalmOS.h>
// ---------------------------------------------------------------------
// PilotMain is called by the startup code and implements a simple event
// handling loop.
// ---------------------------------------------------------------------
UInt32 PilotMain( UInt16 cmd, void *cmdPBP, UInt16 launchFlags )
{
EventType event;
if (cmd == sysAppLaunchCmdNormalLaunch) {
// Display a string.
WinDrawChars( "Hello, world!", 13, 55, 60 );
// Main event loop:
do {
// Doze until an event arrives.
EvtGetEvent( &event, evtWaitForever );
// System gets first chance to handle the event.
SysHandleEvent( &event );
// Normally, we would do other event processing here.
// Return from PilotMain when an appStopEvent is received.
} while (event.eType != appStopEvent);
}
return;
}
|
You can compile it like this. Did you fix your PATH to have /usr/local/palm/bin ?
m68k-palmos-gcc hello.c -o hello m68k-palmos-obj-res hello build-prc hello.prc "Hello, World" WRLD *.hello.grc |
Blamho! Now you'll have a hello.prc that you can put in the emulator (works!) or in your palm (WORKS!).
5. Screen Shots
Here's some pics and screen shots of the emulator (running under windows) running hello.prc (compiled under linux). You'll note the name of the app is what was specified on the build-prc command line. I also tested the hello.prc file on my PalmIIIe. It Works!
[top]
6. References
I glommed all this together from the following urls.http://www.PalmOS.com/dev/tech/tools/gcc/
http://www.PalmOS.com/dev/tech/tools/gcc/building.html
http://www.PalmOS.com/dev/tech/tools/emulator/
http://www.PalmOS.com/dev/tech/tools/sdk35.cgi
ftp://ftp.gnu.org/pub/gnu
http://www.netmeister.org/palm/POSE/POSE-HOWTO.html
http://www.orbits.com/Palm/PalmDevelopment-HOWTO.html
http://www.cyberport.com/~tangent/palm/faq/articles/gcc.html
[top]
7. Downloads
I have copies of the software mentioned locally here at jimweller.net. Some of it is protectected by licenses. So be sure and read those. And be all legal and stuff. It is only a 128K connection, but for what it's worth here ya' go:binutils-2.9.1.tar.gz
emulator-win.zip
emulator_skins_15.zip
gcc-2.95.2.tar.gz
gdb-4.18.tar.gz
prc-tools-2.0.tar.gz
sdk35-docs.tar.gz
sdk35-examples.tar.gz
sdk35.tar.gz
hello.c
[top]
All trademarks and copyrighted materials on this page are owned by their respective owners. The Rest Copyright © Jim Weller 2001.
Linux Palm Developer's Quick Start Guide