DCEmulation

dreamcast development • homebrew software • hardware hacking • indie games • emulators • and more!
Back to main site
It is currently Sat Oct 25, 2014 5:37 am

All times are UTC - 8 hours [ DST ]




Post new topic Reply to topic  [ 46 posts ]  Go to page Previous  1, 2, 3  Next
Author Message
PostPosted: Thu Feb 24, 2011 1:17 pm 
Offline
DC Developer
DC Developer
User avatar

Joined: Sat Dec 01, 2007 7:51 am
Posts: 295
So have any of you guys got it working with no errors?

I got a shit ton of them, trying again from scratch.


Top
 Profile  
 
PostPosted: Fri Feb 25, 2011 11:29 am 
Offline
DC Developer
DC Developer

Joined: Thu Aug 20, 2009 9:00 am
Posts: 320
Lemme guess - the ARM failed gcc pass 1... it's a known bug of gcc-core4.x.x. Use gcc-4.5.2 instead of gcc-core-4.5.2 and it will make it through the makefile in dc-chain just fine.


Top
 Profile  
 
PostPosted: Sat Feb 26, 2011 2:19 pm 
Offline
DC Developer
DC Developer
User avatar

Joined: Sat Dec 01, 2007 7:51 am
Posts: 295
Aha, that was it yeah it compiled perfectly now, thank you.
It took 8 hours for my 3ghz single core cpu to compile gcc... amazing.

