Appendix 2. Setting Up Your Software Development Environment

This appendix shows the procedure for setting up the GNU software development tools and example source code. The GNU software development tools setup procedure is broken down into two sections: one for Windows and one for Linux. The GNU software tools we use for the example code include the gcc version 3.4.4, as version 2.15, ld version 2.15, gdb version 6.3, and binutils version 2.15.

This book’s web site contains several compressed archive files that expand to include the various source code and tools used in this book. These files are:

windowshost.zip

Contains the Cygwin setup files and the Windows-based GNU software development tools

linuxhost.tar.gz

Contains the Linux-based GNU software development tools

ecos.tar.gz

Contains the eCos source code repository and the eCos development tools (see Appendix D for additional information on setting up the eCos host environment)

examples.zip and examples.tar.gz

Contain the book’s example code

Tip

The Linux example code in Chapter 12 has not been built and tested using a host computer running Windows. It is common to use a Linux host system for developing embedded Linux applications.

Building applications for Linux using a Windows host is beyond the scope of this book. It involves the use of the Cygwin free software toolset, a somewhat more involved procedure than the one described in this chapter.

Windows Host Installation

The GNU software development tools were run on a Pentium 4 computer with Windows XP (Service Pack 2). The first phase of the Windows setup is to install Cygwin, a Unix environment for Windows. Additional information about Cygwin can be found online at http://www.cygwin.com.

The first step in the Windows host installation procedure is to download the windowshost.zip file and unzip it to temporary directory.

Cygwin Installation

Cygwin is used for building all of the examples in this book under Windows. The following instructions assume that C: is your hard disk drive where the files are installed. The Cygwin environment is installed under the C:\cygwin directory.

  1. Run the Cygwin installation program setup.exe. The Cygwin install files are located under the cygwin directory in the windowshost.zip file.

  2. The first dialog box is titled Cygwin Net Release Setup Program. This gives the details about the setup program version information. Click Next to continue.

Tip

Looking at the commands and directories here might get a bit confusing, because Windows and Unix environments differ in how they separate directories: Windows uses the backslash (\) and Unix uses the forward slash (/).

  1. Now select the directory from which to install the Cygwin tools. In this case, we select “Install from Local Directory” and then click Next.

  2. In the next dialog box, select the location on your hard drive where you want the Cygwin tools to be installed. Leave the default as C:\cygwin. (If you want to choose an alternate destination, change the drive and directory location accordingly.) In the Install For selection box, select All Users, and for the Default Text File Type, select DOS. Then click Next.

  3. Tell the Cygwin setup where the local files that you want to install reside. Browse to the cygwin temporary directory, where you unzipped the Cygwin install files, and then click Next. This will cause the Cygwin setup program to inventory the available tools and display the available list.

  4. Select the tools to install. Make sure all tools that you want to install are selected for installation. In order to add tools, click on the View button to get the full list of packages available for installation. Then, click on the circular arrow in the New column in order to select the appropriate package for installation. This should change the text next to the circular arrow from “Skip” to the version of the particular package that will be installed. After all packages have been selected for install, click Next to start the installation.

  5. After the installation is complete, click Finish. This will add Cygwin icons to the desktop and start menu. Click Ok on the Installation Complete dialog box.

At this point, you should verify that you have a C:\cygwin directory with the Cygwin directories and files installed.

GNU Software Tools Installation

The next phase of the Windows host tools setup is to set up the GNU software development tools, as shown here. The GNU software tools are installed under the \ cygwin\opt directory.

  1. The Windows version of the ARM-based GNU tools is located under the \ gnutools directory in the windowshost.zip file. Unzip the file gnutools.zip to the \cygwin\opt directory on your hard drive.

  2. Set the path to the GNU tools location in the Cygwin bash shell. To ensure the path is set correctly each time the Cygwin bash shell is started, edit the bash profile file. The file is named .bash_profile and is located under the $HOME directory (which is specific to your environment). Add the following to the last line in this file:

  3.                      PATH=/opt/gnutools/arm-elf/bin:$PATH ; export PATH

You should notice that the GNU development tools are installed under C:\cygwin\opt\gnutools. If you look under the arm-elf\bin directory, you should see the GNU tools (such as gcc, as, gdb, and ld) executable files, prepended with the name arm-elf. This describes the processor for which the tools are built, arm, and the object file format, elf (which stands for “executable and linkable format”).

To test that you installed the tools correctly and set up the path properly, open a Cygwin bash shell and enter the command:

# arm-elf-gcc -v

You should see this response:

Reading specs from /opt/gnutools/arm-elf/lib/gcc/arm-elf/3.4.4/specs
Configured with: /src/gcc-3.4.4/configure --target=arm-elf --prefix=/opt/gnutool
s/arm-elf --enable-languages=c,c++ --with-gnu-as --with-gnu-ld --with-newlib --w
ith-gxx-include-dir=/opt/gnutools/arm-elf/arm-elf/include -v
Thread model: single
gcc version 3.4.4
               

Linux Host Installation

The GNU software development tools were tested on a Celeron computer running Linux Fedora Core 5.

Tip

The GNU software tools for Linux that are set up in this procedure enable you to build the examples for all chapters except Chapter 12. The examples in Chapter 12 are intended to run on the Arcom board’s embedded Linux operating system. The GNU tools installation for building the Chapter 12 example code is covered in Appendix E.

GNU Software Tools Installation

The GNU software tools are installed under the /opt directory. To install them and make them usable, follow these steps. (You will need to ensure that you have permission to become superuser (root) in order to perform the Linux setup successfully).

  1. Open a terminal window and change to the /opt directory with the command:

  2. # cd /opt
  3. The Linux version of the ARM-based GNU tools is located in the file linuxhost.tar.gz. Copy this file to the /opt directory. Next, decompress the file on your hard drive using the command:

  4. # tar xvzf linuxhost.tar.gz
  5. Finally, set the path to the GNU tools location in your bash shell profile. This ensures the path is set correctly each time the bash shell is started. Edit the bash profile file named $HOME/.bash_profile (where $HOME is specific to your environment). Add the following to the last line in this file:

  6.                      PATH=/opt/gnutools/arm-elf/bin:$PATH ; export PATH

You should notice that the GNU development tools are installed under /opt/gnutools. The executable files, such as arm-elf-gcc, are contained under the /opt/gnutools/bin directory. The prepended name arm-elf describes the processor for which the tools are built, arm, and the object file format, elf.

To test that you installed the tools correctly and set up the path properly, close the existing terminal window. Open a new terminal window (to ensure the path is set properly) and enter the command:

# arm-elf-gcc -v

You should see this response:

Reading specs from /opt/gnutools/arm-elf/lib/gcc/arm-elf/3.4.4/specs
Configured with: /src/gcc-3.4.4/configure --target=arm-elf --prefix=/opt/gnutool
s/arm-elf --enable-languages=c,c++ --with-gnu-as --with-gnu-ld --with-newlib --w
ith-gxx-include-dir=/opt/gnutools/arm-elf/arm-elf/include -v
Thread model: single
gcc version 3.4.4

Example Code Installation

The example files for the book can be extracted into any directory. We recommend installing the example source code files in the /opt/ProgEmbSys directory. The book’s example code is contained in the files examples.zip and examples.tar.gz.

Each chapter’s directory contains all the example source code needed to build the chapter’s executables. Makefiles are included in order to simplify the build process. The details of the build procedure are covered in Chapter 4. The procedure for downloading and debugging the examples is covered in Chapter 5.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.118.254.94