=========================================================================== Installing the GNU HC12 Toolchain Binaries =========================================================================== :Author: Colin D. Bennett :Date: 23 May 2008 .. contents:: 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: .. include:: Toolchain_binary_download_list.txt 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. .. _FreeHC12 downloads: http://freehc12.gibibit.com/Download .. _FreeHC12 documentation: http://freehc12.gibibit.com/Docs .. _Building a GNU HC12 Toolchain: http://freehc12.gibibit.com/Toolchain_build