GCC 7.3.0 for m68k / m68020-60 / m5475 (ColdFire)
Moderators: simonsunnyboy, Mug UK, Zorro 2, Moderator Team
-
- Hardware Guru
- Posts: 2276
- Joined: Sat Sep 10, 2005 11:11 am
- Location: Kosice, Slovakia
- Contact:
GCC 7.3.0 for m68k / m68020-60 / m5475 (ColdFire)
GCC 7.3.0 for the FreeMiNT target has been just released: https://github.com/freemint/m68k-atari- ... 7_3_0-mint
The main difference against GGN's GCC (currently in version 8.2) is that this toolchain provides the more traditional patchset, i.e. producing a.out binaries compatible with TOS executables, doesn't require any special flags or pre-/post-processing. And hey, works natively on the FireBee!
On the other hand it is, well, an a.out target so it doesn't produce so finely tuned link time optimisations.
The main difference against GGN's GCC (currently in version 8.2) is that this toolchain provides the more traditional patchset, i.e. producing a.out binaries compatible with TOS executables, doesn't require any special flags or pre-/post-processing. And hey, works natively on the FireBee!
On the other hand it is, well, an a.out target so it doesn't produce so finely tuned link time optimisations.
Re: GCC 7.3.0 for m68k / m68020-60 / m5475 (ColdFire)
This is great!
Thanks Mikro!
Thanks Mikro!

Re: GCC 7.3.0 for m68k / m68020-60 / m5475 (ColdFire)
Fantastic work.
-
- Hardware Guru
- Posts: 2276
- Joined: Sat Sep 10, 2005 11:11 am
- Location: Kosice, Slovakia
- Contact:
Re: GCC 7.3.0 for m68k / m68020-60 / m5475 (ColdFire)
Hold on with celebrations, Thorsten has found a bug in m68020/m5475 versions. Investigating... :-/
-
- Atari God
- Posts: 1268
- Joined: Sun Aug 03, 2014 5:54 pm
Re: GCC 7.3.0 for m68k / m68020-60 / m5475 (ColdFire)
And just for those who are not reading the mailing list: cross-compilers for gcc 7.3.1 and 8.2 are available since quite some time on http://tho-otto.de/crossmint.php, together with some commonly used packages, for linux, win32 and macOS.
Mikro's versions are native compilers, usable on mint.
Mikro's versions are native compilers, usable on mint.
Re: GCC 7.3.0 for m68k / m68020-60 / m5475 (ColdFire)
Native compilers are what I need/useThorstenOtto wrote:Mikro's versions are native compilers, usable on mint.

-
- Hardware Guru
- Posts: 2276
- Joined: Sat Sep 10, 2005 11:11 am
- Location: Kosice, Slovakia
- Contact:
Re: GCC 7.3.0 for m68k / m68020-60 / m5475 (ColdFire)
All good, the archives now contain properly configured and built compilers for all three platforms. Same URL as in the first post.
Re: GCC 7.3.0 for m68k / m68020-60 / m5475 (ColdFire)
Thanks mikro and anyone else involved. I too use the native GCC, on my FireBee. So this is really welcomed news.
-
- Atari God
- Posts: 1268
- Joined: Sun Aug 03, 2014 5:54 pm
Re: GCC 7.3.0 for m68k / m68020-60 / m5475 (ColdFire)
It should be noted that you may still run into some problems with newer gcc: the previous toolchain (gcc 4.6.4 in most cases) compiled in c99 mode by default. gcc 7.x uses c11, and gcc 8.x c17. While this might be even required to be able to compile some newer packages, the mintlib currently does not completely support this, so you may encounter some missing functions here and there.
-
- Atari Super Hero
- Posts: 529
- Joined: Wed Oct 24, 2007 7:52 pm
- Location: France
- Contact:
Re: GCC 7.3.0 for m68k / m68020-60 / m5475 (ColdFire)
Hi,
I've given a try to the gcc8.2.1 under linux with Otto's pre compiled programs and it works well. That's a great job.
I've got a question : I've compiled a quick hello word program (source and compile command below), and the result is 103849 bytes.
Is there a way to get lighter exe ?
I would expect a less than 4 kb exe in this case.
Regards
Laurent
The source
#include <stdio.h>
int main(int argc, char* argv[])
{
puts("Hello, world !");
return 0;
}
The compile command : m68k-atari-mint-gcc hello.c -o hello.tos -O2 -m68030 -s
I've given a try to the gcc8.2.1 under linux with Otto's pre compiled programs and it works well. That's a great job.
I've got a question : I've compiled a quick hello word program (source and compile command below), and the result is 103849 bytes.
Is there a way to get lighter exe ?
I would expect a less than 4 kb exe in this case.
Regards
Laurent
The source

