Another Saturn SDK

Red Ring Rico

Mid Boss
Hey, all.

I've been working on a kind of Saturn SDK, the goal is to make Saturn development as simple and quick to get into as possible (of course, there's still the learning curve of Saturn programming). At the moment, it is just a bare-bones Hitachi SH-2 ELF toolchain; GCC (6.2.0), GMP (6.0.1), MPFR (3.1.5), MPC (1.0.3), binutils (2.27), newlib (2.4.0), GNU Make (4.1), and the Code::Blocks IDE. For Windows, there is also MSYS2. There are still many things left to do, such as generate another compiler for the Motorola chip, include mkisofs, provide a set of sample programs, tutorials, and documentation (reference material, best practices, tutorials/guides)

It would be great if anyone wants to contribute to this SDK in any way, whether that be writing documentation, reporting bugs, code samples, or adding features and tools.

The build scripts currently run under Linux at the moment. I'm sure with some modification they will work under MacOS, BSD, SunOS, or Windows. You can check them out:
Installer
Hitachi SH-2 GCC
SGL
GNU Make
Documentation
IDE
MSYS2

Download
Windows 32-bit
Windows 64-bit
Linux 32-bit
Linux 64-bit

For the Linux versions, you will need to use chmod to allow yourself read and execute permissions:
$ chmod 755 <File>.run

Bugs/Improvements
Please report any bugs/improvements with the GitHub issues page for each project. For general-purpose suggestions not specific to any tool, create a new thread in the sub-forum Rico's Saturn SDK. If you have created or are currently creating a tool you would like to have included in the SDK, create a repository of your own and start a thread on the sub-forum or message me directly. Thank you.
 
Last edited:
An ELF toolchain should still be able to link COFF objects, so converting the libraries is not necessary.
 
great job Red Ring Rico ! all latest stuff, it will replace kpit which quite old now
do you provide make.exe with gcc ?
 
antime said:
An ELF toolchain should still be able to link COFF objects, so converting the libraries is not necessary.
I have not had any success linking the COFF libraries from the SGL (haven't tried the SBL) with a simple program that just clears the screen until the console is powered off. Admittedly, I am unsure of the procedure for linking against a set of COFF libraries with a program created as an ELF and have not fully explored all posibilities yet. Other than specifying "coff-sh" instead of "elf32-sh" in the linker script, I'm not sure how to link against the COFF libraries. Doing so does not allow for using any newlib or GCC libraries, which are, of course, "elf32-sh". I'd appreciate any pointers in the right direction on using both the SGL as well as the GCC and newlib libraries.

vbt said:
great job Red Ring Rico ! all latest stuff, it will replace kpit which quite old now
do you provide make.exe with gcc ?
I can absolutely include make. Though I will re-name it with the prefix "saturn-", as make 4.0 is not commonplace and if there are any features of 4.0 that could be used which are not supported in older versions. It would be nice to not have a situation with incompatible features trying to be used on older versions.
 
Red Ring Rico said:
Admittedly, I am unsure of the procedure for linking against a set of COFF libraries with a program created as an ELF and have not fully explored all posibilities yet.
You at least didn't use to have to do anything. Just list them on the linker command line like all other objects and libraries, and the linker would handle the rest. However, since COFF support is obsoleted it may be that this capability has been removed.
 
I don't recall having to do anything special to link COFF objects into an ELF executable either. As I recall the main point of writing libbfd was for the linker itself to not care about file layout details as long as the necessary metadata was present somewhere.
 
Great job! This is much needed for the developers using Linux like myself. However, if you could throw in the assemblers into the installer too that would be even better and maybe the SBL library to make it a all-in-one SDK.

For IDE, Im using Codeblocks for Dreamcast with KOS as it lets you set up multiple profiles for the compilers etc.

I can even try to help you with some of the stuff when i get back from turkey (vacation). I'll contact you on github
 
[attachment=4408]
some size improvement and some speedup comparing to kpit 13
 

Attachments

  • Image3.jpg
    Image3.jpg
    73 KB · Views: 242
Thank you so much Red Ring Rico!!!!

I may have to update my post on Saturn Dev using Codebocks :) to use this instead of kpit :D
 
Sorry for the noob question but I can't get saturn-sh2-elf-ld finding correctly libgcc.a :-/

Code:
C:\SaturnOrbit\saturn-sdk\toolchain_elf\bin>saturn-sh2-elf-ld--verbose | grep SEARCH_DIR
File STDIN:
SEARCH_DIR("=/usr/local/lib"); SEARCH_DIR("=/lib"); SEARCH_DIR("=/usr/lib");

Here is what I tried so far :
-lc C:/SaturnOrbit/saturn-sdk/toolchain_elf/lib/gcc/sh-elf/4.9.0/libgcc.a
-LC:/SaturnOrbit/saturn-sdk/toolchain_elf/lib/gcc/sh-elf/4.9.0/ -lgcc

