Looking for something newer?
Try the new m68k-atari-mintelf toolchain

Vincent Rivière's m68k-atari-mint cross-tools

This page is dedicated to the programmers who want to:

You will find here gcc, g++, as, ld, and other tools configured to produce executables for the Atari ST. It means that you can use all the latest C++ features, such as templates, exceptions, STL, as well as inline assembly, to build software which will run on your old Atari ST.

Original sources are provided, as well as the patches and build scripts. It would be easy to recompile them on any operating system already supporting the GNU tools.
Feel free to redistribute, recompile, and improve the packages, with respect to their own licenses.

The MiNT patches were originally written by Guido Flohr and Frank Naumann in 1998 for the FreeMiNT project. I upgraded them to newer binutils and GCC versions starting from 2007.

Quickstart for Windows

  1. Install Cygwin by running setup-x86_64.exe (32 bit Cygwin is no longer supported). This will provide you a full UNIX-like environment necessary for running the GNU tools.
  2. Install the following packages, using the Cygwin setup program: libmpc3.
  3. Download and install cross-mint-cygwin-20230115-setup.exe.
  4. Now you can use any tool prefixed by m68k-atari-mint-, such as m68k-atari-mint-gcc, m68k-atari-mint-g++, and even read the man pages.

Everything is installed in /opt/cross-mint.
If you want to completely uninstall the tools, you just have to remove that directory.

Other operating systems

Individual packages

These packages can only be useful for advanced users.

Component Version Packages
binutils 2.30
GitHub repository: freemint/m68k-atari-mint-binutils-gdb
Original sources: binutils-2.30.tar.bz2 (official and faster link)
MiNT patch: binutils-2.30-mint-20180703.patch.bz2
Build script: binutils-2.30-mint-20180703-bin-cygwin-howto.txt
Cygwin Package: binutils-2.30-mint-20180703-bin-cygwin-20210601.tar.bz2
MiNTBin Git-20201129
GitHub repository: freemint/mintbin
Original sources: mintbin-Git-20201129.tar.gz
Build script: mintbin-Git-20201129-bin-cygwin-howto.txt
Cygwin Package: mintbin-Git-20201129-bin-cygwin-20210606.tar.bz2
GCC 4.6.4
GitHub repository: freemint/m68k-atari-mint-gcc
Original sources: gcc-4.6.4.tar.bz2 (official and faster link)
MiNT patch: gcc-4.6.4-mint-20200504.patch.bz2
Build script: gcc-4.6.4-mint-20200504-bin-cygwin-howto.txt
Cygwin Package: gcc-4.6.4-mint-20200504-bin-cygwin-20230114.tar.bz2
MiNTLib Git-20220821
GitHub repository: freemint/mintlib
Original sources: mintlib-Git-20220821.tar.gz
Build script: mintlib-Git-20220821-bin-cygwin-howto.txt
Cygwin Package: mintlib-Git-20220821-bin-cygwin-20230110.tar.bz2
PML 2.03
Original sources: pml-2.03.tar.bz2
MiNT patch: pml-2.03-mint-20191013.patch.bz2
Build script: pml-2.03-mint-20191013-bin-cygwin-howto.txt
Cygwin Package: pml-2.03-mint-20191013-bin-cygwin-20230114.tar.bz2
GEMlib Git-20230112
GitHub repository: freemint/gemlib
Original sources: gemlib-Git-20230112.tar.bz2
Build script: gemlib-Git-20230112-bin-cygwin-howto.txt
Cygwin Package: gemlib-Git-20230112-bin-cygwin-20230114.tar.bz2
GDB 5.1
GitHub repository: freemint/m68k-atari-mint-binutils-gdb
Original sources: gdb-5.1.tar.gz
MiNT patch: gdb-5.1-mint-20081102.patch.bz2
Cygwin build script: gdb-5.1-mint-20081102-bin-cygwin-howto.txt
Cygwin Package: Unavailable for 64-bit hosts
MiNT build script: gdb-5.1-mint-20081102-bin-mint-howto.txt
MiNT Package: gdb-5.1-mint-20081102-bin-mint-20100124.tar.bz2
CFLIB Git-20221026
GitHub repository: freemint/cflib
Original sources: cflib-Git-20221026.tar.bz2
Build script: cflib-Git-20221026-bin-cygwin-howto.txt
Cygwin Package: cflib-Git-20221026-bin-cygwin-20230115.tar.bz2
GEMMA Git-20210702
GitHub repository: freemint/gemma
Original sources: gemma-Git-20210702.tar.bz2
Build script: gemma-Git-20210702-bin-cygwin-howto.txt
Cygwin Package: gemma-Git-20210702-bin-cygwin-20230115.tar.bz2
LDG SVN-20150827
Original sources: ldg-SVN-20150827.tar.bz2
Build script: ldg-SVN-20150827-bin-cygwin-howto.txt
Cygwin Package: ldg-SVN-20150827-bin-cygwin-20230115.tar.bz2
SDL 1.2-Git-20230104
Original sources: sdl-1.2-Git-20230104.tar.bz2
Build script: sdl-1.2-Git-20230104-bin-cygwin-howto.txt
Cygwin Package: sdl-1.2-Git-20230104-bin-cygwin-20230115.tar.bz2
ncurses 5.9
Original sources: ncurses-5.9.tar.gz
Build script: ncurses-5.9-bin-cygwin-howto.txt
Cygwin Package: ncurses-5.9-bin-cygwin-20201102.tar.bz2
zlib 1.2.13
Original sources: zlib-1.2.13.tar.gz
Build script: zlib-1.2.13-bin-cygwin-howto.txt
Cygwin Package: zlib-1.2.13-bin-cygwin-20230115.tar.bz2
Readline 6.2
Original sources: readline-6.2.tar.gz
Build script: readline-6.2-bin-cygwin-howto.txt
Cygwin Package: readline-6.2-bin-cygwin-20131212.tar.bz2
OpenSSL 1.0.1e
Original sources: openssl-1.0.1e.tar.gz
MiNT patch: openssl-1.0.1e-mint-20131219.patch.bz2
Build script: openssl-1.0.1e-mint-20131219-bin-cygwin-howto.txt
Cygwin Package: openssl-1.0.1e-mint-20131219-bin-cygwin-20131219.tar.bz2
cygwin-setup 20230111
GitHub repository: vinriviere/cross-mint-cygwin-setup
Sources: cross-mint-cygwin-20230115-setup-src.zip
Binary: cross-mint-cygwin-20230115-setup.exe

