Skip to content

A legacy GNU toolchain that includes GCC 3.4.6, BinUtils 2.16.1, GPC 2.1-20070904, NewLib 1.19.0, and GDB 6.8. While primarily intended for building a cross-toolchain targeting Hitachi/Renesas H8/300 processors with the COFF (or, colloquially, HMS) format, this should work for other targets as well.

License

Notifications You must be signed in to change notification settings

BrickBot/GNU-Legacy-Toolchain

Repository files navigation

GNU Legacy Toolchain       GNU Legacy Toolchain CI   GitHub License

A legacy GNU toolchain that includes BinUtils, GCC, GPC, GDB, and NewLib.

Multiple use cases exist for continuing to maintain a legacy toolchain:

  • COFF targets, such as for the H8/300 Processor
  • GNU Pascal Compiler (GPC)
  • Fortran77 / G77 Compiler
  • Common Language Infrastructure (CLI) Common Intermediate Language (CIL) Front End

While primary goal of this respository is to build a cross-toolchain targeting Hitachi/Renesas H8/300 processors with the COFF format, this should work for other targets as well. Though this H8/300 target has colloquially been referred to as h8300-hitachi-hms, it is more properly identified as h8300-hitachi-coff (ref 1, ref 2, object file format info).

Quick Start Build Guide

Build instructions are largely the same as those for GCC, with a few additional steps and options. A working example can be seen in the Continuous Integration workflow, but the basic sequence is as follows:

  1. Have a working Linux, Unix, or WSL environment with Bash shell support (currently untested under Mac or Cygwin)
  2. Install build dependencies
    1. See the Continuous Integration workflow for a current dependency list
    2. If you platform/distro does not include a package for git-restore-mtime (like Debian does) and you will be cloning from git, install this manually (c.f. the git-tools project page for both distro package names and manual install instructions).
  3. Obtain a copy of the source via either of the following means:
    1. Clone from GitHub: git clone [--branch <name of branch or tag>] https://github.com/BrickBot/GNU-Legacy-Toolchain.git –or–
    2. Download and extract a source archive, such as from one of the releases
  4. Fix source file timestamps (this should typically only need to be executed once after obtaining the source)
    1. Execute the script fix-mtime that is found in the root of the source tree
    2. Note that this could take several minutes to complete, depending on the speed of the system
  5. Create a folder for building that is outside the source tree
  6. From that build folder, run either configure or one of the following use-case-specific wrapper helpers:
    1. h8300-hitachi-coff-configure: For use with COFF targets for the Hitachi H8/300, which defaults to an integrated toolchain based on GCC v3. The target h8300-hitachi-elf is additionally enabled, which adds elf32-h8300 support to tools such as objcopy.
    2. rcx-lego-configure: Created for use with the LEGO MindStorms RCX, which defaults to an integrated toolchain based on the above but with a separate GDB v5 instead.
  7. Run make
  8. Run make install to copy the files into an installation structure.
    1. By default, the install will be to a separate folder from which Stow can then be used to link the files into your system installation.
    2. In this manner, Stow facilitates a cleaner and easier way to manage installs of locally-built software.
  9. Run make stow to then link the files into your system installation.

Advanced Options for Configure

Toolchain sets selection: --toolchain-sets=<comma-separated list of set(s)>

To allow different toolchain sets to be installed side-by-side, each toolchain set is configured to be build with a different program suffix.

Set(s) Program Suffix Description
binutils216 -2.16.1 Builds an independent BinUtils only, based on BinUtils 2.16.1 but—like GCC 3—using some common elements from GCC 3.4.6 and GCC 4.4.7
NOTE: This is for an independent build of BinUtils ONLY and is NOT to be combined with the other toolchain sets.
gdb5 -5 Builds an independent GDB only, based on GDB 5.3
gcc3 -3 Builds a combined toolchain set based on GCC 3.4.6 but using some common elements from GCC 4.4.7
gcc44 -4.4 Builds a combined toolchain set based on GCC 4.4.7
gdb5,gcc3 (respective) Builds a combined toolchain set based on GCC 3.4.6 but uses an independent GDB based on GDB 5.3
gdb5,gcc44 (respective) Builds a combined toolchain set based on GCC 4.4.7 but uses an independent GDB based on GDB 5.3
gdb5,gcc3,gcc44 (respective) Builds all three. If combining into a single install, files conflicts not already resolved by the differing toolchain program suffixes are resolved as follows: GCC 4.4 takes precedence over GCC 3, which takes precedence over GDB 5

Repository Composition Notes

The primary selection criteria was the last known versions to include support for h8300-*-coff, but this also overlapped well with support for GPC, Fortran77/g77, and the CLI CIL front end.

