#3040 - Jer1400 - Mon Feb 17, 2003 3:44 am
I've just started GBA development and I'm in a bit of trouble already. You see, I am using the GCC development kit along with MSVC++ to create .bin roms. The only problem is...it doesn't work. I did everything the tutorial told me to do, but everytime I try to build the .bin rom, my computer totally locks up. It worked once, and I'm not quite sure why, but then it continued to freeze. These are the instructions I followed:
Ok, now that you have installed Visual C++ 6.0, start it up. We are now going make a test compile, so go to "File" and select "New" (or just push Ctrl+N). Open up the "Projects" tab (if it's not already open), and select "MakeFile". Under "Project name:", write "CPPTest". On "Location:", I have written "C:\GBADEV\" as my default location, but you can use any other that you see fit. I always like to make it clean and easy to remember though.
Remember that the project, which is named "CPPTest" will make a new directory called "CPPTest", in the GBADEV-folder. In other words, the test file we are going to compile, and all the files within this project will be located in the "C:\GBADEV\CPPTest\" directory. Make sure the "Win32" box is ticked under "Platforms:", and that "Create new workspace" is selected. Now click "OK". Look at the place where it says "Output:". Since the ROM-images we are going to make isn't an .exe but a .bin, we will have to rename it. Make sure it says "CPPTest.bin", and click on "Next". Do the same thing once again, and click "Finish".
"New Project Information" will appear. Just close it by clicking "OK". We are now ready to modify Visual C++ a bit so that it will use the Development Kit that we have downloaded (if you haven't already, check the "Downloading and installing the Development Kit"-part, and do that before you continue). In the "Tools" drop down menu, select "Options". Open up the "Directories"-tab. Under where it says "Show directories for:", it should say "Include files". Change it to "Executable files". A new list of folders will appear. At the very bottom, click twice and write in the location of the Development Kit. In my case, I have installed the kit under C:\GBA, so that's what I'll write as my location. I will also have to put "\bin" at the end to, so the correct location would be "C:\GBA\bin". Remember not to add a \ at the end of the location (like "C:\GBA\bin\"), or it might not work. Push "ok".
Now, let's make use of the CPPTest files included in the ZIP file of this document. Go to the folder where you unzipped it, and locate the folder names "Files", then "CPPTest". The folder should contain the following files:
boot.s
CPPTest.mak
ctrbegin.o
crtend.o
Linkscript
main.cpp
Copy and paste all these files into the CPPTest folder (my location at C:\GBADEV\CPPTest). When that's done, let's get a better overview of the files we have in our folder. In Visual C++, look at the middle window at the left side. There are two "tabs" in the bottom, called "ClassView" and "FileView". Click on the "FileView" tab. Notice the change in the window above. Now click on the [+] next to the "CPPTest files" directory icon, and you will notice three folders. This is the place where we will add our files so that we can easily access them and edit them as we find it appropriate. To add the files, left click on the "CPPTest files" directory icon, and choose "Add Files to Project?" from the menu that appears. It will as default choose to include C++ files, so the only thing showing here should be "main.cpp". Change "Files of type" to "All files". You can now get a look at every file placed within the workspace directory (note the name "workspace directory"). Now, with Ctrl pushed, click on "boot.s", "Linkscript", "CPPTest.mak" and "main.cpp". Once all of these are selected, push OK. Notice that the files now seem to appear at the left window (workspace window), under the folders. If you look closely though, you will notice that "main.cpp" is gone. Well, it isn't. Visual C++ has recognized the file as a source file, and placed it in the appropriate folder. Click on the [+] next to the "Source Files" folder to make sure it is in its right place. Now, before we move on, let me tell you a bit about the workspace window, and the reason to include files here.
The workspace window is quite handy, and is one of the main reasons why developers uses and IDE instead of just writing everything in for instance "Notepad" or "Dos-Edit" (that, and the fact that an IDE gives you error outputs - more on that later). To include files in this windows, just Right-Click and select "Add Files to Project?", then locate your files. The files will then be placed in their appropriate folders, for easy location later. Files that the Visual C++ does not recognize, will be placed underneath the folders. An assumption often made by newbie-programmers (like myself) is that it is the files in the workspace directory that determines what is compiled in the final output (in this case, the .bin file - GBA rom). This is certainly not the case. The files in the directory are just a way to have easy access. To access a file and its content, just double-click it, and it will appear in a window at the right side of the workspace window. You can then easily edit the code. A good rule is to always close the window of the file you are working on, if you are to open up another. That way, you can avoid having to codes open at once, since it doesn't save the code if you don't close it. You will also avoid having multiple windows of the same code, making it hell on earth to edit.
So, what is compiled then? Well, the file called "CPPTest.mak" keeps track on that. And since we're going to use it in this case, let's open it up now, as it needs some editing. Double-click on it, and its source should appear in all its glory. Look for the place where it says "SRCDIR = G:\GBA\CPPTest". Let me explain why this is not the right directory to use in our case; we put the Development Kit in the C:\GBA directory (at least I did), and what the SRCDIR is looking for is actually the Source Directory (whoa, you saw it right away, right?). Change it to "C:\GBADEV\CPPTest" instead, and this time, make damned sure not to add a "\" in the end there, as it will make the compiler go crazy (well, it won't work anyway). Also, note that it is on G: at default, so make sure you don't forget to change it. All the other directories (the five below the one we just changed) are looking for certain things in the development kit it needs to compile the program. Let's change it so that it fits our setup. Again, I will use my location, just alter it as you see fit. In "CMPDIR = G:\DevKitAdv\bin", just change the "G:\DevKitAdv\" part so it says "C:\GBA\". Alter it so that it reads this at the end:
SRCDIR = C:\GBADEV\CPPTest
CMPDIR = C:\GBA\bin
LIBDIR = C:\GBA\lib\gcc-lib\arm-agb-elf\3.0.2\interwork
LIBDIR2 = C:\GBA\arm-agb-elf\lib\interwork
INCDIR = C:\GBA\lib\gcc-lib\arm-agb-elf\3.0.2\include
INCDIR2 = C:\GBA\arm-agb-elf\include
If you are in a hurry, you could just copy paste this, but I highly recommend that you punch it in manually, as that is the only way to learn it. There is no shortcut to learning, my friend ;) Now that all that is done, close the SourceView window. Notice that it doesn't ask you to save, just assume so and writes straight to the file (you can't "undo" anything after this).
Ok, we are now set to compile our first program. If you want to take a look at the source code for what we are about to compile, just open up "main.cpp" in the workspace directory. Not much code, eh? Well, wonder what the result will be? Maybe a new Mario game, or perhaps the sequel to Half-Life? Go to the "Build" drop-down menu and select "Rebuild All". The compiler will take it's time, compiling the source code. You can see it in action by looking at the bottom window, compiling and linking the files needed. When it's done, it should say "CPPTest.bin - 0 error(s), 0 warning(s)" (if you don't get this message, you got a problem - see the "Aaarg!"-section for help). This means that the .bin file has been made. That's right, your very first GameBoy Advance rom has been compiled (ok, so the code isn't done by you, but you still did something!), and you can now play it on your favorite emulator. Open it up, and fire away! The rom is located in the CPPTest folder, by the way.
I won't tell you what the end result is, but if you have been using windows for a long time, the result should bring back memories :p
**
**End Instructions**
**
So I followed those instructions, and it froze. I'm using windows ME, and I've reinstalled everything multiple times already. Any tips, ideas or anything at all would really help and is very much appriciated. Thanks you in advance.:)
Ps.
I'm sorry if this is a bit offtopic but I didn't see a board for general development.
_________________
http://saoghal.cywh.com/Jer1400/index.html
*Note that the site is still in early development.
Ok, now that you have installed Visual C++ 6.0, start it up. We are now going make a test compile, so go to "File" and select "New" (or just push Ctrl+N). Open up the "Projects" tab (if it's not already open), and select "MakeFile". Under "Project name:", write "CPPTest". On "Location:", I have written "C:\GBADEV\" as my default location, but you can use any other that you see fit. I always like to make it clean and easy to remember though.
Remember that the project, which is named "CPPTest" will make a new directory called "CPPTest", in the GBADEV-folder. In other words, the test file we are going to compile, and all the files within this project will be located in the "C:\GBADEV\CPPTest\" directory. Make sure the "Win32" box is ticked under "Platforms:", and that "Create new workspace" is selected. Now click "OK". Look at the place where it says "Output:". Since the ROM-images we are going to make isn't an .exe but a .bin, we will have to rename it. Make sure it says "CPPTest.bin", and click on "Next". Do the same thing once again, and click "Finish".
"New Project Information" will appear. Just close it by clicking "OK". We are now ready to modify Visual C++ a bit so that it will use the Development Kit that we have downloaded (if you haven't already, check the "Downloading and installing the Development Kit"-part, and do that before you continue). In the "Tools" drop down menu, select "Options". Open up the "Directories"-tab. Under where it says "Show directories for:", it should say "Include files". Change it to "Executable files". A new list of folders will appear. At the very bottom, click twice and write in the location of the Development Kit. In my case, I have installed the kit under C:\GBA, so that's what I'll write as my location. I will also have to put "\bin" at the end to, so the correct location would be "C:\GBA\bin". Remember not to add a \ at the end of the location (like "C:\GBA\bin\"), or it might not work. Push "ok".
Now, let's make use of the CPPTest files included in the ZIP file of this document. Go to the folder where you unzipped it, and locate the folder names "Files", then "CPPTest". The folder should contain the following files:
boot.s
CPPTest.mak
ctrbegin.o
crtend.o
Linkscript
main.cpp
Copy and paste all these files into the CPPTest folder (my location at C:\GBADEV\CPPTest). When that's done, let's get a better overview of the files we have in our folder. In Visual C++, look at the middle window at the left side. There are two "tabs" in the bottom, called "ClassView" and "FileView". Click on the "FileView" tab. Notice the change in the window above. Now click on the [+] next to the "CPPTest files" directory icon, and you will notice three folders. This is the place where we will add our files so that we can easily access them and edit them as we find it appropriate. To add the files, left click on the "CPPTest files" directory icon, and choose "Add Files to Project?" from the menu that appears. It will as default choose to include C++ files, so the only thing showing here should be "main.cpp". Change "Files of type" to "All files". You can now get a look at every file placed within the workspace directory (note the name "workspace directory"). Now, with Ctrl pushed, click on "boot.s", "Linkscript", "CPPTest.mak" and "main.cpp". Once all of these are selected, push OK. Notice that the files now seem to appear at the left window (workspace window), under the folders. If you look closely though, you will notice that "main.cpp" is gone. Well, it isn't. Visual C++ has recognized the file as a source file, and placed it in the appropriate folder. Click on the [+] next to the "Source Files" folder to make sure it is in its right place. Now, before we move on, let me tell you a bit about the workspace window, and the reason to include files here.
The workspace window is quite handy, and is one of the main reasons why developers uses and IDE instead of just writing everything in for instance "Notepad" or "Dos-Edit" (that, and the fact that an IDE gives you error outputs - more on that later). To include files in this windows, just Right-Click and select "Add Files to Project?", then locate your files. The files will then be placed in their appropriate folders, for easy location later. Files that the Visual C++ does not recognize, will be placed underneath the folders. An assumption often made by newbie-programmers (like myself) is that it is the files in the workspace directory that determines what is compiled in the final output (in this case, the .bin file - GBA rom). This is certainly not the case. The files in the directory are just a way to have easy access. To access a file and its content, just double-click it, and it will appear in a window at the right side of the workspace window. You can then easily edit the code. A good rule is to always close the window of the file you are working on, if you are to open up another. That way, you can avoid having to codes open at once, since it doesn't save the code if you don't close it. You will also avoid having multiple windows of the same code, making it hell on earth to edit.
So, what is compiled then? Well, the file called "CPPTest.mak" keeps track on that. And since we're going to use it in this case, let's open it up now, as it needs some editing. Double-click on it, and its source should appear in all its glory. Look for the place where it says "SRCDIR = G:\GBA\CPPTest". Let me explain why this is not the right directory to use in our case; we put the Development Kit in the C:\GBA directory (at least I did), and what the SRCDIR is looking for is actually the Source Directory (whoa, you saw it right away, right?). Change it to "C:\GBADEV\CPPTest" instead, and this time, make damned sure not to add a "\" in the end there, as it will make the compiler go crazy (well, it won't work anyway). Also, note that it is on G: at default, so make sure you don't forget to change it. All the other directories (the five below the one we just changed) are looking for certain things in the development kit it needs to compile the program. Let's change it so that it fits our setup. Again, I will use my location, just alter it as you see fit. In "CMPDIR = G:\DevKitAdv\bin", just change the "G:\DevKitAdv\" part so it says "C:\GBA\". Alter it so that it reads this at the end:
SRCDIR = C:\GBADEV\CPPTest
CMPDIR = C:\GBA\bin
LIBDIR = C:\GBA\lib\gcc-lib\arm-agb-elf\3.0.2\interwork
LIBDIR2 = C:\GBA\arm-agb-elf\lib\interwork
INCDIR = C:\GBA\lib\gcc-lib\arm-agb-elf\3.0.2\include
INCDIR2 = C:\GBA\arm-agb-elf\include
If you are in a hurry, you could just copy paste this, but I highly recommend that you punch it in manually, as that is the only way to learn it. There is no shortcut to learning, my friend ;) Now that all that is done, close the SourceView window. Notice that it doesn't ask you to save, just assume so and writes straight to the file (you can't "undo" anything after this).
Ok, we are now set to compile our first program. If you want to take a look at the source code for what we are about to compile, just open up "main.cpp" in the workspace directory. Not much code, eh? Well, wonder what the result will be? Maybe a new Mario game, or perhaps the sequel to Half-Life? Go to the "Build" drop-down menu and select "Rebuild All". The compiler will take it's time, compiling the source code. You can see it in action by looking at the bottom window, compiling and linking the files needed. When it's done, it should say "CPPTest.bin - 0 error(s), 0 warning(s)" (if you don't get this message, you got a problem - see the "Aaarg!"-section for help). This means that the .bin file has been made. That's right, your very first GameBoy Advance rom has been compiled (ok, so the code isn't done by you, but you still did something!), and you can now play it on your favorite emulator. Open it up, and fire away! The rom is located in the CPPTest folder, by the way.
I won't tell you what the end result is, but if you have been using windows for a long time, the result should bring back memories :p
**
**End Instructions**
**
So I followed those instructions, and it froze. I'm using windows ME, and I've reinstalled everything multiple times already. Any tips, ideas or anything at all would really help and is very much appriciated. Thanks you in advance.:)
Ps.
I'm sorry if this is a bit offtopic but I didn't see a board for general development.
_________________
http://saoghal.cywh.com/Jer1400/index.html
*Note that the site is still in early development.