Packages history is available here.

More information

The original binutils patch was written by Guido Flohr.
Patrice Mandin has ported that patch to many versions of GCC and the binutils. You can find those versions and nice tutorials on his site.

I started to be interested in cross-compilation in 2002. I wanted to build software for the Atari ST from Windows, so I looked for it on the web. Fortunately, I found that a port of GCC was made for the MiNT project. I downloaded the patches, and ported them to the current versions. Later, I ported my patches to newer versions of GCC and the binutils. Every time, I spent a lot of time, for an incomplete result that I didn't share.

In 2007, I thought to all that wasted time. I decided to do the port once again, but this time with the aim of getting something fully usable, which I could share with other people. I found a few bugs in the binutils which were real problems for the MiNT target. Thanks to the binutils team (especially Nick Clifton - many thanks!), the bugs were fixed in the official sources, being a benefit for all other targets.

Please note that I'm not particularly interested in MiNT and the MiNTLib. I just want to be able to build programs for the plain old TOS. As far as I know, the MiNTLib is currently the only standard library supported by GCC for the Atari targets. It may not be a problem, because it is backwards compatible with TOS, but it produces too big executables.

Here is further information about the packages.

binutils

The binutils are a collection of low-level language tools.
The full documentation can be found here.

m68k-atari-mint-as is the assembler (later referred as gas)
It converts an assembler source file into a binary object file. Due to limitations in the current linker, the generated file format must be an a.out variant. The older patches used a MiNT-specific file format. Because there is nothing specific to MiNT in the object files, I decided to use the file format a.out-zero-big instead, which is a standard variant of a.out natively supported by the binutils.
Recent versions of gas accept the standard Motorola syntax, but the assembler directives are slightly different from Devpac's.
Note that gas produces sections of size multiple of 4. This allows to align data to a 4-byte boundary by using the .balign 4 directive. This is only useful for a 68020+ CPU in FastRAM, but useless for old 68000 targets, where 2 bytes may be wasted at the end of each .o file.
By default gas generates code for the 68020 (unlike GCC), and it tries to optimize the jump instructions when possible. When you use m68k-atari-mint-as directly, make sure to append the -m68000 command-line option to avoid the generation of instructions like bsr.l which would bomb out on a standard 68000.

m68k-atari-mint-ld is the linker.
It is able to combine several object files into one standard TOS executable.
Guido Flohr found an excellent trick: by adding an additional header of 228 bytes after the standard 28 byte header, he was able to make executables which can be treated either as a TOS executable (by the TOS and MiNT) or as a standard a.out executable (by other GNU utilities).
By default, the debug info is generated in STABS format. Standard DRI symbols can be generated by appending the option --traditional-format. Thus, you can see the generated symbols with your favorite debugger such as MonST!
If you don't want any debug symbol, just link with the -s option.