#include <stdio.h>
int main(int argc, char* argv[])
{
puts("Hello, world !");
return 0;
}
The compile command : m68k-atari-mint-gcc hello.c -o hello.tos -O2 -m68030 -s
-
- Atari God
- Posts: 1268
- Joined: Sun Aug 03, 2014 5:54 pm
Re: GCC 7.3.0 for m68k / m68020-60 / m5475 (ColdFire)
ThanksLaurentS wrote:Hi,
I've given a try to the gcc8.2.1 under linux with Otto's pre compiled programs and it works well. That's a great job.

Yes, thats the drawback of having a (mostly) posix compliant c-library. Other system don't care about that, because the library is mostly shared nowadays.I've got a question : I've compiled a quick hello word program (source and compile command below), and the result is 103849 bytes.
That depends on the program. For simple ones, you can use Markus' libcmini, but of course that lacks a lot of functions available in mintlib. Also, file I/O using stdio streams is rather slow there, because it is always unbuffered.Is there a way to get lighter exe ?
- Eero Tamminen
- Fuji Shaped Bastard
- Posts: 2292
- Joined: Sun Jul 31, 2011 1:11 pm
Re: GCC 7.3.0 for m68k / m68020-60 / m5475 (ColdFire)
One gets minimal HelloWorld binary also "with MiNTlib", by:
* using TOS calls instead of C file stream functions like puts()
* telling GCC not to link full startup code (as no argument parsing is needed)
(Full startup code may also depend on printf/file stream functions for error reporting i.e. everything they indirectly bring in.)
* using TOS calls instead of C file stream functions like puts()
* telling GCC not to link full startup code (as no argument parsing is needed)
(Full startup code may also depend on printf/file stream functions for error reporting i.e. everything they indirectly bring in.)
-
- Atari God
- Posts: 1268
- Joined: Sun Aug 03, 2014 5:54 pm
Re: GCC 7.3.0 for m68k / m68020-60 / m5475 (ColdFire)
That *might* work, but then you have to write your own startup code. And even simple programs (beside hello world) usually need argument parsing, at least for a supplied filename as argument. And of course you must make sure that you don't accidently access stdin/stdout/stderr somehow, since they are not properly initialized.Eero Tamminen wrote:One gets minimal HelloWorld binary also "with MiNTlib", by:
* telling GCC not to link full startup code (as no argument parsing is needed)
Re: GCC 7.3.0 for m68k / m68020-60 / m5475 (ColdFire)
For years I've been using VBCC due to its ability to compile "devpac syntax" assembler source, and to specify function parameters into specific register.ThorstenOtto wrote:And just for those who are not reading the mailing list: cross-compilers for gcc 7.3.1 and 8.2 are available since quite some time on http://tho-otto.de/crossmint.php, together with some commonly used packages, for linux, win32 and macOS.
Example: void SetFullPalette(__reg("d0") int palette, __reg("a0") void *data);
Unfortunately, looking at the code produced by VBCC, it's quite inefficient, even for trivial stuff, for example:
unsigned short somevar;
unsigned short othervar;
somevar = othervar + 3;
I get something like:
moveq #0,d0
move.w othervar,d0
addq.l #3,d0
move.w d0,somevar
So I hope GCC 8.2 can do better, but I have lots of code written in assembly, and I just can't understand how I can bind it to GCC by specifying function parameters into specific register.
I tried to use "regparm" like this:
void __attribute__((regparm(2))) SetFullPalette(int palette, void *data);
But I get " warning: 'regparm' attribute directive ignored [-Wattributes]"
does anyone knows if this is possible with GCC or do I need to stick with VBCC ?
My retro games shop including Atari ST/Falcon/Firebee games ! -- Free Atari games/demos/tools -- Free Falcon demos/tools
Atari Mega STe 4MB + SD2SCSI 1GB + NOVA ET4000 + Pico PSU + Gotek HxC // Atari STe 2MB
Atari Mega STe 4MB + SD2SCSI 1GB + NOVA ET4000 + Pico PSU + Gotek HxC // Atari STe 2MB
Re: GCC 7.3.0 for m68k / m68020-60 / m5475 (ColdFire)
https://github.com/mfro0/libcminiLaurentS wrote:Hi,
I've given a try to the gcc8.2.1 under linux with Otto's pre compiled programs and it works well. That's a great job.
I've got a question : I've compiled a quick hello word program (source and compile command below), and the result is 103849 bytes.
Is there a way to get lighter exe ?
I would expect a less than 4 kb exe in this case.
Regards
Laurent
The source
#include <stdio.h>
int main(int argc, char* argv[])
{
puts("Hello, world !");
return 0;
}
The compile command : m68k-atari-mint-gcc hello.c -o hello.tos -O2 -m68030 -s
But 4k is unrealistic with a full fledged printf(). About 4k is possible (with libcmini), but you need to replace the printf() call with Cconws().
You can even squeeze a little more out with a 'fastcall' compiler (but this requires a rebuild of all libs).
- Eero Tamminen
- Fuji Shaped Bastard
- Posts: 2292
- Joined: Sun Jul 31, 2011 1:11 pm
Re: GCC 7.3.0 for m68k / m68020-60 / m5475 (ColdFire)
I think you should still be able to use VASM as standalone assembler and link object files it produces with GCC programs.Orion_ wrote:So I hope GCC 8.2 can do better, but I have lots of code written in assembly, and I just can't understand how I can bind it to GCC by specifying function parameters into specific register.
DML's game / demo engine library should be "full" of both of these kind of things:
* http://www.atari-forum.com/viewtopic.php?f=16&t=31558
* https://bitbucket.org/d_m_l/agtools/src
(On quick check it had both independent VASM files, and inline GCC assembly inside C/C++ files.)
-
- Hardware Guru
- Posts: 2276
- Joined: Sat Sep 10, 2005 11:11 am
- Location: Kosice, Slovakia
- Contact:
Re: GCC 7.3.0 for m68k / m68020-60 / m5475 (ColdFire)
If you desperately want to use those regparms, take a look at Peylow's gcc fork: https://github.com/PeyloW/gcc-4.6.4 -- it supports both 'fastcall' and 'regparm' parameters.Orion_ wrote:So I hope GCC 8.2 can do better, but I have lots of code written in assembly, and I just can't understand how I can bind it to GCC by specifying function parameters into specific register.
I tried to use "regparm" like this:
void __attribute__((regparm(2))) SetFullPalette(int palette, void *data);
But I get " warning: 'regparm' attribute directive ignored [-Wattributes]"
does anyone knows if this is possible with GCC or do I need to stick with VBCC ?
-
- Atari God
- Posts: 1268
- Joined: Sun Aug 03, 2014 5:54 pm
Re: GCC 7.3.0 for m68k / m68020-60 / m5475 (ColdFire)
It's also available in the gcc-4.6.4 version on my site. But only for this compiler, not for 7.3 or 8.2. And as already mentioned, you will need libraries that are also compiled with --fastcall. mintlib does not work, but libcmini should support it.mikro wrote: If you desperately want to use those regparms, take a look at Peylow's gcc fork: https://github.com/PeyloW/gcc-4.6.4 -- it supports both 'fastcall' and 'regparm' parameters.
Re: GCC 7.3.0 for m68k / m68020-60 / m5475 (ColdFire)
Seems like it's not working with 4.6.4:ThorstenOtto wrote: It's also available in the gcc-4.6.4 version on my site. But only for this compiler, not for 7.3 or 8.2. And as already mentioned, you will need libraries that are also compiled with --fastcall. mintlib does not work, but libcmini should support it.
m68k-atari-mint-gcc-4.6.4.exe -fomit-frame-pointer -c -S -O2 main.c
main.c:27:1: warning: 'fastcall' attribute directive ignored [-Wattributes]
I don't use any standard library, I made my own, and I'm compiling for the Sega Megadrive.
I would really like to use gcc 8 because, I compared the generated code of gcc 4 and gcc 8 for the same portion of C code, and gcc 8 is better.
My retro games shop including Atari ST/Falcon/Firebee games ! -- Free Atari games/demos/tools -- Free Falcon demos/tools
Atari Mega STe 4MB + SD2SCSI 1GB + NOVA ET4000 + Pico PSU + Gotek HxC // Atari STe 2MB
Atari Mega STe 4MB + SD2SCSI 1GB + NOVA ET4000 + Pico PSU + Gotek HxC // Atari STe 2MB
-
- Atari God
- Posts: 1268
- Joined: Sun Aug 03, 2014 5:54 pm
Re: GCC 7.3.0 for m68k / m68020-60 / m5475 (ColdFire)
You should better use it as a compile switch (-mfastcall). Although attributes should work too, that is highly experimental, since the original branch from Peylow did not support that. There might be still some problems with mixing fastcall/cdecl function in the same source.Orion_ wrote: main.c:27:1: warning: 'fastcall' attribute directive ignored [-Wattributes]
Then you just have to compile it using that switch, and place it in the correct directory (/usr/lib/mfastcall for 32bit, /usr/lib/mshort/mfastcall for 16bit etc, prepending /usr/m68k-atari-mint/sys-root for the cross-compiler). Just make sure you also pass -mfastcall when link so the correct ones are linked. Of course, if there are assembler files in your library, you will have to adjust them according to new parameter passing.I don't use any standard library, I made my own
In most cases, yes. But things have changed a lot since gcc 4.6.4, so the needed changes for -mfastcall support can't be easily ported. If you feel like it, everything is available also as a git repository at https://github.com/th-otto/m68k-atari-mint-gccand gcc 8 is better.
Re: GCC 7.3.0 for m68k / m68020-60 / m5475 (ColdFire)
m68k-atari-mint-gcc-4.6.4.exe -mcpu=68000 -mfastcall -fomit-frame-pointer -S -O2 -c main.cThorstenOtto wrote: You should better use it as a compile switch (-mfastcall).
cc1.exe: error: unrecognized command line option '-mfastcall'
Well, I never succeeded at compiling GCC under Windows, so I doubt I can make anything from these sources :/ThorstenOtto wrote:In most cases, yes. But things have changed a lot since gcc 4.6.4, so the needed changes for -mfastcall support can't be easily ported. If you feel like it, everything is available also as a git repository at https://github.com/th-otto/m68k-atari-mint-gcc
My retro games shop including Atari ST/Falcon/Firebee games ! -- Free Atari games/demos/tools -- Free Falcon demos/tools
Atari Mega STe 4MB + SD2SCSI 1GB + NOVA ET4000 + Pico PSU + Gotek HxC // Atari STe 2MB
Atari Mega STe 4MB + SD2SCSI 1GB + NOVA ET4000 + Pico PSU + Gotek HxC // Atari STe 2MB
-
- Atari God
- Posts: 1268
- Joined: Sun Aug 03, 2014 5:54 pm
Re: GCC 7.3.0 for m68k / m68020-60 / m5475 (ColdFire)
You could take a look at that script that i use. Its the same for linux, macos, and windows, with only a few differences, so it was not really that difficult. Its much more difficult though to build a native compiler, e.g. compile gcc by itself on windows, because of that damn mismatch between msys and windows path names.Orion_ wrote:Are you sure you use the correct version?ThorstenOtto wrote: cc1.exe: error: unrecognized command line option '-mfastcall'The one from Vincent does not have that support. Otherwise i have to check it, maybe i forgot to update the windows archive, but the linux version should work.
ThorstenOtto wrote:Well, I never succeeded at compiling GCC under Windows, so I doubt I can make anything from these sources :/
Re: GCC 7.3.0 for m68k / m68020-60 / m5475 (ColdFire)
I use the MinGW32 4.6.4 version from your websiteThorstenOtto wrote:Are you sure you use the correct version?Orion_ wrote: cc1.exe: error: unrecognized command line option '-mfastcall'The one from Vincent does not have that support. Otherwise i have to check it, maybe i forgot to update the windows archive, but the linux version should work.
I also tried the m68k-ataribrowner-elf-gcc-7.1.0, but I get the same error
My retro games shop including Atari ST/Falcon/Firebee games ! -- Free Atari games/demos/tools -- Free Falcon demos/tools
Atari Mega STe 4MB + SD2SCSI 1GB + NOVA ET4000 + Pico PSU + Gotek HxC // Atari STe 2MB
Atari Mega STe 4MB + SD2SCSI 1GB + NOVA ET4000 + Pico PSU + Gotek HxC // Atari STe 2MB
-
- Atari God
- Posts: 1268
- Joined: Sun Aug 03, 2014 5:54 pm
Re: GCC 7.3.0 for m68k / m68020-60 / m5475 (ColdFire)
Ok, i'll take a look. But may take a few days.I use the MinGW32 4.6.4 version from your website
That's a complete different port, and does not have Peylows patches applied. Its only advantage is that it supports link-time-optimization because it generates elf format, at the cost of having to convert the output in a separate step to a gemdos program. Also it does not have *any* libraries available. You can achieve the same effect by using my m68k-atari-mintelf toolchain, without the drawbacks.I also tried the m68k-ataribrowner-elf-gcc-7.1.0, but I get the same error