turrier.fr

Source : ct|23.04.08

< Tutorials Computer, Multimedia, Chinese

Program in C language for Palm OS

It exists many solutions and tools to realize programs working on a Palm Handheld. Those solutions and tools distinguish themselves principally by :
- Their price : this one can vary of o cts (free softwares) to more than 100 euros (commercial softwares);
- Their flexibility in use : according as we can realize programs on the PC, on the Palm or on both;
- Their install, setting and use complexity ;
- Their power (interpreted or compiled programs, power of the compiler, runtime required or not during the execution...).

The solution that we will present lies on free tools. It is simple to install and to use and it generates standalone and powerfulexecutables (programs compiled, without runtime and "royalty free"). It is also flexible enough, because she allows :
- To write source programs ".c" directly on the PC or on the Palm, with help of a text editor ;
- To save these programs, on the PC or on the Palm, with a Palm format (.pdb);
- To compile then to execute those programs on the PC ( after having transferred them in the Palm emulator) or on the Palm himself;
- To transfer the source programs from the PC to the Palm, or from the Palm to the PC.

We will now specify all those possibilities following the plan indicated hereafter:

1) Download the necessary tools;
2) Install the necessary tools, on the Palm and on the PC;
3) Write and test a program on the Palm;
4) Transfer a program (source and executable) from the Palm to the PC;
5) Write and test a program on the PC;
6) Transfer a program (source and executable) from the PC to the Palm.

1) Download the necessary tools

We will suppose that you are in possession of a Palm handeld, that this one has (if possible ) an integrated SD card reader (some models as the Zire 22 have not one , Tungsten E2 and TX models have one ...), that you have installed the software "Palm Desktop" which is present on the installation CD of your Palm, and that the link beetwen your PC and your Palm ("Hotsync" link) works correctly.

The necessary tools, to install on your PC and on your Palm, are indicated hereafter. To the date of writing these lines (April 2008), they can be free downloaded via internet.

1- The development package "Onboardc" (file "OnBsuite251.zip" on the "sourceforge.net" web site);
2- The Palm emulator (file "Tungstene_Simulator.zip" on the "euro.palm.com/fr/fr/index.html" web site, link "développeurs"). To obtain this file, it will be asked you to fill a form and to give an e-mail address where a password will be sent to you);
3- A text to pdb converter (TL-PDB version V0.98.4d, file "tlpdb_ff.zip" on the "tl-pdb.softonic.fr/palm" web site );
4- A Palm file explorer (file "FileZ683.zip". To find a web site for the download, type "fileZ" in the Google motor search);
5- Optionally, a text editor ("NotePad++") which gives a syntax highlighting in C language.

image1
image2
image3
image4

When they are unzipped those files are automatically decomposed on the following way :

The file "OnBsuite251.zip" is decomposed in several files and directories, in a parent directory named OnBsuite251. In this directory we can see 4 files "OnBoard.prc", "OnBoardc.prc", "OnBoardHeaderv40.pdb" and "SrcEdit.prc". These files will be particularly useful for us;

image5

The file "Tungstene_Simulator.zip" is decomposed in many files, in a directory named "TungstenE". We can find here : many DLL files, the file "PalmSim.exe" which constitutes the emulator, and the directory "EFIGSP" which contains the ROM file "TungstenE_EFIGSP.rom" (this last file will be used by the emulator).

image6

The file "tlpdb_ff.zip" generates the file TLPDB.exe, in the directory tlpdb_ff.

image7

Lastly, the file "FileZ683.zip" generates the file "filez.prc" which constitutes an exellent files explorer for the Palm.

image8

2) Install the tools on the Palm and on the PC

Begin to transfer on your Palm, with the help of the Hotsync link (cf install CD of the Palm), the 5 files "OnBoardC.prc","OnBoard.prc", "OnBoardHeaderV40.pdb", "SrcEdit.prc" et "filez.prc".

image9

The utility of these files is the following :
"OnBoardc.prc" is a compiler, to compile (to the Palm format) the source files written in C language;
"OnBoard.prc" is a file used by the compiler;
"Onboardheaderv40.pdb" is also a file used by the compiler;
"SrcEdit.prc" is a source programs editor, which permits to write source programs in C language on the Palm;
"filez.prc" is a tool permitting to explore and to manage all files on the Palm.

