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).
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:
- Have a working Linux, Unix, or WSL environment with Bash shell support (currently untested under Mac or Cygwin)
- Install build dependencies
- See the Continuous Integration workflow for a current dependency list
- 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).
- Obtain a copy of the source via either of the following means:
- Clone from GitHub:
git clone [--branch <name of branch or tag>] https://github.com/BrickBot/GNU-Legacy-Toolchain.git
–or– - Download and extract a source archive, such as from one of the releases
- Clone from GitHub:
- Fix source file timestamps (this should typically only need to be executed once after obtaining the source)
- Execute the script
fix-mtime
that is found in the root of the source tree - Note that this could take several minutes to complete, depending on the speed of the system
- Execute the script
- Create a folder for building that is outside the source tree
- From that build folder, run either
configure
or one of the following use-case-specific wrapper helpers: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 targeth8300-hitachi-elf
is additionally enabled, which addself32-h8300
support to tools such asobjcopy
.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.
- Run
make
- Run
make install
to copy the files into an installation structure. - Run
make stow
to then link the files into your system installation.
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 |
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:
- Build and Installation Configuration Documentation for GCC 3.4.6
- GCC 3.4.6 Manual
- GCC 4.4.7 Manual
- Manual subsets and/or other formats (scroll down for the GCC 3.4.6 and 4.4.7 manuals section)
- The Ada programming language apparently does not support bootstrapping, so it is not currently available with either GCC v3 or GCC v4.4.
³ GPC: Additional links and information—
- The GNU Pascal Manual
- GPC website
- Compilation and installation guide: Note the section covering
pascal.install
at the end - Cross-compilation guide
- Compilation and installation guide: Note the section covering
- Source files from hebisch/gpc
- Mailing list (no longer seems to be active)
⁴ NewLib: Release history link opens in a subframe; at the site, navigate to Download > Snapshots to view the release timeline history subframe.
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
- 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.
For patches and updates applied from other sources, a more in-depth description is available in the patches
folder.
Changes to each of the source projects as compared to their last official releases can be reviewed as follows:
- Config
- Currently still able to use the latest config.guess and config.sub from upstream.
- All config.guess and config.sub files in all included source projects are sym-linked to the files here.
- BinUtils 2.16.1
- GCC 3.4.6
- GCC 4.4.7
- GPC 2.1-20070904
- Short, earlier history: No substantive changes here, but included for completeness
- NewLib 1.19.0
- GDB 5.3
- GDB 6.8
- GDB 7.12.1: Not currently used in this project, but included for reference
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.