DCEmulation

dreamcast development • homebrew software • hardware hacking • indie games • emulators • and more!
Back to main site
It is currently Sun Mar 01, 2015 10:02 pm

All times are UTC - 8 hours [ DST ]




Post new topic Reply to topic  [ 23 posts ]  Go to page 1, 2  Next
Author Message
PostPosted: Thu Dec 05, 2013 7:28 pm 
Offline
DC Developer
DC Developer
User avatar

Joined: Fri Jun 18, 2010 7:29 pm
Posts: 460
Whats up guys.

I have not touched and code on DC for the last month or so, ever since I installed my new OS and have not yet re-installed the DC tool chain.

Since Dev Iso R4 is no longer hosted on this site, I decided to break down and install kos 2.0 from the ground up.

First, I installed Cygwin.

Next, I downloaded kos 2.0, newlib-2.0, gcc-4.7.3, and binutils-2.23.2. To be certain, the newlib version I am using is "newlib-linaro-2.0.0-2013.06.tar".

Running the kos/utils/dc-chain makefile, the patch seems to run fine, but it fails to build-sh4.
Image

Any help will be appreciated!


Top
 Profile  
 
PostPosted: Thu Dec 05, 2013 8:21 pm 
Offline
Insane DCEmu
Insane DCEmu
User avatar

Joined: Sat Jan 31, 2004 1:34 pm
Posts: 183
Location: Russia/Novosibirsk
Just remove -j4 from makejobs variable in Makefile. I think it help you, I'm build all fine.

