Cross compile for 68000 in C under Windows
This article contains my notes for setting up a m68k cross-compiler using Cygwin. It’s all free software and gives me a way to create binary images for a 68000 CPU from C code on Windows. Here’s the step-by-step to set it up:
Step 1. Install Cygwin
Go to http://www.cygwin.com/ and download setup.exe. Run it.
During the setup, you will have the opportunity to select what packages to install. Choose the following:
- binutils
- gcc-core
- bzip2
- flex
- make
Step 2. Download the compiler source code
You want binutils and gcc-core from GNU. Go to the GNU download page, choose a mirror and download the following files. Place them in your Cygwin home directory.
- binutils-2.15.tar.bz2
- gcc-core-3.4.2.tar.bz2
Yes there are more up-to-date versions but at the time of writing, the latest gcc versions do not support the 68000 platform. Feel free to try different versions but I know the versions just mentioned will work.
Step 3. Compile and install binutils
Launch Cygwin and type the following commands. Typing this kind of stuff is automatic for me these days. Its a pretty standard GNU setup procedure.
mkdir /usr/local/m68k tar jxvf binutils-2.15.tar.bz2 cd binutils-2.15/ ./configure --prefix=/usr/local/m68k --target=m68k-coff make install
Step 4. Compile and install gcc
Same again for the C compiler.
cd ~ export PATH=$PATH:/usr/local/m68k/bin tar jxvf gcc-core-3.4.2.tar.bz2 cd gcc-core-3.4.2/ ./configure --prefix=/usr/local/m68k --target=m68k-coff --enable-languages=c make install
Step 5. Set up your path
The 68000 compiler will be located in /usr/local/m68k/bin. To make life easier, you might like to add the following to your ~/.bashrc file:
export PATH=$PATH:/usr/local/m68k/bin
Step 6. Enjoy
Here’s the command to compile some C code:
m68k-coff-gcc -o test.out test.c
And the command to create a binary image from the compiled code:
m68k-coff-objcopy -O binary test.out test.bin

Its nice to know that while I was