GCC 7.3.0 for m68k / m68020-60 / m5475 (ColdFire)

C and PASCAL (or any other high-level languages) in here please

Moderators: simonsunnyboy, Mug UK, Zorro 2, Moderator Team

mikro
Hardware Guru
Hardware Guru
Posts: 1823
Joined: Sat Sep 10, 2005 11:11 am
Location: Kosice, Slovakia
Contact:

GCC 7.3.0 for m68k / m68020-60 / m5475 (ColdFire)

Postby mikro » Tue Sep 25, 2018 9:29 am

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.

vido
Atari Super Hero
Atari Super Hero
Posts: 633
Joined: Mon Jan 31, 2011 7:39 pm

Re: GCC 7.3.0 for m68k / m68020-60 / m5475 (ColdFire)

Postby vido » Tue Sep 25, 2018 10:18 am

This is great!
Thanks Mikro! :)

PeterS
Captain Atari
Captain Atari
Posts: 221
Joined: Fri Nov 09, 2007 1:53 pm
Location: England, GB

Re: GCC 7.3.0 for m68k / m68020-60 / m5475 (ColdFire)

Postby PeterS » Tue Sep 25, 2018 12:27 pm

Fantastic work.

mikro
Hardware Guru
Hardware Guru
Posts: 1823
Joined: Sat Sep 10, 2005 11:11 am
Location: Kosice, Slovakia
Contact:

Re: GCC 7.3.0 for m68k / m68020-60 / m5475 (ColdFire)

Postby mikro » Tue Sep 25, 2018 1:30 pm

Hold on with celebrations, Thorsten has found a bug in m68020/m5475 versions. Investigating... :-/

ThorstenOtto
Atari Super Hero
Atari Super Hero
Posts: 516
Joined: Sun Aug 03, 2014 5:54 pm

Re: GCC 7.3.0 for m68k / m68020-60 / m5475 (ColdFire)

Postby ThorstenOtto » Tue Sep 25, 2018 1:36 pm

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.

vido
Atari Super Hero
Atari Super Hero
Posts: 633
Joined: Mon Jan 31, 2011 7:39 pm

Re: GCC 7.3.0 for m68k / m68020-60 / m5475 (ColdFire)

Postby vido » Tue Sep 25, 2018 1:39 pm

ThorstenOtto wrote:Mikro's versions are native compilers, usable on mint.

Native compilers are what I need/use :)

mikro
Hardware Guru
Hardware Guru
Posts: 1823
Joined: Sat Sep 10, 2005 11:11 am
Location: Kosice, Slovakia
Contact:

Re: GCC 7.3.0 for m68k / m68020-60 / m5475 (ColdFire)

Postby mikro » Wed Oct 03, 2018 6:50 pm

All good, the archives now contain properly configured and built compilers for all three platforms. Same URL as in the first post.

User avatar
jfl
Atari Super Hero
Atari Super Hero
Posts: 872
Joined: Tue Jul 18, 2006 10:55 pm
Location: Liège, Belgium
Contact:

Re: GCC 7.3.0 for m68k / m68020-60 / m5475 (ColdFire)

Postby jfl » Wed Oct 03, 2018 7:04 pm

Thanks mikro and anyone else involved. I too use the native GCC, on my FireBee. So this is really welcomed news.
Jean-François
GEMDict – GEMClip

ThorstenOtto
Atari Super Hero
Atari Super Hero
Posts: 516
Joined: Sun Aug 03, 2014 5:54 pm

Re: GCC 7.3.0 for m68k / m68020-60 / m5475 (ColdFire)

Postby ThorstenOtto » Thu Oct 04, 2018 9:18 am

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.

BlankVector
Captain Atari
Captain Atari
Posts: 462
Joined: Wed Oct 24, 2007 7:52 pm
Location: France
Contact:

Re: GCC 7.3.0 for m68k / m68020-60 / m5475 (ColdFire)

Postby BlankVector » Thu Oct 04, 2018 9:33 am

Great job :)
Subscribe to my Vretrocomputing channel on YouTube and Facebook.

User avatar
LaurentS
Captain Atari
Captain Atari
Posts: 274
Joined: Mon Jan 05, 2009 5:41 pm

Re: GCC 7.3.0 for m68k / m68020-60 / m5475 (ColdFire)

Postby LaurentS » Wed Nov 21, 2018 12:22 pm

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

ThorstenOtto
Atari Super Hero
Atari Super Hero
Posts: 516
Joined: Sun Aug 03, 2014 5:54 pm

Re: GCC 7.3.0 for m68k / m68020-60 / m5475 (ColdFire)

Postby ThorstenOtto » Wed Nov 21, 2018 12:45 pm

LaurentS 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.


Thanks ;)

I've got a question : I've compiled a quick hello word program (source and compile command below), and the result is 103849 bytes.


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.

Is there a way to get lighter exe ?


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.

User avatar
Eero Tamminen
Atari God
Atari God
Posts: 1862
Joined: Sun Jul 31, 2011 1:11 pm

Re: GCC 7.3.0 for m68k / m68020-60 / m5475 (ColdFire)

Postby Eero Tamminen » Wed Nov 21, 2018 10:15 pm

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.)

ThorstenOtto
Atari Super Hero
Atari Super Hero
Posts: 516
Joined: Sun Aug 03, 2014 5:54 pm

