Appendix 4. Setting Up the eCos Development Environment

To build an eCos application, you must link the application with the eCos library. This appendix describes how to build a new eCos library for linking with application code.

A prebuilt eCos library is already included in the book’s compressed file, but you may need to know the eCos library build procedure if you move to a new development board or require additional functionality in the eCos library.

The eCos examples, covered in Chapter 11, are built in the same manner as the other examples in the book. The build procedure is covered in Chapter 4, and the download-and-debug procedure in Chapter 5. The eCos examples are built using the GNU tools set up in Appendix B, along with the prebuilt eCos library.

Additional details about building eCos applications can be found in the book Embedded Software Development with eCos, by Anthony Massa (Prentice Hall PTR).

The eCos Build Environment

Enter the following commands in a Cygwin bash shell under Windows or in a terminal window under Linux. The instructions extract the eCos source code to the /opt/ecos directory. Other directories can be used, but the instructions need to be adjusted accordingly.

Warning

Using Linux, you will need permission to become superuser (root) to perform the setup successfully.

eCos Source Code Installation

The eCos source code is contained in the file ecos.tar.gz. If you use a different version of the eCos source code, change the following instructions accordingly:

  1. Make a directory where the eCos source code is extracted, with the following command:

  2. # mkdir –p /opt/ecos
    # cd /opt/ecos
  3. Copy the eCos source file ecos.tar.gz to the /opt/ecos directory.

  4. Extract the eCos source code files using the following:

  5. # tar xvzf ecos.tar.gz
  6. The directory that contains the eCos source code should now be available under /opt/ecos/ecos-redboot-viper-v3i7.

  7. Set up the environment variables. Edit the $HOME/.bash_profile file (where $HOME is specific to your environment) and add the following lines:

  8.                      PATH=/opt/ecos/ecos-redboot-viper-v3i7/tools:$PATH ; export PATH
                         ECOS_REPOSITORY=/opt/ecos/ecos-redboot-viper-v3i7/packages ; export ECOS_REPOSITORY
  9. Close the current bash environment and open a new one. This allows the changes just made to the environment to become effective.

Building the eCos Library

For this build procedure, we use the eCos command-line configuration tool ecosconfig, which is included under the /opt/ecos/ecos-redboot-viper-v3i7/tools directory. Therefore, these commands are also executed either at a Cygwin bash shell prompt on Windows platforms or on a command line on Linux. There is also a graphical configuration tool that could be used to accomplish the same outcome.

The resulting eCos files are located under the /opt/ProgEmbSys/chapter11/ecos directory. If you have installed the book’s source code, there should already be an eCos library present at this location. You need to rename or move the existing eCos library directory before proceeding.

  1. Make a directory where the eCos files are going to be built, using the following commands:

  2. # mkdir –p /opt/ProgEmbSys/chapter11/ecos
    # cd /opt/ProgEmbSys/chapter11/ecos
  3. Create a new configuration for the Arcom board using the eCos default template by entering the following command:

  4. # ecosconfig new arcom-viper default
  5. Create the eCos build tree using the command:

  6. # ecosconfig tree
  7. Finally, build the eCos library by entering the command:

  8. # make
  9. If you encounter an error, make sure the path is set up correctly, as previously shown. After successfully building an eCos library, you should see the following message:

  10. build finished
  11. You should have various directories under /opt/ProgEmbSys/chapter11/ecos, including the directory install/lib. The lib directory contains the eCos operating system archive files that get linked with eCos applications.

The eCos makefiles contain a variable, ECOS_INSTALL_DIR, which is set to the location of the eCos install directory—/opt/ProgEmbSys/chapter11/ecos/install in this case. If the eCos install directory location changes, this variable must also be changed.

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

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