Installing the GNU HC12 Toolchain Binaries

Author: Colin D. Bennett <colin@gibibit.com>
Date: 23 May 2008

Introduction

The easiest way to get a working toolchain for building HC12/HCS12 programs is to download the precompiled binary toolchain package. The binary package will only work on systems with the same architecture as the system it was built for. Currently the only binary package is for x86 systems. It is built for Ubuntu Linux 6.10 and may not work on other distributions because the required versions of system shared libraries may not be available.

As in Building a GNU HC12 Toolchain, the toolchain can be installed under your user's home directory, so root access is not required to install it. It is also possible to install it so that multiple users on the system can share it by installing to a location such as /opt or /usr/local. In this document, it will be assumed that you are installing the toolchain in $HOME/bin/m6812-elf.

Instructions

Download the Package

Download the binary distribution archive from the FreeHC12 downloads page. The following builds are available:

Architecture Operating System Download Link
x86 Ubuntu Linux 6.10 m6812-elf-01_x86-ubuntu6.10.tgz
x86 Ubuntu Linux 7.10 m6812-elf-01_x86-ubuntu7.10.tgz
x86 Ubuntu Linux 8.04 m6812-elf-01_x86-ubuntu8.04.tgz

Extract the Package

We'll install under the $HOME/bin directory, where $HOME is your user's home directory. You can actually just type $HOME at the shell prompt and the shell will replace it with your actual home directory. If no $HOME/bin directory exists already, it will be created:

mkdir -p $HOME/bin

Now extract the binary package into $HOME/bin. The archive will unpack into a subdirectory called m6812-elf, so it won't put files directly in $HOME/bin. You can extract the archive with a GUI archiving program such as Gnome's File Roller or KDE's Ark, but it is actually faster and simpler to do it from the command line. Replace /path/to/archive.tgz with the name of the binary package file you downloaded:

tar -xzf /path/to/archive.tgz -C $HOME/bin

At this point, you should be able to run the C compiler by specifying the full path to it:

$HOME/bin/m6812-elf/bin/m6812-elf-gcc -v

This should print out the version of gcc. If you get an error, the binary package may not be compatible with you operating system. Try building and installing the toolchain from the source code (see Building a GNU HC12 Toolchain for details).

Final Setup

The last thing to do is edit your ~/.profile or ~/.bash_profile to set up the required environment variables. At this point, putting $HOME/bin/m6812-elf/bin in your path is all that is needed, but when you install the FreeHC12 library, you will need to set up a couple more environment variables so that it can be located. To prepare for that step, we will create a file called .m6812-env in our home directory with the following contents:

PATH="$HOME/bin/m6812-elf/bin:$PATH"

Then, add the following line to your ~/.bash_profile or ~/.profile (depending on which one your system is set up to use):

. ~/.m6812-env

(Make sure there is a space between the . and the ~/.m6812-env.)

Now if you log out and log back in to your account, you should be able to execute m6812-elf-gcc from the shell prompt without specifying the full path to it, since your .profile properly set up your PATH.

Programaming: Getting Started

Now that you have a working HC12 toolchain, you may want to read the documents on the FreeHC12 documentation page under the Programming section.