Re: GCC 7.3.0 for m68k / m68020-60 / m5475 (ColdFire)

Postby ThorstenOtto » Thu Nov 22, 2018 3:00 am

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)


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.

User avatar
Orion_
Captain Atari
Captain Atari
Posts: 406
Joined: Sat Jan 10, 2004 12:20 pm
Location: France
Contact:

Re: GCC 7.3.0 for m68k / m68020-60 / m5475 (ColdFire)

Postby Orion_ » Tue Jan 15, 2019 8:04 pm

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.

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.
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

User avatar
mfro
Atari Super Hero
Atari Super Hero
Posts: 777
Joined: Thu Aug 02, 2012 10:33 am
Location: SW Germany

Re: GCC 7.3.0 for m68k / m68020-60 / m5475 (ColdFire)

Postby mfro » Tue Jan 15, 2019 8:16 pm

LaurentS 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


https://github.com/mfro0/libcmini

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).

User avatar
Eero Tamminen
Atari God
Atari God
Posts: 1862
Joined: Sun Jul 31, 2011 1:11 pm

Re: GCC 7.3.0 for m68k / m68020-60 / m5475 (ColdFire)

Postby Eero Tamminen » Tue Jan 15, 2019 8:44 pm

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 think you should still be able to use VASM as standalone assembler and link object files it produces with GCC programs.

DML's game / demo engine library should be "full" of both of these kind of things:
* 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.)

mikro
Hardware Guru
Hardware Guru
Posts: 1823
Joined: Sat Sep 10, 2005 11:11 am
Location: Kosice, Slovakia
Contact:

Re: GCC 7.3.0 for m68k / m68020-60 / m5475 (ColdFire)

Postby mikro » Wed Jan 16, 2019 6:47 am

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 ?

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.

ThorstenOtto
Atari Super Hero
Atari Super Hero
Posts: 516
Joined: Sun Aug 03, 2014 5:54 pm

Re: GCC 7.3.0 for m68k / m68020-60 / m5475 (ColdFire)

Postby ThorstenOtto » Wed Jan 16, 2019 7:29 am

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.


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.

User avatar
Orion_
Captain Atari
Captain Atari
Posts: 406
Joined: Sat Jan 10, 2004 12:20 pm
Location: France
Contact:

Re: GCC 7.3.0 for m68k / m68020-60 / m5475 (ColdFire)

Postby Orion_ » Wed Jan 16, 2019 12:35 pm

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.

Seems like it's not working with 4.6.4:
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

ThorstenOtto
Atari Super Hero
Atari Super Hero
Posts: 516
Joined: Sun Aug 03, 2014 5:54 pm

Re: GCC 7.3.0 for m68k / m68020-60 / m5475 (ColdFire)

Postby ThorstenOtto » Wed Jan 16, 2019 1:39 pm

Orion_ wrote:main.c:27:1: warning: 'fastcall' attribute directive ignored [-Wattributes]


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.

I don't use any standard library, I made my own


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.

and gcc 8 is better.


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

User avatar
Orion_
Captain Atari
Captain Atari
Posts: 406
Joined: Sat Jan 10, 2004 12:20 pm
Location: France
Contact:

Re: GCC 7.3.0 for m68k / m68020-60 / m5475 (ColdFire)

Postby Orion_ » Wed Jan 16, 2019 2:17 pm

ThorstenOtto wrote:You should better use it as a compile switch (-mfastcall).

m68k-atari-mint-gcc-4.6.4.exe -mcpu=68000 -mfastcall -fomit-frame-pointer -S -O2 -c main.c
cc1.exe: error: unrecognized command line option '-mfastcall'

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

Well, I never succeeded at compiling GCC under Windows, so I doubt I can make anything from these sources :/
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

ThorstenOtto
Atari Super Hero
Atari Super Hero
Posts: 516
Joined: Sun Aug 03, 2014 5:54 pm

Re: GCC 7.3.0 for m68k / m68020-60 / m5475 (ColdFire)

Postby ThorstenOtto » Wed Jan 16, 2019 3:10 pm

Orion_ wrote:
ThorstenOtto wrote:cc1.exe: error: unrecognized command line option '-mfastcall'


Are you sure you use the correct version? ;) 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 :/


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.

User avatar
Orion_
Captain Atari
Captain Atari
Posts: 406
Joined: Sat Jan 10, 2004 12:20 pm
Location: France
Contact:

Re: GCC 7.3.0 for m68k / m68020-60 / m5475 (ColdFire)

Postby Orion_ » Wed Jan 16, 2019 4:29 pm

ThorstenOtto wrote:
Orion_ wrote:cc1.exe: error: unrecognized command line option '-mfastcall'


Are you sure you use the correct version? ;) 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 use the MinGW32 4.6.4 version from your website
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

ThorstenOtto
Atari Super Hero
Atari Super Hero
Posts: 516
Joined: Sun Aug 03, 2014 5:54 pm

Re: GCC 7.3.0 for m68k / m68020-60 / m5475 (ColdFire)

Postby ThorstenOtto » Wed Jan 16, 2019 6:27 pm

I use the MinGW32 4.6.4 version from your website


Ok, i'll take a look. But may take a few days.

I also tried the m68k-ataribrowner-elf-gcc-7.1.0, but I get the same error


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.


Social Media

     

Return to “C / PASCAL etc.”

Who is online

Users browsing this forum: No registered users and 1 guest