#116796 - mog123 - Mon Jan 29, 2007 8:19 pm
Hi, i have tried to learn nesdev. although i failed, it was just too much for me.
tepples told me that gba dev is simpler, so i wanted to try. although i'm having problems right from the start. I downloaded devkitarm and msys.
Installed them.
they are on
D:\dev\devkitarm
D:\dev\msys
I have a source file from tonc's tutorial. and i don't know how to compile it.
when i was compiling some nes asm code. i just drag dropped my *.asm file on the nesasm.exe and there it was.
But this is more complicated on this step.
Any help please?
#116798 - tepples - Mon Jan 29, 2007 8:37 pm
Put the following in hello.c:
Code: |
/*
Turn the screen green!
Platform: GBA
Author: Damian Yerrick
Copyright: All rights released
*/
typedef unsigned int u16;
#define BG_COLORS ((u16 *)0x05000000)
#define REG_DISPCNT (*(u16 *)0x04000000)
#define RGB5(r,g,b) ((r)|((g)<<5)|((b)<<10))
int main(void) {
REG_DISPCNT = 0; // mode 0, no backgrounds or sprites
BG_COLORS[0] = RGB5(0, 31, 0);
while (1) {}
}
|
Put the following in mk.bat:
Code: |
set Path=(ORIGINAL POST WAS IN ERROR; SEE BELOW)
arm-eabi-gcc -Wall -mthumb -mthumb-interwork hello.c -o hello.elf -specs=gba_mb.specs
arm-eabi-objcopy -O binary hello.elf hello.gba
gbafix hello.gba
pause
|
Run mk.bat and then run hello.gba, and if the screen turns green, then devkitARM is installed correctly. If you get an error, please copy the text of the error message from the window and paste it here, or we won't be able to help you.
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.
Last edited by tepples on Thu Feb 01, 2007 1:38 am; edited 1 time in total
#116800 - mog123 - Mon Jan 29, 2007 8:48 pm
http://img363.imageshack.us/img363/5797/qweqwewp4.jpg
i made the mk.bat file, and the hello.c(both in the root folder of devkit arm)
and i got that screen when trying to run mk.bat
EDIT: lol, i placed them in the bin folder. and i got an elf file and a gba file, lolz xd
EDIT2: i played the gba through visualboyadvance and i got a very bright green.
Ok, i think it's installed good.
So how do i make the elf and gba file into one gba file?
#116801 - keldon - Mon Jan 29, 2007 9:04 pm
I believe you are supposed to run that from within the MinGW/MSys shell provided with devkit arm. Although I think that you should learn a bit of c/c++ first before you jump head first into console dev. All depends on your previous knowledge, but if you know nothing about programming, or very little then I would suggest to learn to program.
#116803 - tepples - Mon Jan 29, 2007 9:25 pm
What do you mean by "lol, i placed them in the bin folder." To what files does the word "them" refer?
I can't read RandomSlavicTongue, but it looks like "Bad command or file name". If there is a file named D:\dev\devkitarm\bin\arm-elf-gcc, then change the first line of mk.bat to
Code: |
set Path=D:\dev\devkitarm\bin;%Path%
|
and see if anything clears up. Then you can place hello.c and mk.bat anywhere.
Hint: You can copy text from the command prompt window to the Clipboard. Click the system menu (click the C:\> icon at the top left of the window), choose Edit > Mark (or localized counterpart), drag a box around what you want to copy, and press Enter. Then paste into your reply.
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.
#116804 - mog123 - Mon Jan 29, 2007 9:31 pm
i got it compiled tepples, see my "EDIT'S"
now I'm good to go with programming? i'll try to do some tonc now.
by them i mean the two files:
hello.c
and mk.bat
ok, i changed the mk.bat file just like you said, and it compiles from anywhere, thanks a bunch!
#117012 - Yooser Naim - Wed Jan 31, 2007 7:59 pm
I'm in nearly the same position as Mog123, only difference being that the 'green screen test' tepples posted did not work for me. I used the devkitPro Installer, and I think I have the correct paths set, but maybe not. When I ran your batchfile the following errors appeared:
' arm-eabi-gcc' is not recognized as an internal or external command,
operable program or batch file.
And then continued on to say the same thing about ' arm-eabi-objcopy' and ' gbafix'. Would you have any idea what I could have done wrong?[/i]
#117035 - gmiller - Wed Jan 31, 2007 10:07 pm
Thoses messages are telling you that it could not find the programs to compile, link, and create a GBA executable. Depending on how your system is set up it could be that your PATH environment variable does not have correct setup or some other issue. You could try adding this to your batch file and see if the batch file works:
set PATH=c:\where\devkitpro\devkitarm\bin;c:\where\mysys\bin;%PATH%
There may be others that are needed as well but this should work for the compiler/linker. The DEVKITPRO, DEVKITARM and others are generally needed along with the location of the msys/bin folder. Also make sure that the relative path name to your files to compile do not contain spaces and the absolute path to the devkitpro stuff has no spaces in the folder names.
Last edited by gmiller on Wed Jan 31, 2007 10:09 pm; edited 1 time in total
#117036 - tepples - Wed Jan 31, 2007 10:07 pm
Does it really have a space between the opening quote and the executable name?
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.
#117068 - Yooser Naim - Thu Feb 01, 2007 1:04 am
No tepples, there were no spaces. Sorry. Here's an exact copy of the output:
C:\>set Path=/c/devkitPro/devkitARM\bin;c:\devkitPro\msys\bin;C:\WINDOWS\system3
2;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\Program Files\QuickTime\QTSystem\
C:\>arm-eabi-gcc -Wall -mthumb -mthumb-interwork hello.c -o hello.elf -specs=gba
_mb.specs
'arm-eabi-gcc' is not recognized as an internal or external command,
operable program or batch file.
C:\>arm-eabi-objcopy -O binary hello.elf hello.gba
'arm-eabi-objcopy' is not recognized as an internal or external command,
operable program or batch file.
C:\>gbafix hello.gba
'gbafix' is not recognized as an internal or external command,
operable program or batch file.
C:\>pause
Press any key to continue . . .
I also ran the batch file modifications that both of you (tepples and gmiller) have mentioned, but they resulted in similar messages.
You mentioned something about placing the hello.c and mk.bat somewhere specific and then running them, could that be a problem? As you can tell from the screen output above, I just have them in my C:\ directory. What else could I have done wrong?
Don't rule out anything, not even the strangest of errors; I'm not knowledgeable about development environments and I only know a few things about command line shells. I think I might know enough C to squeeze out some very simple programs, judging from what I've seen in the devkit examples. I just can't seem to get the environment running, and have appreciated your help so far. Thanks.
#117069 - Yooser Naim - Thu Feb 01, 2007 1:10 am
I should also mention that I had devkit Installer place the devkitPro folder in my C:\ drive, so there should be no spaces in the directories.
#117071 - gmiller - Thu Feb 01, 2007 1:15 am
the path string should be c:\devkitPro\devkitARM\bin; ...
The path has to use windows slashes that slant the wrong way ... ;-) The DEVKITPRO and other environment variables need the unix style variables that slant the right way :D.
#117077 - tepples - Thu Feb 01, 2007 1:38 am
Yooser Naim wrote: |
Sorry. Here's an exact copy of the output:
C:\>set Path=/c/devkitPro/devkitARM\bin;c:\devkitPro\msys\bin;C:\WINDOWS\system3
2;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\Program Files\QuickTime\QTSystem\ |
The use of $DEVKITARM in my original batch file was in error, as I had forgotten that that variable uses MSYS-style path syntax, not Windows-style path syntax. I was used to the MINGDIR and DJDIR syntaxes used by the Allegro library's makefile, which do use a Windows-style path.
Quote: |
I also ran the batch file modifications that both of you (tepples and gmiller) have mentioned, but they resulted in similar messages. |
Could you paste the set Path= line of the modified batch file?
Quote: |
You mentioned something about placing the hello.c and mk.bat somewhere specific and then running them, could that be a problem? As you can tell from the screen output above, I just have them in my C:\ directory. What else could I have done wrong? |
Location should not matter if the batch file is correct.
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.
#117083 - Yooser Naim - Thu Feb 01, 2007 3:22 am
I reentered all my environment variables and copied and pasted the bin directory into the modified batch file
Tepples, your modification is below:
[quote]"If there is a file named D:\dev\devkitarm\bin\arm-elf-gcc, then change the first line of mk.bat to: [code]set Path=D:\dev\devkitarm\bin;%Path%[/code] [/quote]
your code with my directory:
set Path=C:devkitPro\devkitARM\bin;%Path%
It works. It turned out the gba file and it executes properly. I don't know what happened; I must have entered my own directory into the code wrong, or didn't save the changes either to the modified file or to the environment variables...I don't know.
I might have been able to avoid these problems had I really read thoroughly enough through the posts before trying out your green screen test. I hope I didn't use too much of your time and effort. Thanks to everybody for all your help.