MiNTBin

MiNTBin has been written by Guido Flohr. It is a set of tools for manipulating the MiNT executables generated by ld. They are a complement to the binutils. The main tools are stack for setting the stack size of an executable, and flags for setting the header flags.

GCC

m68k-atari-mint-gcc is the C compiler.
m68k-atari-mint-g++ is the C++ compiler.
They just work. I only tested the C and C++ languages, but other languages may work, too.
If you want to generate DRI symbols in the final executable, append the option -Wl,--traditional-format to inform the linker.
I configured this version to generate 68000 code by default, and I enabled multilib. By default, sizeof(int) == 4, but if you compile with -mshort then sizeof(int) == 2 (unsupported by the current MiNTLib). Every object file and every library must be compiled with the same option! You can also generate code for the 68020 and higher and for the FPU by using the -m68020-60 option. And you can generate code for ColdFire V4e processors by using the -mcpu=5475 option.
The full documentation can be found here.
GCC contains everything to compile C programs, except a standard library and a math library.

MiNTLib

MiNTLib is a standard C library. It allows to build software which runs on MiNT and TOS operating systems. Unlike other packages, I used the latest sources from the CVS repository instead of the latest official release.
I'm not particularly interested by MiNT, so I don't plan to make more work on the MiNTLib than necessary to compile it. The latest versions of the MiNTLib produces executables which are really too big, compared to the older versions of the MiNTLib or the Pure C.

PML

PML stands for Portable Math Library.
It works, but of course it is really slow on a 68000 without FPU.

GEMlib

The GEMlib allows to write graphical programs using GEM.
It is maintained by Arnaud Bercegeay, the official releases are available on the GEMlib's homepage. However, the latest sources are available on the FreeMiNT's GitHub repository.

GDB

GDB is the GNU debugger. It allows to debug a MiNT executable, put breakpoints in the C or C++ sources, examine the variables, step trough code lines...

Two binary packages are provided:

Remote debugging allows a MiNT program to be run or a real Atari machine (or emulator), while the debugger runs on another machine. For example, you can run GDB on Cygwin for debugging a program running inside ARAnyM. The communication between the two machines is done using TCP/IP.

Quick HOWTO for remote debugging using Cygwin and ARAnyM:

  1. Let say that your ARAnyM IP address is 192.168.0.2, and you want to debug an executable named hello using the TCP port 4444. Any unused port between 1024 and 65535 can be used.
  2. Make sure TCP/IP works between Cygwin and ARAnyM (check with ping in both directions).
  3. Compile hello with debug information: m68k-atari-mint-gcc hello.c -o hello -g
  4. Keep the executable with debug information on Cygwin, and put a copy (or stripped copy) into ARAnyM (or better: use HOSTFS).
  5. On ARAnyM, run the command gdbserver :4444 hello
    gdbserver will start hello in suspended mode and will wait for incoming connections. No further action will be required on the ARAnyM side (except looking at the program output).
  6. On Cygwin, run the command m68k-atari-mint-gdb hello.
  7. At the (gdb) prompt, type target remote 192.168.0.2:4444
    On both sides, the message "Remote debuggin using..." will be displayed.
  8. On Cygwin, use gdb as usual. Put a breakpoing using b main. Then type cont (instead of run), because the remote process has already been started remotely.

Debugging can be more user-friendly!
Run m68k-atari-mint-gdb with the --tui option to enable full-screen source debugging.

You can even use the graphical debugger ddd for remote debugging MiNT programs.

  1. On Cygwin, install the ddd package.
  2. On ARAnyM, run gdbserver as described above.
  3. On Cygwin, start X-Window with the command startx.
  4. In the xterm window, type ddd --debugger m68k-atari-mint-gdb hello
  5. In the ddd command window, type the target remote... command.
  6. Use ddd as usual!

Important note: this release of gdb 5.1 is experimental, and suffers from severe issues:

CFLIB

CFLIB is Christian Felsch's GEM utility library. It provide advanced controls, such as check boxes, radio buttons, combo boxes... It also allows windowed dialogs.
BUG: On plain TOS, the CFLIB makes intensive usage of the GEM USERDEF feature. Due to bad GEM design, USERDEF callbacks are called in supervisor mode using the very small internal AES stack. Unfortunately, some GemLib functions such as v_gtext() needs an insane amount of stack (more than 2 KB). So some USERDEF callbacks quickly produces an AES internal stack overflow, and crashes all the system.
Concretely, due to this issue, programs using the CFLIB work fine on XaAES and TOS 4.04, but crashes on TOS 1.62 and EmuTOS.