Once the 4 files "FileZ", "OnBoardC", "OnBoard" et "SrcEdit"have been transferred on the Palm, their icons must appear in the principal "Applications" screen of the Palm. In our example, You will not have need to click the icon "Onboard" but only the three others icons (FileZ, OnBoardC et SrcEdit).

image10
image11

On the PC, the Palm emulator ("PalmSim.exe") and the file format converter TL-PDB ("True Love in PDB", "TLPDB.exe") are ready to use. It suffices to click the icons of those files.

image12

3) Write and test a program on the Palm

To make free place, before creating a new project, delete all old OnBoardC projects that you will don't use on the Palm. For that, click "App/Supprimer" in the principal screen menu of the Palm and delete the useless files.

image13

On the Palm, click the icon "OnBoardC.prc".

image14

The following screen will appear. If it does not appear, delete the old projects Onboardc who are still on your Palm. Click "New", to begin with a new project.

image15

Type the name of your project "monessai" for instance, check the checkbox "Generate skeleton" and click the OK button.

image16

The project file "monessai.proj", the source file "monessai.c" (containing a skeleton of source code) and the associated ressources are automatically and quickly generated by Onboardc. Click the button "Build" in order to compile the source file "monessai.c" and to generate the Palm executable file "monessai.prc".

image17

At the end of this operation, the icon of the program "monessai.prc" must appear in the principal application screen of the Palm.

image18

Click this icon and the program "monessai" will run. This program, resulting of the automatically by Onboard generated C source code, displays simply "Hello GUI" in his window.

image19

We will now to modify this source program. On the principal application screen of the Palm, click the icon "SrcEdit".

image20

Select the file "monessai.c" and click "OK".

image21

The source listing of the program appears. Modify him, replacing "Hello GUI" with "Bonjour !" for instance.

image22

Run OnBoardC again, and recompile the source program, clicking the "Buid" button. Run the new program clicking on his icon in the screen application of the Palm. That works perfectly !

image23

4) Transfer a program from the Palm to the PC

We will now to transfer, with help of "fileZ", the source file "monessai.c" and the executable file "monessai.prc" from the Palm to the PC. Click the icon of "fileZ".

image24

Choose the option "View and Edit Files".

image25

To copy the file "monessai.prc" on the SD Card of the Palm, choose this file (a red v-shaped sign must appear on the left of the file name ) then click "Item/Copy".

image26

In the following screen, choose the SD Card to effect the transfer. Do the same operations to transfer the file "monessai.c". Once those two transfers are ended, the files must appear in the directory of the SD card. Copy those files in any directory on your PC, with the help of a SD Card reader. You will remark that the source file "monessai.c" has been transformed by the Palm in a file "monessai.c.pdb" which is to the palm format (PDB).

image27

On the PC, you can now :
-Transfer these files in the Palm emulator (in the window of the emulator, click the right button of the mouse and choose the option"Install/Database");
- Run the program "monessai.prc", clicking his icon in the window of the Palm emulator;
- Open the source file "monessai.c.pdb" with "SrcEdit", in the window of the emulator.
- Open the file "monessai.c.pdb" with TL-PDB (Do "File/Open").

image29

5) Write and test a program on the PC

With the help of the clipboard, you can copy the source text contained in TL-PDB and paste him in any text editor (in the free text editor "Notepad++" for instance, which gives syntax highlighting in C language). So it becomes more easy and rapid to modify, on the PC, the source program and to create a new program.

image30

When your modifications are terminated, save your source program in a text file (.txt), then open this text file with TL-PDB. Give a name to your new source program, in the textbox "Palm E-book Title:", after having clicked "Format/PDB File properties".

image31
image32

Lastly, in TL-PDB, save your source program (with the format PDB), clicking "File/Save As".

image33

Transfer this source program in the emulator (Click on the right button of the mouse and choose the option "Install/Database"). Compile it with "Onboardc" and, if the compilation is ok, execute it clicking his icon in the screen application" of the Palm emulator.

6) Transfer a program from the PC to the Palm

To transfer an executable program ("nomduprogramme.prc") or source programm ("nomduprogramme.c.pdb") from the PC to a Palm, you can at choice :
- Use the "Hotsync" link (cf the install CD of your Palm)
- Or else, copy those files on your SD Card, then use the tool "fileZ" to transfer those files in the memory of your Palm.

Now that you know many possibilities to operate, you can try to create new programs. Do not hesitate to increase your knowledges in C language or in the specific Palm API, consulting specialized web sites on those subjects.


Valid XHTML 1.0 Transitional

© http://turrier.fr (2007)