GCC cross-compiler to OS-9

Support forum for homebrew development on the Philips CD-i system. Hosted through the CDinteractive network the CD-i Homebrew Forum will provide an active resource for new software initiatives on the system and offer hosting for any serious attempts.
Post Reply
User avatar
cdifan
CD-i Emulator Author
Posts: 923
Joined: Fri Jun 24, 2005 6:19 am
Location: The Netherlands
Contact:

GCC cross-compiler to OS-9

Post by cdifan » Thu Oct 28, 2010 12:01 am

Today I came accross the following link:

ftp://os9archive.rtsi.com/OS9/OSK/GCC/S ... src.tar.gz

This seems to be exactly what the name suggests: a sun4-hosted gcc that compiles to OS-9. It is a full gnu toolchain using gas and ld and even includes support for the Microware ROFF object file format.

Now the big question, of course: how hard is it to compile this as a PC-hosted cross compiler?

I have Cygwin on my PC so it should have been a matter of doing
./configure --host=i486-cygwin --target=m68k-os9
Unfortunately this configure does not support cygwin, substituting msdos fails with file permission errors on a number of files having weird 8.3 names so is probably not recommended (this may be due to Win7, though).

Anybody have some clues? I cannot find any of the os9 support files in never gcc versions, so this port was probably never folded back into the main gcc trunk.

I could trying the "host" configuration of a stock gcc 2.x (which should build under cygwin) over into this gcc?

User avatar
cdifan
CD-i Emulator Author
Posts: 923
Joined: Fri Jun 24, 2005 6:19 am
Location: The Netherlands
Contact:

Post by cdifan » Sat Aug 06, 2011 11:38 pm

Took another look at this and I found some useful information.

The original port is from Walter Hunt (walter@mailhost.aimla.com).
Walter Hunt wrote:As a hack project, I ported GCC/GAS/binutils/etc. as a cross-compiler
from Sun/Linux/DOS to OS-9. Unfortunately, efforts to complete the necessary
paperwork to get this work donated to the FSF drowned somewhere in beaurocracy.
The original announcement with more details can be found here: http://www.dr-bischoff.de/os9cross/hunt.html with some more info to be found at http://www.dr-bischoff.de/os9cross_e.html (I don't know how accurate this is).

User avatar
cdifan
CD-i Emulator Author
Posts: 923
Joined: Fri Jun 24, 2005 6:19 am
Location: The Netherlands
Contact:

Post by cdifan » Tue Aug 09, 2011 12:52 am

Some more progress to report...

I have this now building cleanly on a Cygwin 1.5 installation, and it seems to generate valid OS9 modules for a few simple testcases. Mostly build config stuff, but I have also fixed a few small bugs. I had to mix/match the Cygwin host config from 2.95 to get configure to recognize cygwin instead of the obsolete go32, and then some compile error fixes.

The end result is a set of working xgcc / xas / xld / x... binaries in /usr/local/bin, with support files in /usr/local/lib/gcc-lib. It needs the OS9 header and library files in /usr/local/os9/include and lib, slightly tweaked (include files converted to unix format to avoid cpp warnings and lib files xranlib'd so that xld can find symbols).

E.g. xgcc -o cdi_test test.c -lcdi -g produces working cdi_test and cdi_test.stb and cdi_test.dbg modules (I think, haven't tested extensively yet).

This is the original gcc 2.6.2 release from Walter Hunt; I am currently working on upgrading to gcc 2.7.2-3 (it patches cleanly but has new gcc compile errors which undoubtedly need more build config tweaking).

User avatar
cdifan
CD-i Emulator Author
Posts: 923
Joined: Fri Jun 24, 2005 6:19 am
Location: The Netherlands
Contact:

Post by cdifan » Tue Aug 09, 2011 1:18 am

Question for homebrew developers: should I keep the xgcc name or should it be os9gcc? Not that it really matters much, it's just the driver (typically handled with a single CC = xgcc line in your Makefile).

Note that the Microware cross-compiler is called xcc (it's assembler is r68, the linker is l68).

User avatar
cdoty
Frog Feast Dev
Posts: 125
Joined: Sun Jul 03, 2005 12:35 am
Location: Houston, TX
Contact:

Post by cdoty » Fri Oct 28, 2011 8:41 am

cdifan wrote:Question for homebrew developers: should I keep the xgcc name or should it be os9gcc? Not that it really matters much, it's just the driver (typically handled with a single CC = xgcc line in your Makefile).

Note that the Microware cross-compiler is called xcc (it's assembler is r68, the linker is l68).
Either would work. I usually put them in a separate directory, and include them in the path, every cross compiler I have is named gcc, ld, and as.

Do you intend to upload this somewhere? Gcc 2.7.2 worked pretty well, that's what I've used for Frog Feast on most 68000 based systems.
Visit RasterSoft on facebook or visit the website.

User avatar
cdifan
CD-i Emulator Author
Posts: 923
Joined: Fri Jun 24, 2005 6:19 am
Location: The Netherlands
Contact:

Post by cdifan » Fri Oct 28, 2011 6:58 pm

cdoty wrote:Do you intend to upload this somewhere? Gcc 2.7.2 worked pretty well, that's what I've used for Frog Feast on most 68000 based systems.
Once I've done some testing and possibly some more modifications I will upload it somewhere. I have been busy with other things recently...

User avatar
cdoty
Frog Feast Dev
Posts: 125
Joined: Sun Jul 03, 2005 12:35 am
Location: Houston, TX
Contact:

Post by cdoty » Sat Oct 29, 2011 4:42 am

cdoty wrote:Do you intend to upload this somewhere? Gcc 2.7.2 worked pretty well, that's what I've used for Frog Feast on most 68000 based systems.
Actually I was using 2.95.2. The Jaguar tools were 2.6.3, which did present some problems, if I remember correctly.
Visit RasterSoft on facebook or visit the website.

User avatar
cdifan
CD-i Emulator Author
Posts: 923
Joined: Fri Jun 24, 2005 6:19 am
Location: The Netherlands
Contact:

Post by cdifan » Sat Oct 29, 2011 12:19 pm

I've written tons of C++ code for CD-i using gcc 2.5.8 (different port). No big problems that I'm aware of.

Post Reply