Skip to content

kentosama/m68k-elf-gcc

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

GCC toolchain for the Motorola 68000

This is a set of bash scripts for build gcc toolchain on unix environment for the Motorola 68000 family (m68k) was mainly used in SEGA Mega Drive, SEGA Mega CD, SNK NeoGeo, Atari ST, Amiga and older computers.

Build the toolchain

First, you need to install devel environment was come with your Linux distro for build the toolchain.

ArchLinux

$ sudo pacman -Syu
$ sudo pacman -S base-devel

Debian

$ sudo apt update
$ sudo apt install build-essential textinfo

Ubuntu

$ sudo apt update
$ sudo apt install build-essential textinfo

Fedora

$ sudo dnf update
$ sudo dnf groupinstall "Development Tools"
$ sudo dnf groupinstall "C Development Tools and Libraries"

After, going into your workspace where you want build the toolchain (for example ~/workspace/source) and clone this repository:

cd ~/workspace/source
git clone https://github.com/kentosama/m68k-elf-gcc.git
cd m68k-elf-gcc

Now, you can run build-toolchain.sh for start the build. The process should take approximately 15 min or several hours depending on your computer. Please, don't run this script as root!

$ ./build-toolchain.sh

For build the toolchain with the newlib, use --with-newlib argument:

$ ./build-toolchain.sh --with-newlib

For build the toolchain with other processors of the Motrola 68000 family, use --with-cpu argument:

$ ./build-toolchain.sh --with-cpu=68000,68030...

For change the program prefix, use --program-prefix argument:

$ ./build-toolchain.sh --program-prefix=sega-genesis-

Install

Once the Motorola 68000 toolchain was successful built, you can process to the installation. Move or copy the "m68k-toolchain" folder in "/opt" or "/usr/local":

$ sudo cp -R m68k-toolchain /opt

If you want, add the Motorola 68000 toolchain to your path environment:

$ echo export PATH="${PATH}:/opt/m68k-toolchain/bin" >> ~/.bashrc
$ source ~/.bash_profile

Finally, check that m68k-elf-gcc is working properly:

$ m68k-elf-gcc -v

The result should display something like this:

Using built-in specs.
COLLECT_GCC=./m68k-elf-gcc
COLLECT_LTO_WRAPPER=/home/kentosama/Workspace/m68-elf-gcc/m68k-toolchain/libexec/gcc/m68k-elf/6.3.0/lto-wrapper
Target: m68k-elf
Configured with: ../../source/gcc-6.3.0/configure --prefix=/home/kentosama/Workspace/m68-elf-gcc/m68k-toolchain --build=x86_64-pc-linux-gnu --host=x86_64-pc-linux-gnu --target=m68k-elf --program-prefix=m68k-elf- --enable-languages=c --enable-obsolete --enable-lto --disable-threads --disable-libmudflap --disable-libgomp --disable-nls --disable-werror --disable-libssp --disable-shared --disable-multilib --disable-libgcj --disable-libstdcxx --disable-gcov --without-headers --without-included-gettext --with-cpu=m68000
Thread model: single
gcc version 6.3.0 (GCC) 

For backup, you can store the Motorola 68000 toolchain in external drive:

$ tar -Jcvf sh2-gcc-6.3.0-toolchain.tar.xz m68k-toolchain
$ mv m68k-gcc-6.3.0-toolchain.tar.xz /storage/toolchains/