Chapter 14. Toolchain

To build GCC for use with this package, it is necessary to follow some additional steps compared with what would ordinarily be required for building the compiler. These steps are required to provide the eCos header files which are used by the GCC build, to determine properties of the run-time system and to apply a set of changes (a “patch”) to allow eCos to provide C++ exception support in a flexible and future-proof way. This patch takes particular care to ensure that the compiler and libstdc++ continue to behave correctly when no eCos kernel is present.

  1. With eCos installed, the ECOS_REPOSITORY environment variable set and ecosconfig in your PATH variable, run the following commands at a bash shell prompt in an empty directory, choosing a TARGET of the appropriate architecture:

    $ ecosconfig new TARGET libstdc++
      $ ecosconfig tree
      $ make headers
  2. Take the header tree generated under install/include and install it in the TARGET/sys-include subdirectory where you intend to install your tools. For example if you wish to install the new tools to /opt/newtools, then place the headers in a new directory /opt/newtools/TARGET/sys-include. (Note you must ensure you have write-access to /opt in this example, or you can choose an alternate path).
  3. A C++ exception support patch is supplied on the eCosPro Developer's Kit CD-ROM. Once the patch has been applied, it is necessary to run the following command:

     $ contrib/gcc_update --touch
  4. Configure GCC from within an empty build directory as follows, ensuring that the GNU binary utilities are at the head of the PATH:

     $ /src/gcc-3.x.x/configure --target=TARGET \
              --prefix=/opt/newtools --enable-languages=c,C++ \
              --with-gnu-as --with-gnu-ld --with-newlib \
              --enable-threads