On another topic, I've tried lib wildmidi for some port and it wouldn't work, the sounds just wouldn't play. I've tried several things but either SDL takes control of the audio drivers or does the mp3lib ( yes I've tried that ) and even converting the music to mod or s3m or xm so SDL plays them but still it woulnd't play. Using the mp3 makes the bgm work but not the sfx...


Top
 Profile  
 
PostPosted: Sat Feb 26, 2011 7:35 pm 
Offline
DC Developer
DC Developer

Joined: Thu Aug 20, 2009 9:00 am
Posts: 320
Neoblast wrote:
Aha, that was it yeah it compiled perfectly now, thank you.
It took 8 hours for my 3ghz single core cpu to compile gcc... amazing.


Wow, that's oddly slow. My 1.66 GHz CoreDuo compiles the whole shebang in less than two hours. Oh well, at least it works. :grin:

Quote:
On another topic, I've tried lib wildmidi for some port and it wouldn't work, the sounds just wouldn't play. I've tried several things but either SDL takes control of the audio drivers or does the mp3lib ( yes I've tried that ) and even converting the music to mod or s3m or xm so SDL plays them but still it woulnd't play. Using the mp3 makes the bgm work but not the sfx...


You need to point wildmidi to your own buffers. Look at this bit of the sound callback from Doom:

Code:
  // fill buffers with either music or silence
  if (mus_playing == 1) {
    int output_result;
    uint32 count_diff = wm_info->approx_total_samples - wm_info->current_sample;
    if (count_diff <= NUM_SAMPLES) {
      mus_playing = mus_looping ? 2 : 0; // restart from beginning next loop if looping
      output_result = WildMidi_GetOutput(midi_ptr, (char *)musout, (count_diff * 4));
      memset(&musout[count_diff*2], 0, (NUM_SAMPLES - count_diff)*4);
    } else {
      output_result = WildMidi_GetOutput(midi_ptr, (char *)musout, (NUM_SAMPLES * 4));
    }
    wm_info = WildMidi_GetInfo(midi_ptr);
    for (iy=0; iy<NUM_SAMPLES; iy++) {
      pcmoutl[offset + iy] = musout[iy * 2];
      pcmoutr[offset + iy] = musout[iy * 2 + 1];
    }
  } else {
    // clear buffers
    memset((void *)&pcmoutl[offset], 0, NUM_SAMPLES*2);
    memset((void *)&pcmoutr[offset], 0, NUM_SAMPLES*2);
  }


I ask wildmidi to fill a buffer called musout with NUM_SAMPLES 16-bit stereo samples (that's why it's NUM_SAMPLES*4). Then I mix that buffer with any pcm for the final buffer to send to whatever is playing the sound.

WildMidi isn't too hard to use - look at Mus_Register() for how to get ready to play a midi file, at Mus_Unregister() how for to clean up, and fill_buffer() on how to get samples. There's very little to it.


Top
 Profile  
 
PostPosted: Sun Feb 27, 2011 5:35 am 
Offline
DC Developer
DC Developer
User avatar

Joined: Sat Dec 01, 2007 7:51 am
Posts: 295
Quote:
I ask wildmidi to fill a buffer called musout with NUM_SAMPLES 16-bit stereo samples (that's why it's NUM_SAMPLES*4). Then I mix that buffer with any pcm for the final buffer to send to whatever is playing the sound.

WildMidi isn't too hard to use - look at Mus_Register() for how to get ready to play a midi file, at Mus_Unregister() how for to clean up, and fill_buffer() on how to get samples. There's very little to it.


Thank you again I will try that, I thought that the play function did all that like some others do. My bad.

Back on topic again, now that seeing that this works for all who have tried what's left to start thinking about iso r5 ?


Top
 Profile  
 
PostPosted: Wed Mar 02, 2011 2:20 pm 
Offline
DC Developer
DC Developer

Joined: Thu Aug 20, 2009 9:00 am
Posts: 320
Yeah, having gcc 4.5.2 and the rest for r5 would be a real boon to folks who can't or don't want to compile it all themselves.


Top
 Profile  
 
PostPosted: Mon Apr 25, 2011 5:36 am 
Offline
DCEmu Newbie
DCEmu Newbie
User avatar

Joined: Sun Apr 24, 2011 9:21 pm
Posts: 3
Location: Camuy, PR
I'm following the instructions of the original post to a T but still having issues. First of all, got a failure right from the opening moments, as the make is now looking for newlib-1.19.0. Alright fine, downloaded and placed newlib-1.19.0 where it goes. Make wanted to repatch, this is illogical so I tried skipping it. It won't take no for an answer and refuses to continue. Fine... delete directories and re-copy them. Make again. Now, I get this:

Code:
checking for suffix of object files... configure: error: in `/usr/kos/kos/utils/
dc-chain/build-newlib-sh-elf-1.19.0/sh-elf/newlib/libc/machine/sh':
configure: error: cannot compute suffix of object files: cannot compile
See `config.log' for more details.
configure: error: ../../../../../../newlib-1.19.0/newlib/libc/machine/sh/configu
re failed for sh
configure: error: ../../../../../newlib-1.19.0/newlib/libc/machine/configure fai
led for machine
configure: error: ../../../../newlib-1.19.0/newlib/libc/configure failed for lib
c
make[2]: *** [configure-target-newlib] Error 1
make[2]: Leaving directory `/usr/kos/kos/utils/dc-chain/build-newlib-sh-elf-1.19
.0'
make[1]: *** [all] Error 2
make[1]: Leaving directory `/usr/kos/kos/utils/dc-chain/build-newlib-sh-elf-1.19
.0'
+++ Fixing up sh4 newlib includes...
cp /usr/kos/kos/utils/dc-chain/../../../kos/include/pthread.h /opt/toolchains/dc
/sh-elf/sh-elf/include
cp: cannot create regular file `/opt/toolchains/dc/sh-elf/sh-elf/include': No su
ch file or directory
make: *** [fixup-sh4-newlib] Error 1


Not sure where to take it from here.

_________________
We are but shadows and dust, Maximus. Shadows and dust!


Top
 Profile  
 
PostPosted: Mon Apr 25, 2011 6:20 am 
Offline
The Crabby Overlord
The Crabby Overlord
User avatar

Joined: Mon May 27, 2002 9:31 am
Posts: 4249
That most likely means that newlib's configure script couldn't actually find sh-elf-gcc. Usually, that means that the first pass of building the sh-elf compiler broke somewhere along the line.


Top
 Profile  
 
PostPosted: Mon Apr 25, 2011 10:51 am 
Offline
DCEmu Newbie
DCEmu Newbie
User avatar

Joined: Sun Apr 24, 2011 9:21 pm
Posts: 3
Location: Camuy, PR
What a surprise... something gcc-related broke. I'm used to it. Oh well... guess I'll just wait for a binary release... :worship: :dc:

_________________
We are but shadows and dust, Maximus. Shadows and dust!


Top
 Profile  
 
PostPosted: Mon Apr 25, 2011 12:17 pm 
Offline
DC Developer
DC Developer

Joined: Thu Aug 20, 2009 9:00 am
Posts: 320
BlueCrab wrote:
That most likely means that newlib's configure script couldn't actually find sh-elf-gcc. Usually, that means that the first pass of building the sh-elf compiler broke somewhere along the line.


Actually, it usually means you forgot to assign yourself write privileges to where it was supposed to save the compiler. :wink:


Top
 Profile  
 
PostPosted: Mon Apr 25, 2011 12:53 pm 
Offline
The Crabby Overlord
The Crabby Overlord
User avatar

Joined: Mon May 27, 2002 9:31 am
Posts: 4249
Chilly Willy wrote:
BlueCrab wrote:
That most likely means that newlib's configure script couldn't actually find sh-elf-gcc. Usually, that means that the first pass of building the sh-elf compiler broke somewhere along the line.


Actually, it usually means you forgot to assign yourself write privileges to where it was supposed to save the compiler. :wink:

Still, something in the first stage of gcc building is broken in that case (also in binutils, but that's another story). :wink:


Top
 Profile  
 
PostPosted: Mon Apr 25, 2011 4:37 pm 
Offline
DC Developer
DC Developer

Joined: Thu Aug 20, 2009 9:00 am
Posts: 320
Look at that source directory

/usr/kos/kos/utils/dc-chain/build-newlib-sh-elf-1.19.0/sh-elf/newlib/libc/machine/sh

I can't help but think that's part of the problem. :grin:

Putting the source in /usr/kos? I think it would be better just in the regular projects directory. It seems to be set for the default directory to save to... look at this error

Code:
cp: cannot create regular file `/opt/toolchains/dc/sh-elf/sh-elf/include': No su
ch file or directory


That's the default, but they haven't made an /opt/toolchains/dc directory, or don't have permissions for /opt.


Top
 Profile  
 
PostPosted: Tue Apr 26, 2011 3:43 pm 
Offline
DCEmu Newbie
DCEmu Newbie
User avatar

Joined: Sun Apr 24, 2011 9:21 pm
Posts: 3
Location: Camuy, PR
As a rule, if something isn't explicitly stated in the instructions, I don't do it... and that includes doing things like creating /opt/toolchains/dc or other such details. Otherwise, problems that arise from straying always come back on the user as being an incompetent ass. :) I updated newlib only because it was obvious that it needed to be done, but everything else was done verbatim. I'm willing to give it another shot just because I'd like to get this going (and SliTaz's gcc4.5.2 requires GLIBC_2.11 and there's no package for that so gcc is useless there, hence I can't do a damn thing with it... SliTaz is the ONLY Linux I will EVER use, without argument or exception).

EDIT: I said to hell with it and just found the old R4 instead... that was a piece of cake to get going, since I already have cygwin installed due to an earlier install of psxsdk. Using this, I was able to finally build a working binary... just one of the examples for now, but a step in the right direction. Now to figure out what to do with the elf file... time to find some docs. :)

EDIT2: It seems R4 comes with something called BootDreams which appears to be what I need to make a working disc image... now to try it out in an emulator. :)

