Page 1 of 2 12 LastLast
Results 1 to 10 of 11

Thread: DC Dev R4 Dev-C++ Guide

                  
   
  1. #1
    DCEmu Old Pro Elven6's Avatar
    Join Date
    May 2006
    Posts
    1,158
    Rep Power
    58

    Default DC Dev R4 Dev-C++ Guide

    Heres a guide to get Dev-C++ to do things that would make it compatible with the Dreamcast file type. Im working from the old R2 guide, but im just making adjustments to bring it up to date.

    This is my first guide, so please be easy on it, unlike whats happened to the other guides, I will do my best to keep things updated and answer and questions you may have.

    Pre-Req:
    Dev C++
    DC Dev R4
    A Dreamcast (Duh!)

    Some minor knowledge in Computer Science will help ALOT.

    Note: This guide assumes the directory that Cygwin is installed in is c:\cygwin, for the sake of simplicity please install it in the default directory.

    1) Setting up the compiler
    a) Go to Tools Menu -> Compiler options
    b) Create a new compiler, name it Dreamcast
    c) Add this to the compiler commands : -O2 -DFRAME_POINTERS -ml -m4-single-only -fno-optimize-sibling-calls -D_arch_dreamcast -D_arch_sub_pristine -Wall-g -fno-builtin -fno-strict-aliasing -ml -m4-single-only -Wl,-Ttext=0x8c010000-nostartfiles -nostdlib
    d) Add this to the linker commands : -g -fno-builtin -fno-strict-aliasing -ml -m4-single-only -Wl,-Ttext=0x8c010000 -nostartfiles -nostdlib -Wall-g C:\cygwin\usr\local\dc\kos\kos\kernel\arch\dreamca st\kernel\startup.o -lstdc++ -Wl,--start-group -lkallisti -lc -lgcc -Wl,--end-group

    Note: Notice the -Wall-g command in both of the commands above, depending on the program you are using, it may require a space ex: -Wall -g, the hello world program show below will not, however other programs probably will, so be on the look out for it.

    2) Setting up the directories
    a) Directories Tab
    b) Binaries Sub-Tab
    c) Add the following:
    c:\cygwin\bin
    c:\cygwin\usr\local\dc\sh-elf\bin
    d) Libraries Sub-Tab
    e) Add the following directories:
    c:\cygwin\usr\local\dc\kos\kos\lib\dreamcast
    c:\cygwin\usr\local\dc\kos\kos\addons\lib\dreamcas t
    c:\cygwin\usr\local\dc\sh-elf
    f) C Includes Sub-Tab
    g) Add the following directories:
    c:\cygwin\usr\local\dc\kos\kos\include
    c:\cygwin\usr\local\dc\kos\kos-ports\include
    c:\cygwin\usr\local\dc\kos\kos\kernel\arch\dreamca st\include
    c:\cygwin\usr\local\dc\kos\kos\addons\include
    c:\cygwin\usr\local\dc\sh-elf\sh-elf\include
    h) C++ Includes Sub-Tab
    i) Add the following directories:
    c:\cygwin\usr\local\dc\kos\kos\include
    c:\cygwin\usr\local\dc\kos\kos-ports\include
    c:\cygwin\usr\local\dc\kos\kos\kernel\arch\dreamca st\include
    c:\cygwin\usr\local\dc\kos\kos\addons\include
    c:\cygwin\usr\local\dc\sh-elf\sh-elf\include
    c:\cygwin\usr\local\dc\sh-elf\include\c++\3.4.6

    3) Linking programs
    a) Go To The Programs Tab
    b) Set the following programs to these:
    gcc -> sh-elf-gcc.exe
    g++ -> sh-elf-g++.exe
    gprof -> sh-elf-gprof.exe

    4) The Hello World Test
    a) File -> New -> Project
    b) Empty Project
    c) Project -> Project Options
    d) Compiler Tab
    e) Select the Dreamcast compiler, then go to build options, at the bottom check the override box and change the extension to .elf ex: project1.exe -> project1.elf
    f) Click OK
    g) Project -> New File
    h) Type the following:
    Code:
    #include 
    KOS_INIT_FLAGS(INIT_DEFAULT | INIT_MALLOCSTATS);
    int main(int argc, char **argv) {
    printf("\nhello world\n\n");
    return 1;
    }
    i) File -> Save
    j) Save as main.c
    k) Execute -> Compile

    You should know have a .elf file in the folder you saved your project too. You can upload it to your Dreamcast via Dctool OR convert the file and run it in a emulator OR using Bootdreams to burn it to a disc. (Don't ask me how to convert because I don't know how either)

    So what do you think? If you liked it then please visit my blog (link is in my signature), if you have any questions please leave them below.
    Last edited by Elven6; March 13th, 2008 at 21:33.

  2. #2
    DCEmu Old Pro Elven6's Avatar
    Join Date
    May 2006
    Posts
    1,158
    Rep Power
    58

    Default

    I was hoping this could be moved to the guide section aswell, since I don't have access to post their.

  3. #3
    DCEmu Rookie
    Join Date
    Dec 2005
    Location
    Dorval,Quebec(Canada)
    Age
    27
    Posts
    137
    Rep Power
    55

    Default

    Thanks for the Guide Elven6.Its a lot easier to compile now.

  4. #4
    DCEmu Old Pro Elven6's Avatar
    Join Date
    May 2006
    Posts
    1,158
    Rep Power
    58

    Default

    Thanks, the fricken thing is giving me trouble compiling me code now! Even if the code is a Dreamcast port source!!!

    Wow thats weird, in the original post's source file, their are no spaces in Dreamcast, but in the submitted post it says Dreamcas t!

  5. #5
    DCEmu Rookie
    Join Date
    Dec 2005
    Location
    Dorval,Quebec(Canada)
    Age
    27
    Posts
    137
    Rep Power
    55

    Default

    When I copied the compiler commands it automatically made a space between "S" and "T".But now it works for me.
    There is space to fix: (SPOILER)
    Spoiler!
    Last edited by Bear_XI; March 16th, 2008 at 01:54.

  6. #6

    Default

    I wrote a program a long time ago that adds all this info to Dev-C++'s settings file but I didn't release it because I didn't know of a way to add the startup.o object linked in without needed it in your project's directory.

    I'll take a look at your tutorial and release it if it works like I'd like. I also have a Dreamcast project file I made that works with Dev-C++ also.

  7. #7
    DCEmu Old Pro Elven6's Avatar
    Join Date
    May 2006
    Posts
    1,158
    Rep Power
    58

    Default

    Quote Originally Posted by Bear_XI View Post
    When I copied the compiler commands it automatically made a space between "S" and "T".But now it works for me.
    There is space to fix: (SPOILER)
    Spoiler!

    Yea theirs a glitch in the forum thingy, in the original source that I was writing in the forum their was no space, but when ever I posted it it would show a space.

  8. #8
    DCEmu Newbie аlex's Avatar
    Join Date
    May 2006
    Location
    Russia/Siberia
    Age
    38
    Posts
    72
    Rep Power
    0

    Default

    I have translated this guide into Russian
    http://www.dcfan.net.ru/forum/showthread.php?t=1119

  9. #9
    DCEmu Coder Maturion's Avatar
    Join Date
    Aug 2007
    Location
    Munich, Germany
    Posts
    178
    Rep Power
    0

    Default

    Awesome! Also a nice translation.

  10. #10

Page 1 of 2 12 LastLast

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •