SweetnTasty
December 29th, 2005, 23:36
Hi all, just thought I'd let you know how you can easily set up Dev-C++ with the KOS/GCC environment that comes with DC Dev R2 ( or any other "normal" KOS/GCC setup for that matter )
Remember to replace "D:\DC_DEV\" with your cygwin base dir (eg. c:\cygwin\ for most of you)
Oh and err.. I suck at writing guides, so stick with it
1) Setting up the compiler
a) Tools Menu -> Compiler options
b) Create a new compiler if you wish ( I only use Dev-C++ for DC devving, so i use the default )
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 D:\DC_DEV\usr\local\dc\kos\kos\kernel\arch\dreamca st\kernel\startup.o -lstdc++ -Wl,--start-group -lkallisti -lc -lgcc -Wl,--end-group
2) Setting up the directories
a) Directories Tab
b) Binaries Sub-Tab
c) Add the following directories:
D:\DC_DEV\bin
D:\DC_DEV\usr\local\dc\sh-elf\bin
d) Libraries Sub-Tab
e) Add the following directories:
d:\dc_dev\usr\local\dc\kos\kos\lib\dreamcast
d:\dc_dev\usr\local\dc\kos\kos\addons\lib\dreamcas t
D:\DC_DEV\usr\local\dc\sh-elf
f) C-Includes Sub-Tab
g) Add the following directories:
d:\dc_dev\usr\local\dc\kos\kos\include
d:\dc_dev\usr\local\dc\kos\kos-ports\include
d:\dc_dev\usr\local\dc\kos\kos\kernel\arch\dreamca st\include
d:\dc_dev\usr\local\dc\kos\kos\addons\include
D:\DC_DEV\usr\local\dc\sh-elf\sh-elf\include
h) C-Includes Sub-Tab
i) Add the following directories:
d:\dc_dev\usr\local\dc\kos\kos\include
d:\dc_dev\usr\local\dc\kos\kos-ports\include
d:\dc_dev\usr\local\dc\kos\kos\kernel\arch\dreamca st\include
d:\dc_dev\usr\local\dc\kos\kos\addons\include
D:\DC_DEV\usr\local\dc\sh-elf\sh-elf\include
D:\DC_DEV\usr\local\dc\sh-elf\include\c++\3.4.2
3) Setting up programs
a) 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) Testing
a) File -> New -> Project
b) Empty Project
c) Project -> Project Options
d) Compiler Tab
e) Select the compiler you set up
f) Click OK
g) Project -> New File
h) Type the following:
#include <kos.h>
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
l) Now just upload it to your DC as you normally would ( eg. dctool -b 115200 -x test.elf )
Hope this helps someone :)
EDIT: Jumped the gun a bit, for some reason gpp didnt like asm code if a certain gcc switch wasnt set..
Remember to replace "D:\DC_DEV\" with your cygwin base dir (eg. c:\cygwin\ for most of you)
Oh and err.. I suck at writing guides, so stick with it
1) Setting up the compiler
a) Tools Menu -> Compiler options
b) Create a new compiler if you wish ( I only use Dev-C++ for DC devving, so i use the default )
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 D:\DC_DEV\usr\local\dc\kos\kos\kernel\arch\dreamca st\kernel\startup.o -lstdc++ -Wl,--start-group -lkallisti -lc -lgcc -Wl,--end-group
2) Setting up the directories
a) Directories Tab
b) Binaries Sub-Tab
c) Add the following directories:
D:\DC_DEV\bin
D:\DC_DEV\usr\local\dc\sh-elf\bin
d) Libraries Sub-Tab
e) Add the following directories:
d:\dc_dev\usr\local\dc\kos\kos\lib\dreamcast
d:\dc_dev\usr\local\dc\kos\kos\addons\lib\dreamcas t
D:\DC_DEV\usr\local\dc\sh-elf
f) C-Includes Sub-Tab
g) Add the following directories:
d:\dc_dev\usr\local\dc\kos\kos\include
d:\dc_dev\usr\local\dc\kos\kos-ports\include
d:\dc_dev\usr\local\dc\kos\kos\kernel\arch\dreamca st\include
d:\dc_dev\usr\local\dc\kos\kos\addons\include
D:\DC_DEV\usr\local\dc\sh-elf\sh-elf\include
h) C-Includes Sub-Tab
i) Add the following directories:
d:\dc_dev\usr\local\dc\kos\kos\include
d:\dc_dev\usr\local\dc\kos\kos-ports\include
d:\dc_dev\usr\local\dc\kos\kos\kernel\arch\dreamca st\include
d:\dc_dev\usr\local\dc\kos\kos\addons\include
D:\DC_DEV\usr\local\dc\sh-elf\sh-elf\include
D:\DC_DEV\usr\local\dc\sh-elf\include\c++\3.4.2
3) Setting up programs
a) 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) Testing
a) File -> New -> Project
b) Empty Project
c) Project -> Project Options
d) Compiler Tab
e) Select the compiler you set up
f) Click OK
g) Project -> New File
h) Type the following:
#include <kos.h>
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
l) Now just upload it to your DC as you normally would ( eg. dctool -b 115200 -x test.elf )
Hope this helps someone :)
EDIT: Jumped the gun a bit, for some reason gpp didnt like asm code if a certain gcc switch wasnt set..