EDIT3: Got nullDC installed and running, and ran the .cdi... ran without problems, though the console seemed to spit out tons of messages about "Excepts"... don't know if that's normal or not, but hey, it's running. Looks like I have a working toolchain now. :) Having an updated one would be nice, but this will do the trick for now. Dreamcast development, here I come. :D

_________________
We are but shadows and dust, Maximus. Shadows and dust!


Top
 Profile  
 
PostPosted: Sat May 07, 2011 11:34 am 
Offline
DC Developer
DC Developer
User avatar

Joined: Sun Sep 05, 2010 3:44 am
Posts: 78
So, after a few tries I finally managed to install GDB and Insight succesfully with this toolchain on MinGW Win32. Furthermore, it works OK with dc-tool-ip 1.0.4 in MinGW and I can debug lots of things now :)

The steps are not so trivial, but if you managed to compile this toolchain, then you will have succeed with that one.

PREPARATION AND INITIAL NOTES

1 ) Check that 'wget' is installed in your system. In MinGW, you can download binaries here: http://downloads.sourceforge.net/mingw/ ... RT.tar.bz2
2 ) GCC 4.5.2 needs GDB 7.0.50 or above by specifications. If you try to compile GDB 6.7.1 (default version)... it will fail :(

If you only want to compile GDB (for hard guys!):
a ) Open Makefile and change GDB version to 7.0.50 (tested and worked), or 7.2.
Code:
make gdb

