Mark Tigges wrote:
So, as I've learned more about PODS, and prc-tools I have become quite
dismayed.  We have a visualization library for detail in context
viewing of GIS data.  We have successfully deployed this on 300+MHz
ARM machines in the past, running various PocketPC incarnations.  It
seems to me that in order to get this working on 5.4 I need to do the
following:

  1. Compile our C++ library using pacc -pno

  2. Write a C interface for at least (limited functionality) 100
     functions (about 700 for full functionality) which does the
following:
       a. take the function arguments and compile them into a data
          block.

       b. use the PceNativeCall to call the appropriate PNO function
          with that data block as argument.

  3. Write a m68k app with this PNO linked as a resource.

I think there's another way.  You can put 99% of the application inside
the PNO.  The stuff that goes outside it is the basic initialization
stuff that handles launch codes and so on.  The event loop can go
inside the PNO itself.

There are some advantages and some disadvantages to this.

Advantages:
1.  The structure of your app itself will not have to radically altered,
    because the bulk of the app never crosses the 68k / PNO barrier.
    This is actually a huge advantage when you consider endian, word
    alignment, and structure packing issues and how much of a nightmare
    these can be if you need to share complex data structures across
    the 68k / PNO barrier.

2.  Advantage:  speed.  All of your code is ARM.

Disadvantages:

1.  All system calls go through 68k[*].  This means that any struct you
    pass to a system call or get back from a system call (including
    all events!) will show up as 68k-formatted stuff, and you've got
    to read and write that with ARM code.  For example, a RectangleType
    is four 2-byte ints, so when you write one of those, you'll have
    to worry about endianness.  How much extra work this generates
    for you depends on how many different API calls you make, but
    the good news is that your app grows larger, you typically only
    make a few additional API calls, so once you've got most of them
    wrapped in a compatibility layer, you're OK.  (The biggest
    difficulty here is debugging these API calls if you get the
    wrapper wrong, which is easy to do since the work is tedious.)

2.  The app will only be able to run on devices that can run PNOs.
    Many people write their apps as 68k for compatibility and have
    68k versions of the PNO routines as well, so that they can
    use whatever is available on the device.  However, in your case,
    if you've got complex CPU-intensive stuff (which it sounds like
    you do), then you probably wouldn't support 68k stuff anyway.

3.  Since you are putting everything in the PNO, the PNO image itself
    is going to grow large, or at least larger than your typical
    PNO (which just has a few kilobytes of code in it).  Since you'll
    have to put your PNO in a PRC, you'll have to break it up into
    multiple pieces and rejoin them into a contiguous memory area
    before you can run the PNO.  This adds complexity and requires
    you allocate lots of contiguous memory from dynamic heap, and
    dynamic heap is pretty limited on Palm OS devices.  However,
    since you are restricting yourself to Palm OS 5.x anyway, most
    OS 5.x devices have a reasonable amount of dynamic heap.

4.  Debugging.  It's not impossible, but it is a little harder.
    You can't run an ARM PNO on any Simulator or Emulator, so you'll
    have to debug against real hardware, or build an x86 DLL version
    of your PNO and debug that on the Simulator on the PC.

Even though I've listed 4 disadvantages and 2 advantages, I still
think the advantages might outweight the disadvantages.

  - Logan

[*]  Actually, it is apparently possible to do them directly
     without going from ARM (your app) into PACE (68k emulation)
     and back down into ARM (system call implementation), but
     it's tricky, and the 68k interface to the system calls is
     a standard, published interface so you probably have a better
     guarantee of compatibility across different devices.

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

Reply via email to