Page 1 of 1

My current Sega MD/CD/32X devkit

Posted: Sun May 05, 2019 3:34 pm
by Chilly Willy
I'm posting an arc of the code needed to build my latest toolchain, along with a few examples. All the needed code is included together with a makefile to build everything at once. The toolchain is comprised of

gcc 9.1.0
binutils 2.32
newlib 3.1.0
zasm 3.0.22

Those are all the latest releases other than zasm. That's the last v3 zasm, which I use for assembling z80 code. v4 zasm introduced some changes to the assembler that I haven't bothered updating for, as well as being more of a pain to build. I made a makefile for zasm (since it normally comes set to build in MACOSX), and used the linux config file set for x86-84. If you use MacOS and/or use 32-bit, you'll need to change the config.h file.

To build, make sure your /opt folder can be written by your user. Download this archive and decompress into a folder; note that the file is about 101MB, compressed with 7zip. In a terminal, cd to the directory you decompressed everything to, then enter 'make'. It will create the toolchains directory (if need be) and then the sega directory inside that. It will then build c, c++, obj-c, and obj-c++ compilers for SH2 and 68000, using newlib for the standard c libraries. It will then create a bin directory in toolchains/sega, build zasm, and copy it into that bin directory. It will then copy the bootblocks and ldscripts directories into toolchains/sega. Once it's done, you can clean up the build folder by running 'make clean'. Note that the examples aren't copied into the toolchain.

Once the toolchain is done, you can build the examples to check that everything is working. I included my Yeti3D example, and the C/C++ TicTacToe examples for MD and 32X. All were tested on my system under Xubuntu 18.04 and work fine on real hardware and Fusion 3.64.

Re: My current Sega MD/CD/32X devkit

Posted: Mon Jul 22, 2019 2:14 am
by edenist
Thanks very much for posting this. It's quite simple and elegant.
I have been a longtime user of gendev [SGDK], but I much like your self-contained toolchain.

Note it builds just fine on freebsd, too. The only change is you need to explicitly specify gnu make instead of the default BSD make. The easiest way is just to edit the makefile and

Code: Select all

%s/make /gmake /gc
.

Re: My current Sega MD/CD/32X devkit

Posted: Mon Jul 22, 2019 1:58 pm
by Chilly Willy
Thanks for posting that. There are plenty of people who use BSD, so I'm sure others may find that handy.

In any case, SGDK is a nice devkit. I contribute to it myself. It's more for people making MD/Genesis games who want/need a lot of functions to control it's many features. To the end, it's great. I work more on 32X, and a bit on SCD, so I tend to not need quite as much MD support, and my devkit and examples reflect that. On 32X stuff, I tend to leave the Z80 reset, and the 68000 runs a tight loop in work ram to a) keep it off the cart as much as possible as bus contention on the cart is the number one source of slowdown on the 32X, and b) having it monitor the communication registers for when the 32X side needs it to do something like read/write the save ram, or update the controller variables.

Re: My current Sega MD/CD/32X devkit

Posted: Fri Nov 13, 2020 9:36 am
by Mixail
What could be the reason for this error when starting a makefile?

Code: Select all

