PDA

View Full Version : DC Deving on Linux



ClumsyCliff
June 17th, 2005, 01:53
Hello all,

This is my first post here, so it is likely to be a typical noob question, that has been answered dozens of times in various threads. For that I apologize in advance.

I'm a linux coder and want to start tinkering with my Dreamcast. The tutorials I've found all seem geared to a windows dev environment. I need some guidance on setting up a linux dev system.

I 'think' I want to use KOS on the DC and just code in C/C++ so I'll obviously be using gcc, but am unclear on exactly how to set it up to cross compile for the DC. I've got a BBA and a coders cable, but am also unsure on what is the best way to transfer my programs to the DC.

Any help would be greatly appreciated.

Cheers,

Cliff

Darksaviour69
June 17th, 2005, 12:39
BBA u lucky boy (some coders would kill for one of those! ), thats what u want to use..
i'm not a coder, but i think that BlackAura and Dan potter (2 of the best coders in th HB scene) use a Linux to dev on. and yeah you want to be useing KOS as well.

someone with a bit more smarts will tell u more ;)

btw welcome to the DC scene

quarn
June 17th, 2005, 14:23
http://gamedev.allusion.net/softprj/kos/dcsetup.php

ClumsyCliff
June 17th, 2005, 15:15
DarkSaviour69: Thanks for the fast response! I figured the BBA was the way to go, it cost me enough so I'd have been upset if it wasn't the best one to use :)

quarn: Thanks for the link, I'll give that a shot tonight when I get home from work.

I've got 2 weeks off starting next Tuesday, so hopefully by the end of it I'll have something to show.

ClumsyCliff
June 20th, 2005, 15:27
http://gamedev.allusion.net/softprj/kos/dcsetup.php

I've followed the directions (about 5 times now) and each time, when attempting to compile kos, I get an error because "arm-elf-g++" doesn't exist.

I'm not sure what I've missed. Anyone else run into this?

Thanks in advance,

Cliff

Masta-G
June 20th, 2005, 15:54
G++ is a compiler part of gcc (gnu compiler collection). If you want to compile linux apps for dreamcast, you need to build yourself a crosscompiler. I suggest you either use Kegel's famous crosstool http://www.kegel.com/crosstool/ to build a glibc based crosscompiler or use buildroot http://buildroot.uclibc.org/ to build a uclibc based compiler (uclibc is a lightweight C library used for small systems like mobile devices, probally the best thing for dreamcast). When you have setup the toolchain Crosscompiler correctly you are ready to compile dreamcast linux stuff.
Check out the wiki page on http://linuxsh.sf.net it describes how to get linux running on your dreamcast using your bba.
An older tut http://linuxdevices.com/articles/AT7466555948.html here describing how to build the old dclinux (now part of the linuxsh project) distro. Its unsupported now but it has most of the dc hardware (vmufs, sound and modem) working.

Anyways good luck with it.

BlackAura
June 20th, 2005, 17:14
Chances are that you haven't set up the path for the ARM toolchain properly. You need two cross-compilers to build KOS - one for the Dreamcast's main CPU (the SH-4), and one for the Dreamcast's sound CPU (and ARM7). Unless you're writing your own sound drivers, you'll probably never need the ARM compiler again, but you need it for compiling the sound driver.

Anyway, that guide doesn't actually work properly. It builds GCC 3.4.1, I think, and the ARM from that version of GCC generates apparently broken code. It doesn't build a working sound driver, basically. You need an older version of the ARM cross compiler (GCC 3.0.4) to build KOS.

There's probably not much point in making you download the source code for GCC 3.0.4 and the associated binutils (you have to use an earlier version or it won't work), and it's pointless to make you rebuild the things again anyway. I have instructions on how to do it here (http://www.dcemulation.com/phpBB/viewtopic.php?t=65237), but they're kind of complicated. You may as well use the ones I prepared earlier (compiled under Ubuntu 5.04, but they should work on anything any Linux distro that uses glibc). The ARM toolchain is GCC 3.0.4, and the SH-4 toolchain is GCC 3.4.3.

http://greay.phpwebhosting.com/DC/toolchain/arm-elf-3.tar.bz2 (2.5MB)
http://greay.phpwebhosting.com/DC/toolchain/sh-elf-3.tar.bz2 (13.1MB)

Download those (you can use the SH-4 toolchain you already have, if you like - it doesn't really make any difference). Extract them somewhere. I usually use a subdirectory of my home directory, like ~/dreamcast/{arm-elf,sh-elf} but you can use /usr/local if you like.

Grab the latest version of KallistiOS using Subversion:


svn co http://www.allusion.net/svn/kos/kos
svn co http://www.allusion.net/svn/kos/kos-ports
Or from the latest snapshots:
http://gamedev.allusion.net/svn/snapshots/kos-snapshot-20050618.tar.bz2
http://gamedev.allusion.net/svn/snapshots/kos-ports-snapshot-20050618.tar.bz2

Grab them and extract them somewhere. You should now have a kos directory, and a kos-ports directory.

Next step - configure KOS. Find the file kos/doc/environ.sh.sample and copy it to kos/environ.sh then open it in a text editor.

Change this bit to reflect the path to the KOS directory. In my case, that's /home/blackaura/dreamcast/kos
# KOS main base path
export KOS_BASE="/usr/local/home/bard/prj/svn/kos"
Next, modify this bit to point to wherever you unpacked the sh-elf cross compiler. Make sure you use the sh-elf version, and not the dc version (I have no idea what that's doing in there). Just comment out the first two lines, uncomment the next two, and change the path.
# Compiler prefixes
export KOS_CC_BASE="/usr/local/dc/dc-elf"
export KOS_CC_PREFIX="dc"
#export KOS_CC_BASE="/usr/local/dc/sh-elf" # DC
#export KOS_CC_PREFIX="sh-elf"
Next, the ARM toolchain. Same deal as before - just change the paths:
# If you are compiling for DC and have an ARM compiler, use these too.
export DC_ARM_BASE="/usr/local/dc/arm-elf"
export DC_ARM_PREFIX="arm-elf"
Save that. Pop up a console. Go to the kos directory, and type this:
. ./environ.sh
make
Hopefully, that'll work. If you want all the useful addon libraries that come with KOS (you probably do), go to the kos-ports directory and type "make" there as well to build all of them. It takes much longer than compiling KOS alone.

Once you've done that, you can build the examples by going into the examples directory and typing "make" a lot of them probably won't work, because they haven't been updated in a very long time. If they don't work, just remove them from the makefiles.

ClumsyCliff
June 21st, 2005, 15:57
Chances are that you haven't set up the path for the ARM toolchain properly.

-- snip --

You're right, I hadn't... :( Thanks for the excellent information and the files!

BlackAura
June 22nd, 2005, 05:09
No problem. Good luck!