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 > Newbie Question

#3479 - silvir - Tue Feb 25, 2003 6:15 pm

Hello all, I've got a problem and I don't really know what to do, maybe you could help? The problem is that the compiler does not work, I've got Devkitadv unzipped into the C:/devkitadv directory, and a file named new.c in that directory. The new.c file is ready to be converted, but that's where my problem is. I don't know how to change it into binary/gba type file. Please give me easy to understand step-by-step instructions, it would be greatly appreciated. This has frustrated me for a while and I know it's just some stupid thing... Thanks in advance.

#3481 - tepples - Tue Feb 25, 2003 7:24 pm

Before you use Devkit Advance for Windows OS, you should be familiar with the Windows command prompt and with environment variables.

First make sure that C:\devkitadv\bin is in your PATH. How to set this up differs across different versions of Microsoft Windows operating systems, and you may have to reboot after setting it. Then go to a command prompt and type the following commands:

gcc new.c -o 1.elf
objcopy -O binary 1.elf 1.gba
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.

#3482 - silvir - Tue Feb 25, 2003 7:45 pm

Alright, first off, is the command prompt also called the ms-dos command prompt? If so, then I know where it's at, otherwise I haven't the slightest clue. And how would you set the path for either Windows ME or Windows XP? Either one would be fine becuase I have two different computers running on different OS. Thanks for your help so far.

#3485 - tepples - Tue Feb 25, 2003 8:44 pm

In Windows ME and other Windows 9x operating systems, the command prompt is called "MS-DOS Prompt".

If you don't want to add devkitadv permanently to your path, you can run a batch file, which I call gbadev.bat, every time you start a command prompt:
Code:

@echo off
echo Setting environment variables for GBA development
set PATH=c:\devkitadv\bin;%PATH%
c:
cd \gbadev

(I keep all my GBA projects in the \gbadev folder)

Make sure to put it in c:\windows\command (under win9x) or c:\windows\system32 (under win2k/xp) so that the command prompt can find it.
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.

#3486 - silvir - Tue Feb 25, 2003 9:00 pm

I'm getting an error now: Invalid directory Here's all the steps I've done so far:

-I've made the batch file
-Moved the new.c file into c:/devkitadv/gbadev
-The batch file is in c:/windows/command

I'm not sure what I've done wrong, thanks (yet again) for helping me out.

#3496 - tepples - Wed Feb 26, 2003 3:16 am

silvir wrote:
I'm getting an error now: Invalid directory

Good. "Invalid directory" instead of "Bad command or file name" means the batch file is being found, but the 'cd' instruction inside the batch file is not finding the folder.

Quote:
-Moved the new.c file into c:/devkitadv/gbadev

The batch file says \gbadev not \devkitadv\gbadev. Please either correct the batch file to match your folder structure (by changing the path supplied to 'cd') or correct your folder structure to match the batch file.
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.

#3517 - silvir - Wed Feb 26, 2003 2:43 pm

Now when I run it, it changes the path, now when I try to put in the code you gave me it pops up with this:
Virtual memory exhausted: Invalid argument
I'm guessing this means I need more virtual memory (duh), and I did try to free up some space, but I still get this error. Do you have an amount of virtual memory that I should be shooting for?
_________________
[Images not permitted - Click here to view it]

#3520 - tepples - Wed Feb 26, 2003 4:26 pm

silvir wrote:
Now when I run it, it changes the path, now when I try to put in the code you gave me it pops up with this:
Virtual memory exhausted: Invalid argument
I'm guessing this means I need more virtual memory (duh), and I did try to free up some space, but I still get this error. Do you have an amount of virtual memory that I should be shooting for?

According to http://devkitadv.sourceforge.net/ You need to download "agb-win-patch-r4".

One problem with this patch: When you convert a large binary file to a .c file, GCC eats up a lot of memory when compiling large constant arrays. Workarounds:

  • Convert your binary assets to assembly language instead of C. GCC doesn't seem to use nearly as much memory when compiling large constant arrays in assembly language as it does when compiling large arrays in C.
  • Convert your binary assets directly to object files.
  • My solution: Use GBFS instead of linking your assets with the engine. GBFS files are archives that you append to your .gba file, and the program accesses objects in them by name. In addition, if you use GBFS, you can have different licenses for the engine and the assets. Drawback: You can't append a GBFS file to a .elf file, so you can't debug with it in VBA+GDB.

_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.

#3550 - silvir - Thu Feb 27, 2003 4:56 am

*sigh*, why can't everything just work? I feel like such an idiot asking all these questions, but I suppose it's the only way to learn...

Ok, I tryed downloading that batch, but when I tryed opening it it said it was missing CYGWIN1.DLL, so I took the time and downloaded Cygwin, guess what? It still dosn't work. Do you know why it's doing this? I'm pretty frustrated right now...
_________________
[Images not permitted - Click here to view it]

#3554 - misehert - Thu Feb 27, 2003 11:59 am

Don't know if this is any help, but I sympathize with you becasue I'm also new to this. I have WIN98SE and just followed the directions of gbajunkie.co.uk tutorials (using 98 patch, etc.) and the make.bat routine.

If all else fails, I would recommend starting from scratch and follow his step-by-step. It got me up and running - with no problems.
_________________
Sorry, I'm just a Stoopid Noobie...

thank god for video x 4 - i can see again

#3557 - silvir - Thu Feb 27, 2003 3:03 pm

Problem is, that's what I used to set it up, maybe I'll try again...
_________________
[Images not permitted - Click here to view it]

#3559 - silvir - Thu Feb 27, 2003 3:43 pm

WAAAA-HOOOOOOOOOOOOOO!!! It works! I'm happy. =) Thanks to all who've helped, now it's time to learn how to program. ;)
_________________
[Images not permitted - Click here to view it]