Instructions for DCFreeDev compiler setup

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
q_006
Mental DCEmu
Mental DCEmu
Posts: 415
https://www.artistsworkshop.eu/meble-kuchenne-na-wymiar-warszawa-gdzie-zamowic/
Joined: Thu Oct 10, 2002 7:18 pm
Has thanked: 0
Been thanked: 0
Contact:

Instructions for DCFreeDev compiler setup

Post by q_006 »

This is for setting up your Dev-C++ or DCFreeDev compiler settings so you can get your DC Dev going as quickly as possible.

in Dev-C++ go to Project, then Project Options you'll see this screen:
Image

now just staying in the same menu you'll just go from tab to tab, following the screen shots below:
Image
Image
Image

here, the complete code for the compiler is:

Code: Select all

-Wall -g -ml -m4-single-only -O2 -fno-builtin -fno-strict-aliasing -fomit-frame-pointer -fno-optimize-sibling-calls
-D_arch_dreamcast
and for the linker is:

Code: Select all

-ml -m4-single-only -nostartfiles -nostdlib -Wl,-Ttext=0x8c010000
startup.o
-lkallisti -lgcc
Image

here you just have to make sure the output file has the extension ".elf"
Image

add, browse, and choose "dreamcast.mak". the contents of the file will look like this:

Code: Select all

romdisk.img:
	genromfs -f romdisk.img -d romdisk -v

romdisk.o: romdisk.img
	bin2o romdisk.img romdisk romdisk.o
	copy c:\dev-cpp\sh-elf\templates\startup.o
	md romdisk

all-before: romdisk.o
	
all-after : 

	sh-elf-objcopy -O binary $(BIN) temp.bin
	c:\dev-cpp\chankast\emu.bat temp.bin
unless you are using a coder's cable. then the file looks like this:

Code: Select all

all-after : 
	dc-tool -t COM1 -b 115200 -x $(BIN)
Image

from here just go to Execute, Clean, then Compile and you should be good to go.

to make Chankast work you'll have to get the necessary files.
believe me it should take you 5 minutes tops to Google for them.
Last edited by q_006 on Thu Jan 06, 2005 1:02 pm, edited 1 time in total.
q_006
Mental DCEmu
Mental DCEmu
Posts: 415
Joined: Thu Oct 10, 2002 7:18 pm
Has thanked: 0
Been thanked: 0
Contact:

Post by q_006 »

if anyone has any questions, comments, corrections, or suggestions, please feel free to PM or post.
I'll get to it as soon as possible.
dospro
Insane DCEmu
Insane DCEmu
Posts: 147
Joined: Thu Dec 30, 2004 7:12 pm
Has thanked: 0
Been thanked: 0
Contact:

Post by dospro »

Hi. after having the worst times trying all the way of configuring this dev thing, i still cant make it work.

So far i have got this.

Having already configured as the post says.
I have the following errors:
sh-elf-gcc.exe C:\Dev-Cpp\proyectos\dc\t2\sh-elf-gcc.exe
startup.o: No such file or directory.
C:\Dev-Cpp\proyectos\dc\t2\Makefile.win
[Build Error] [Project2.elf] Error 1

which i cant fix.
What can i do now?
User avatar
elefas
DC Developer
DC Developer
Posts: 75
Joined: Thu Jan 22, 2004 2:16 pm
Location: Greece
Has thanked: 0
Been thanked: 0
Contact:

Post by elefas »

@dospro: you have to copy startup.o to your project directory. Do a search in c:\dev-cpp\ to find startup.o and copy it to your directory.

I used DCFreeDev for porting a supervision emulator. the outputed elf works fine but the bin (both scrambled and unscrambled) do not work, only freeze or restart DC. Tried both sh-elf-objcopy and elf2bin to produce the bin from the elf, the commands show no errors but DC cannot run them!!!! Please help!!! I released the emulator because I had tested only the elf which worked but I get many complains that the bins don't work!!!!
__.:/|D|C|___eLef@s___|S|E|G|A|\:.__
User avatar
Quzar
Dream Coder
Dream Coder
Posts: 7497
Joined: Wed Jul 31, 2002 12:14 am
Location: Miami, FL
Has thanked: 4 times
Been thanked: 9 times
Contact:

Post by Quzar »

sh-elf-objcopy -O binary -R .stack blah.elf blah.bin

that might fix your problem.
"When you post fewer lines of text than your signature, consider not posting at all." - A Wise Man
User avatar
elefas
DC Developer
DC Developer
Posts: 75
Joined: Thu Jan 22, 2004 2:16 pm
Location: Greece
Has thanked: 0
Been thanked: 0
Contact:

Post by elefas »

thanks quzar but I have already tried that and it doesn't work :cry:

Problem now solved! :D
__.:/|D|C|___eLef@s___|S|E|G|A|\:.__
q_006
Mental DCEmu
Mental DCEmu
Posts: 415
Joined: Thu Oct 10, 2002 7:18 pm
Has thanked: 0
Been thanked: 0
Contact:

