DC-DreamOS Group
DreamOS Developement Environment Rev. 0.6
All Unix OSs (including Cygwin)
Copyright Michael Robinson 2003

Contents:

Requirements
Preparation
Binutils
Preliminary GCC
Newlib
Final GCC
MakeIP (TBA)
Scramble (TBA)
Help & Comments
Bibliography

Requirements

In order to follow this DreamOS development environment setup guide you must possess the follow skills and materials: a computer running some sort of Unix/Linux or Cygwin, knowledge of basic Unix commands (see our "Basic Unix" tutorial), and the below mentioned files.

Preparation

Before you begin any installation you need to setup the correct directory structure and obtain the necessary files. First switch to your root directory (/) (in Cygwin your top folder) and create a directory (folder in Cygwin) named "gcc". Then in that directory create the directories "build-binutils", build-gcc", and "build-newlib". Second, download binutils-2.11.2.tar.gz, gcc-3.0.3.tar.gz, and newlib-1.9.0.tar.gz. You can download any version, but the above versions are known to work with Cygwin. Be sure to download these files to you /gcc directory. Open your command prompt and switch to the /gcc directory and run "gunzip filename.tar.gz" and then "tar xf filename.tar" on each compressed
file (make sure to run the commands in that order, first gunzip then tar), where filename equals the compressed file's name.

Binutils

The binutils will will allow you to create and work with binary files for the SH-4. The making and configuring of binutils and all other files in this guide must be done from within a command line shell or console program such as Bash. To ease the installation, set the following shell variables now (do this by simply typing what's below):

target=sh-elf
prefix=/usr/local/dc/$target
binaries=$prefix/bin
PATH=$binaries:$PATH

In order for the installation to work properly you'll need to type the above variables every time you enter and exit the prompt during the installation process (in other words, don't close the console or exit the prompt). Now switch to your /gcc/build-binutils directory and then configure the binutils make file as follows (once you switch to the directory just type what's below):

../binutils-2.11.2/configure --target=$target --prefix=$prefix

This takes about five minutes to complete, when it does type "make all install" (be sure you're still in the /gcc/build-binutils directory). This takes around ten minutes, while you're waiting you can finish the rest of the setup by adding binutils's path to either your .profile or .bashrc files (located in /etc, open one of these with a text editor and add the following line, the file names may vary slightly depending on your OS) as follows:

PATH=/usr/local/dc/sh-elf/bin:$PATH

Your SH-4 binutils installation is now complete and located in /usr/loca/dc/sh-elf/bin.

Preliminary GCC

This GCC installation is the preliminary compiler we'll use to compile the newlib library. If you're still working in the same shell session from the previous step, your shell variables will already be set. If you've started a new shell you'll need to return to the Binutils step and set the variables as indicated. Once set, change to your /gcc/build-gcc directory and configure your make file as follows:

../gcc-3.0.3/configure --target=$target --prefix=$prefix --without-headers --with-newlib --enable-languages=c

Again, this step takes about five minutes to complete. When configuration is complete make GCC by typing "make all install", this takes around ten to fifteen minutes. Your preliminary GCC installation is now complete, this installation is used only to compile Newlib, which you'll do in the next step.

Newlib

Newlib is an embedded C library that provides you with the necessary C "commands", it is perfectly suited for the SH-4. Again, ensure your shell variables are properly set as indicated in the Binutils step, if you've already set them in your current session there's no need to set them again. Next, change to your /gcc/build-newlib directory, and configure the make file as follows:

../newlib-1.9.0/configure --target=$target --prefix=$prefix

This takes around ten seconds and once complete make newlib by using the following extended make command (be sure to include the backslashes):

make all install \
CC_FOR_TARGET=$binaries/${target}-gcc \
AS_FOR_TARGET=$binaries/${target}-as \
LD_FOR_TARGET=$binaries/${target}-ld \
AR_FOR_TARGET=$binaries/${target}-ar \
RANLIB_FOR_TARGET=$binaries/${target}-ranlib

Making newlib takes around twenty-five to thirty minutes so be prepared to wait. Your newlib installation is now completed and you can move on to the final GCC installation.

Final GCC

This is the final GCC installation which replaces the previous one with support from the newlib files installed in the last step. Once again verify your shell variables are properly set and switch to your /gcc/build-gcc directory. Then run the clean instruction by typing "make clean", this clears out the old makefile configuration created for the preliminary GCC installation. Once cleaned, configure your makefile as follows:

../gcc-3.0.3/configure --target=$target --prefix=$prefix --without-headers --with-newlib --enable-languages=c,c++

This takes around five to ten minutes to complete, when finished type "make all install" to make the intallation. Your GCC SH-4 development environment for Sega Dreamcast is now finished and only a few Dreamcast utilities are left.

Help & Comments

If you need any help completing the steps in this guide please send an e-mail to dc-dreamos-main@lists.sourceforge.net and we'll try to help you as much as possible. If you find any inconsistencies, incorrect information, or have a comment or suggestion please e-mail me at mhr_54@users.sourceforge.net. I routinely implement all suggestions and corrections which I feel will benefit others, so please send any ideas you may have.

Bibliography

Hanger Eleven (www.hanger-eleven.de/en/devdc-gcc-cygwin.htmle)
Marcus Comstedt (mc.pp.se/dc)

SourceForge.net Logo

Copyright DC-DreamOS Group 2003

Content Copyright Michael Robinson 2003