How to develop a Palm program in Linux

Source: Internet
Author: User
Article Title: how to develop a Palm program in Linux. Linux is a technology channel of the IT lab in China. Includes basic categories such as desktop applications, Linux system management, kernel research, embedded systems, and open source.
Palm
Yeah, it's Palm. now more and more people are involved in Palm program development. today, let's try to develop the Palm program on Linux.
Why is it Linux?
The reason is simple, because Linux is free, because many tools in Linux are free, and Linux itself is the best program development platform.
To write a Palm program in Linux, in addition to a Linux environment that can work normally, we also need the following:
· 1. we need the SDK of the Palm OS to develop the program of the Palm. The SDK of the Palm can be downloaded for free on the site of the Palm: http://www.palmos.com/dev/
· 2. Palm Emulator-Palm simulator, used to simulate the Palm program we write to execute the Palm. Palm Emulator can also be sub-love Palm site Free Download: http://www.palmos.com/dev/
· 3. RPC-Tools: if you want to develop a Palm program in Linux. RPC-Tools is required. RPC-Tools actually makes some necessary modifications to the GNU Compiler Collection, aggreger, linker, and symbolic debugger, so that we can use C/C ++ on Linux to develop the Palm program. RPC-Tools can be downloaded for free in http://prc-tools.sourceforge.net.
· 4. gcc-2.95.3 we need to build a cross compiler, following RPC-Tools recommendations, here we choose to download gcc-2.95.3: http://www.gnu.org/software/gcc/gcc-2.95/
· 5. GDB-used to establish cross debuger (debugging), similarly, as per the recommendations in RPC-Tools, we choose gdb-5.0: ftp://sources.redhat.com/pub/gdb/old-releases/gdb-5.0.tar.bz2
· 6. binutils-the tools we need include ld, as, ar, nm, objcopy, objdump, ranlib, size, strings, strip, c ++ filt, addr2line and nlmconv Here we select binutils-2.9.1 ftp://ftp.gnu.org/gnu/binutils/binutils-2.9.1.tar.gz
· 7. make-3.77-we choose make-3.77 ftp://ftp.gnu.org/pub/gnu/make/make-3.77.tar.gz
· 8. PilRC-PilRC is the resource compiler of Palm. that is to say, compile the executable code of m68k into the. prc file of palm. PilRC can be obtained free of charge in the following link: http://www.ardiri.com/index.php? Redir = palm & cat = pilrc & subcat = download
The RedHat 7.3 system is used for testing.
Install the Palm SDK
First, a palmos-sdk rpm file will appear in tar vxfz sdk50.tar.gz. use rpm-ivh for installation. the SDK will be installed in/opt/palmdev/sdk-5. now we need to make a symbolic link, link the sdk-5 to the sdk.
Cd/opt/palmdev
Sdk-5 sdk ln-s
Now we have installed the Palm SDK. next we should install the environment required for development.
Install PRC-Tools and Tools required by cross compile
First, create a new directory.
Mkdir/tmp/prc
Then copy the prc-tools-2.0.92.tar.gz binutils-2.9.1.tar.bz2 gcc-2.95.3.tar.bz2 gdb-5.0.tar.bz2 all over.
Cp prc-tools-2.0.92.tar.gz/tmp/prc
Cp binutils-2.9.1.tar.bz2/tmp/prc
Cp gcc-2.95.3.tar.bz2/tmp/prc
Cp gdb-5.0.tar.bz2/tmp/prc
Cp make-3.77.tar.gz/tmp/prc
Then cd to the/tmp/prc DIRECTORY. execute the decompression action:
First, extract all. gz files.
  
For I in *. gz; do tar vxfz $ I; done
  
The following are some. bz2 files compressed with bzip2.
  
For I in *. bz2; do tar vxfj $ I; done
  