Go take a cofee / beer / drink of your desire, and wait to compile it. If everything is OK, you will have a new sh-elf-gdb.exe file.

If you want to compile Insight (recommended):
1 ) When you compile Insight, you will compile also GDB + Tcl/Tk (a graphical library that Insight uses).
2 ) The Insight version is in pair with GDB version (i.e. Insight 7.2 means that it has GDB 7.2).
3 ) Any clean version of Insight will fail to compile in a MinGW environment.
4 ) The 7.0.50 version of Insight (snapshot) worked for me. I tried latest CVS 7.2 but it gave me errors. So, I'll use this version in this mini How-to.

COMPILE INSIGHT

1 ) Download manually this version of Insight: insight-weekly-CVS-7.0.50-20091130.tar.bz2 . You can get from here: ftp://sourceware.org/pub/insight/snapsh ... 30.tar.bz2
2 ) Rename the file to: insight-7.0.50.tar.bz2
3 ) Uncompress everything in dc-chain folder (so, there should be a new src folder inside dc-chain).
4 ) Download the MinGW patch (see attachments), extract the content in dc-chain folder, and apply it:
Code:
patch -p1 -i insight-mingw.patch

5 ) Now, rename the 'src' folder to: 'insight-7.0.50'
6 ) Open Makefile and change the Insight version to: 7.0.50
7 ) Create the following fake file to cheat Makefile:
Code:
touch unpack_insight_stamp

8 ) Finally, time to compile! (and cross fingers hehe).
Code:
make insight


The process is quite slow (less than building toolchain, but enough to go out and take a walk). If everything is fine, you will have two new exes: sh-elf-gdb.exe and sh-elf-insight.exe.

COMPILE DC-TOOL

This GDB will only work with latest SVN version of dc-tool. I remark the SVN because it won't work for any of the 1.0.4 binaries that I found on the Internet. You need to compile dc-tool-ip (or dc-tool-serial) with your new and shiny toolchain, and then burn into a CD the Dreamcast binary (make-cd) folder.

1 ) In Makefile.cfg, I had to add one more library to compile dc-tool (and change paths). It should be like this
Code:
# MinGW
# these must point to your sh-elf bfd, not the system one
BFDLIB      = -L/usr/sh-elf/lib -lbfd -lintl -liberty -lws2_32 -lwsock32
BFDINCLUDE   = /usr/sh-elf/include


2 ) Remember to check other configs (like the Dreamcast IP in the IP version). When ready, 'make' and 'make install'

3 ) If you want to use BootDreams to burn the Dreamcast binary, you have to use the scramble utility first on the 1st_read.bin: http://mc.pp.se/dc/files/scramble.c

In this post I won't explain how to use these tools (there is a good tutorial in the DDEr4 package), but if anyone needs help I'll explain a bit about them. Happy debugging!!


Attachments:
insight-mingw.zip [1.39 KiB]
Downloaded 97 times
Top
 Profile  
 
PostPosted: Fri Jul 08, 2011 6:26 am 
Offline
DC Developer
DC Developer
User avatar

Joined: Sun Sep 05, 2010 3:44 am
Posts: 78
After spending a few hours (read: lots of hours) I finally managed to squash an important bug that, unfortunately, affects all the users that used this system.

