Manually configuring Code::Blocks svn

This guide will walk you through the steps on manually configuring Code::Blocks to compile Dreamcast applications by using Dreamcast Development Envrionment ISO R2 and higher (a.k.a dependent).

  1. Open Code::Blocks svn.
  2. In the menu bar goto Settings -> Compiler and debugger...
  3. Select GNU GCC Compiler from the Selected compiler drop-down box, click Copy and type Dreamcast sh-elf (dependent) then click OK.
  4. Now under the main tab Compiler settings click the sub-tab Other options and enter the following into the textbox:

    -ml -m4-single-only -g -fno-builtin -fno-optimize-sibling-calls -fno-strict-aliasing -D_arch_dreamcast -D_arch_sub_pristine -Wall -Os

  5. Under the main tab Linker settings enter the following into the Other linker options texbox:

    -ml -m4-single-only -Wall -nostdlib -nostartfiles -lstdc++ -Wl,-Ttext=0x8c010000 -Wl,--start-group -lkallisti -lc -lgcc -Wl,--end-group

  6. Under the main tab Search directories click the sub-tab Compiler and add the following folders:

    C:\cygwin\usr\local\dc\kos\kos-ports\include
    C:\cygwin\usr\local\dc\kos\kos\include
    C:\cygwin\usr\local\dc\kos\kos\kernel\arch\dreamcast\include
    C:\cygwin\usr\local\dc\kos\kos\addons\include
    C:\cygwin\usr\local\dc\sh-elf\include\c++\3.4.6


    Click the Linker sub-tab and add the following folders:

    C:\cygwin\usr\local\dc\kos\kos\lib\dreamcast
    C:\cygwin\usr\local\dc\kos\kos\addons\lib\dreamcast


  7. Under the main tab Toolchain executables set the Compiler's installation directory to:

    C:\cygwin\usr\local\dc\sh-elf

    and change the programs to:

    C compiler: sh-elf-gcc.exe
    C++ compiler: sh-elf-g++.exe
    Linker for dynamic libs: sh-elf-g++.exe
    Linker for static libs: sh-elf-ar.exe

    (the rest can be left as-is or blanked)

    Click the Additional Paths sub-tab and add the following folder:

    C:\cygwin\bin

  8. Under the main tab Other settings click on Advanced options... then the Commands tab. In the Available commands list click on Link object files to console execuatable. Under Command line macro, replace the text in the textbox with the following:

    $linker $libdirs -o $exe_output "C:\cygwin\usr\local\dc\kos\kos\kernel\arch\dreamcast\kernel\startup.o" $link_objects $link_resobjects $link_options $libs

  9. Click OK and once again then close Code::Blocks to save the Dreamcast compiler settings.

  10. Copy the dreamcast folder from this archive to C:\Program Files\CodeBlocks\share\CodeBlocks\templates\wizard.
  11. Open C:\Program Files\CodeBlocks\share\CodeBlocks\templates\wizard\config.script in a text editor and add RegisterWizard(wizProject,     _T("dreamcast"),    _T("Dreamcast application"), _T("Dreamcast")); after // project wizards:

    It should look like this when done:

        //
        // project wizards
        //
        RegisterWizard(wizProject,     _T("dreamcast"),    _T("Dreamcast application"), _T("Dreamcast"));
        RegisterWizard(wizProject,     _T("empty"),        _T("Empty project"),         _T("Console"));


  12. Open Code::Blocks and goto Tools -> Configure tools....
  13. Click Add and enter the following:

    Name: genromfs (dep)
    Execuatable: C:\cygwin\usr\local\dc\kos\kos\utils\genromfs\genromfs.exe
    Parameters: -f "${PROJECT_DIR}romdisk.img" -d "${PROJECT_DIR}romdisk" -v -x .svn
    Launching options: Launch tool visible (without output redirection)

    Click OK, then click Add once more and add the following information:

    Name: bin2odc (dep)
    Execuatable: C:\cygwin\usr\local\dc\kos\kos\utils\bin2o\bin2odc.exe
    Parameters: "${PROJECT_DIR}romdisk.img" "${PROJECT_DIR}romdisk.o"
    Launching options: Launch tool visible (without output redirection)

  14. Close Code::Blocks and copy bin2odc.exe to C:\cygwin\usr\local\dc\kos\kos\utils\bin2o\.
  15. Code::Blocks is now setup.