Sanity Check | Testing Setup with Hello World
- anothrguitarist
- DCEmu Freak
- Posts: 52
- https://www.artistsworkshop.eu/meble-kuchenne-na-wymiar-warszawa-gdzie-zamowic/
- Joined: Sat Feb 02, 2008 6:55 pm
- Has thanked: 0
- Been thanked: 0
Sanity Check | Testing Setup with Hello World
I posted the following topic on gamedev.net and was referred here:
"I ran the build script found at http://cadcdev.svn.sourceforge.net/view ... /dc-chain/ in order to setup my tools, but I want to test them out. KOS comes with a few example programs, namely a hello world, but I don't know whether I have to burn a CD-R, buy a broadband calbe, or if I can run a quick test on an emulator. I don't have a Dreamcast anymore, but I'm going to buy a pair soon. I'd like to be able to test my setup now on an emulator, however, does anyone know how I would do that?
NOTE: I have setup GCC 3.4.6 for the ARM and SH4 platforms and have obtained the newest snapshots of KOS and KOS ports. The KOS documentation says that I should not use anything beyond 3.0.4, but I suspect the readme is outdated. I downloaded the version of GCC that the build script required, so I think I should be fine."
If anyone could help out, I'd appreciate it.
"I ran the build script found at http://cadcdev.svn.sourceforge.net/view ... /dc-chain/ in order to setup my tools, but I want to test them out. KOS comes with a few example programs, namely a hello world, but I don't know whether I have to burn a CD-R, buy a broadband calbe, or if I can run a quick test on an emulator. I don't have a Dreamcast anymore, but I'm going to buy a pair soon. I'd like to be able to test my setup now on an emulator, however, does anyone know how I would do that?
NOTE: I have setup GCC 3.4.6 for the ARM and SH4 platforms and have obtained the newest snapshots of KOS and KOS ports. The KOS documentation says that I should not use anything beyond 3.0.4, but I suspect the readme is outdated. I downloaded the version of GCC that the build script required, so I think I should be fine."
If anyone could help out, I'd appreciate it.
-
- Damn Dirty Ape
- Posts: 5031
- Joined: Thu Nov 07, 2002 11:11 pm
- Location: Saugerties, NY
- Has thanked: 0
- Been thanked: 0
Re: Sanity Check | Testing Setup with Hello World
There are a few emulators. nullDC, lxdream, etc (there's a third, and I should know the name but I'm drawing a blank). You could try it in an emulator, but just because it works (or doesn't work) there doesn't mean the same is true for the real machine. If I remember correctly, "Hello World" won't do much for you (unless it uses the bios font drawing routines instead of printf). If you get the PNG example running you're probably good to go.
SDL needs to be patched if you're going to use it. The timer doesn't work right, the joystick needs a couple of small changes, and the sound code needs to be patched. There should be a patch for the joystick and sound stuff on the KOS sourceforge page. In the timer code, you'll just need to replace the stuff that refers to 'jiffies' with 'timer_ms_gettime_64();' to get it to work like you'd expect.
If you get a broadband adapter or coder's cable, you don't need to burn a CD each time you compile your program. You can use DCLoad/DCTool. Others can help you there--I burn discs. If you burn CDs, you can use a multisession disc. Download and burn a copy of DCHakker or Demomenu to use as a boot disc. It's fairly easy. You only need to burn whatever data files your program uses once per disc, and just keep replacing the executable each time you burn a new session.
That's about it. Your GCC should be good. That's about what everyone is using now--mine might be a couple of versions older, but 3.4.6 should work just fine.
SDL needs to be patched if you're going to use it. The timer doesn't work right, the joystick needs a couple of small changes, and the sound code needs to be patched. There should be a patch for the joystick and sound stuff on the KOS sourceforge page. In the timer code, you'll just need to replace the stuff that refers to 'jiffies' with 'timer_ms_gettime_64();' to get it to work like you'd expect.
If you get a broadband adapter or coder's cable, you don't need to burn a CD each time you compile your program. You can use DCLoad/DCTool. Others can help you there--I burn discs. If you burn CDs, you can use a multisession disc. Download and burn a copy of DCHakker or Demomenu to use as a boot disc. It's fairly easy. You only need to burn whatever data files your program uses once per disc, and just keep replacing the executable each time you burn a new session.
That's about it. Your GCC should be good. That's about what everyone is using now--mine might be a couple of versions older, but 3.4.6 should work just fine.
- anothrguitarist
- DCEmu Freak
- Posts: 52
- Joined: Sat Feb 02, 2008 6:55 pm
- Has thanked: 0
- Been thanked: 0
Re: Sanity Check | Testing Setup with Hello World
Thanks for the informative post. Testing the png example will suffice until a scrape up the money to buy a DC and broadband cable. I have a couple of additional question, however... Will I have to do anything special to set up code::blocks, or will I just have to tell it to use my newly built compilers? If it spits out the binaries, do I have to create a romdisk image in order for it to emulate properly or something like that?
anothrsignature, anothrsite, anothrguitarist
-
- Damn Dirty Ape
- Posts: 5031
- Joined: Thu Nov 07, 2002 11:11 pm
- Location: Saugerties, NY
- Has thanked: 0
- Been thanked: 0
Re: Sanity Check | Testing Setup with Hello World
I'm really not experienced with code::blocks or the emulators. I think that the emulators run iso images, but I'm not positive.
For Code::Blocks, fackue has created a package for Windows users that should have it all set up for you. If that doesn't meet your needs, there was a thread in this forum about getting it to work before fackue put together his package. The Search function should unearth it.
You are aware that a broadband adapter is probably going to set you back over $100, right? A coder's cable will probably be much cheaper. You can also develop without either, but you just won't be able to see anything printed to the console. I've been doing this for several years and have always just used a multi-session CD-R.
For Code::Blocks, fackue has created a package for Windows users that should have it all set up for you. If that doesn't meet your needs, there was a thread in this forum about getting it to work before fackue put together his package. The Search function should unearth it.
You are aware that a broadband adapter is probably going to set you back over $100, right? A coder's cable will probably be much cheaper. You can also develop without either, but you just won't be able to see anything printed to the console. I've been doing this for several years and have always just used a multi-session CD-R.
- anothrguitarist
- DCEmu Freak
- Posts: 52
- Joined: Sat Feb 02, 2008 6:55 pm
- Has thanked: 0
- Been thanked: 0
Re: Sanity Check | Testing Setup with Hello World
I think I'm going to start over because I hadn't built KOS after all. I've been forgetting to mention that I'm not on Windows, and I would prefer to use Ubuntu 7.10 with 32-bit architecture for my development. Do you think you could help me get started? Here's my plan:
- Download Stalin's build script to build my compilers.
- Download the latest version of KOS and KOS-ports, which I think can be found [url = "http://cadcdev.svn.sourceforge.net/view ... athrev=556"]here[/url]*
- Edit my environ.sh appropriately
- Build KOS
- Manually edit code::blocks
I don't think I will have a problem getting code::blocks set up correctly, but it can be easy to make a mistake. Stalin's build script made everything easy; I just need to make sure that I am using the right version of KOS. Additionally, I've been having a few problems getting KOS to build. I started editing source code and downloading different versions of various files from the repository, thus I think I should just start over in order to avoid errors down the road. Before I start, can you point me to an up-to-date tutorial that describes how to get the latest version of KOS and set everything up? I've searched, but I can't seem to find anything that is current.
*Is this the latest version of KOS, and is it possible to import a working copy? If not, do you know where to get the latest stable version of KOS and KOS-ports?
- Download Stalin's build script to build my compilers.
- Download the latest version of KOS and KOS-ports, which I think can be found [url = "http://cadcdev.svn.sourceforge.net/view ... athrev=556"]here[/url]*
- Edit my environ.sh appropriately
- Build KOS
- Manually edit code::blocks
I don't think I will have a problem getting code::blocks set up correctly, but it can be easy to make a mistake. Stalin's build script made everything easy; I just need to make sure that I am using the right version of KOS. Additionally, I've been having a few problems getting KOS to build. I started editing source code and downloading different versions of various files from the repository, thus I think I should just start over in order to avoid errors down the road. Before I start, can you point me to an up-to-date tutorial that describes how to get the latest version of KOS and set everything up? I've searched, but I can't seem to find anything that is current.
*Is this the latest version of KOS, and is it possible to import a working copy? If not, do you know where to get the latest stable version of KOS and KOS-ports?
anothrsignature, anothrsite, anothrguitarist
-
- Damn Dirty Ape
- Posts: 5031
- Joined: Thu Nov 07, 2002 11:11 pm
- Location: Saugerties, NY
- Has thanked: 0
- Been thanked: 0
Re: Sanity Check | Testing Setup with Hello World
See http://cadcdev.sourceforge.net/softprj/kos/dcsetup.php for info on building everything.
See http://cadcdev.sourceforge.net/softprj/kos/svn.php for info on checking out KOS from the svn repository.
And the thread on code::blocks is viewtopic.php?f=29&t=74733&hilit=+code+blocks
To set up your environ.sh file, you should just need to edit it to reflect the paths for where you put everything on your system.
See http://cadcdev.sourceforge.net/softprj/kos/svn.php for info on checking out KOS from the svn repository.
And the thread on code::blocks is viewtopic.php?f=29&t=74733&hilit=+code+blocks
To set up your environ.sh file, you should just need to edit it to reflect the paths for where you put everything on your system.
- anothrguitarist
- DCEmu Freak
- Posts: 52
- Joined: Sat Feb 02, 2008 6:55 pm
- Has thanked: 0
- Been thanked: 0
Re: Sanity Check | Testing Setup with Hello World
Thank you. I can't wait to set everything up a little later on ... Calculus beckons right now, but I'll let you know how things went.
anothrsignature, anothrsite, anothrguitarist
- henzenmann
- Insane DCEmu
- Posts: 186
- Joined: Wed Jul 12, 2006 4:58 pm
- Has thanked: 0
- Been thanked: 0
- Contact:
Re: Sanity Check | Testing Setup with Hello World
Current instructions are here:
http://www.dreamcast-scene.com/index.ph ... xToolchain
A script for completely automatic setup is here:
http://www.elliptique.net/wiki/index.ph ... evelopment
http://www.dreamcast-scene.com/index.ph ... xToolchain
A script for completely automatic setup is here:
http://www.elliptique.net/wiki/index.ph ... evelopment
- anothrguitarist
- DCEmu Freak
- Posts: 52
- Joined: Sat Feb 02, 2008 6:55 pm
- Has thanked: 0
- Been thanked: 0
Re: Sanity Check | Testing Setup with Hello World
Thank you!
EDIT: That was easy... now all I have to do is set up code::blocks. I'll let you know how it goes.
EDIT: That was easy... now all I have to do is set up code::blocks. I'll let you know how it goes.
anothrsignature, anothrsite, anothrguitarist
- anothrguitarist
- DCEmu Freak
- Posts: 52
- Joined: Sat Feb 02, 2008 6:55 pm
- Has thanked: 0
- Been thanked: 0
Re: Sanity Check | Testing Setup with Hello World
I'm having a little trouble setting up code::blocks. I followed the tutorial in the following thread and changed all of the directories to /home/john/kos-checkout/:
viewtopic.php?f=29&t=74733&hilit=+code+blocks
Yet for some reason, my build log prints the following (I have emphasized the problematic line):
"-------------- Build: Release in TestingKOS4 ---------------
Compiling: main.c
/home/john/Desktop/Programming/TestingKOS4/main.c: In function `main':
/home/john/Desktop/Programming/TestingKOS4/main.c:22: warning: implicit declaration of function `usleep'
Linking console executable: bin/Release/TestingKOS4
sh-elf-g++: C:cygwinusrlocaldckoskoskernelarchdreamcastkernelstartup.o: No such file or directory
Process terminated with status 1 (0 minutes, 0 seconds)
0 errors, 1 warnings"
I'm not sure why it is looking in C:cygwinusrlocal etcetera because I thought that I had changed the directories appropriately. If anyone could help out, I'd appreciate it.
viewtopic.php?f=29&t=74733&hilit=+code+blocks
Yet for some reason, my build log prints the following (I have emphasized the problematic line):
"-------------- Build: Release in TestingKOS4 ---------------
Compiling: main.c
/home/john/Desktop/Programming/TestingKOS4/main.c: In function `main':
/home/john/Desktop/Programming/TestingKOS4/main.c:22: warning: implicit declaration of function `usleep'
Linking console executable: bin/Release/TestingKOS4
sh-elf-g++: C:cygwinusrlocaldckoskoskernelarchdreamcastkernelstartup.o: No such file or directory
Process terminated with status 1 (0 minutes, 0 seconds)
0 errors, 1 warnings"
I'm not sure why it is looking in C:cygwinusrlocal etcetera because I thought that I had changed the directories appropriately. If anyone could help out, I'd appreciate it.
anothrsignature, anothrsite, anothrguitarist
-
- Damn Dirty Ape
- Posts: 5031
- Joined: Thu Nov 07, 2002 11:11 pm
- Location: Saugerties, NY
- Has thanked: 0
- Been thanked: 0
Re: Sanity Check | Testing Setup with Hello World
It looks like you didn't change this part:
pnpbios wrote: Go to the second primary tab labled Linker. Add the folowing lines to the Other Options box.Code: Select all
-g -fno-builtin -fno-strict-aliasing -ml -m4-single-only -Wl,-Ttext=0x8c010000 -nostartfiles -nostdlib C:\cygwin\usr\local\dc\kos\kos\kernel\arch\dreamcast\kernel\startup.o -Wl,--start-group -lkallisti -lc -lgcc -Wl,--end-group
- anothrguitarist
- DCEmu Freak
- Posts: 52
- Joined: Sat Feb 02, 2008 6:55 pm
- Has thanked: 0
- Been thanked: 0
Re: Sanity Check | Testing Setup with Hello World
That was it, but I could have sworn that I had changed the directory. All is working great so far. I'm pretty confident that KOS is set up correctly, but I still need to test it on an emulator. I should probably build the png test program as well. Thanks again for your help.
anothrsignature, anothrsite, anothrguitarist
- anothrguitarist
- DCEmu Freak
- Posts: 52
- Joined: Sat Feb 02, 2008 6:55 pm
- Has thanked: 0
- Been thanked: 0
Re: Sanity Check | Testing Setup with Hello World
Having a few problems. Firstly, when I tried the png example, the linker cannot find png.h or zlib.h, which is odd because I have told the linker to look in the appropriate directories. So I decided to try the other suggestion found on the following thread because I would like to use c++ as well:
viewtopic.php?f=29&t=74733&hilit=+code+blocks
I tried using the gnu_wrapper, but now I receive the following output when trying to build the program that worked earlier:
-------------- Build: Release in TestingKOS7 ---------------
Compiling: main.c
exec: 52: -Wall: not found
Process terminated with status 2 (0 minutes, 0 seconds)
0 errors, 0 warnings
Any help would be appreciated.
viewtopic.php?f=29&t=74733&hilit=+code+blocks
I tried using the gnu_wrapper, but now I receive the following output when trying to build the program that worked earlier:
-------------- Build: Release in TestingKOS7 ---------------
Compiling: main.c
exec: 52: -Wall: not found
Process terminated with status 2 (0 minutes, 0 seconds)
0 errors, 0 warnings
Any help would be appreciated.
anothrsignature, anothrsite, anothrguitarist
- henzenmann
- Insane DCEmu
- Posts: 186
- Joined: Wed Jul 12, 2006 4:58 pm
- Has thanked: 0
- Been thanked: 0
- Contact:
Re: Sanity Check | Testing Setup with Hello World
That probably means that you did not set up or "source" your environ.sh correctly, so the wrappers cannot fill in the variable for the compiler binary (meaning the command line then looks like "-Wall ..." instead of "sh-elf-gcc -Wall ...", leading to the error you got).
Also, if you had set up your env. correctly, simply running "make" in the png example directory should work perfectly. From the compiler output you could then also see the exact preprocessor/compiler/linker options that work.
Also, if you had set up your env. correctly, simply running "make" in the png example directory should work perfectly. From the compiler output you could then also see the exact preprocessor/compiler/linker options that work.
- anothrguitarist
- DCEmu Freak
- Posts: 52
- Joined: Sat Feb 02, 2008 6:55 pm
- Has thanked: 0
- Been thanked: 0
Re: Sanity Check | Testing Setup with Hello World
Are you saying that I did not set up my environ.sh correctly before I built KOS?
anothrsignature, anothrsite, anothrguitarist
-
- Damn Dirty Ape
- Posts: 5031
- Joined: Thu Nov 07, 2002 11:11 pm
- Location: Saugerties, NY
- Has thanked: 0
- Been thanked: 0
Re: Sanity Check | Testing Setup with Hello World
If you were able to compile KOS, then no. Each time you start compiling Dreamcast programs in a new terminal window, you need to type 'source /path/to/environ.sh' to load it and set all the variables to the proper values. You will need to do something similar in code::blocks.
- anothrguitarist
- DCEmu Freak
- Posts: 52
- Joined: Sat Feb 02, 2008 6:55 pm
- Has thanked: 0
- Been thanked: 0
Re: Sanity Check | Testing Setup with Hello World
Thanks for clearing that up, you guys are very resourceful.
anothrsignature, anothrsite, anothrguitarist
- emptythought
- DC Developer
- Posts: 2015
- Joined: Wed Jan 30, 2002 9:14 am
- Location: UNITED STATES NRN
- Has thanked: 0
- Been thanked: 0
- Contact:
Re: Sanity Check | Testing Setup with Hello World
I don't wanna hijack this thread but -- where is this defined at?OneThirty8 wrote:In the timer code, you'll just need to replace the stuff that refers to 'jiffies' with 'timer_ms_gettime_64();' to get it to work like you'd expect.
EDIT: Oooh, It's timer_ms_gettime64().
And when you say the joystick code needs to be patched, is the patch on SourceForge all that's needed?
Last edited by emptythought on Sun Feb 10, 2008 4:51 pm, edited 1 time in total.
-
- Damn Dirty Ape
- Posts: 5031
- Joined: Thu Nov 07, 2002 11:11 pm
- Location: Saugerties, NY
- Has thanked: 0
- Been thanked: 0
Re: Sanity Check | Testing Setup with Hello World
It's in kos-ports/SDL/base/src/timer/dc/SDL_systimer.c:fackue wrote:I don't wanna hijack this thread but -- where is this defined at?OneThirty8 wrote:In the timer code, you'll just need to replace the stuff that refers to 'jiffies' with 'timer_ms_gettime_64();' to get it to work like you'd expect.
Code: Select all
void SDL_StartTicks(void)
48 {
49 /* Set first ticks value */
50 start = jiffies;
51 }
52
53 Uint32 SDL_GetTicks(void)
54 {
55 return((jiffies-start)*1000/HZ);
56 }
Yes.fackue wrote: And when you say the joystick code needs to be patched, is the patch on SourceForge all that's needed?
- anothrguitarist
- DCEmu Freak
- Posts: 52
- Joined: Sat Feb 02, 2008 6:55 pm
- Has thanked: 0
- Been thanked: 0
Re: Sanity Check | Testing Setup with Hello World
Alright, it looks like I'm still having problems. I was able to build the png example from the make file, and I was able to build the hello world example in code::blocks. However, I thought I was able to build the png from code::blocks as well, but I was wrong. I'm getting the following errors
I've tried various things to fix this, such as linking the project to libz.a found in kos/addons/libs, but I'm unable to figure out the problem. I've added the romdisk_boot folder to my project as well, so that shouldn't be the source of my problem.. It seems to me that I am missing an include, included the png header incorrectly, or am not linking to the right libraries. Can anyone help me out?
Code: Select all
-------------- Build: Release in ProjectScholar ---------------
Compiling: main.c
Linking console executable: bin/Release/ProjectScholar.elf
obj/Release/main.o: In function `back_init':
/home/john/Desktop/Programming/Project Scholar/main.c:27: undefined reference to `_png_to_texture'
obj/Release/main.o: In function `font_init':
/home/john/Desktop/Programming/Project Scholar/main.c:54: undefined reference to `_wfont'
obj/Release/main.o: In function `text_init':
/home/john/Desktop/Programming/Project Scholar/main.c:69: undefined reference to `_zlib_getlength'
/home/john/Desktop/Programming/Project Scholar/main.c:69: undefined reference to `_gzopen'
/home/john/Desktop/Programming/Project Scholar/main.c:69: undefined reference to `_gzread'
/home/john/Desktop/Programming/Project Scholar/main.c:69: undefined reference to `_gzclose'
obj/Release/main.o:(.data+0x0): undefined reference to `_romdisk_boot'
collect2: ld returned 1 exit status
Process terminated with status 1 (0 minutes, 0 seconds)
7 errors, 0 warnings
anothrsignature, anothrsite, anothrguitarist