Author Topic: Make an up to date MD/32X Toolchain  (Read 7102 times)

0 Members and 1 Guest are viewing this topic.

Offline ChillyWilly

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1751
  • Just a coding machine.
Make an up to date MD/32X Toolchain
« on: April 05, 2011, 01:53:45 PM »
Building a new Genesis/32X toolchain

1 - Go here and download the following:

gcc-4.5.2.tar.bz2
gcc-g++-4.5.2.tar.bz2
gcc-objc-4.5.2.tar.bz2

Decompress them all in the same folder; you should end up with one folder called gcc-4.5.2.

2.1 - Go here and download mpfr-2.4.2.tar.bz2.
2.2 - Go here and download mpc-0.8.2.tar.gz.
2.3 - Go here and download gmp-5.0.1.tar.bz2.

Decompress them all in the same folder. You should have three folders called mpfr-2.4.2, mpc-0.8.2, and gmp-5.0.1. Rename them to get rid of the version numbers, leaving you with mpfr, mpc, and gmp. Copy them into the gcc-4.5.2 folder.

3 - Go here and download binutils-2.21.tar.bz2.

Decompress it in the same folder as the gcc folder so that you have two folders - gcc-4.5.2 and binutils-2.21.

4 - Go here and download newlib-1.19.0.tar.gz.

Decompress it in the same folder as gcc and binutils, leaving you with three folders - gcc-4.5.2, binutils-2.21, and newlib-1.19.0.

5 - Download this archive containing a makefile and several linker scripts.

Decompress it to the same folder as the others above.

6 - If you wish to leave the makefile with the default path of /opt/toolchains/gen, make sure you have permission to write to /opt or the toolchain will fail to install to the path. Since there's nothing critical in /opt, it's easiest just to do "sudo chmod 777 -R /opt" which allows anyone to do anything they want in /opt.

7 - Run "make -f makefile-gen" - depending on the speed of your computer, you should now have two toolchains in /opt/toolchains/gen: m68k-elf and sh-elf. Make another folder in /opt/toolchains/gen called ldscripts and copy the linker scripts from the archive into that folder.

You now have the latest gcc, binutils, and newlib for both the 68000 and the SH2. Both have compilers for C, C++, Objective-C, and Objective-C++.

8 - Make a bin folder in /opt/toolchains/gen. Copy whatever misc tools you use into it, like sixpack or bin2c.

9 - You'll need the proper exports to use the toolchains, and assuming you left the path to /opt, they would be:

For the 68000:
export GENDEV=/opt/toolchains/gen
export PATH=$GENDEV/m68k-elf/bin:$GENDEV/bin:$PATH

For the 32X:
export GENDEV=/opt/toolchains/gen
export PATH=$GENDEV/sh-elf/bin:$GENDEV/m68k-elf/bin:$GENDEV/bin:$PATH


Here is an archive with example code - it includes Tic-Tac-Toe in both C and C++ for both the MD and the 32X, as well as my 32X version of  Yeti3D with Module playing and sound effects. Also included are the latest linker scripts to be copied to /opt/toolchains/gen/ldscripts/.

MD_32X_Examples.7z


EDIT: I goofed up something in the example archive. I changed a flag for compiling the crtstuff.c file, but then "lost" the changes to the linker script to go with it. Here's the updated linker scripts for the MD (this wasn't an issue for the 32X). These replace the current files in /opt/toolchains/gen/ldscripts/.

http://www.mediafire.com/download.php?2pc35tb4bp2b1yv
« Last Edit: February 14, 2012, 12:17:24 PM by ChillyWilly »

Offline Conle

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2203
Re: Make an up to date MD/32X Toolchain
« Reply #1 on: April 05, 2011, 03:09:24 PM »
Good idea to post it on the forums aswell  :D
I will put it on the news page  :)

Offline ChillyWilly

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1751
  • Just a coding machine.
Re: Make an up to date MD/32X Toolchain
« Reply #2 on: April 05, 2011, 03:19:21 PM »
It was posted elsewhere, but we use it now for the MD menu AND this site does regular contests, so I figured it should probably be here as well. I plan to make a better effort at the next contest myself, and the toolchain is a step in that direction.

Offline Conle

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2203
Re: Make an up to date MD/32X Toolchain
« Reply #3 on: April 05, 2011, 03:42:28 PM »
It was posted elsewhere

Oh yeah , right , i just had in mind the email you sent us  ~sm-68.gif~.gif

Offline ChillyWilly

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1751
  • Just a coding machine.
Re: Make an up to date MD/32X Toolchain
« Reply #4 on: February 14, 2012, 12:20:33 PM »
The toolchain has been updated, along with all the examples and various projects. The current MD Myth menu also uses the new toolchain. So please refer to the sticky thread for the latest.

http://www.neoflash.com/forum/index.php/topic,7362.0.html