Linking order
-
- DC Developer
- Posts: 2285
- https://www.artistsworkshop.eu/meble-kuchenne-na-wymiar-warszawa-gdzie-zamowic/
- Joined: Fri Feb 21, 2003 7:37 am
- Location: Chicago, IL
- Has thanked: 0
- Been thanked: 1 time
- Contact:
Linking order
Does startup.o have to be the first in the list of object files when linking? I'm just curious if this is my booting problem.
![Image](http://img159.imageshack.us/img159/5720/pub9.4651202415174E+27.png)
-
- DC Developer
- Posts: 2285
- Joined: Fri Feb 21, 2003 7:37 am
- Location: Chicago, IL
- Has thanked: 0
- Been thanked: 1 time
- Contact:
It was not booting and I fixed it. It was the link order. Note to all programmers: startup.o must come first in the link command. It doesn't matter for serial upload because dc-load already has it's startup code in memory. I'm uploading a new pre-pre-pre-alpha of Sper Famicast to my website right now.
![Image](http://img159.imageshack.us/img159/5720/pub9.4651202415174E+27.png)
- Arqueiro
- DCEmu Nutter
- Posts: 785
- Joined: Tue Jul 02, 2002 9:29 am
- Has thanked: 0
- Been thanked: 0
- Contact:
good woek man !!! i see the news about this emulator ! vary good job!scherzo wrote:It was not booting and I fixed it. It was the link order. Note to all programmers: startup.o must come first in the link command. It doesn't matter for serial upload because dc-load already has it's startup code in memory. I'm uploading a new pre-pre-pre-alpha of Sper Famicast to my website right now.
do u already found one to program the ASM code ? this is a hard part of your work...
sorry but i dont know ASM
![Sad :(](./images/smilies/icon_e_sad.gif)
but i like to help you in other things if you want !
3d graphics and visualization ?
http://www.arquiteturadigital.com
http://www.arquiteturadigital.com
-
- DC Developer
- Posts: 2285
- Joined: Fri Feb 21, 2003 7:37 am
- Location: Chicago, IL
- Has thanked: 0
- Been thanked: 1 time
- Contact:
I'm using Dev-C++ configured to use a precompiled sh4 toolchain and KOS libs. I picked them up from links in this thread:BlackAura wrote:Are you using a custom makefile for this, by any chance? If you're using a makefile like the ones the KOS examples use, it's taken care of by the makefile template thingy that the makefile includes.
http://www.dcemulation.org/phpBB/viewtopic.php?t=38963
Dev-C++ lists the object files on the linker's command line in the order the source files were added to the project AND it puts the custom parameters for the linker (where I had startup.o) at the end of command line. So I just had to write a post step in the makefile that linked with startup.o first. So I'm actually linking twice now, overwriting the first elf. Maybe I can stop Dev-C++ from doing it's link but it's pretty harmless as it is right now.
Once I figure out all these little quirks of using Dev-C++ as an IDE for Dreamcast Development, I'd like to release a zip of my Dev-C++ so that people can setup a development environment on windows in just about one step.
![Image](http://img159.imageshack.us/img159/5720/pub9.4651202415174E+27.png)
-
- DC Developer
- Posts: 462
- Joined: Wed Oct 17, 2001 7:44 pm
- Has thanked: 0
- Been thanked: 0
I managed to get it to work, but there seems to be different issues for different people. I bet it might be a ntfs/fat32/win98 or win2k/xp type of compatability issue. I got it to work by setting up the Dreamcast compiler like it says, except using mingw32-make.exe instead of regular make.exe in dev-cpp's bin folder. I also had to remove the rm lines from the dreamcast.mak files, because the rm lines were giving an error about nothing to remove, even though it should've just warned.. or something. After I had done all that, it worked quite well, actually.
-
- DCEmu Veteran
- Posts: 850
- Joined: Mon Sep 01, 2003 11:12 am
- Location: NC/Iraq
- Has thanked: 0
- Been thanked: 0
- Contact:
Code: Select all
all-before:
rm -f romdisk.img romdisk.o
genromfs -f romdisk.img -d romdisk -v
bin2o romdisk.img romdisk_boot romdisk.o
[b]all-after :[/b]
# dc-tool -e -x $(BIN)
sh-elf-gcc startup.o <blah blah blah, object files>-o $(BIN) -L"C:/Dev-Cpp/dclib" -ml -m4-single-only -nostartfiles -nostdlib -Wl,-Ttext=0x8c010000 romdisk.o -lmp3 -loggvorbisplay -lparallax -lkmg -lpng -ljpeg -lkglx -lkallisti -lz -lm -lgcc -lk++
sh-elf-strip $(BIN)
- JMD
- 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:
Thanks WillSams
I tried many times but I it's got a pbm with the Windows style folder :
error :
I think I don't have the same make.exe than you because the syntax
don't run on my install
I must use :
I made few weeks ago a doc (sorry it's in french) of how to install Dev-C++ with l@Cible
I tried many times but I it's got a pbm with the Windows style folder :
Code: Select all
sh-elf-gcc.exe startup.o main.o Text.o utils.o myGraphLib.o Game.o Pause.o HScore.o Menu.o -o "shangai.elf" -L"C:/Program Files/Dev-Cpp/dclib" -ml -m4-single-only -nostartfiles -nostdlib -Wl,-Ttext=0x8c010000 startup.o romdisk.o -loggvorbisplay -lpng -lz -lm -lkallisti -lgcc
Code: Select all
make.exe: *** No rule to make target `/Program', needed by `main.o'. Stop.
Code: Select all
all-before:
rm -f romdisk.img romdisk.o
genromfs -f romdisk.img -d romdisk -v
bin2o romdisk.img romdisk_boot romdisk.o
Code: Select all
dreamcast.mak:2: *** missing separator. Stop.
Code: Select all
romdisk.img:
genromfs -f romdisk.img -d romdisk -v
romdisk.o: romdisk.img
bin2o romdisk.img romdisk romdisk.o
all-before: romdisk.o
-
- DCEmu Veteran
- Posts: 850
- Joined: Mon Sep 01, 2003 11:12 am
- Location: NC/Iraq
- Has thanked: 0
- Been thanked: 0
- Contact:
-
- DC Developer
- Posts: 529
- Joined: Wed Oct 17, 2001 7:44 pm
- Location: Texas
- Has thanked: 0
- Been thanked: 0
- Contact:
Didn't realize that it was under dev-cpp, I only used it as an editor then used the command line under mingw to compile ![Smile :)](./images/smilies/icon_e_smile.gif)
because the -L is the location of the lib directory not that will eliminate the space problem between Program and Files
maybe use
or
![Smile :)](./images/smilies/icon_e_smile.gif)
shouldn't it besh-elf-gcc.exe startup.o main.o Text.o utils.o myGraphLib.o Game.o Pause.o HScore.o Menu.o -o "shangai.elf" -L"C:/Program Files/Dev-Cpp/dclib" -ml -m4-single-only -nostartfiles -nostdlib -Wl,-Ttext=0x8c010000 startup.o romdisk.o -loggvorbisplay -lpng -lz -lm -lkallisti -lgcc
Code: Select all
sh-elf-gcc.exe startup.o main.o Text.o utils.o myGraphLib.o Game.o Pause.o HScore.o Menu.o -o "shangai.elf" -ml -m4-single-only -nostartfiles -nostdlib -Wl,-Ttext=0x8c010000 startup.o romdisk.o -L"C:/Program Files/Dev-Cpp/dclib" -loggvorbisplay -lpng -lz -lm -lkallisti -lgcc
maybe use
Code: Select all
c:\\Program\ Files\\Dev-Cpp\\dclib
Code: Select all
C:/Program\ Files/Dev-Cpp/dclib
- JMD
- 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:
Ok,
I found solution to my makefile pbm. I googled and find this.
It was a stupid pbm beetween tab and spaces so I edit the file with notepad
.
Here is my new makefile :
When I use a variable, I've no more pbm with long file names.
And the end of my compilation log :
We can see the 2 compils, the strip, the objcopy and the scramble.
The second elf (el2 : the elf after the strip) work's fine with the coder cable and DC-Tool.
BUT (I begin to feel a bit bored now
),
When I use DemoMenu to run my file (I use the DCEvolution Xmas Disc's one), no file runs.
I tried the bin, the 1st...bin and the el2 (file after strip).
Where is the pbm ? In the DemoMenu version, In the compil order ?
Have you got any ideas ?
Thanks
I found solution to my makefile pbm. I googled and find this.
It was a stupid pbm beetween tab and spaces so I edit the file with notepad
![Smile :)](./images/smilies/icon_e_smile.gif)
Here is my new makefile :
Code: Select all
LIBS2 = $(patsubst startup.o, ,$(LIBS))
BIN2 = $(patsubst %.elf,%.el2,$(BIN))
RBIN = $(patsubst %.elf,%.bin,$(BIN))
FBIN = 1st_read.bin
romdisk.img :
genromfs -f romdisk.img -d romdisk -v
romdisk.o : romdisk.img
bin2o romdisk.img romdisk romdisk.o
all-before : romdisk.o
$(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)
And the end of my compilation log :
Code: Select all
sh-elf-gcc.exe main.o Text.o utils.o myGraphLib.o Game.o Pause.o HScore.o Menu.o -o "Maqiupai.elf" -L"C:/Program Files/Dev-Cpp/dclib" -ml -m4-single-only -nostartfiles -nostdlib -Wl,-Ttext=0x8c010000 startup.o romdisk.o -loggvorbisplay -lpng -lz -lm -lkallisti -lgcc -nostdlib
sh-elf-gcc.exe startup.o main.o Text.o utils.o myGraphLib.o Game.o Pause.o HScore.o Menu.o -o Maqiupai.el2 -L"C:/Program Files/Dev-Cpp/dclib" -ml -m4-single-only -nostartfiles -nostdlib -Wl,-Ttext=0x8c010000 romdisk.o -loggvorbisplay -lpng -lz -lm -lkallisti -lgcc -nostdlib
sh-elf-strip Maqiupai.el2
sh-elf-objcopy Maqiupai.el2 Maqiupai.bin
scramble Maqiupai.bin 1st_read.bin
Execution terminated
The second elf (el2 : the elf after the strip) work's fine with the coder cable and DC-Tool.
BUT (I begin to feel a bit bored now
![Crying or Very sad :cry:](./images/smilies/icon_cry.gif)
When I use DemoMenu to run my file (I use the DCEvolution Xmas Disc's one), no file runs.
I tried the bin, the 1st...bin and the el2 (file after strip).
Where is the pbm ? In the DemoMenu version, In the compil order ?
Have you got any ideas ?
Thanks