I say the problem is more serious :)
After build the KOS on gcc 4.8.2 it works very not stably... setting video mode broken and maybe even a problem with mutex/thread (but I'm not sure yet).
When DC connected to composite cable, then why in this place, a condition that is triggered cable VGA, so the video only works with VGA connection:

Code:
    /* If we're on a VGA box, disable vertical smoothing */
    if(vid_mode->cable_type == CT_VGA) {
        dbglog(DBG_KDEBUG, "pvr: disabling vertical scaling for VGA\n");

        if(pvr_state.fsaa)
            PVR_SET(PVR_SCALER_CFG, 0x10400);
        else
            PVR_SET(PVR_SCALER_CFG, 0x400);
    }
    else {
        dbglog(DBG_KDEBUG, "pvr: enabling vertical scaling for non-VGA\n");

        if(pvr_state.fsaa)
            PVR_SET(PVR_SCALER_CFG, 0x10401);
        else
            PVR_SET(PVR_SCALER_CFG, 0x401);
    }


I don't touch anything, kos does it himself.
I think variable vid_mode is crashed on some place. And not only it global variable...

_________________
Image


Last edited by SWAT on Thu Dec 05, 2013 8:24 pm, edited 2 times in total.

Top
 Profile  
 
PostPosted: Thu Dec 05, 2013 8:22 pm 
Offline
The Crabby Overlord
The Crabby Overlord
User avatar

Joined: Mon May 27, 2002 9:31 am
Posts: 4435
Well, first of all, you're not using an official version of newlib. I have no idea if that particular tarball you've downloaded has changed anything significant, but I wouldn't necessarily want to chance it. Get the real version of newlib, which the download.sh script in dc-chain will do for you (or at least point you to the right place to get it).

Second, there's a known issue with the bfd.texinfo file (which is actually why your build is failing) and newer versions of the tool used with it. This was discussed in this topic recently, and the solution is in this post specifically. To save you from having to click on the link, here's that post:
BlueCrab wrote:
That's a bug in the binutils texinfo files. I never build them with my builds, so I had never noticed that issue...

Re-run the unpack.sh script, then run the following two commands before doing the make:
Code:
sed -e 's/ @colophon/ @@colophon/' -e 's/doc@cygnus.com/doc@@cygnus.com/' binutils-2.23.2/bfd/doc/bfd.texinfo > binutils-2.23.2/bfd/doc/bfd.texinfo2
mv binutils-2.23.2/bfd/doc/bfd.texinfo2 binutils-2.23.2/bfd/doc/bfd.texinfo

This will be fixed in the git when I update the dc-chain Makefile again.


As stated in that post, it is fixed on the git repository, so any future releases of KOS (after 2.0.0) won't have that problem. :wink:
Just to be clear, this has nothing to do with using multiple jobs for make or with any GCC 4.8.x related bugs (which I haven't seen any of myself, but that's beside the point anyway, since you're not using GCC 4.8.x).


Top
 Profile  
 
PostPosted: Thu Dec 05, 2013 8:27 pm 
Offline
Insane DCEmu
Insane DCEmu
User avatar

Joined: Sat Jan 31, 2004 1:34 pm
Posts: 183
Location: Russia/Novosibirsk
Sorry for offtopic, I'm just saying of bug in 4.8.2 for you BlueCrab. You use it by default in dc-chain.
With 4.7.3 I'm not have this bug.

_________________
Image


Top
 Profile  
 
PostPosted: Thu Dec 05, 2013 8:35 pm 
Offline
The Crabby Overlord
The Crabby Overlord
User avatar

Joined: Mon May 27, 2002 9:31 am
Posts: 4435
Someone else was reporting a similar issue with trying to use PAL50 modes and it deciding to use VGA instead, but I'm pretty sure that this person wasn't trying to use GCC 4.8.x. That was covered in this topic. Eventually he got everything working, but I dunno what he did to fix it. I'm guessing something got built wrong somewhere along the way, and rebuilding the toolchain fixed it for him.

That said, yes, the Git version of KOS has 4.8.2 as the GCC version, and it works fine for me. I haven't had any issues using it thus far, and being that the other person who has reported a similar problem wasn't using 4.8.x, I'm going to guess there's something else wrong that isn't related to GCC itself.


Top
 Profile  
 
PostPosted: Thu Dec 05, 2013 8:42 pm 
Offline
Insane DCEmu
Insane DCEmu
User avatar

Joined: Sat Jan 31, 2004 1:34 pm
Posts: 183
Location: Russia/Novosibirsk
Possible. With video modes have any strange problems for a long time, after start using 4.x in principle. This problem is very difficult to catch. May want to disable some optimizations?
As far as I understood from this topic, he eventually build it up on the old compilers of DCDev r4...

_________________
Image


Top
 Profile  
 
PostPosted: Thu Dec 05, 2013 9:11 pm 
Offline
The Crabby Overlord
The Crabby Overlord
User avatar

Joined: Mon May 27, 2002 9:31 am
Posts: 4435
It was my understanding that he got a newer compiler working, since he said that went OK on his machine itself, just not in a VM.


Top
 Profile  
 
PostPosted: Thu Dec 05, 2013 9:35 pm 
Offline
Insane DCEmu
Insane DCEmu
User avatar

Joined: Sat Jan 31, 2004 1:34 pm
Posts: 183
Location: Russia/Novosibirsk
Do not you think it is very strange? :)
I have tried to build code under linux and under cygwin, no difference. And how can there be a virtual machine is to blame I do not understand. I think he did something on that he did not pay attention unfortunately... Perhaps when linking something to interchange places for object files/libs or something. It's not fix a problem, it's just fortune.

_________________
Image


Top
 Profile  
 
PostPosted: Fri Dec 06, 2013 12:50 am 
Offline
Insane DCEmu
Insane DCEmu
User avatar

Joined: Sat Jan 31, 2004 1:34 pm
Posts: 183
Location: Russia/Novosibirsk
I'm just compile example on 4.8.2...

Code:
thd: pre-emption enabled, HZ=100
maple: active drivers:
    Dreameye (Camera): Camera
    Sound Input Peripheral: Microphone
    PuruPuru (Vibration) Pack: JumpPack
    VMU Driver: Clock, LCD, MemoryCard
    Mouse Driver: Mouse
    Keyboard Driver: Keyboard
    Controller Driver: Controller
  DMA Buffer at ac0b7fe0
vid_set_mode: 640x480 NTSC
fs_romdisk: mounting image at 0x8c0419b8 at /rd
dc-load console support enabled
maple: attached devices:
  B0: Dreamcast Controller          (01000000: Controller)
  B1: Visual Memory                 (0e000000: Clock, LCD, MemoryCard)
  B2: Visual Memory                 (0e000000: Clock, LCD, MemoryCard)
Use the DPAD to move the modifier square around (it starts at (320, 240))
Press Start to exit.
pvr: disabling vertical scaling for VGA
kmg_to_img: file '/rd/fruit.kmg' is incompatible:
   magic 00474d4b version 0 platform 1
Failed to load /rd/fruit.kmg
arch: shutting down kernel
maple: final stats -- device count = 3, vbl_cntr = 20, dma_cntr = 18
vid_set_mode: 640x480 NTSC
fs_romdisk: unmounting image at 0x8c0419b8 from /rd


Aaaaand 2 errors!
"disabling vertical scaling for VGA" (DC uses composite cable! Why he thinks that the cable VGA?)
"file '/rd/fruit.kmg' is incompatible" (Why it's hapen?)

I think that the network stack do not work for me for the same reason, since version 4.5.2.
I talked about this 2 year ago, I still have not found cause.
This is a complex glitch cause must be sought not in the specific code...
I have attached two examples, please try them on your hardware.


Attachments:
examples.7z [719.28 KiB]
Downloaded 16 times

_________________
Image
Top
 Profile  
 
PostPosted: Fri Dec 06, 2013 8:02 am 
Offline
The Crabby Overlord
The Crabby Overlord
User avatar

Joined: Mon May 27, 2002 9:31 am
Posts: 4435
For the time being, I've rolled back the GCC version used by dc-chain in the git repository until I have a chance to actually sit down and investigate what's going on.


Top
 Profile  
 
PostPosted: Fri Dec 06, 2013 9:14 am 
Offline
The Crabby Overlord
The Crabby Overlord
User avatar

Joined: Mon May 27, 2002 9:31 am
Posts: 4435
So, the problem about fruit.kmg being incompatible is actually an issue with an incompatibility between your host machine (PC) compiler and the code for vqenc. Basically, that particular tool assumes that you're using a machine where sizeof(unsigned long) == 4 and sizeof(unsigned int) == 4. This would not be true on a 64-bit machine compiling 64-bit binaries. I've fixed that in the git repository.


Top
 Profile  
 
PostPosted: Fri Dec 06, 2013 9:45 am 
Offline
DC Developer
DC Developer
User avatar

Joined: Fri Jun 18, 2010 7:29 pm
Posts: 460
BlueCrab wrote:
Well, first of all, you're not using an official version of newlib. I have no idea if that particular tarball you've downloaded has changed anything significant, but I wouldn't necessarily want to chance it. Get the real version of newlib, which the download.sh script in dc-chain will do for you (or at least point you to the right place to get it).

Second, there's a known issue with the bfd.texinfo file (which is actually why your build is failing) and newer versions of the tool used with it. This was discussed in this topic recently, and the solution is in this post specifically. To save you from having to click on the link, here's that post:
BlueCrab wrote:
That's a bug in the binutils texinfo files. I never build them with my builds, so I had never noticed that issue...

Re-run the unpack.sh script, then run the following two commands before doing the make:
Code:
sed -e 's/ @colophon/ @@colophon/' -e 's/doc@cygnus.com/doc@@cygnus.com/' binutils-2.23.2/bfd/doc/bfd.texinfo > binutils-2.23.2/bfd/doc/bfd.texinfo2
mv binutils-2.23.2/bfd/doc/bfd.texinfo2 binutils-2.23.2/bfd/doc/bfd.texinfo

This will be fixed in the git when I update the dc-chain Makefile again.


As stated in that post, it is fixed on the git repository, so any future releases of KOS (after 2.0.0) won't have that problem. :wink:
Just to be clear, this has nothing to do with using multiple jobs for make or with any GCC 4.8.x related bugs (which I haven't seen any of myself, but that's beside the point anyway, since you're not using GCC 4.8.x).


Thanks for the responses guys!

You are right as usual Mr. BlueCrab! Everything seems to be building right now. With any luck, I will post back later when I actually get to compiling some code under the new tool chain.

EDIT #1:
It seems to have hit another snag, specifically during build-sh4-gcc-pass2
Image
I have gotten things to work by disabling the objective c support
Line 56 in the Makefile, I had to change this
Code:
pass2_languages=c,c++,objc,obj-c++

to
Code:
pass2_languages=c,c++


Top
 Profile  
 
PostPosted: Fri Dec 06, 2013 11:36 am 
Offline
The Crabby Overlord
The Crabby Overlord
User avatar

Joined: Mon May 27, 2002 9:31 am
Posts: 4435
PH3NOM, Cygwin seems to have all kinds of nasty issues lately for some reason. That said, I haven't actually tried compiling 4.7.3 on Cygwin, but I did build 4.8.2 with it and it seemed to work without issue. Of course, unless you're planning on using Objective C, you're fine just working around it in the way you did. :wink:

Onto SWAT's issue... So, I'm pretty sure I have that VGA detection issue sorted out as well. I realized after I posted that I hadn't had any issues that I was running my DC off of a VGA box every time I've tested it with 4.8.2. So, I hooked it up via a composite cable and, sure enough, ran into the same bug. Anyway, it was a really silly issue, and thus easily fixed. Basically, there's a function that detects the video cable type attached by reading some registers. Well, those reads should have been done through a volatile pointer, which wasn't the case in the code. So, I fixed that and the problem disappeared. This might well have fixed that other person's issue too, although I suppose unless he comes back, we'll never know. :roll:


Top
 Profile  
 
PostPosted: Fri Dec 06, 2013 2:46 pm 
Offline
DC Developer
DC Developer
User avatar

Joined: Fri Jun 18, 2010 7:29 pm
Posts: 460
Had another tool chain error, on the fixup phase it threw an error about permission denied.
The solution was to run the Cygwin terminal as administrator, as I am using Windows 8.

Now, I have successfully built the dc-chain, and set the
Code:
. ./environ.sh
based on the /doc/environ.sh.sample but edited for my working directory.

Attempting to build KOS begins nicely, but then throws an error when it gets to building the sound code:
Image


Top
 Profile  
 
PostPosted: Fri Dec 06, 2013 2:51 pm 
Offline
The Crabby Overlord
The Crabby Overlord
User avatar

Joined: Mon May 27, 2002 9:31 am
Posts: 4435
64-bit Cygwin seems to be quite unstable. I'd recommend not using a 64-bit version of Cygwin until they fix the various problems it seems to have. See this topic for other issues that seem to happen earlier in the process on a 64-bit Cygwin.

If you want specifics of what to install in a 32-bit Cygwin to make things work, I posted what worked for me in this post. Mind you, I didn't actually use this Cygwin toolchain beyond compiling KOS (it was built on a machine at my work, so I didn't have a Dreamcast around to test it out more thoroughly), but it did work for building KOS when I used a 32-bit version of Cygwin.


Top
 Profile  
 
PostPosted: Fri Dec 06, 2013 8:46 pm 
Offline
DC Developer
DC Developer
User avatar

Joined: Fri Jun 18, 2010 7:29 pm
Posts: 460
BlueCrab wrote:
64-bit Cygwin seems to be quite unstable. I'd recommend not using a 64-bit version of Cygwin until they fix the various problems it seems to have. See this topic for other issues that seem to happen earlier in the process on a 64-bit Cygwin.

If you want specifics of what to install in a 32-bit Cygwin to make things work, I posted what worked for me in this post. Mind you, I didn't actually use this Cygwin toolchain beyond compiling KOS (it was built on a machine at my work, so I didn't have a Dreamcast around to test it out more thoroughly), but it did work for building KOS when I used a 32-bit version of Cygwin.


Okay, since this has been a logistical nightmare regarding 32bit/64bit, and I just got things working, I will post my own tutorial for how to build a working KOS 2.0 Dreamcast Tool Chain / Compiler.

Image

1.) Install Cygwin 32bit, setup-x86.exe from here http://cygwin.com/install.html
1.a) Click next twice, making sure to install from internet.
1.b) Chose install directory. I chose d:\cygwin. Click next.
1.c) Chose download directory. Does not effect install directory. Click next 3 times.
1.d) Chose packages to install. I chose Devel, Libs, and Utils. Your screen should look like this:
Image
1.e) Click next. When the download and install is completed ( this can take some time ), Cygwin should be good to go.

2.) Run 32bit Cygwin Terminal as administrator
Image

3.) Download kos-2.0.0-src.tar.gz from here http://sourceforge.net/projects/cadcdev/files/kallistios/2.0.0/
3.a) Create a folder /dc/ in your /Cygwin/usr/local/ folder
3.b) Create a folder /kos/ in your /Cygwin/usr/local/dc/ folder
3.c) Extract the contents of /kos-2.0.0-src/ into your /Cygwin/usr/local/dc/kos/ folder

4.) Install the DC-Chain
4.a) Download this patch I made thanks to BlueCrab and extract into your dc-chain folder
Attachment:
File comment: Makefile and patch for building KOS 2.0 on Cygwin 32bit / Windows 8
dc-chain-kos-2.0.zip [3.5 KiB]
Downloaded 42 times

4.b) In cygwin, navigate to your dc-chain folder. Since I installed the chain on my d:, my command is
Code:
cd d:/cygwin/usr/local/dc/kos/utils/dc-chain

4.c) Download the libs needed by dc-chain by running the script with this command:
Code:
./download.sh

4.d) Extract the libs needed by dc-chain by running the script with this command:
Code:
./unpack.sh

4.e) Patch the default kos install by running the script with this command:
Code:
./patch.sh

4.f) Build the dc-chain with this command
Code:
make


5.) Configure the environment and compile KOS
5.a) Download this environ.sh and extract into your /Cygwin/usr/local/dc/kos/ folder
Attachment:
File comment: eniron.sh for building kos 2.0
environ.sh.rar [1.4 KiB]
Downloaded 33 times

5.b) Navigate to your kos directory in Cygwin. Since I installed the chain on my d:, my command is
Code:
cd d:/cygwin/usr/local/dc/kos

5.c) Configure your environment by running this command:
Code:
. ./environ.sh

5.d) Build KOS by running the command
Code:
make


That's All! When kos is built, you are ready to start compiling your own code for the Dreamcast using Kos 2.0 and GCC 4.7.3.

I hope that helps!


Top
 Profile  
 
PostPosted: Fri Dec 06, 2013 9:19 pm 
Offline
Insane DCEmu
Insane DCEmu
User avatar

Joined: Sat Jan 31, 2004 1:34 pm
Posts: 183
Location: Russia/Novosibirsk
BlueCrab wrote:
Well, those reads should have been done through a volatile pointer, which wasn't the case in the code.

I thought so :) Thanks! But I think that this is not the end of gcc 4.8.3 bugs features ;)
I'll let you know if I find out something else.

_________________
Image


Top
 Profile  
 
PostPosted: Fri Dec 06, 2013 10:01 pm 
Offline
The Crabby Overlord
The Crabby Overlord
User avatar

Joined: Mon May 27, 2002 9:31 am
Posts: 4435
SWAT wrote:
BlueCrab wrote:
Well, those reads should have been done through a volatile pointer, which wasn't the case in the code.

I thought so :) Thanks! But I think that this is not the end of gcc 4.8.3 bugs features ;)
I'll let you know if I find out something else.
Yeah... I wouldn't be surprised if there aren't other places in the code that have the same problem. In fact, I'd actually be very surprised if there wasn't at least one other place where such things are happening. :lol:


Top
 Profile  
 
PostPosted: Thu Feb 12, 2015 10:17 am 
Offline
DCEmu Cool Newbie
DCEmu Cool Newbie

Joined: Mon Feb 09, 2015 8:06 am
Posts: 15
Where can I download dc-chain?

What I don't understand with DC development is how there is no real SDK for it, I mean like KOS but only 1 kit packed together with everything needes to make a DC game + a Manual (How to make a code a DC game)

It would make DC dev'ing way more handy.


Last edited by HUCAST on Thu Feb 12, 2015 1:40 pm, edited 1 time in total.

Top
 Profile  
 
PostPosted: Thu Feb 12, 2015 1:39 pm 
Offline
The Crabby Overlord
The Crabby Overlord
User avatar

Joined: Mon May 27, 2002 9:31 am
Posts: 4435
It's included in KOS -- in utils/dc-chain.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 23 posts ]  Go to page 1, 2  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