Does anyone know the command to specify libgcc.a path to ld ?
 
cafe-alpha said:
Sorry for the noob question but I can't get saturn-sh2-elf-ld finding correctly libgcc.a :-/

Code:
C:\SaturnOrbit\saturn-sdk\toolchain_elf\bin>saturn-sh2-elf-ld--verbose | grep SEARCH_DIR
File STDIN:
SEARCH_DIR("=/usr/local/lib"); SEARCH_DIR("=/lib"); SEARCH_DIR("=/usr/lib");

Here is what I tried so far :
-lc C:/SaturnOrbit/saturn-sdk/toolchain_elf/lib/gcc/sh-elf/4.9.0/libgcc.a
-LC:/SaturnOrbit/saturn-sdk/toolchain_elf/lib/gcc/sh-elf/4.9.0/ -lgcc

Does anyone know the command to specify libgcc.a path to ld ?

Fixed :)
I used gcc to link everything instead of directly calling ld.

Edit : it compiles fine, but sdc/gfs libraries don't work correctly (file is not read from CDROM), it is probably because too much code is stripped ...
 
cafe-alpha said:
Fixed :)
I used gcc to link everything instead of directly calling ld.

Edit : it compiles fine, but sdc/gfs libraries don't work correctly (file is not read from CDROM), it is probably because too much code is stripped ...
same problem with kpit 12 or 13, i didn't find a way to fix it (few search)
 
vbt said:
cafe-alpha said:
Fixed :)
I used gcc to link everything instead of directly calling ld.

Edit : it compiles fine, but sdc/gfs libraries don't work correctly (file is not read from CDROM), it is probably because too much code is stripped ...
same problem with kpit 12 or 13, i didn't find a way to fix it (few search)

-O0 compiles as expected, but -O1 makes GFS init function to fail.

I may have found a non-subtle solution (as usual with me :D) to fix this problem, and shall let you know when it will be fixed :)
 
I upgraded all my projects to Saturn SDK compilers. Thank you Red Ring Rico :)

The solution I used to read files from CDROM was to drop SBL libraries and use CyberWarriorX library instead.

Too bad Saturn SDK doesn't includes make.exe : this is the last utility that forces me to use SaturnOrbit.
 
jae686 said:
Could you supply a very simple example of a "hello world" ?

Best Regards.
this :

http://vberthelot.free.fr/SX/satdev/programs/Daniel%20Eriksson/xmasg.rar

or that :

http://vberthelot.free.fr/SX/satdev/programs/andreass/freq1.zip

and you have Rockin'-B's tutorial :

http://vberthelot.free.fr/SX/satdev/tutorial/SaturnGameTutorial.htm
 
could it be useful for saturn newlib ?
--enable-newlib-nano-malloc

lib_a-nano-mallocr.o (9 452 bytes)
lib_a-mallocr.o (19 540 bytes)

after some test
no speed loss
binary size smaller by 7-8kb
 
with gcc 4.9.0 & 4.9.1 there is a new option to display colors on some events like warning or errors. after building 4.9.1 it doesn't work because it seems to be disabled for windows

the fix :

https://raw.githubusercontent.com/nak5124/build_env/master/gcc_build/patches/gcc/0010-color.patch

and set GCC_COLORS to "error=01;31:warning=01;35:note=01;36:caret=01;32:locus=01:quote=01"

more details here :

http://sourceforge.net/p/msys2/mailman/message/32804660/
 
Are you working on building gcc 4.9.1 for SH-2 ?
I can't wait to see my console window filled with red colored text :D
 
I'm sorry about being overly-absent from maintaining this SDK recently. I finally fixed my Katana Dev. Box a few weeks ago and have been kind of wrapped up with it, along with having gotten back into collecting older PC hardware. Anyway, I'm trying to re-balance and dedicate a part of my week to maintaining the SDK.

vbt: Thanks, I'll have to check out nano-malloc. There are probably a lot of options for the tools and libraries which could help with creating a more appropriate set of tools and libraries for the Saturn. About the colours; I've always dumped the output of my compiler and linker messages to files for colourisation at a later stage, so I haven't yet seen the new colour highlighting. I was sceptical of using the newer GCC so soon after its release, therefore I'll be including that as soon as I can.

I can get GNU make in the SDK tonight and try for GCC 4.9.1 by the end of the week (assuming there are no major build problems). The IDE is kind of getting there. I'm having a devil of a time just getting a new test project wizard running, Code::Blocks builds and includes it, but I can't seem to get it to go to the stage of creating directories in the wizard (I copied the default Console project wizard and modified it). I can include the IDE, but for now it won't be able to build Saturn executables without a lot of user intervention.
 
Back
Top