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.
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.
Packages history is available here.
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.
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.
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.
m68k-atari-mint-gcc
is the C compiler.m68k-atari-mint-g++
is the C++ compiler.-Wl,--traditional-format
to inform the linker.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.Two binary packages are provided:
gdb
(running on MiNT for debugging MiNT executables),
and gdbserver
to wait for remote debugging sessions.
m68k-atari-mint-gdb
, which will connect to the gdbserver
running on MiNT.
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:
hello
using the TCP port 4444. Any unused port between 1024 and 65535 can be used.
hello
with debug information: m68k-atari-mint-gcc hello.c -o hello -g
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).
m68k-atari-mint-gdb hello
.
(gdb)
prompt, type target remote 192.168.0.2:4444
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.
ddd
package.
gdbserver
as described above.
startx
.
xterm
window, type ddd --debugger m68k-atari-mint-gdb hello
ddd
command window, type the target remote...
command.
ddd
as usual!
Important note: this release of gdb 5.1 is experimental, and suffers from severe issues:
next
command. The native gdb 5.0 provided on SpareMiNT doesn't seem to
have this bug.
vim
, less
, or the GDB text UI.
$ 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.
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.
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
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.