OK, I finally figured it out. Thanks for the piece about the -e option, that 
was critical.

I'll post what I did for anyone else who stumbles across this thread later in 
search of help.

So let's say I have these files to compile. An App.rcp file, an App.c file that 
has some code to make an actual Palm application (maybe it is preference 
options), and then a bunch of files (Standalone_07d0.c, Standalone_07d1.c, 
etc.) that will be standalone code resources, each of those files containing 
only one function. I wanted the code resources to start at 2000 (0x07d0).  
Also, the commands below assume that the function name in each of the 
Standalone files is the same as the filename, e.g. Standalone_07da.c contains 
only one function whose name is Standalone_07da
You could name the function inside something different, I believe, but then you 
have to give that different function name to the -e option that goes to the 
linker and specifies which function is the entry point to the code resource.

The way I was able to build everything into one functioning prc was like this:

pilrc App.rcp

m68k-palmos-gcc -O1 -o App -x c App.c

m68k-palmos-gcc -O1 -o Standalone_07d0 -nostartfiles -Wl,-eStandalone_07d0 -x c 
Standalone_07d0.c
mv Standalone_07d0 code07d0

m68k-palmos-gcc -O1 -o Standalone_07d1 -nostartfiles -Wl,-eStandalone_07d1 -x c 
Standalone_07d1.c
mv Standalone_07d1 code07d1

build-prc App.prc -n "App" -c aPPl *.bin code*


When compiling the standalone code resources, as I understand it, you need the 
-nostartfiles option so it does not look for PilotMain.

Then you need the option that is sent to the linker, 
-Wl,-eNameOfStandaloneFunction to tell the linker what function should be the 
first function in the standalone code resource. Based on this, it will put a 
jump instruction as the very first data/code in the code resource, that tells 
where to jump to find the entry function. When I didn't do this, it was putting 
my string literals as part of the .text, but they were before the actual code, 
and so things didn't work.

Maybe this will help some other poor confused soul like me.





-- 
For information on using the ACCESS Developer Forums, or to unsubscribe, please 
see http://www.access-company.com/developers/forums/

Reply via email to