Hi,

Many thanks to Patrick Porlan and Jun-Kiat Lam on helping me with the 64k
size related problems!

Since I found the information so useful I thought I would summarize it
and post it here for everyone.

Regards,
Chris

---------------------------------------------------------------------------
--------

Here's the 64k limit top ten list...


1-  Palm OS databases are resources or records, depending on the DB type.

2-  Resources are limited to 64K. The code in prc's is provided as
resource(s).

3-  The compiler has to generate several code resources for big
applications.
    Some people would say that your compiler must support "multi-segment
applications"

4-  This goes with some tweaking for functions calls that across segments,
    and several limitations. For example, all the code executed in
sublaunch
    must be located in the first segment.

5-  I'm not sure about that, but I think that the application globals are
only
    accessible in the first segment (I don't know about GCC - I've heard
that it
    provides some support for better globals handling).

6-  The globals are accessible from all segments In fact they are accessed
    though a register relative addressing scheme, and the base register
    is preserved across inter-segment function calls.

7 - You have to use a different startup code for multi-segment
applications.
    The standard statup.lib doesn't care about the inter segment jump
table,
    but the one that is used when you create a new project using the
    multi-segment application template is OK.

8-  Functions calls are PC relative in Palm OS applications. Generally they
are
    coded using +/- 32K jumps (near). If your code has more than 32K of
code
    larger ranges become necessary. You can either use large (32 bits)
offsets,
    or let the compiler/linker optimize that (smart model). That setting is
    independent from the startup code that you use in your app.

9-  To be precise, you can have all kinds of function calls in a large
    multi-segment application:
     - short (16 bit range) program counter relative calls
     - long ones
     - inter-segment calls, that need some wrapping code from the
compiler/linker

    Also, the main must be located in the first segment. In CodeWarrior,
    you can assign source or object files to a specific segment. You should
    try to minimize inter-segment calls for minimum size and maximum speed.

    If your application gets sublaunched, all processing must be done in
the
    first segment (minimal application startup operation is performed to
    save time, since all applications in your Palm are sublaunched each
    time a notification like time change or reset is broadcasted).

10- Maximum application size is 64K per segment. You should resegment your
if
    it is larger than this. There is a documentation on creating
multisegment
    apps in "Targeting Palm OS.pdf", page 47.


Reply via email to