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 > mutlifile multiboot image

#9962 - johnny_north - Sat Aug 23, 2003 4:12 pm

I'm trying to build a multiboot image for the first time. I want to transfer this image from one gba to a second gba that is not using a cart. I've sucessfully managed to compile Jeff F's mbclient demo on dever's and I'd like to do the same with my own multiboot image.

I've included the following define in my gba.h file:
#define MULTIBOOT volatile const int __gba_multiboot = 1;

I'm using Jeff's Crt0 file. I've left the following line uncommented:
.equ __MultiBootInclude, 1

Here are my questions:

1) Jeff's instructions say to use MULTIBOOT at the top of the main file. This is a mutli file project though containing several .cpp and .h files. Do I need to use MULTIBOOT more that one time? Do I need to use it like this:
MULTIBOOT = what ever or just MULTIBOOT.

2) If creating a multiboot image is sucessful, should all of the code reside in the EWRAM portion when I look at the map file? ie all in the 0x02000000 area? After trying to compile this as a multiboot, the map file still shows code in the 0x08000000 area.

When I compile using one instace on MULTIBOOT in my main.cpp file, then that the image and transfer it, the stransfer seems to happen normally, but the second gba just displays a blank screen. The mb bin does execute by itself in VBA though, so I know there's nothing wrong with the code itself.

Can someone help me build this mb image correctly?

#9964 - tepples - Sat Aug 23, 2003 5:23 pm

If you want to "replicate" a loaded .mb binary to another GBA, use the standard multiboot procedure to send the currently running binary (starting at 0x02000000, and however long your binary is) to the other GB.

If you want a replication demo with source code, e-mail me.
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.

#9971 - johnny_north - Sat Aug 23, 2003 8:16 pm

Yes, I think I would like to know how to replicate a mb image and send it to another GBA. I'll e-mail you.

My primary purpose though is to find the correct manner of creating a gba binary that could be transfered from one gba to another and then executed on the 2nd gba. The master gba program is much larger than the 256k limit, so the multiboot version is a stripped down version sent to allow 2 player functionality.

I'm planning to bin2o the mb version and then include it in the master via make.

#10071 - djei-dot - Tue Aug 26, 2003 2:43 pm

johnny_north wrote:
1) Jeff's instructions say to use MULTIBOOT at the top of the main file. This is a mutli file project though containing several .cpp and .h files. Do I need to use MULTIBOOT more that one time? Do I need to use it like this:
MULTIBOOT = what ever or just MULTIBOOT.


Use only MULTIBOOT; .
The __gba_multiboot variable is supposed to be a global variable. So just put your multiboot instruction where you put other global variables. I had some troubles with this in the past, the place where the multiboot instruction should be is not very well documented...

#10091 - johnny_north - Tue Aug 26, 2003 7:34 pm

Thanks for the help guys. I solved the problem by doing the following:

Made sure that MULTIBOOT was at the top of the main.cpp file with only #include ?gba.h? appearing before it.

Made sure that main.o was the very first file to link after crt0.o, crtbegin.o and crtend.o.

Changed #define MULTIBOOT __gba_multiboot = 1 to just #define MULTIBOOT __gba_multiboot.

One or more of these things did the trick.