NOTICE: DO NOT USE the custom gcc-4.5.2-kos.diff that comes inside mingwpack.zip !!! The patch file is outdated and your binaries will crash because there were changes into KOS thread system. Instead of it, please, use the updated gcc-4.5.2-kos.diff that comes with the KOS SVN.

If you already have your toolchain, I'm afraid you will have to rebuild it using the new patch... :(

Here I list my updated version of the components that I used to build a succesfull toolchain:
- gcc-core-4.5.2.tar.bz2
- gcc-objc-4.5.2.tar.bz2
- gcc-g++-4.5.2.tar.bz2

- mpfr-2.4.2.tar.bz2
- mpc-0.8.2.tar.tar
- gmp-5.0.2.tar.bz2

- binutils-2.21.tar.bz2
- newlib-1.19.0.tar.gz

I attach my Makefile (utils/dc-chain) with latests versions and doc changes, and ready to work with latest KOS svn. You can use this instead of the Makefile that comes in the package.

Have fun!!


Attachments:
File comment: Updated makefile with doc and latest versions.
Makefile-mingw.zip [3.12 KiB]
Downloaded 106 times
Top
 Profile  
 
PostPosted: Wed Sep 14, 2011 12:28 pm 
Offline
DC Developer
DC Developer
User avatar

Joined: Fri Mar 05, 2004 1:22 pm
Posts: 343
Location: France
Hello,

Thanks for all your infos in this very intersting thread.

I have just a question, because I'm completly outdated... GDB works under dc-tool/dc-load? How can we works with GDB to debugging Dreamcast binaries ??? :o

_________________
[big_fury]SiZiOUS, http://www.sizious.com/
Image
Warning : This person speak english very badly


Top
 Profile  
 
PostPosted: Wed Sep 14, 2011 1:07 pm 
Offline
DC Developer
DC Developer
User avatar

Joined: Sun Sep 05, 2010 3:44 am
Posts: 78
Hey SiZiOUS, nice to see you here again :D

Yes, GDB should work OK with dc-tool/dc-load. If I'm not wrong, when you upload the binary (ELF) using -g with dc-tool, it waits for a connection (just after uploading and before executing). In short words, the DC is the GDBserver (server part).

Your computer, then, connects to the DC and it works as a GDBclient. After a succesfull connection, you control the GDBserver (start execution, breakpoints...).

Same applies to dctool-serial, but without IP's.


Top
 Profile  
 
PostPosted: Fri Sep 16, 2011 10:35 am 
Offline
DC Developer
DC Developer
User avatar

Joined: Fri Mar 05, 2004 1:22 pm
Posts: 343
Location: France
Hi Indiket :)

But how it can works ? Do I need both BBA and Serial Cable in order to use GDB? Or only BBA is enough ?

Thanks for the reply :D

_________________
[big_fury]SiZiOUS, http://www.sizious.com/
Image
Warning : This person speak english very badly


Top
 Profile  
 
PostPosted: Fri Sep 16, 2011 12:41 pm 
Offline
DC Developer
DC Developer
User avatar

Joined: Sun Sep 05, 2010 3:44 am
Posts: 78
No no, only one of them is needed (BBA or Serial Cable).

I don't know exactly the technical details, but Wikipedia is a great start:
http://en.wikipedia.org/wiki/Gdbserver


Top
 Profile  
 
PostPosted: Fri Sep 16, 2011 1:04 pm 
Offline
DC Developer
DC Developer
User avatar

Joined: Fri Mar 05, 2004 1:22 pm
Posts: 343
Location: France
OK!! Thanks for the info!

I'm just trying to compiling this KOS environment with the Dreamcast(tm) tutorial and your improvements, and everything is doing well for the moment (compiling the toolchain)!

I'm so happy to see that KOS and the DC is supported in 2011! I'm just remember when I discovered the DC scene in 2002... and i'm still here!! 10 years !! Incredible :grin:

_________________
[big_fury]SiZiOUS, http://www.sizious.com/
Image
Warning : This person speak english very badly


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 46 posts ]  Go to page Previous  1, 2, 3  Next

All times are UTC - 8 hours [ DST ]


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group