Mac <-> DC Programmer Thread
- I.M. Weasel
- Iron Muskateer Weasel
- Posts: 2780
- https://www.artistsworkshop.eu/meble-kuchenne-na-wymiar-warszawa-gdzie-zamowic/
- Joined: Fri Jan 04, 2002 4:45 am
- Location: The city of the future, Los Braingeles
- Has thanked: 1 time
- Been thanked: 3 times
- Contact:
Mac <-> DC Programmer Thread
this is a sticky.
lets start simple.
________________
KOS - C functions Library for the Dreamcast
SH4 Toolchain/enviroment - The Dreamcast platform (i.e. Windows,mac,unix,dc )
Cross Compiling - Making a program for an OS not currently running
CygWin - A program that lets you use UNIX on PC (OS X has it already )
________________
How?
Know a little C.
Setup the SH4 cross compiling enviroment on your Mac.
Configure and Make the KOS library.
Write in C! with KOS functions/usage included.
Upload the compiled program to your dc ,either via cd or serial cable
________________
Programs
Stalin's Script - http://stalin.thegypsy.com/bscript.shtml a UNIX script that will setup the SH4 enviroment automatically (some variables Need to be changed.)
DC Serial Cable on Mac - macemu.com/~dreamcast/dc_apps.htm Developed by the Mac pack Team. Needs - A computer with old-school serial ports (modem or printer).
An Adapter (that i cant find on ebay).
_________________
Resources
What i've found.
*Small tutorial on getting everything ready on lunix http://www.atani-software.net/dcprog/
* A new adapter which has the 9 pin serial port that the serial cable uses, and connects to your mac via USB. Widely available on eBay. Pic Below.
I dont think it will work with the DC_Serial on Mac package, because the package contains a program that speaks to the serial port. Although from that, the correct software may be included. If not,it can be located on VersionTracker, i bet.
lets start simple.
________________
KOS - C functions Library for the Dreamcast
SH4 Toolchain/enviroment - The Dreamcast platform (i.e. Windows,mac,unix,dc )
Cross Compiling - Making a program for an OS not currently running
CygWin - A program that lets you use UNIX on PC (OS X has it already )
________________
How?
Know a little C.
Setup the SH4 cross compiling enviroment on your Mac.
Configure and Make the KOS library.
Write in C! with KOS functions/usage included.
Upload the compiled program to your dc ,either via cd or serial cable
________________
Programs
Stalin's Script - http://stalin.thegypsy.com/bscript.shtml a UNIX script that will setup the SH4 enviroment automatically (some variables Need to be changed.)
DC Serial Cable on Mac - macemu.com/~dreamcast/dc_apps.htm Developed by the Mac pack Team. Needs - A computer with old-school serial ports (modem or printer).
An Adapter (that i cant find on ebay).
_________________
Resources
What i've found.
*Small tutorial on getting everything ready on lunix http://www.atani-software.net/dcprog/
* A new adapter which has the 9 pin serial port that the serial cable uses, and connects to your mac via USB. Widely available on eBay. Pic Below.
I dont think it will work with the DC_Serial on Mac package, because the package contains a program that speaks to the serial port. Although from that, the correct software may be included. If not,it can be located on VersionTracker, i bet.
Last edited by I.M. Weasel on Wed May 07, 2003 1:05 am, edited 2 times in total.
http://tofuheavyindustries.com
Mac Dream Tool / Mac Dream Tool Services (released Sept. 2019)
Creator of Various awesome Video Games
"You don't have to be forgiven. Clint Eastwood taught us that."
Mac Dream Tool / Mac Dream Tool Services (released Sept. 2019)
Creator of Various awesome Video Games
"You don't have to be forgiven. Clint Eastwood taught us that."
-
- DC Developer
- Posts: 9951
- Joined: Sun Dec 30, 2001 9:02 am
- Has thanked: 0
- Been thanked: 1 time
So, how much have you guys got working so far, if anything?
If the USB serial adapter behaves anything like it does on a PC, it should show up as a standard serial port. Of course, that's really doubtful, since MacOS X probably doesn't support any kind of serial ports anyway.
I don't know how different MacOS X is to a standard Unix system, but once you've got the serial adapter and plugged it in, it should show up somewhere in the /dev tree. If it shows up there, and behaves basically the same as a serial port does on any other Unix system (which it can probably be made to), you should just be able to use the Unix versions of the DC->PC comm software, compile it under OSX, and it should work. Probably.
As for the software side... I think the first step would have to be getting Binutils set up and working for an OSX host and a SH-4 target. GCC's the native compiler for OSX, isn't it? So I assume that it would basically compile under OSX, right?
Simplest way to test it would be to download the source code for binutils, and do something like this at a terminal
That should (theoretically) build an OSX targetted version of binutils (but not install it). If that works, then there's a good chance compiling for an SH-4 target would work too. Basically, that's the same as above, but you need to specify a few additional paramaters to the configure script:
That should build SH-4 targetted binutils, and install them to /usr/local/dc/sh-elf. Presumably, that would be different on a Mac. Of course, under a standard Unix system, that'll only work if you're logged in as the root user, since you need write permissions to /usr, and standard users don't have that. You could install it to your own home directory, like this:
If the USB serial adapter behaves anything like it does on a PC, it should show up as a standard serial port. Of course, that's really doubtful, since MacOS X probably doesn't support any kind of serial ports anyway.
I don't know how different MacOS X is to a standard Unix system, but once you've got the serial adapter and plugged it in, it should show up somewhere in the /dev tree. If it shows up there, and behaves basically the same as a serial port does on any other Unix system (which it can probably be made to), you should just be able to use the Unix versions of the DC->PC comm software, compile it under OSX, and it should work. Probably.
As for the software side... I think the first step would have to be getting Binutils set up and working for an OSX host and a SH-4 target. GCC's the native compiler for OSX, isn't it? So I assume that it would basically compile under OSX, right?
Simplest way to test it would be to download the source code for binutils, and do something like this at a terminal
Code: Select all
tar -xzvf binutils-version.tar.gz
mkdir binutils-build
cd binutils-build
../binutils-version/configure
make
Code: Select all
tar -xzvf binutils-version.tar.gz
mkdir binutils-build
cd binutils-build
../binutils-version/configure --prefix=/usr/local/dc/sh-elf --target=sh-elf
make all install
Code: Select all
tar -xzvf binutils-version.tar.gz
mkdir binutils-build
cd binutils-build
../binutils-version/configure --prefix=~/dc-build/sh-elf --target=sh-elf
make all install
-
- DCEmu Turkey Baster
- Posts: 2663
- Joined: Tue Feb 26, 2002 8:34 pm
- Has thanked: 0
- Been thanked: 0
-
- DCEmu Newbie
- Posts: 1
- Joined: Thu May 29, 2003 2:43 pm
- Has thanked: 0
- Been thanked: 0
Mac OS X build environment working
I managed to build binutils and gcc to target SH4 & ARM in Mac OS X.
I used Stalin's script found at http://stalin.thegypsy.com/bscript.shtml (from the links in the above posts). I used version 0.3.
I don't think I have a working C++ compiler yet since there were some errors with that build portion, but the C compiler works. I tested this by using KOS 1.1.9 (binaries, haven't tried building KOS yet). I built a couple of the samples and copied the binaries over to my linux box which has the dc coders cable & dc-tool set up (it's my current dc dev environment until i get all the mac stuff worked out). from there i was able to send the executables to the dc.
Here's what I did to get this stuff to work (using Terminal and tcsh):
Create a directory where you want to put all this stuff. As an example I'll use /usr/local/dreamcast.
download stalin's script and put it in /usr/local/dreamcast. I called it "build_script".
edit build_script w/ your favorite text editor. change the stuff that you want to in it. i only had to change the prefix setting. change that to the dir you want everything to be based from -- /usr/local/dreamcast
save it.
make it executable:
download all the source tars:
extract all the tars:
Now, on Jaguar (I'm on 10.2.6) I had to modify one of the source files in binutils. that file is binutils-2.11.2/libiberty/strerror.c ... this mod should work if you're using binutils 2.11.2. should be around line 468.
original line looks like this:
extern int sys_nerr;
change it to:
extern __const int sys_nerr;
go back out to your base dir (/usr/local/dreamcast).
from there you can do:
take a nap or something while you wait. unless you hit errors this could take awhile to complete.
when that's done you should have the binutils targetting sh4, gcc targetting sh4 and newlib built for sh4. if you get a working C++ compiler that's another bonus.
next:
same thing as build_sh4. it will take a bit and in the end you'll get everything targeted for arm.
One problem I ran into when doing sh4, but didn't with arm -- for some reason once the binutils built even though the dir was on the PATH make couldn't find them, so the gcc build complained about missing sh-elf-ar. all i had to do was close the Terminal window and open a new one and it worked. i tried rehash but that didn't seem to cut it, but for some reason restarting the terminal did. hope you don't hit the same problem, I really don't know why it happened.
KOS is another story. Get the binaries from sourceforge.net. I'll put the details for that in another message.
Hope this helps!
I used Stalin's script found at http://stalin.thegypsy.com/bscript.shtml (from the links in the above posts). I used version 0.3.
I don't think I have a working C++ compiler yet since there were some errors with that build portion, but the C compiler works. I tested this by using KOS 1.1.9 (binaries, haven't tried building KOS yet). I built a couple of the samples and copied the binaries over to my linux box which has the dc coders cable & dc-tool set up (it's my current dc dev environment until i get all the mac stuff worked out). from there i was able to send the executables to the dc.
Here's what I did to get this stuff to work (using Terminal and tcsh):
Create a directory where you want to put all this stuff. As an example I'll use /usr/local/dreamcast.
download stalin's script and put it in /usr/local/dreamcast. I called it "build_script".
edit build_script w/ your favorite text editor. change the stuff that you want to in it. i only had to change the prefix setting. change that to the dir you want everything to be based from -- /usr/local/dreamcast
save it.
make it executable:
Code: Select all
chmod +x build_script
Code: Select all
./build_script download
Code: Select all
./build_script extract
original line looks like this:
extern int sys_nerr;
change it to:
extern __const int sys_nerr;
go back out to your base dir (/usr/local/dreamcast).
from there you can do:
Code: Select all
./build_script build_sh4
when that's done you should have the binutils targetting sh4, gcc targetting sh4 and newlib built for sh4. if you get a working C++ compiler that's another bonus.
next:
Code: Select all
./build_script build_arm
One problem I ran into when doing sh4, but didn't with arm -- for some reason once the binutils built even though the dir was on the PATH make couldn't find them, so the gcc build complained about missing sh-elf-ar. all i had to do was close the Terminal window and open a new one and it worked. i tried rehash but that didn't seem to cut it, but for some reason restarting the terminal did. hope you don't hit the same problem, I really don't know why it happened.
KOS is another story. Get the binaries from sourceforge.net. I'll put the details for that in another message.
Hope this helps!
- I.M. Weasel
- Iron Muskateer Weasel
- Posts: 2780
- Joined: Fri Jan 04, 2002 4:45 am
- Location: The city of the future, Los Braingeles
- Has thanked: 1 time
- Been thanked: 3 times
- Contact:
Could you elaborate a bit more on what you did? closed the active window it was built in,did you do a rebuld in the new window?Reno wrote: One problem I ran into when doing sh4, but didn't with arm -- for some reason once the binutils built even though the dir was on the PATH make couldn't find them, so the gcc build complained about missing sh-elf-ar. all i had to do was close the Terminal window and open a new one and it worked. i tried rehash but that didn't seem to cut it, but for some reason restarting the terminal did. hope you don't hit the same problem, I really don't know why it happened.
http://tofuheavyindustries.com
Mac Dream Tool / Mac Dream Tool Services (released Sept. 2019)
Creator of Various awesome Video Games
"You don't have to be forgiven. Clint Eastwood taught us that."
Mac Dream Tool / Mac Dream Tool Services (released Sept. 2019)
Creator of Various awesome Video Games
"You don't have to be forgiven. Clint Eastwood taught us that."
- I.M. Weasel
- Iron Muskateer Weasel
- Posts: 2780
- Joined: Fri Jan 04, 2002 4:45 am
- Location: The city of the future, Los Braingeles
- Has thanked: 1 time
- Been thanked: 3 times
- Contact:
I tried to that way,but it states thatsBlackAura wrote:
As for the software side... I think the first step would have to be getting Binutils set up and working for an OSX host and a SH-4 target. GCC's the native compiler for OSX, isn't it? So I assume that it would basically compile under OSX, right?
Simplest way to test it would be to download the source code for binutils, and do something like this at a terminalThat should (theoretically) build an OSX targetted version of binutils (but not install it). If that works, then there's a good chance compiling for an SH-4 target would work too. Basically, that's the same as above, but you need to specify a few additional paramaters to the configure script:Code: Select all
tar -xzvf binutils-version.tar.gz mkdir binutils-build cd binutils-build ../binutils-version/configure make
That should build SH-4 targetted binutils, and install them to /usr/local/dc/sh-elf. Presumably, that would be different on a Mac. Of course, under a standard Unix system, that'll only work if you're logged in as the root user, since you need write permissions to /usr, and standard users don't have that. You could install it to your own home directory, like this:Code: Select all
tar -xzvf binutils-version.tar.gz mkdir binutils-build cd binutils-build ../binutils-version/configure --prefix=/usr/local/dc/sh-elf --target=sh-elf make all install
Code: Select all
tar -xzvf binutils-version.tar.gz mkdir binutils-build cd binutils-build ../binutils-version/configure --prefix=~/dc-build/sh-elf --target=sh-elf make all install
Code: Select all
[Terminals-Computer:~/binutils-build] termshort% ../binutils-version/configure
../binutils-version/configure: Command not found.
so it doesnt function at all. I am have been using stalins script but have not gotten it working yet...
http://tofuheavyindustries.com
Mac Dream Tool / Mac Dream Tool Services (released Sept. 2019)
Creator of Various awesome Video Games
"You don't have to be forgiven. Clint Eastwood taught us that."
Mac Dream Tool / Mac Dream Tool Services (released Sept. 2019)
Creator of Various awesome Video Games
"You don't have to be forgiven. Clint Eastwood taught us that."
- I.M. Weasel
- Iron Muskateer Weasel
- Posts: 2780
- Joined: Fri Jan 04, 2002 4:45 am
- Location: The city of the future, Los Braingeles
- Has thanked: 1 time
- Been thanked: 3 times
- Contact:
Update: I spent 8 hours yesterday night setting up the sh4 cross compiler while being walked through by BlackAura. I think I know what I did, I worked from 11pm to 9am, and by the end it was becoming quite a blur. I must run a few more testing, i.e. compiling a dc program to see if it all works. If so I'll write it up into a tutorial. And if so,all thats left is the hardware side.
http://tofuheavyindustries.com
Mac Dream Tool / Mac Dream Tool Services (released Sept. 2019)
Creator of Various awesome Video Games
"You don't have to be forgiven. Clint Eastwood taught us that."
Mac Dream Tool / Mac Dream Tool Services (released Sept. 2019)
Creator of Various awesome Video Games
"You don't have to be forgiven. Clint Eastwood taught us that."
- I.M. Weasel
- Iron Muskateer Weasel
- Posts: 2780
- Joined: Fri Jan 04, 2002 4:45 am
- Location: The city of the future, Los Braingeles
- Has thanked: 1 time
- Been thanked: 3 times
- Contact:
i know it was around 10 hours. felt like a time warp with all that compilng.I saved all the terminal windows as text files and our IM convo.so Im gonna take the tutorial from there. I have a few small questions to ask you when i get back from work.(blackaura)
http://tofuheavyindustries.com
Mac Dream Tool / Mac Dream Tool Services (released Sept. 2019)
Creator of Various awesome Video Games
"You don't have to be forgiven. Clint Eastwood taught us that."
Mac Dream Tool / Mac Dream Tool Services (released Sept. 2019)
Creator of Various awesome Video Games
"You don't have to be forgiven. Clint Eastwood taught us that."
-
- DCEmu Crazy Poster
- Posts: 33
- Joined: Thu May 22, 2003 3:48 pm
- Has thanked: 0
- Been thanked: 0
Renoberator, actually you're my hero! the build worked perfect, it even didn't have the problem that made you to restart the terminal! I think c++ will work fine also
Now to KOS!
Did you do something special or just followed the included included instructions modifiying the paths on environ-dc.tcsh?
thanks!
hkkm
Now to KOS!
Did you do something special or just followed the included included instructions modifiying the paths on environ-dc.tcsh?
thanks!
hkkm
-
- DCEmu Crazy Poster
- Posts: 33
- Joined: Thu May 22, 2003 3:48 pm
- Has thanked: 0
- Been thanked: 0
Renoberator, I've posted your instructions on KOS dev list to share with others.
Also from the list, Christian Groessler posted this message:
wich I think is a nice solution. it is also perfect for people with pretty limited disk space to make the builds!
cheers!
Also from the list, Christian Groessler posted this message:
(it is better to use a ftp app such as transmit)Hi,
for those who don't want to compile a MacOS-X hosted toolchain by
themselves, I've put up a precompiled one some time ago.
It's on
ftp://ftp.aladdin.de/pub/people/chris/d ... -toolchain
Still gcc 3.0.4...
regards,
chris
wich I think is a nice solution. it is also perfect for people with pretty limited disk space to make the builds!
cheers!
-
- DCEmu Crazy Poster
- Posts: 33
- Joined: Thu May 22, 2003 3:48 pm
- Has thanked: 0
- Been thanked: 0
yeahI.M. Weasel wrote:glad to hear someones chiming in on this issue
ToeJam wrote:Apparently it's an anonymous login type thing? I'm downloading them now with Transmit. (just copy the address, and then in transmit hit Edit:Paste, and connect/download)
that's OK, alternatively I've found you can use also these direct links:
ftp://ftp.aladdin.de/pub/people/chris/d ... .4.tar.bz2
ftp://ftp.aladdin.de/pub/people/chris/d ... .4.tar.bz2
hkkm
-
- DCEmu Crazy Poster
- Posts: 33
- Joined: Thu May 22, 2003 3:48 pm
- Has thanked: 0
- Been thanked: 0
sure, I just wanted to bring the fastest pointerToeJam wrote: Well duh, or you could browse the folder through your web browser or any other number of tools, I just mentioned one of many ways to the files that work oh so lovely (actually I have to try compiling some dc stuff).
well, I'm already trying to buids KOS 1.2.0 but get this error:
Code: Select all
make -C utils
make -C genromfs
cc -O2 -Wall -c -o genromfs.o genromfs.c
genromfs.c:80: header file 'sys/sysmacros.h' not found
cpp-precomp: warning: errors during smart preprocessing, retrying in basic mode
make[2]: *** [genromfs.o] Error 1
make[1]: *** [all] Error 2
make: *** [build-utils] Error 2
Code: Select all
#if !defined(__FreeBSD__) && !defined(__NetBSD__)
# include <sys/sysmacros.h>
#endif
Is anybody having the same problem?
cheers
hkkm
-
- DC Developer
- Posts: 9951
- Joined: Sun Dec 30, 2001 9:02 am
- Has thanked: 0
- Been thanked: 1 time
MacOS is a kind of BSD, as are FreeBSD and NetBSD. Those lines are supposed to include that header file, which isn't found on BSD systems, only if the system is not BSD. I had the same trouble when I was helping I. M. Weasel with this. Basically, you can either comment it out (bad idea) or add another !defined() thingy to it. I can't remember what that definition should be.
-
- DCEmu Crazy Poster
- Posts: 33
- Joined: Thu May 22, 2003 3:48 pm
- Has thanked: 0
- Been thanked: 0
thanks BA, I'm working on it and I have found an inelegant workaround, I have this:BlackAura wrote:MacOS is a kind of BSD, as are FreeBSD and NetBSD. Those lines are supposed to include that header file, which isn't found on BSD systems, only if the system is not BSD. I had the same trouble when I was helping I. M. Weasel with this. Basically, you can either comment it out (bad idea) or add another !defined() thingy to it. I can't remember what that definition should be.
Code: Select all
#if !defined(__FreeBSD__) && !defined(__NetBSD__)
# include <sys/types.h>
#endif
thanks!
hkkm
- I.M. Weasel
- Iron Muskateer Weasel
- Posts: 2780
- Joined: Fri Jan 04, 2002 4:45 am
- Location: The city of the future, Los Braingeles
- Has thanked: 1 time
- Been thanked: 3 times
- Contact:
blackaura told me originally to delete the references to all malloc.h defines
http://tofuheavyindustries.com
Mac Dream Tool / Mac Dream Tool Services (released Sept. 2019)
Creator of Various awesome Video Games
"You don't have to be forgiven. Clint Eastwood taught us that."
Mac Dream Tool / Mac Dream Tool Services (released Sept. 2019)
Creator of Various awesome Video Games
"You don't have to be forgiven. Clint Eastwood taught us that."
-
- DCEmu Crazy Poster
- Posts: 33
- Joined: Thu May 22, 2003 3:48 pm
- Has thanked: 0
- Been thanked: 0
thanks! I'm going to do it now, I hope there aren't many files....I.M. Weasel wrote:blackaura told me originally to delete the references to all malloc.h defines
[edit] 62 #include <malloc.h> have been commented (nice to have project builder available)... now the hellz compiler doesn't find jpeglib.h!
hkkm