Hello all,

I've tried unsuccessfully to get a pilot program written and running.
I get errors using the emulator with my program.  I'm looking for
advice on what to do next. Here are the details:

First, the things that I *can* do and/or understand:
----------------------------------------------------
 1. I've lurked on this list for about 3 weeks now
 2. I've downloaded and installed the GCC tools
    - I have about 15 years of Unix experience and can write makefiles
      from scratch; I'm not having any troubles with the tools as far
      as I can tell.
 3. I've used the emulator quite successfully with a whole bunch of
    other .prc files, including HackMaster, half-a-dozen hacks and
    at least two dozen other .prc's.  I even understand gremlins.
 4. I've downloaded, installed and used CodeWarrior Lite with their
    sample program ("starter") successfully, on both the emulator and
    my physical hardware.  I'm not staying with CW because I can't fork
    over $350 at this time.  Actually, my budget is $0, but I'm okay
    on time, so I'm sticking with GCC.
 5. I've read the following documents:
    - The API documents: System Management, Interface Management and
      Data & Comm Management (at least the text parts, not all the
      "man"-page stuff)
    - The GCC tutorial
    - The Code Warrior Tutorial
    - The Palm Cook Book for Windows
 6. I'm running on Win95. (Please, no religious flames here.  I have
    multiple users on my computers all day running Windows applications
    with no interest or training in Linux.)
 7. I'm not running emacs (yes, all those years were done with vi).
 8. Professionally, I live in Microsoft Developer Studio writing Windows
    code.  So I continue to use that tool for Pilot Programming and I've
    created a menu with options and hotkeys for building pilot stuff.

Now for the things I'm having problems with:
--------------------------------------------

 1. I'm *not* running "copilot".  I would if I could, but it won't load
    on my system.  When running (what I think is) POSE, it seems to run
    fine.  But with copilot I get an error dialog saying that "this program
    has performed an illegal instruction and will be shut down..." 
    I'm using the same ROM file for both programs, which I downloaded
    from 3Com's web site.
 2. Because I can't run copilot, I (think that I) cannot run a debugger.
 3. I've tried walking through the GCC tutorial application but ran
    into two problems that did not seem to be intended parts of the
    tutorial process:
    - pilrc reports a duplicate control ID.  This was easy to fix,
      but was inconsistent with what's written in the guide.
    - I'm not sure what to do about the second error.  Here's the output
      from the compile batch file:

         C:\projects\pilot\tutorial>pilrc tex2hex.rcp 
         pilrc v1.5.  by Wes Cherry ([EMAIL PROTECTED])

         Writing ./tFRM03e8.bin
         240 bytes
         Writing ./tver0001.bin
         4 bytes
         Writing ./tAIB03e8.bin
         144 bytes
         Writing ./Tbmp03e8.bin
         656 bytes
         Writing ./Tbmp03e9.bin
         656 bytes
         Writing ./MBAR03e8.bin
         171 bytes
         Writing ./Talt03e8.bin
         62 bytes
         Writing ./Talt03e9.bin
         48 bytes

         C:\projects\pilot\tutorial>m68k-palmos-coff-gcc -O1 -c tex2hex.c 
-o tex2hex.o 

         C:\projects\pilot\tutorial>m68k-palmos-coff-gcc -O1 tex2hex.o -o 
tex2hex
         tex2hex.o(.text+0x3ca):tex2hex.c: relocation truncated to fit: 
DISP16 memHandleUnlock

         C:\projects\pilot\tutorial>m68k-palmos-coff-obj-res tex2hex
         Can't open tex2hex

    -----------------
    obviously, things start falling apart after the relocation error
    -----------------

 4. I've minimized the GCC tutorial application over several iterations
    and I'm now down to only PilotMain that looks like:

       #include <pilot.h>
       DWord PilotMain( Word cmd, Ptr cmdPBP, Word launchFlags )
       {
          int error;
          if (cmd == sysAppLaunchCmdNormalLaunch)
          {
             /* do nothing */
          }
          return 0;
       }

 5. I build the program like this:  (The actual makefile correctly has tabs
    before the commands, not the spaces that this mail message shows)

       MAIN   = testform
       NAME   = "Test Form"
       ID     = DsTf
       CFLAGS = -DERROR_CHECK_LEVEL=2
       GCC = m68k-palmos-coff-gcc
       RES = m68k-palmos-coff-obj-res
       ALLOBJS = $(MAIN).o $(OBJS)

       .c.o:
          $(GCC) $(CFLAGS) -c $<

       default: $(MAIN).prc

       # This step produces all the .bin files from the resource
       # definition source.  The output file names are not
       # predictable, so I produce an additional touch file.
       touch_pilrc.tch: $(MAIN).rcp
          pilrc $(MAIN).rcp
          @echo touch >$@

       # This step produces all the .grc files from the object code.
       # The output file names are not predictable, so I produce an 
       # additional touch file.
       touch_res.tch: $(ALLOBJS)
          $(RES) $(ALLOBJS)
          @echo touch >$@

       $(MAIN).prc: touch_pilrc.tch touch_res.tch
          build-prc $(MAIN).prc $(NAME) $(ID) *.grc *.bin
          ls -l $(MAIN).prc

   --------------------------
   The output of the makefile is:
   --------------------------

      pilrc testform.rcp
      pilrc v1.5.  by Wes Cherry ([EMAIL PROTECTED])
      Writing ./tFRM03e8.bin
      166 bytes

      m68k-palmos-coff-gcc -DERROR_CHECK_LEVEL=2 -c testform.c

      m68k-palmos-coff-obj-res testform.o 

      build-prc testform.prc "Test Form" DsTf *.grc *.bin

      ls -l testform.prc
      -rw-r--r--   1 500      everyone      411 Mar 01 23:17 testform.prc

      Tool returned code: 0

 5. This shell *will* load "successfully" and will even "run" (doing
    nothing) and the previous application always runs afterwards.
    But if I tweak some code, rebuild, reload and try again then I
    might get an emulator dialog saying that the program has performed
    an illegal instruction.  Tweak some more, and I'm back to the do-nothing
    behavior!  I can't seem to consistently reproduce the individual scenarios
    at will.

 6. Even if I get the do-nothing scenario, once I run the program,
    I can't delete it using the emulated memory application.  Everything
    goes fine up to the confirmation, and then it says, "unable to
    delete <program>".

 7. In the crash scenario, once I run the program, the emulator resets
    and then keeps crashing.  I assume that this is because the errant
    app is running in turn with the other apps during a reset and dying
    again.  I have to kill the process and erase the emulator's "ram" file.

Help...?

Dave.

-- 
Dave Smith
Colorado Springs, CO USA

Reply via email to