gbadev.org forum archive

This is a read-only mirror of the content originally found on forum.gbadev.org (now offline), salvaged from Wayback machine copies. A new forum can be found here.

Coding > Linking a binary File to my Rom

#23075 - Lord - Sat Jul 03, 2004 2:01 pm

Hi, what I'm doing is the following(using gcc):

Code:

ld $(LDFLAGS) -o $(ROM_NAME).elf $(O_FILES) -l stdc++ -l gcc -l c -b binary mybinfile.bin


I basically simply want to append mybinfile.bin to my Rom; Now what happens is that the data ends up somewhere arround 0x03000000 (WRam);
Now I'd like to have it in the Game Rom(0x08000000
), but I cant get that to work.
Using something like -Tdata 0x08000000 hastn given me any usable results as well, so I've come to ask here.
So, does anyone know what Flags I have to use?

Thanks in advance,

Lord.

#23084 - tepples - Sat Jul 03, 2004 4:55 pm

If you just want to append a data file to your ROM and then find it from within the program, and not "link" it in the traditional sense, then have a look at my GBFS tools.
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.

#23087 - Lord Graga - Sat Jul 03, 2004 5:12 pm

tepples wrote:
<shameless plug> If you just want to append a data file to your ROM and then find it from within the program, and not "link" it in the traditional sense, then have a look at my GBFS tools</shameless plug>.


I couldn't resist, and I'm just kidding ;)


Anyway, I usually include binaries by using OBJCOPY. Check out WinterMutes makefiles over at his page.

#23779 - Lord - Wed Jul 21, 2004 12:52 pm

*Pushing dead Thread*

Well, I didnt reply for some time, because I simply forgot about this :P
Now that I've remembered, after having a look at the makefile LG posted, I'm where I was at the begining. I dont get it :P

I've been playing around a bit and found out that if I use


ld $(LDFLAGS) -o $(ROM_NAME).elft $(O_FILES) -l stdc++ -l gcc -l c
ld -o $(ROM_NAME).elf $(ROM_NAME).elft -Tdata 0x8000000 -b binary mybinfile.bin


I at least have my binary data somewhere in rom data.

But its position changes, eg when I declare new variables in my c code.

How am I suposed to konw, in my code, where the binary data lands?

And LG, I'd be glad if you could give me a specific example :)

Thanks,

Lord ^^