Prc-tools has made some changes to the above programs, so we need to patch the above program code:
Cat prc-tools-2.0.92/*. palmos. diff | patch-p0
Now we enter the prc-tools-2.0.92 Directory, first we need to do is to binutils-2.91, gdb-5.0, gcc-2.95.3 and make-3.77 these directories with symbolic link respectively link to the prc-tools-2.0.92 directory.
Cd prc-tools-2.0.92
Ln-s ../binutils-2.9.1 binutils
Ln-s ../gcc-2.95.3 gcc
Ln-s ../gdb-5.0 gdb
Ln-s ../make-3.77 make
To keep the source code directory clean and complete, we create a directory build at the time of compilation:
Cd ..
Mkdir build
Now we just need to run the configure in the prc-tools-2.0.92.
../Prc-tools-2.0.92/configure -- target = m68k-palmos -- enable-languages ages = c, c ++
Here we pass the configure two parameters respectively, one is to tell us the target is the m68k-palmos and the other is the enable C/C ++ language. in prc-tools, this configure script will help us build makefiles required by binutils, gcc, gdb, and make. now we have the following in our build directory:
Binutils config. log crt gcc include libm Makefile
Config. cache config. status doc gdb libc make tools
  
  
Now we only need to use make all-install. (if you are not using the root account, do not forget to su as root)
Make all-install
Because compile takes a long time. if your system has more than one CPU, remember to add the-j number option after make. The value of number is the number of your CPU plus one. for example, if you have two CPUs, you can use make-j3 all-install. if you have three CPUs, use make-j4 all-install. if your machine has a large amount of RAM (several GB) and a dozen CPUs, you can also use make-j all-install to compile. if-j is not followed by any number, make will not impose any restrictions on jobs. for more information, see man make.
During the compilation process, we still have a small problem to solve (at least this problem exists in the RedHat version system). The first problem we encounter is, there is an error in gdb compilation:
In file encoded ded from/usr/include/curses. h: 111,
From ../prc-tools-2.0.92/gdb/utils. c: 28:
/Usr/lib/gcc-lib/i386-redhat-linux/2.96/include/stdbool. h: 39: conflicting types for 'false'
../Bfd. h: 101: previous declaration of 'false'
/Usr/lib/gcc-lib/i386-redhat-linux/2.96/include/stdbool. h: 41: conflicting types for 'true'
../Bfd. h: 101: previous declaration of 'true'
  
We can see in gdb/gdb. utils. the 28th rows in c include curses. h. and curses. the 111st rows in h include stdbool again. h, stdbool. h defines false, while bfd/bfd. h also defines false, so that the two false values conflict. therefore, compilation fails. the simplest and lazy way to open
/Usr/lib/gcc-lib/i386-redhat-linux/2.96/include/stdbool. h
Put:
Typedef enum
{
False = 0,
True = 1
} _ Bool;
  
Mark this line for now
  
/*
Typedef enum
{
False = 0,
True = 1
} _ Bool;
*/
  
And then try again
  
Make all-install
  
Now we will encounter the second problem:
  
Gcc-DEXEC_PREFIX = \ "/usr/local \"-I. -I .. /.. prc-tools-2.0.92/tools /.. /binutils/include-I .. /binutils/bfd-g-O2-o def. yy. o-c def. yy. c
../Prc-tools-2.0.92/tools/def. l: 35: 19: utils. h: No such file or directory
../Prc-tools-2.0.92/tools/def. l: 37: 23: pfdheader. h: No such file or directory
  
  
Utils not found. h and pfdheader. h this is easy to solve, just copy the two files under the prc-tools-2.0.92/tools to the build/tools, here we copy everything to the past, otherwise, we will continue to say that utils cannot be found. h file
Cp ../prc-tools-2.0.92/tools/* tools/
  
Then proceed to make all-install
  
Next, an error occurs to interrupt compilation:
  
Gcc-DEXEC_PREFIX = \ "/usr/local \"-I. -I .. /.. prc-tools-2.0.92/tools /.. /binutils/include-I .. /binutils/bfd-g-O2-o def. yy. o-c def. yy. c
.../Prc-tools-2.0.92/tools/def. l: 39: conflicting types for 'dup'
/Usr/include/unistd. h: 441: previous declaration of 'dup'
  
Here, the dup defined by row 39th in def. l has been defined by row 441st in/usr/include/unistd. h. Therefore, a conflict occurs.
  
The simplest method is to solve the problem:
The first thing to do is
  
Vim tools/def. yy. c
Change # include of row 3 to # include "unistd. h "to compile def. yy. c will not find/usr/include/unistd. h. h
Next
  
Cp/usr/include/unistd. h tools/
  
Copy unistd. h to the tools and change unistd. h.
  
Last
  
Vim tools/unistd. h
  
Returns the extern int dup (int _ fd) _ THROW of the first row;
Mark up
// Extern int dup (int _ fd) _ THROW;
Make all-install again after saving the disk. at this time, all the tools required for cross compile are available under your/usr/local/bin.
PS. Don't forget to change/usr/lib/gcc-lib/i386-redhat-linux/2.96/include/stdbool. h back to the original look Oh.
Install pilrc
Now the last step is to install pilrc
First Copy pilrc-2.9.tar.gz to/tmp
Cp pilrc-2.9.tar.gz/tmp
  
Decompress:
  

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.