E:\DevSegaCD32x>make -f E:\DevSegaCD32x\Makefile
MAKE Version 5.4  Copyright (c) 1987, 2009 CodeGear
Error E:\DevSegaCD32x\Makefile 64: Redefinition of target 'build-sh2-gcc'
Error E:\DevSegaCD32x\Makefile 64: Redefinition of target 'build-sh2-newlib'
Error E:\DevSegaCD32x\Makefile 65: Redefinition of target 'build-sh2-binutils'
Error E:\DevSegaCD32x\Makefile 65: Redefinition of target 'build-sh2-gcc'
Error E:\DevSegaCD32x\Makefile 65: Redefinition of target 'build-sh2-gcc-pass1'
Error E:\DevSegaCD32x\Makefile 65: Redefinition of target 'build-sh2-newlib'
Error E:\DevSegaCD32x\Makefile 65: Redefinition of target 'build-sh2-newlib-only'
Error E:\DevSegaCD32x\Makefile 66: Redefinition of target 'build-sh2-binutils'
Error E:\DevSegaCD32x\Makefile 66: Redefinition of target 'build-sh2-gcc'
Error E:\DevSegaCD32x\Makefile 66: Redefinition of target 'build-sh2-gcc-pass1'
Error E:\DevSegaCD32x\Makefile 66: Redefinition of target 'build-sh2-newlib'
Error E:\DevSegaCD32x\Makefile 66: Redefinition of target 'build-sh2-newlib-only'
Error E:\DevSegaCD32x\Makefile 67: Redefinition of target 'build-m68k-gcc'
Error E:\DevSegaCD32x\Makefile 67: Redefinition of target 'build-m68k-newlib'
Error E:\DevSegaCD32x\Makefile 68: Redefinition of target 'build-m68k-binutils'
Error E:\DevSegaCD32x\Makefile 68: Redefinition of target 'build-m68k-gcc'
Error E:\DevSegaCD32x\Makefile 68: Redefinition of target 'build-m68k-gcc-pass1'
Error E:\DevSegaCD32x\Makefile 68: Redefinition of target 'build-m68k-newlib'
Error E:\DevSegaCD32x\Makefile 68: Redefinition of target 'build-m68k-newlib-only'
Error E:\DevSegaCD32x\Makefile 69: Redefinition of target 'build-m68k-binutils'
Error E:\DevSegaCD32x\Makefile 69: Redefinition of target 'build-m68k-gcc'
Error E:\DevSegaCD32x\Makefile 69: Redefinition of target 'build-m68k-gcc-pass1'
Error E:\DevSegaCD32x\Makefile 69: Redefinition of target 'build-m68k-newlib'
Error E:\DevSegaCD32x\Makefile 69: Redefinition of target 'build-m68k-newlib-only'
Error E:\DevSegaCD32x\Makefile 82: Redefinition of target 'build-sh2-binutils'
Error E:\DevSegaCD32x\Makefile 83: Redefinition of target 'build-sh2-binutils'
Error E:\DevSegaCD32x\Makefile 84: Redefinition of target 'build-sh2-binutils'
Error E:\DevSegaCD32x\Makefile 85: Redefinition of target 'build-sh2-binutils'
Error E:\DevSegaCD32x\Makefile 93: Redefinition of target 'build-sh2-gcc-pass1'
Error E:\DevSegaCD32x\Makefile 93: Redefinition of target 'build-m68k-gcc-pass1'
Error E:\DevSegaCD32x\Makefile 93: Redefinition of target 'build-sh2-gcc-pass2'
Error E:\DevSegaCD32x\Makefile 94: Redefinition of target 'build-sh2-gcc-pass1'
Error E:\DevSegaCD32x\Makefile 94: Redefinition of target 'build-m68k-gcc-pass1'
Error E:\DevSegaCD32x\Makefile 94: Redefinition of target 'build-sh2-gcc-pass2'
Error E:\DevSegaCD32x\Makefile 95: Redefinition of target 'build-sh2-gcc-pass1'
Error E:\DevSegaCD32x\Makefile 96: Redefinition of target 'build-sh2-gcc-pass1'
Error E:\DevSegaCD32x\Makefile 103: Redefinition of target 'build-sh2-newlib-only'
Error E:\DevSegaCD32x\Makefile 104: Redefinition of target 'build-sh2-newlib-only'
Error E:\DevSegaCD32x\Makefile 105: Redefinition of target 'build-sh2-newlib-only'
Error E:\DevSegaCD32x\Makefile 106: Redefinition of target 'build-sh2-newlib-only'
Error E:\DevSegaCD32x\Makefile 114: Redefinition of target 'build-sh2-gcc-pass2'
Error E:\DevSegaCD32x\Makefile 115: Redefinition of target 'build-sh2-gcc-pass2'
Error E:\DevSegaCD32x\Makefile 158: Command syntax error
Error E:\DevSegaCD32x\Makefile 159: Command syntax error
Error E:\DevSegaCD32x\Makefile 160: Command syntax error
Error E:\DevSegaCD32x\Makefile 161: Command syntax error
Error E:\DevSegaCD32x\Makefile 162: Command syntax error
Error E:\DevSegaCD32x\Makefile 163: Command syntax error
Error E:\DevSegaCD32x\Makefile 166: Command syntax error
Error E:\DevSegaCD32x\Makefile 168: Command syntax error
Error E:\DevSegaCD32x\Makefile 170: Command syntax error
*** 51 errors during make ***

Re: My current Sega MD/CD/32X devkit

Posted: Thu Aug 18, 2022 12:14 pm
by Chilly Willy
New update!

https://drive.google.com/file/d/1C-mTey ... sp=sharing

Featuring:
gcc 12.1.0
binutils 2.38
newlib 4.2.0
zasm 4.4

I've been building Doom 32X Resurrection, OpenLara, and everything else using this for a month or two without a problem, so it should be safe to update. The biggest change is zasm - you'll need to update the z80 make commands for it like this

ASMZ80 = $(ROOTDIR)/bin/zasm
FLAGSZ80 = -bv2

and the first couple lines of the z80 source file like this

#target ram
#code SRAM, $0000, $2000

Re: My current Sega MD/CD/32X devkit

Posted: Fri Sep 02, 2022 9:55 pm
by Chilly Willy
For people having trouble compiling the toolchain, here's an archive of my /opt/toolchains/sega directory. It's about 500 MB, and expands to about 3GB. This is built for an AMD64 system running Ubuntu 20.04 (or a derivative like Xubuntu).

https://drive.google.com/file/d/1wIORIX ... sp=sharing

Re: My current Sega MD/CD/32X devkit

Posted: Wed Jan 04, 2023 12:47 am
by matthewnimmo
Chilly Willy wrote:
Fri Sep 02, 2022 9:55 pm
For people having trouble compiling the toolchain, here's an archive of my /opt/toolchains/sega directory. It's about 500 MB, and expands to about 3GB. This is built for an AMD64 system running Ubuntu 20.04 (or a derivative like Xubuntu).

https://drive.google.com/file/d/1wIORIX ... sp=sharing
Anyone run into this error message using chilly willy’s 32x toolchain? Ive got his latest toolchain that he prebuit back in September of 2022. I have it running on the exact same version of ubuntu as well. Ive checked that all files are there and have full permissions. Here is the error message when trying to run “make” for tictactoe. “/home/ubuntu/sega/sh-elf/bin/../libexec/gcc/sh-elf/12.1.0/cc1: error while loading shared libraries: libmpc.so.3: cannot open shared object file: No such file or directory make: *** [Makefile:46: main.o] Error 1”. Thanks again for any help!

Re: My current Sega MD/CD/32X devkit

Posted: Mon Jan 09, 2023 3:14 pm
by Chilly Willy
I don't remember about the 9.x version, but the 12.1.0 version was built without gmp, mpc, or mpfr... why? My system didn't need them, so I thought that gcc removed those from the build dependencies. Apparently, this is not the case for some people. The way to fix that is to get the archives for the latest gmp, mpc, and mpfr, decompress them, remove any version number from the directory names (so the directories for the source are just gmp/, mpc/, and mpfr/), then copy those directories into the gcc source code directory. Then it should build with those libs.

I'm working on an update to the devkit that will also add gdb for folks that use gens-kmod, and it will have gmp, mpc, and mpfr so that that doesn't happen again.