Developing under linux

K

kahuna

Is anyone doing saturn dev under linux? If so, what do I need to get started? I already know C and C++ and I'm comfortable with emacs/vi and makefiles.
 
GNU SH toolchain, built for COFF if you are using SGL, and DOSEMU to run the AR software if you are using a AR card.
 
Ok, so now where do I find the Gnu Sh toolchain? Do I have to rebuild GCC to target sh?
 
That's what I do. I think the configure target was sh-unknown-coff. You maybe could find a prebuilt one somewhere though.

Only build binutils and gcc, not g++ because g++ requires a libc to be built, which requires OS support. The typical procedure is to port newlib to the OS of the target (in this case, the Sega libraries) since that is a lot less work than porting glibc, and glibc is too big for embedded anyway. But that is not in the ballpark of a beginner, so just get a working binutils and gcc (--disable-threads --enable-languages=c --with-newlib) going first.
 
Originally posted by runderwo@Tue, 2005-09-06 @ 09:01 PM

That's what I do. I think the configure target was sh-unknown-coff. You maybe could find a prebuilt one somewhere though.

Only build binutils and gcc, not g++ because g++ requires a libc to be built, which requires OS support. The typical procedure is to port newlib to the OS of the target (in this case, the Sega libraries) since that is a lot less work than porting glibc, and glibc is too big for embedded anyway. But that is not in the ballpark of a beginner, so just get a working binutils and gcc (--disable-threads --enable-languages=c --with-newlib) going first.

[post=139276]Quoted post[/post]​


WTF?????

www.kpitgnutools.com
 
Wait for me. I'm about to start deving in Linux now and I'm in exactly the same boat you are. And by now, I mean after I fix X Windows. I updated my whole system yesterday and I screwed up something. Bad. Doh.

First: Get Yabause working. It's a Sega saturn emulator for Linux.

Second: Get satconv for linux working. I tried the source code and it's complaining about putch and stuff. I got the binary working just find though.

Third: We figure out how to convert binary to iso...I forgot how to do it on Windows, gotta review.

Fourth: Set up the dev environment. That's gonna be a bitch.
 
I think I'll go the route of compiling the toolchain myself. I've done this before to target different platforms for GCC and it's a piece of cake. Plus, I don't think kpit supports debian based ditros and I don't feel like I should have to register for open source software.

Making a gcc that will support sh-coff will be easy enough. I'm not sure whta you mean by "porting newlib" though. Do I just have to get newlib and put it in the gcc source directory like you would for any other embedded system or do I have to go through the code and make changes?
 
Originally posted by ExCyber@Tue, 2005-09-06 @ 10:34 PM

Or not. That being said, I'm personally no longer using SGL/SBL and so probably won't be able to help you set up that package.

[post=139309]Quoted post[/post]​


Thanks for fixing this up for linux users. What are you using instead of SGL now?
 
Originally posted by slinga@Tue, 2005-09-06 @ 10:17 PM

Second: Get satconv for linux working. I tried the source code and it's complaining about putch and stuff. I got the binary working just find though.

[post=139306]Quoted post[/post]​


You might want to check out satburn, my linux saturn burning suite. I have a perl sub to patch ISOs and BINs. You might be able to turn that sub into something you like.

http://forums.segaxtreme.net/index.php?showtopic=16562
 
Originally posted by Kahuna

What are you using instead of SGL now?
I'm not doing any Saturn dev now, but I'd like to get back into it soon and plan to write my own libraries and/or bang the hardware directly. There's also someone else working on original libs, so we might collaborate.
 
By porting newlib, I mean implementing OS I/O functions that the C library uses. Of course, if all you care about is the math functions and don't need any kind of C library I/O, filesystem or OS features, then you don't need to bother with that at all. A combination of the C math library (which is OS agnostic) and SGL should work out then. Warning, it has been a while since I have played around with this stuff so take it with a grain of salt.
 
Originally posted by slinga@Tue, 2005-09-06 @ 10:17 PM

Wait for me. I'm about to start deving in Linux now and I'm in exactly the same boat you are. And by now, I mean after I fix X Windows. I updated my whole system yesterday and I screwed up something. Bad. Doh.

First: Get Yabause working. It's a Sega saturn emulator for Linux.

