#134259 - profoX - Thu Jul 12, 2007 2:50 am
Tonight I have tried GBA programming for the very first time.
KDevelop (the IDE I use) had an excellent sample for GBA that I could crosscompile and link (after some messing around with devkitadvance)
The compiled rom runs great in VisualBoyAdvance, but I can't get the rom to run on my EZF Flash Advance flash cart.
Please look at this screenshot to see the problem:
The left window (VisualBoyAdvance) displays what it has to display, while the right window (EZF Advance Client) gives an error in the statusbar claiming "It's NOT a valid GBA ROM" when I try to load it.
http://wesley.debianbox.be/images/gba_rom_problem.png
Anyone have ANY idea what could be wrong? This is my first take at creating roms, so maybe it's just something obvious.
I hope you guys know something.. Thanks!
edit: solved -- I just switched over to a more modern toolchain and tried out a new example file :) worked like a charm
Last edited by profoX on Thu Jul 12, 2007 9:32 pm; edited 1 time in total
#134260 - phonymike - Thu Jul 12, 2007 3:04 am
did you fix the header? the rom must contain the 'nintendo logo' at the beginning of the rom. there's a checksum that needs to be calcluated also in the header. look in the tools under header on this site. I use a program called gba rom manipulator, it does all that. you need to compile and fix the header each time, or you can embed the data in your crt0.s file, but it's easier to just run a program to do it.
#134263 - profoX - Thu Jul 12, 2007 3:18 am
I tried this application: http://gbadev.org/tools.php?showinfo=76 (GBA Rom Fixer 1.03) but it's still not working eventhough the program says it has fixed my rom. (because the problem you advised gives me an error)
#134265 - profoX - Thu Jul 12, 2007 3:32 am
According to a perl script I found, only the logo got changed by using the previous program, I used the same script to also fix the checksum and I also changed the rom name, because there were weird characters instead of a name. Now this is what I get after fixing the rom when running the check script:
Quote: |
wesley@ch:/media/exthome/dev/gba$ ./ht.pl -cl hidone.gba
rom name : Test Game
logo: ok!
checksum: ok!
|
But EZFA still does not want to accept the rom :( Any more ideas?
Thanks so far!
#134269 - Ant6n - Thu Jul 12, 2007 4:36 am
do you do any console print in visual boy advance (agbprint?). It'd crash a rom running on hardware afaik.
EDIT: oh, your flash program doesnt even accept your file.
what toolchain are you using? could you post the code/rom?
#134279 - SimonB - Thu Jul 12, 2007 6:55 am
Doesnt the EZFA client require you to name your compiled rom .gba instead of .bin etc?
Simon
#134341 - Lynx - Thu Jul 12, 2007 4:49 pm
Are you talking about the EZF Advance III Flash Cart?
_________________
NDS Homebrew Roms & Reviews
#134347 - profoX - Thu Jul 12, 2007 5:10 pm
Hi, guys. Thanks for your help so far.
SimonB: it is named .gba so that can't be the problem
Ant6n: phonymike has tried to help me a bit through email, but he's on vacation now, so I'll just explain to everyone here what he said (I hope he doesn't mind copy/paste of his mail)
Quote: |
you need a file called crt0.s, did you delete it? your rom has
straight arm7 code from the beginning to end. what it needs to be a true gba
rom is the very first instruction is a jump (branch) that jumps past 189
bytes to the rest of the code. those 189 bytes have the nintendo logo (when
you turn the gba on, it says nintendo at the bottom, that image is stored at
the beginning of the game.) you also need a header which has information
such as a title, revision number, company id code etc. you need to get
crt0.s (it's an assembly file) have it assembled (into crt0.o) and placed at
the very beginning of your rom. right now if you fix the header, it will
overlay your code and make it corrupt. check the docs, and find out about
crt0.s or crt0.o. ask in the forum, maybe coding or beginners about that
file and getting it into your project (with KDvelop.)
I looked at your source and see you do have the crt0.o in the main folder.
that needs to be linked with your main.o (main.c compiles into main.o.) you
deving on linux or smth? I can't tell where your main makefile is. |
To answer his last question: yes, I am devving on linux. And my main makefile is located above the src/ directory.
The crt0.o file (that I created with arm-agb-elf-as) is on my computer somewhere. I use -T"location of the file" as a linker flag to refer to the file (actually, the crt0.o file I use is also included in my source code, one directory higher than src/)
This is the error I get when I try to configure with the -T"location of crt0.o" flag:
Quote: |
configure:2778: checking for C compiler default output file name
configure:2805: arm-agb-elf-gcc -nostartfiles -Tcrt0.o conftest.c >&5
/usr/local/bin/../lib/gcc-lib/arm-agb-elf/3.1/../../../../arm-agb-elf/bin/ld:crt0.o:1: ignoring invalid character `\177' in expression
/usr/local/bin/../lib/gcc-lib/arm-agb-elf/3.1/../../../../arm-agb-elf/bin/ld:crt0.o:1: ignoring invalid character `\001' in expression
/usr/local/bin/../lib/gcc-lib/arm-agb-elf/3.1/../../../../arm-agb-elf/bin/ld:crt0.o:1: ignoring invalid character `\001' in expression
/usr/local/bin/../lib/gcc-lib/arm-agb-elf/3.1/../../../../arm-agb-elf/bin/ld:crt0.o:1: ignoring invalid character `\001' in expression
/usr/local/bin/../lib/gcc-lib/arm-agb-elf/3.1/../../../../arm-agb-elf/bin/ld:crt0.o:1: parse error
collect2: ld returned 1 exit status
configure:2808: $? = 1
configure:2846: result:
configure: failed program was:
| /* confdefs.h. */
| #define PACKAGE_NAME ""
| #define PACKAGE_TARNAME ""
| #define PACKAGE_VERSION ""
| #define PACKAGE_STRING ""
| #define PACKAGE_BUGREPORT ""
| #define PACKAGE "hi"
| #define VERSION "0.1"
| /* end confdefs.h. */
|
| int
| main ()
| {
|
| ;
| return 0;
| }
configure:2853: error: C compiler cannot create executables
|
I think the crt0.o file is corrupt or wasn't compiled right?
Anyway, here is the sourcecode for everyone to mess with:
http://wesley.debianbox.be/files/hi.zip
All sourcecode was generated automatically by KDevelop.
Toolchain I use: KDevelop (IDE) + everything in devkitadvance. I compile directly from KDevelop, which first configures a Makefile and then compiles the file using arm-agb-elf-gcc -- I hope that's what you meant with toolchain
Last edited by profoX on Thu Jul 12, 2007 5:14 pm; edited 1 time in total
#134349 - profoX - Thu Jul 12, 2007 5:12 pm
Nope, just version 1 from [REMOVED].. A red cartridge..
Like this: [Piracy related URL removed - MOD]
edit: heh, piracy related? I guess you can't trust Google Images nowadays. Anyway, you guys probably know what I mean... It's a red cartridge.. search "ezf advance" in Google Images and you'll see it.
#134364 - Lynx - Thu Jul 12, 2007 8:01 pm
Just checking because the EZF Advance III was a complete piece of crap. ;)
_________________
NDS Homebrew Roms & Reviews
#134370 - keldon - Thu Jul 12, 2007 8:27 pm
I had this problem; most homebrew games have faulty headers. This was confirmed by the moderator of the EZFlash IRC chat room. Try copying using the EZFlash client, which will fix the header for you.
#134372 - profoX - Thu Jul 12, 2007 8:31 pm
Ok, you guys. I have fixed stuff myself by just discarding devkitadvance and installing/configuring devkitARM + libgba :) works fine -- it even fixes the rom header automatically! Great!!
Thanks for all the help, though!
I didn't know the GBA-Dev community was so big and helpful.