Mitch Fawcett,

>I've checked the forum archives and I can't find any mention of anyone
>having actually created a multi-segment prc using GCC.  The GCC
>documentation doens't mention it either.
>
>So I'll ask... has anyone managed to do it?  My only other choice is
migrate
>my project to CW; which I dread the thought of. Nothing against CW, it is
>just going to be a tremendous amount of work I'd like to avoid.

I had the same problem as you. It took some time, but I got it figured out.
Here is the makefile I ended up using:

--------------------------------------------------------------------------
CC = m68k-palmos-gcc
CFLAGS = -O2 -palmos3.5 -Wunused

AS = m68k-palmos-gcc
ASFLAGS = -c

myprog.prc: bin.stamp myprog myprog.def
 build-prc myprog.def myprog *.bin

myprog: myprog.o myprog-sections.o myprog-sections.ld

myprog.o: myprog.c
myprog-sections.o: myprog-sections.s

myprog-sections.s myprog-sections.ld: myprog.def
 multigen myprog.def

bin.stamp: myprog.rcp myprog.h Myprog.bmp Myprogc.bmp Myprogs.bmp
Myprogsc.bmp
 pilrc -q myprog.rcp

clean:
 rm -f *.o *-sections.* *.prc myprog
--------------------------------------------------------------------------

Then in your code, all you need to do is add the section attribute option to
your routine prototypes, like this:

#define sect1 __attribute__ ((section ("myprog1")))
#define sect2 __attribute__ ((section ("myprog2")))

static void StartApplication (void) sect1;
static void StopApplication (void) sect1;
static void EventLoop (void) sect2;
etc.

Do *NOT* add a section attribute for your PilotMain, because it needs to go
into the default section. Just divide the routines up into segments so that
they stay under 32k.

Lastly, your Myprog.def file should look like this:

application { "My Program" MYPR }
multiple code { "myprog1" "myprog2"}

That's all there is to it! All of this assumes you have everything installed
in the standard locations and that you're using Windows.

Hope that helps!

Tom



-- 
For information on using the Palm Developer Forums, or to unsubscribe, please see 
http://www.palmos.com/dev/tech/support/forums/

Reply via email to