Project Version Release Date High-Level Notes
Config 2024-07-27 2024-07-27 Copies of the latest config.guess and config.sub files. All config.guess and config.sub files in all included source projects are sym-linked to the latest files here.
BinUtils 2.16.1 2005-06-12 ¹ Note lack of support for h8300-*-coff in gas/configure.tgt in later versions
GCC 3.4.6 2006-03-06 ² Last full version series to support h8300-*-coff
GCC 4.4.7 2012-03-13 ² Support for “Generic COFF” in general was dropped following the GCC 4.4 release series. As the last GCC release to support h8300-*-coff (c.f. the lack of support for h8300-*-coff [covered by the "h8300-*-*" case] in libgcc/config.host in later versions), the flag --enable-obsolete must be used when configuring.
GCC CIL Front End 4.3.0-2007-12-13 2011-06-20 (final commit) Work was done on separate branches, and front end work was later forked off from back end work. Earlier coding was against GCC 4.3 before later skipping to GCC 4.5 (in which h8300-*-coff was no longer supported).
GPC 2.1-20070904 2007-09-04 See the links and included README files for further details. ³
NewLib 1.19.0 2010-12-16 Version 1.20.0 introduces incompatibilities with libiberty. Versions 2.0 and later fail to build if targeting h8300-*-coff
GDB 5.3 released 2002-12-12 While a few later versions still supported h8300-*-coff targets, the debugging capabilities built into BrickEmu (an emulator for the LEGO MindStorms RCX) are based on a built-in GDB server that implements the GDB 5 protocol.
GDB 6.8 released 2008-02-29 This version of GDB best aligns with the other packages in the GCC toolchain, in that it is able to be included in a combined toolchain build. (Neither GDB 5.3 nor GDB 7.12.1 are able to be built that way.)
GDB 7.12.1 released 2017-01-21 While GDB 7.12.1 seems to indicate that h8300-*-*-coff targets are supported (note lack of support for h8300-*-*-coff [covered by the "h8300-*-*-*" case] in bfd/config.bfd in later versions), compatibility has not been fully validated, as it was released well after h8300-*-coff support had been dropped from other packages (for example, BinUtils and GDB are both developed in a single, common source repository).

¹ BinUtils: Release date based on the ChangeLog files for bfd, gas, and ld.

² GCC: Link includes the full GCC release timeline, with additional resources as follows:

³ GPC: Additional links and information—

⁴ NewLib: Release history link opens in a subframe; at the site, navigate to Download > Snapshots to view the release timeline history subframe.

GCC 3.4.6 versus GCC 4.4.7

Use of GCC 3.4.6 generally seems preferable to GCC 4.4.7:

  • H8/300 was supported for the duration of the full GCC version series, with 3.4.6 closing the release series
  • More programming languages supported
    • GPC integration is less robust in GCC 4
    • Fortran77/g77 support was not included in later GCC versions, and some older code is not well suited to being built by newer Fortran compilers such as gfortran (ref 1, ref 2).
  • Multiple ongoing patch sources were provided by Linux distributions such as RedHat and Debian
  • Creates smaller binaries compared to builds of the same code created using GCC 4
    • This is especially important on memory-constrained devices such as the LEGO MindStorms RCX
    • Example: For the exact same brickOS-bibo kernel source code and build configuration, the generated binaries are notably smaller with GCC 3.4.6—
GCC Version Supported Programming Languages Kernel Binary File Size App Start (BASE1) Address
3.4.6 C, C++, Java, ObjectiveC, Fortran77, Pascal, TreeLang 13,108 bytes 0xace4
4.4.7 C, C++, Java, CLI CLI front end, possibly Pascal (?) 14,322 bytes 0xb0c4

Potential advantages of GCC 4.4.7 over GCC 3.4.6:

  • A more complete backporting of multiarch was possible for GCC 4.4.7 compared to GCC 3.4.6.
  • Common Language Infrastructure (CLI) Common Intermediate Language (CIL) Front End support is only available in GCC 4.4.7.

Additional Details and Information

Updates and Modifications

For patches and updates applied from other sources, a more in-depth description is available in the patches folder.

Change Log for Included Source Projects

Changes to each of the source projects as compared to their last official releases can be reviewed as follows:

Compostion of Combined Folders

Several folders are duplicated across the various project comprising the toolchain. By appropriately mixing and matching folder versions, it is possible to establish a combined source folder through which a single, combined build can be executed.

More information on how projects were “mixed and matched” to create combined source folders is available in the sym-combined folder.

About

A legacy GNU toolchain that includes GCC 3.4.6, BinUtils 2.16.1, GPC 2.1-20070904, NewLib 1.19.0, and GDB 6.8. While primarily intended for building a cross-toolchain targeting Hitachi/Renesas H8/300 processors with the COFF (or, colloquially, HMS) format, this should work for other targets as well.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published