Search the web
Sign In
New User? Sign Up
gbadev
? Already a member? Sign in to Yahoo!

Yahoo! Groups Tips

Did you know...
Real people. Real stories. See how Yahoo! Groups impacts members worldwide.

Best of Y! Groups

   Check them out and nominate your group.
Having problems with message search? Fill out this form to ensure your group is one of the first to be migrated to the new message search system.

Messages

  Messages Help
Advanced
C++ example working on Mappy, but not hardware (using MBV2)   Message List  
Reply | Forward Message #9140 of 15019 |
Resolution: C++ example working on Mappy, but not hardware (using MBV2)

Jeff F. suggested that I should use the linker's -Map command-line
option to generate a map file. From that I was able to figure out
that the code ended up at address 0x08000000 instead of 0x02000000
(as it should for multiboot). When I initially added the variable
declaration I did it as follows: "volatile const int __gba_multiboot
= 1;" (I had to add the "= 1" for it to compile without errors in C++
mode). Even when I did this the variable still wouldn't show up in
the map file. Eventually I removed the "const" from the declaration
and suddenly the variable appeared in the map file and the code
appeared at address 0x02000000. It seems to me that the C++ compiler
treats a const variable similar to a #define, and doesn't actually
assign a memory address to it (some sort of optimization). When I
removed the "const" from the declaration the "= 1" assignment was
also no longer needed. So simply adding "int __gba_multiboot;"
(*without* the "const") to the main C++ file did the trick. Thanks a
lot, Jeff, for pointing me in the right direction.


--- In gbadev@y..., "gbatag" <Tiaan_Geldenhuys@h...> wrote:
> Hi,
>
> Over the past few days I've been trying to get some C++ code to
> compile and were able to do so. The code runs fine on the Mappy
> emulator but when transferring the multiboot image to my GBA using
> the MBV2 cable I simply get a blank screen once the transfer
> completes. What could be the problem?
>
> After looking through some group posts and browsing the web, I
> eventually found some useful information about compiling C++ code
for
> the GBA in the "Newbie's Guide to GameBoy Advance Development", by
> VerticalE. There's a section providing some details on the CPPTest
> example, written by Jaap Suter if I'm not mistaken, which I used to
> figure out how to get my C++ code to compile. Following that
> example's documentation to the letter, which also includes the
source
> code, I can produce a binary that have this behavior: it runs on
the
> emulator but not on the hardware. The example simply sets up
> graphics Mode 3, paints the screen blue and then has an endless
> loop. It uses Jeff Frohwein's startup code (based on crt0.S v1.25)
> with the ".equ __MultiBootInclude, 1" and ".equ __CPPSupport, 1"
> lines defined. It doesn't define the __gba_multiboot variable in
> main.cpp, but even doing so doesn't make any difference.
>
> When compiling my own application as a pure C application it works
> just fine on both hardware and emulator – it uses graphics Mode 0.
> But when calling this code from a basic C++ class and then
compiling
> it, it just won't work on real hardware. In my application I've
used
> Jeff's latest crt0.S & Linkscript code and am using the crtbegin.o
&
> crtend.o files that come with the latest version of DevKitAdvance.
>
> Could it be a memory alignment issue, or maybe a name mangling
issue
> with the __gba_multiboot variable? What other differences could
> there be? Any help would be appreciated.
>
> Thanks,
> Tiaan.





Fri Jan 4, 2002 1:37 am

gbatag
Offline Offline
Send Email Send Email

Forward
Message #9140 of 15019 |
Expand Messages Author Sort by Date

Hi, Over the past few days I've been trying to get some C++ code to compile and were able to do so. The code runs fine on the Mappy emulator but when...
gbatag
Offline Send Email
Jan 3, 2002
6:05 pm

I had problems doing multiboot with gcc, its ugly but it worked, see the dhrygccmb.zip file at http://www.dwelch.com/gba/dhry.htm for the makefile Here is the...
gba@...
Send Email
Jan 3, 2002
6:34 pm

Jeff F. suggested that I should use the linker's -Map command-line option to generate a map file. From that I was able to figure out that the code ended up at...
gbatag
Offline Send Email
Jan 4, 2002
3:03 am
Advanced

Copyright © 2009 Yahoo! Inc. All rights reserved.
Privacy Policy - Terms of Service - Guidelines - Help