Building the Hitachi SH development tools for Linux
IntroductioneCos requires sh-elf development tools to develop programs for Hitachi SH targets. The development tools come in three parts: the GNU compiler collection (GCC), the GNU Debugger (GDB) and the GNU binary utilities, which include the GNU assembler and linker. This page details the steps required to download and build these development tools.
Downloading the tool sources
GNU Binary Utilities
Unfortunately, the most recent official release of the GNU Binary Utilities (binutils), currently 2.10.1, is not capable of supporting eCos for Hitachi SH. Instead the devlopment tools must be built using a snapshot release of binutils. This is available from the main binutils development site. It is also available at any of the mirror sites for sources.redhat.com. Download sizes are in the region of 7.5MB for .bz2 format archives, or 10MB for .gz format archives.
If you already have binutils sources available but are unsure of their version, you can search the file gas/configure for the string "VERSION" and examine its value.
GNU Compiler CollectionThe GNU Compiler Collection web site contains plenty of information about installing and using GCC. Unfortunately the most recent official release (GCC 2.95.2) is not capable of supporting eCos for Hitachi SH. A snapshot of the GCC development sources should be used to obtain the most up-to-date compiler with new features and bug fixes.
eCos has been tested with the 2000-03-13 snapshot, but it is likely that later snapshots will fix bugs that have not yet been discovered. If you have compiler problems you may wish to consider updating to a more recent snapshot, or reverting to an older one. When downloading a snapshot from the GCC snapshot download area note that only the core compiler and C++ distributions are required (prefix gcc-core- and gcc-g++-).
Note that the instructions for building GCC here are only intended for use with eCos. In any other environment, the tools may not function correctly. Refer to the CrossGCC FAQ for details about building a standalone version of GCC.
It is strongly recommended you use a mirror site close to you, which will result in a faster download, reduced internet congestion, and reduced load on the central server.
Instructions for downloading the GNU Debugger (GDB) are provided on the GDB home page. However, Red Hat has also released an open source graphical front-end to GDB based on Tcl/Tk called Insight, which has a separate home page.
The Insight sources are a superset of the standard GDB sources. It is also still possible to run GDB in command-line mode by using the -nw command-line option when invoking GDB, so there is nothing to lose by using the Insight sources.
The latest release (version 5.0) is recommended and may be downloaded via the GDB home page. Alternatively, click on on one of following links to download the files directly:
Preparing the sources for buildingOnce the tools sources have been downloaded, they must be prepared before building. These instructions assume that the tool sources will be extracted in the /src directory hierarchy. Other locations may be substituted throughout. Similarly placeholders of the form YYYYMMDD and YYMMDD should be replaced with the actual date of the downloaded files. Ensure that the file system used has sufficient free space available. The contents of each archive will expand to occupy approximately 6 times the space required by the compressed archive itself. To extract the downloaded sources, you will need to have either the bzip2 or gzip compression utilities, depending on your choice of download format. A patch utility (preferably GNU patch) is also required.
The following steps should be followed at a sh, ksh or bash prompt. Users of the csh and tcsh shells should replace 2>&1 with |& throughout:
Building the toolsBefore attempting to build the tools, ensure that the GNU native compiler tools directory is on the PATH and precedes the current directory. The following build procedures will fail if . is ahead of the native tools in the PATH.
Approximate disk space requirements for building the development tools are as follows:
Following successful building and installation of each set of tools, the associated build tree may be deleted to save space if necessary. These instructions assume that the tools will be built in the /tmp/build directory hierarchy and installed to /tools. Other locations may be substituted throughout:
TroubleshootingIf you encounter difficulties in building or using the development tools, first check the eCos FAQ and the ecos-discuss mailing list archive to see if the topic has come up before. Initial queries may be directed to the ecos-discuss list. However, there are other mailing lists which may be more appropriate if a problem is clearly related to a particular tool: