thd_schedule: idle task is the only thing left; exiting ????

If you have any questions on programming, this is the place to ask them, whether you're a newbie or an experienced programmer. Discussion on programming in general is also welcome. We will help you with programming homework, but we will not do your work for you! Any porting requests must be made in Developmental Ideas.
Post Reply
bfg
DCEmu Crazy Poster
DCEmu Crazy Poster
Posts: 31
Joined: Wed Oct 17, 2001 7:44 pm
Has liked: 0
Been liked: 0

thd_schedule: idle task is the only thing left; exiting ????

Post by bfg » Sat Nov 16, 2013 3:48 pm

Hello,

i'm trying to make an homebrew for Dreamcast. My test program work on NullDC but don't work on real DC, don't know why ... But the strangest problem is that the game crash after less than 1 minute with sometimes in the null DC debug :

thd_schedule: idle task is the only thing left; exiting

And before this message something that the program try to write in the bios/flash section of the DC ...

Can someone help me ? I can send my program, i really don't understand what i've done wrong ...
User avatar
BlueCrab
The Crabby Overlord
The Crabby Overlord
Posts: 5468
Joined: Mon May 27, 2002 11:31 am
Location: Sailing the Skies of Arcadia
Has liked: 3 times
Been liked: 24 times
Contact:

Re: thd_schedule: idle task is the only thing left; exiting

Post by BlueCrab » Sat Nov 16, 2013 3:57 pm

That error happens if your main thread somehow exits without taking the program with it, and thus there is nothing left for the thread scheduler to schedule. The most common way for that to happen is if you somehow call the thd_exit() function within your main thread. Otherwise, you've corrupted something pretty badly to cause that to happen.

Also, judging by that error message, it seems you're using a pretty old version of KOS (since that error is slightly differently worded now). I'd recommend updating your toolchain and using a more recent version of KOS, just to get all the newer bugfixes and whatnot.
bfg
DCEmu Crazy Poster
DCEmu Crazy Poster
Posts: 31
Joined: Wed Oct 17, 2001 7:44 pm
Has liked: 0
Been liked: 0

Re: thd_schedule: idle task is the only thing left; exiting

Post by bfg » Tue Nov 19, 2013 6:33 am

Ok, so i've installed KOS2.0 and toolchain, and the problem is always the same. So i've started from scratch, take the PNG example, compile and run it ... No crash.

I've reduce my own game to show only a picture (like the png example), and it crash !! The only différence was the content of the romdisk. In my romdisk i've had an empty directory and some files. I've just kept the needed files and trash the directory ...