Second: Get satconv for linux working. I tried the source code and it's complaining about putch and stuff. I got the binary working just find though.

Third: We figure out how to convert binary to iso...I forgot how to do it on Windows, gotta review.

Fourth: Set up the dev environment. That's gonna be a bitch.

[post=139306]Quoted post[/post]​


1. Got yabause working. ./configure --prefix=/opt/yabause && make install

no problems on IA32.

2. I'm just using the satconv binary for linux. No problems with it thus far.

3. mkisofs -sysid "SEGA SATURN" -volid "Your Progam" -volset "Your Program" -publisher "SEGA ENTERPRISES, LTD." -preparer "SEGA ENTERPRISES, LTD." -appid "YourProgram" -abstract "ABS.TXT" -copyright "CPY.TXT" -biblio "BIB.TXT" -generic-boot IP.BIN -full-iso9660-filenames -o YourProgram.ISO <files>

All of the necessary stuff to create isos is in saturnorbit. You should already have mkisofs installed if your running linux.

This iso creation should be scripted too. bash, perl or python would do the trick.

4. This wasn't too bad. The process is as follows:

- Make sure that you have GCC installed (the default one for your distro). There's nothing more time wasting than bootstrapping GCC if it's already available for your system.

cd /usr/src

- Get binutils source (http://www.gnu.org/software/binutils/)

- Get GCC source (gcc.gnu.org)

- Get newlib CVS branch

Instructions here: http://sources.redhat.com/newlib/download.html

- mkdir /tmp/build && mkdir /tmp/build/binutils && mkdir /tmp/build/gcc && mkdir /opt/sh-coff

- unpack sources

tar xjvf binutils<ver>.tar.bz2

tar xjvf gcc<ver>.tar.bz2

.. Move newlib and libgloss from newlib cvs src dir into gcc src directory.

(src is the directory that newlib source is in on the cvs branch. dumb? yah.)

mv src/newlib gcc<ver>/

mv src/libgloss gcc<ver>/

- Build binutils for sh-coff target

cd /tmp/build/binutils

/usr/src/binutils-<ver>/configure --target=sh-coff \

--prefix=/opt/sh-coff -v 2>&1 | tee configure.out

make -w all install 2>&1 | tee make.out

- Now that binutils for sh-coff is build GCC can now be build targeted for the sh processor.

cd /tmp/build/gcc

PATH=/opt/sh-coff/bin:$PATH;export PATH

/usr/src/gcc-<ver>/configure --target=sh-coff --prefix=/opt/sh-coff --with-gnu-as --with-gnu-ld --enable-languages=c --disable-threads --with-newlib -v 2>&1 | tee configure.out

make -w all install 2>&1 | tee make.out

If all goes well you'll have a toolchain that targets sh-coff. You can make a sh-elf toolchain in a similar fashion.

I did not include c++ support because it seems like libstdc++-v3 does not support sh as a target (wtf?).
 
Originally posted by kahuna@Thu, 2005-09-08 @ 05:50 PM

I did not include c++ support because it seems like libstdc++-v3 does not support sh as a target (wtf?).

It does, but the last time I built it I had to disable something when configuring, possibly threading support. IIRC it was very obvious from the error messages. (This was an ELF toolchain. There may be some issues with COFF, but AFAIK it's planned to be dropped anyway.)
 
i develop fine under linux and freebsd with absolutely no limitations at all. i did build my own cross compiler (sh-elf-gcc) and it works fine (well, sometimes...)
 
Thanks for your excellent advice Kahuna. I followed your guide and I had my saturn code compiling in no time. After setting up the compiler, I download Antime's cleaned up package (thanks Excyber) and everything seems to work after modifying the main Make template.

The only mistake I made was at first I used an older version of binutils (2.10). Wouldn't compile for some reason. Eventually I gave up and downloaded 2.16 and that worked like a charm.
 
Good deal slinga. I'm glad it worked for you. I'm going to try to get around to writing my first program for tha saturn on Linux tonight. I've been using my Windows 2000 laptop but the fan died so until I replace that it's all Linux for me.
 
I'm not using anything right now. I have an SGL installation at the moment, but that was installed for rebuilding arflash in the course of debugging AR flash emulation in Yabause. When I get started again I'll most likely either code my own routines (since my usage won't be very demanding at first) or collaborate with others on a library.
 
Back
Top