/opt/Embedix/tools/bin/arm-linux-g++ -o hello1.o -c hello1.cppThis should produce the file
hello1.o. Then link this
with the standard libraries to produce an executable:
/opt/Embedix/tools/bin/arm-linux-g++ -o hello1 hello1.oIf you know about C/C++ development on Linux, you'll be aware that you could do these two operations in a single step, but I want to separate the compile and link phases so it will be clearer what's going on later.
The linker produces the executable file hello1. If
you run the Linux
`file' utility on this exectuable, here's what you should see:
% file hello1 hello1: ELF 32-bit LSB executable, ARM, version 1 (ARM), for GNU/Linux 2.0.0, dynamically linked (uses shared libs), not stripped`Not stripped' means that the executable still contains debugging information, which is why it's 300 kB long! This is a very big file from a four-line program, so you need to do:
/opt/Embedix/tools/bin/arm-linux-strip hello1Which brings the file size down to 62 kB. That's still a big file for a four-line program, but you'll find that this file size increases only very slightly until your program gets to about 1,000 lines of code. Most of the overhead is in the startup and shutdown code.
It goes without saying that, in a real development exercise, you wouldn't want to type all these commands at the prompt. You'd create a shell script or, more usually, a Makefile. I'm not going to describe this process here, since it's standard Unix programming stuff, and nothing to do with Qtopia.
Your next job will be to get the hello1 program onto
the PMA430 for testing. My usual approach is to copy files onto
a local web server, then use the wget utility from the
PMA's command line. However, if you don't have a web server handy,
you can use the USB interface and transfer the program just as you
would any other file. Mount the PMA430 as an external drive, and
copy the hello1 program onto (for example) the
System directory.
From inside the PMA430, the directory that appears as
/System from a host computer appears as
/media/System, because the /media
directory represents the whole hard disk. So, to run
the program, you need to start the console program (using
the `Console' icon on the Applications tab of the launcher).
Then, at the prompt, type:
# chmod 755 /media/System/hello1 # /media/System/hello Hello, World!If you see `Hello, World!', it's worked. If you see anything else, it hasn't. The
chmod command may not be necessary --
it's purpose is to re-assign `execute' permission to the file, which
may have been lost in whatever process you used to copy it from the
host computer.
Go to part 3...
©1994-2006 Kevin Boone, all rights reserved