David, and anyone else getting started with GCC and Win95:

Yes, I remember that one of the resource ID's is duplicated requiring a fix in the
tex2hex.rcp file.

As of mid Feb 1999 these are the latest versions:

GCC (GNU Pilot SDK for Win32) V0.5.0 (quite old) is available from
www.palmcentral.com/original/pilot-gcc-win32.html .   (Tip:  install into C:\GCC )

Get the latest PilRC V2.2 from www.scumby.com/scumbysoft/pilot/pilrc.

Get the latest POSE (Emulator - ex CoPilot) V2.1.d25 from www.palm.com (this is
the development version - not the latest beta V2.0b3 ! ).
While there (www.palm.com/devzone/docs), get the latest PalmOS3 headers (in
WINSDK30.zip - warning - the whole file is 9MB, but you will also want those
latest docs included)
Also consider palmosdocs9902.zip (PalmOS 3.1/3.2).

Get GDBPLUG V0.2 from www.tiac.net/users/thomas/pilot-downloads.htm

You also need GDB V4.16 (think that came with GCC Win32 V0.5.0)

There is a GCC FAQ at
www.geocities.com/SiliconValley/Horizon/5249/GNU_Pilot_SDK.html  (not sure if
underlines or dashes)

Autoexec.bat
=========
The following is my autoexec bat file:
SET PATH=C:\GCC\BIN;C:\GCC\M68K-P~1
call C:\GCC\bin\instsh.bat \bin C:\GCC\bin\bash.exe \bin\sh.exe
SET EMACSLOADPATH=C:\GCC\emacs\lisp
SET EMACSPATH=C:\GCC\bin
SET EMACSLOCKDIR=c:\temp
SET INFOPATH=C:\GCC\info
SET EMACSDOC=C:\GCC\emacs\etc
SET EMACSDATA=C:\GCC\emacs\etc
SET GCC_EXEC_PREFIX=C:\GCC\lib\gcc-lib\

To Compile
========
Use the following testfile.bat in a Dos window (or use a makefile if you know how
- I don't, and this works for me)
@del *.grc
@del *.bin
@del testfile.h
@del testfile.o
@del testfile.prc
pilrc -h testfile.h testfile.rcp
m68k-palmos-coff-gcc -O1 -c testfile.c -o testfile.o -g
m68k-palmos-coff-gcc -O1 testfile.o -o testfile -g
m68k-palmos-coff-obj-res testfile
build-prc  testfile.prc "testfile" XXXX *.grc *.bin
rem NOTE:  XXXX in previous line is your Creator ID from 3Com
dir *.prc
rem copy testfile.prc c:\palm\add-on\testfile.prc

To Start Debugging:
==============
1.    Start POSE
       emulator.exe
       Install application to be tested   eg C:\GCC\progs\testfile.prc
       Go to launcher ie. click Applications button
       DO NOT LAUNCH YET !
2.    Start GDBPLUG in a DOS window
       gdbplug -port 2000 -enable
3.    Start GDB in another DOS window
        C:\GCC\BIN\m68k-palmos-coff-gdb testfile -x tp2000.txt
                    (where tp2000.txt is a text file containing the line
                            target pilot localhost:2000
                      thanks to someone else for this tip)
       Tip:  make a windows shortcut and set
                   Target:   C:\GCC\BIN\m68k-palmos-coff-gdb.exe testfile -x
tp2000.txt
                    Startin:  C:\GCC\progs
       When ready, you should see the message waiting...(press Ctl-C to connect to
halted machine)
4.    POSE:  Launch the application (eg testfile)
5.    GDB should now be working
            some options:    step, next, cont, break functionname, break
testfile.c:lineno, help, quit
6.    To quit
        GDB:              quit, Y
        GDBPLUG:    Ctl-C
        POSE:             exit
NOTE:   For debugging, you must compile with the -g option !

Hope this helps 'cause it sure took me a lot of time to figure it out !

Regards,
Ray
PS:   Specifically, I'm not sure if any of this helps you David.   I can email you
direct the version of tex2hex that compiles and works OK.   I think you need to
get that compiling correctly first.   Suspect you need to get the latest versions
first.


David A. Smith wrote:

> 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