FreeEMS/S12X/XGATE Tools

This page exists to share information on how to obtain various tools for DIY EFI projects. In particular, it exists to share, with the world, the tools required to build FreeEMS.

Previously, there was no free software compiler available for the XGATE coprocessor in the S12XDP512 CPU. Sean Keys has developed a full set of binutils for this core over the last year including an assembler. No C compiler is available, however it is unlikely to be required either. The tools presented here included the new XGATE tools and other older tools rebuilt to work smoothly with that.

Please note, Mac OS X and Windows tools will lag the Debian tools and tool source during times of change. These are brought up to date as quickly as possible.


Debian and Ubuntu

For Debian and Ubuntu there is a repository available. Add the following line to your sources.list file (found in /etc/apt/)

deb css-debs binary

then run

apt-get update

then run

apt-get install freeems-toolchain

Alternatively you may download the Debian Archives and install them manually using

dpkg -i *.deb

If you install from here, you're using what Fred is using to build his master copy of the FreeEMS code. This is the recommended approach for all users building from source.

These packages were built from the binutils commit hash ee7a227de93220d005b1a2cda813dd564ebb11b8 which includes most of the extended S12X and S12 instructions in the binutils-mc9s12x package. These debs have been tested on lenny, wheezy, sid, lucid and maverick!

Debian/Ubuntu 64 Bit Users

If you're using 64 bit Debian or ubuntu (AMD64) then you either need to build everything from source, or run a 32 bit VM. Sadly due to misconfigured dependencies in one of these old packages, they can't be installed on a 64 bit system using the usual --force-architecture method.

Windows XP, Vista and 7

For Windows there is an installer available which includes XGATE binutils, S12X GCC, S12X binutils, S12X newlib, GnuWin32 make and GnuWin32 coreutils. A link to the installer is below.


This package was built using the following components:

The scripts used to build the this installer are available on github at the link below.

FreeEMS Windows Installer Build Scripts

Thanks to David J. Andruczyk for creating this installer!

Mac OS X

WARNING - Right now, only native tools built from source work! Fink and MacPorts variants are NOT up to date with build requirements!

For Mac OSX you will require fink installed and setup with unstable enabled. Once you have that, you can take all of the files from the following zip archive

and place them in the fink info directory


then run

fink install mc9xgate-binutils m68hc1x-newlib m68hc1x-binutils m68hc1x-gcc

You will also need to install make in the same fashion if you have not done so already.

fink install make

Unfortunately there is not currently a macports toolchain available.

This current version does not include the extended S12X and S12 instructions in the mc9s12x binutils package. Hopefully we can update this pretty soon.

Thanks to Steve Ball for creating these info and patch files.

Source Code - Tools

Additionally, you can get the source code for the tools from Sean Keys master branch (or any fork thereof) on github

XGATE Binutils

Source Code - FreeEMS

If you don't already have the FreeEMS source code, you can get it from Fred Cooke's master branch (or any fork thereof) on github

Fred Cooke's FreeEMS Repository

You can git clone it directly (for following Fred's progress), fork it on github and clone your own (for hacking and/or contributing), or even just download a release or a snapshot of the current head of development (to take a look or have a play).

Other Linux Distributions

If you use another type of GNU/Linux distro and would like to contribute packages or package definitions or howtos on building from source on your platform, please get in touch.


Yes, these tools can be used to build most MegaSquirt (S12(X)) based firmware variants. That probably includes MS3 (MS3 is closed source!!!) for Linux and Windows, but not quite yet for Mac OS X.

Developed with VIM

This page was developed using vim over ssh on the server, and it shows! If you want to give this page a bit of a spruce up, go right ahead! You can find me on the diyefi forum to deliver your contribution. Just adding a CSS style sheet would probably be sufficient.

Valid XHTML 1.0 Transitional