GEMMA

GEMMA, the GEM application support library. It is provided in the form of an SLB shared library for FreeMiNT. It provides standard GEM bindings, and also extended functions for additional features.

LDG

LDG stands for Gem Dynamical Libraries. It allows you to use or build .ldg shared libraries. Everything is described on the LDG official website.

SDL

SDL is the Simple DirectMedia Layer library. It is a low-level and cross-platform library for building games or similar programs.
Thanks to Patrice Mandin, SDL is available on Atari platforms. SDL programs can run either in full screen or in a GEM window, depending on the SDL_VIDEODRIVER environment variable.

Ncurses

Ncurses is a library which allows building full-screen text mode programs, such as vim, less, or the GDB text UI.

zlib

zlib is a compression library implementing the Deflate algorithm, used by gzip and PKZIP.

Readline

Readline is a library to allow command line history and completion.

OpenSSL

OpenSSL is an SSL and cryptography library.

A sample program

$ cat hello.c
#include <stdio.h>

int main(int argc, char* argv[])
{
    puts("Hello, world !");

    return 0;
}

$ m68k-atari-mint-gcc hello.c -o hello.tos -O2 -Wl,--traditional-format
$ ls -l hello.tos
-rwxr-xr-x 1 vincent cygwin 80073 Jan  8 20:23 hello.tos

Note: The -Wl,--traditional-format option above is only useful when you want to use a classic Atari debugger like MonST2, as seen on the picture below. Do not use that option in general case.

I recommend the excellent emulator Steem Engine for testing your programs under Windows and Linux.

MonST 2

MiNT Software

As a proof of concept, I have compiled some popular free software for MiNT using this cross-compiler, and it works very well. This is due to the excellent compatibility provided by the FreeMiNT kernel and the MiNTLib. Some binaries may even run on plain TOS. If you want to test MiNT software, you can use the ARAnyM system emulator. The easiest way to begin is to use the AFROS distribution.

Conclusion

I have been able to compile several programs with these tools, from a simple "Hello, world !" to complex C++ programs using CppUnit. They are now mature enough to be shared, and maybe useful to someone else.

Feel free to send me your comments!

Vincent Rivière

Links

Patrice Mandin has made a lot of work for porting GCC and the binutils to the MiNT platform. His work is available here.

Olivier Landemarre has made its own port of GCC 4.2 to the the MiNT platform. He also has a great list of Atari-related stuff.

François Le Coat is the author of the ATARI Search Engine.

Thomas Huth is the author of the Hatari ST emulator. He has sucessfully recompiled this GCC port on Linux, on his PowerMac G4, and has successfully compiled EmuTOS with it!

Keith Scroggins has ported ScummVM to MiNT. Build instructions are available here. He has also made his own native port of GCC 4.0.1 several years before me.

Miro Kropáček has compiled this GCC port for the MiNT host. That means you can run the latest GCC natively on your Atari/MiNT computer, without cross-compilation! He also made a nice Makefile for building all the toolchain. His work is available here.

Paweł Góralski has ported REminiscence to Falcon using this compiler. It is an interpreter for Delphine Software games, enabling to play Flashback on Falcon. He also maintains the Bus Error Wiki with a lot of programming tricks using these cross-tools.

Mark Duckworth has built an RPM package for native MiNT binutils, using the patch available on this page. He has compiled natively a lot of other RPM packages, his work is available here.

Dominique Béréziat has written a tutorial for cross-compiling GEM applications.

Philipp Donzé has built the binaries of these cross-tools for MacOS X (Intel and PowerPC supported). His binaries as well as installation instructions are available here.

Rolf Hemmerling has a nice page about the current Atari resources on the web.

DML has a nice page about Atari and engineering. Moreover, he has developed the amazing Atari Game Tools.

Peter Dassow has a nice page with a lot of links to ST software.

George Nakos used the cross-tools for his raptorBASIC+.

Jookie uses the cross-tools for developing CosmosEx software. CosmosEx is a hardware extension as small as a floppy drive which brings SD-Card, USB, Ethernet and much more to Atari computers.

Daroou extensively uses the cross-tools for his Renaissance software.

François-Xavier Robin wrote a detailed tutorial to build Atari ST software from Linux (French): cross-compilation d'un Helloworld pour TOS et GEM.


Back to the software page