Post by q_006 »

well how did you solve it?
User avatar
Masen
DCEmu Freak
DCEmu Freak
Posts: 68
Joined: Mon Mar 28, 2005 1:35 pm
Has thanked: 0
Been thanked: 0

Post by Masen »

yes plz post it , cause i have exactly the same problem !!!!!!!

So pleaze !!!! :D [/b]
User avatar
Masen
DCEmu Freak
DCEmu Freak
Posts: 68
Joined: Mon Mar 28, 2005 1:35 pm
Has thanked: 0
Been thanked: 0

Post by Masen »

^^
User avatar
elefas
DC Developer
DC Developer
Posts: 75
Joined: Thu Jan 22, 2004 2:16 pm
Location: Greece
Has thanked: 0
Been thanked: 0
Contact:

Post by elefas »

Just use this makefile:

dreamcast.mak

Code: Select all



LIBS2 = $(patsubst startup.o, ,$(LIBS))
BIN2 = $(patsubst %.elf,%.el2,$(BIN))
RBIN = $(patsubst %.elf,%.bin,$(BIN))
FBIN = 1st_read.bin

## Classic Dreamcast.MAL
clean-RD :
	rm -f romdisk.img romdisk.o

romdisk.img : clean-RD
	genromfs -f romdisk.img -d romdisk -v

romdisk.o : romdisk.img
	bin2o romdisk.img romdisk romdisk.o

all-before : romdisk.o
## END Classic Dreamcast.MAL

$(BIN2) : $(BIN)
	$(CC) startup.o $(LINKOBJ) -o $(BIN2) $(LIBS2)

Strip : $(BIN2)
	sh-elf-strip $(BIN2)

$(RBIN) : Strip
	sh-elf-objcopy -O binary $(BIN2) $(RBIN)

all-after : $(RBIN)
	scramble $(RBIN) $(FBIN) 
the trick is in the line: $(CC) startup.o $(LINKOBJ) -o $(BIN2) $(LIBS2)

hope it helps.
(all credits go to scherzo)
__.:/|D|C|___eLef@s___|S|E|G|A|\:.__
Strapping Scherzo
DC Developer
DC Developer
Posts: 2285
Joined: Fri Feb 21, 2003 7:37 am
Location: Chicago, IL
Has thanked: 0
Been thanked: 1 time
Contact:

Post by Strapping Scherzo »

Wha?! What did I do? Is that from an old post of mine when I was using Dev-C++?
Image
User avatar
elefas
DC Developer
DC Developer
Posts: 75
Joined: Thu Jan 22, 2004 2:16 pm
Location: Greece
Has thanked: 0
Been thanked: 0
Contact:

Post by elefas »

Well I can't really remember where I found it, but it was surelly you who solved this problem!!! :lol: And thanks to you I was able to publish superDCision :wink:
__.:/|D|C|___eLef@s___|S|E|G|A|\:.__
User avatar
JMD
Insane DCEmu
Insane DCEmu
Posts: 234
Joined: Wed Dec 11, 2002 6:45 am
Location: A Melody From a Past Life Keeps Pulling Me Back
Has thanked: 0
Been thanked: 0
Contact:

Post by JMD »

Look like my Makefile (You probably found it here) but there is no copyright on it ;)

Scherzo found the linking order tricks : credits go to him :)
Image
There is the theory of Möbius. A twist in the fabric of space where time becomes a loop
User avatar
elefas
DC Developer
DC Developer
Posts: 75
Joined: Thu Jan 22, 2004 2:16 pm
Location: Greece
Has thanked: 0
Been thanked: 0
Contact:

Post by elefas »

Ok Ok, so credits go to all of us!!!!! :D :D :D
__.:/|D|C|___eLef@s___|S|E|G|A|\:.__
User avatar
chronofurb
DCEmu Freak
DCEmu Freak
Posts: 79
Joined: Wed Jan 07, 2004 11:33 pm
Location: Earth
Has thanked: 0
Been thanked: 0

about kos

Post by chronofurb »

I installed dcfreedev version 1.1, and ran the updater to update it to 1.2, should I have to set anyting else before I start coding, I tried one of the examples, but it gives the error kos.h is not found. I even included kos.h in my environment variables that windows keeps. Anyone have ideas what I am doing wrong here...
User avatar
pnpbios
DCEmu Freak
DCEmu Freak
Posts: 96
Joined: Mon May 16, 2005 5:28 pm
Has thanked: 0
Been thanked: 0

Post by pnpbios »

Awsome tutorial. I follow it step by step using The version 1.2 devkit, and i keep getting the following error.

cc1plus.exe: invalid option `l'
cc1plus.exe: invalid option `4-single-only'

any ideas? If i take them out, it spews out the missing kos functions.
User avatar
pnpbios
DCEmu Freak
DCEmu Freak
Posts: 96
Joined: Mon May 16, 2005 5:28 pm
Has thanked: 0
Been thanked: 0

Post by pnpbios »

ah, nevermind.
Post Reply