And miracle ... no more crash and my "game" work on a real Dreamcast too. But ... instead of showing me a beautifull 640*480 screen, it show me 2 * screens (one to the left, one to the right) streched ... I've tryed some other resolution DM_640x480_NTSC_IL and DM_640x480_PAL_IL, and it's the same problem ... :( :( :( :(

I test my "game" on a SD card with Dreamshell on a PAL DC.
User avatar
BlueCrab
The Crabby Overlord
The Crabby Overlord
Posts: 5468
Joined: Mon May 27, 2002 11:31 am
Location: Sailing the Skies of Arcadia
Has liked: 3 times
Been liked: 24 times
Contact:

Re: thd_schedule: idle task is the only thing left; exiting

Post by BlueCrab » Tue Nov 19, 2013 8:18 am

I'd have to look at the code to have any idea what's wrong at this point.
bfg
DCEmu Crazy Poster
DCEmu Crazy Poster
Posts: 31
Joined: Wed Oct 17, 2001 7:44 pm
Has liked: 0
Been liked: 0

Re: thd_schedule: idle task is the only thing left; exiting

Post by bfg » Tue Nov 19, 2013 11:37 am

I'm not doing anything fabulous :)

I'm doing this :

vid_set_mode(DM_640x480_PAL_IL,PM_RGB565);
vid_border_color(0,0,0);
pvr_init_defaults();

What is strange is that NullDC say during Sega Logo and IP.bin image that the video is PAL480i50 and when the homebrew begin it says : VGA480p50 ... Weird no ?

Edit : In KOS 1.3 nulldc during the "game" is on PAL480i50 !!! Seems that KOS20 don't switch video mode and stay only in VGA ...
But, on real hardware i have a black screen ... great ...
User avatar
BlueCrab
The Crabby Overlord
The Crabby Overlord
Posts: 5468
Joined: Mon May 27, 2002 11:31 am
Location: Sailing the Skies of Arcadia
Has liked: 3 times
Been liked: 24 times
Contact:

Re: thd_schedule: idle task is the only thing left; exiting

Post by BlueCrab » Tue Nov 19, 2013 12:32 pm

KOS automatically detects what cable the system is connected to the TV with, and uses that to set the initial video mode. I'm guessing that NullDC emulates a VGA cable by default, hence why KOS would be setting things to VGA mode.

By the way, there is no such thing as KOS 1.3. What was going to be 1.3 was renamed to 2.0 along the way. I'm assuming that what you're calling KOS 1.3 was what was in something like the DC Dev ISO? If so, and if you didn't completely rebuild your toolchain when updating to KOS 2.0, you're likely going to have problems.

Also, nothing has changed with the normal path of the video initialization since KOS 1.2. Only two new features were added to the low-level video code since then: multi-buffered video when not using the PVR and making the vid_border_color() function return the old border color. Neither of those should be in play at all here.

The only thing I can guess is that you either have a broken toolchain or that something somewhere else in your code is wrong. If you can narrow down the problem such that you have a minimized, compilable example showing whatever problems you're having, I'd be happy to take a look this weekend sometime.
bfg
DCEmu Crazy Poster
DCEmu Crazy Poster
Posts: 31
Joined: Wed Oct 17, 2001 7:44 pm
Has liked: 0
Been liked: 0

Re: thd_schedule: idle task is the only thing left; exiting

Post by bfg » Tue Nov 19, 2013 1:34 pm

If you can PM me an email, i can send you an archive.

For information, my NullDC is configured on RGB (not VGA) and PAL for testing.
The KOS"1.3" is from an ISO disk found on the net.
For KOS2.0 i've rebuild everything from "scratch". New cygwin, git source code, compilation of toolchain, and compilation of KOS and KOS-addon. I've got problem on compiling toolchain with make. So after first "crash" i had to to make build-sh4 and make build-arm to work ... May be the patch hasn't be correctly set ... Really don't know what the patch do ...

So on KOS 2.0 i've test that :

Code: Select all

vid_mode_t mavid_mode;

	mavid_mode.generic = DM_640x480;
	mavid_mode.width = 640;
	mavid_mode.height = 640;
	mavid_mode.flags = VID_INTERLACE | VID_PAL;
	mavid_mode.cable_type = CT_ANY;
	mavid_mode.pm = 0;
	mavid_mode.scanlines = 0x270;
	mavid_mode.clocks = 0x35F;
	mavid_mode.bitmapx = 0xAE;
	mavid_mode.bitmapy = 0x2D;
	mavid_mode.scanint1 = 0x15;
	mavid_mode.scanint2 = 0x104;
	mavid_mode.borderx1 = 0x8D;
	mavid_mode.borderx2 = 0x34B;
	mavid_mode.bordery1 = 0x2C;
	mavid_mode.bordery2 = 0x26C;
	mavid_mode.fb_curr = 0;
	mavid_mode.fb_count = 1;
	mavid_mode.fb_base[0] = 0;
 	mavid_mode.fb_base[1] = 0;
	mavid_mode.fb_base[2] = 0;
	mavid_mode.fb_base[3] = 0;

	vid_set_mode_ex(&mavid_mode);
	vid_border_color(0,0,0);	
	pvr_init_defaults();
In nullDC it switch well on PAL480i50, but like KOS13 it make me a blank screen on real hardware ...

I test the iso with Dreamshell and a SD card ...

I can send you the source code, i must admit i'm totally lost on what is wrong ...
User avatar
BlueCrab
The Crabby Overlord
The Crabby Overlord
Posts: 5468
Joined: Mon May 27, 2002 11:31 am
Location: Sailing the Skies of Arcadia
Has liked: 3 times
Been liked: 24 times
Contact:

Re: thd_schedule: idle task is the only thing left; exiting

Post by BlueCrab » Tue Nov 19, 2013 2:14 pm

You should be able to post an archive here. If you can narrow the issue down to one source file that I can just compile and test, that would be best, though.

I don't see anything particularly wrong with how you're setting it up there (although, what you're doing should be exactly the same as vid_set_mode(DM_640x480_PAL_IL, PM_RGB555)), and I know that the last time I tried to use a 50hz display it worked fine on the hardware (although, my TV obviously didn't like it, since it is NTSC).
bfg
DCEmu Crazy Poster
DCEmu Crazy Poster
Posts: 31
Joined: Wed Oct 17, 2001 7:44 pm
Has liked: 0
Been liked: 0

Re: thd_schedule: idle task is the only thing left; exiting

Post by bfg » Thu Nov 21, 2013 12:32 pm

Ok, i've resolved the problem, stay seat, it's really weird ...

Ive take from scratch a KOS2.0 version and install it on my may PC. Compilation of toolchain and kos was OK.
So i've decided to do the same thing in my VMWare windows XPmachine. I've done exactly the same thing, and a "make" error appear like the first time ... Strange ...


So i've decided to install DCDev r4 on my main PC and not in my virtual machine. I compiled my game dans ... it works !!
So the binaries compiled in virtual machine are KO but the binaries compiled from my windows 7 + cygwin 32 works ...

So by by virtual machine !!!
User avatar
BlueCrab
The Crabby Overlord
The Crabby Overlord
Posts: 5468
Joined: Mon May 27, 2002 11:31 am
Location: Sailing the Skies of Arcadia
Has liked: 3 times
Been liked: 24 times
Contact:

Re: thd_schedule: idle task is the only thing left; exiting

Post by BlueCrab » Thu Nov 21, 2013 2:25 pm

Interesting... That's certainly quite strange.

Glad to see you got it working though. :grin:
Post Reply