#37978 - brucesinner - Sat Mar 19, 2005 3:57 pm
Hi folks,
Sorry for the n00b question, I already searched the forum but didnt got a good response for me.
I downloaded Eclipse, installed CDT (all latest version) and downloaded DevKitArm and unzipped it. Now what ?
Im very n00b at Eclipse Environment, what steps do I need to do to make a simple example like this to run:
Code: |
int main(void)
{
// create a pointer to the video buffer
unsigned short* videoBuffer = (unsigned short*)0x6000000;
// switch to video mode 3 (240x160 16-bit)
// by setting a memory register to a specific value
*(unsigned long*)0x4000000 = (0x3 | 0x400);
// draw a white pixels (16 bits) directly to video memory
// pixel location is centered on the screen (120,80)
videoBuffer[80 * 240 + 120] = 0xFFFF;
// continuous loop
while(1) {
}
// end program
return 0;
} |
And to automatically open it in VBA and debug it ? Like VisualHAM does ?
Any help would be gladly appreciated.
Thanks a lot
#38068 - NoMis - Mon Mar 21, 2005 2:10 pm
There are 2 different ways to do that. You can either use Standard makefile projects or managed makefile project. When using the first you have to create your own makefile. The later generates it for you.
In both cases you should update your path environment variable to include the bin path of DevKitArm.
If your using standard makefile project just add a file called "makefile" to your project.
Then you can write your makefile like you normaly would and specify your targets in the "Make targets" view. You can now build by using this view and the targets you specivied there.
To use managed makefiles right click onto your project and bring up the properties dialog. Switch to the compiler and linker settings and use "arm-elf-gcc" or "arm-elf-g++" (whatever your using) as command instead of gcc/g++. There is also a textfield to add custom flags. Use it to add the arm specific flags since the default gcc make configuration doesn't have them. The options recurse through the directories so you can bring up this dialog for folders and files as well to specify different options on specific files/folders. This is helpfull if you wan't to compile specific files with ARM and other with Thumb.
You can also specify your own configuration, to add the ARM specific options, like described here (page on dev.eclipse.org)
Please use the [url=] syntax when linking URLs longer than 80 characters so as not to widen the page.
-- Moderators
Now let's move on to the debugging part.
Since CDT uses GDB we can debug with VBA. To do so you have to make a new Debug configuration for your project.
Make a new configuration and specify your elf file on the "Main" tab. On the debugger tab you have to select "GDB Server" and set the appropriate
TCP options.
Now start VBA with the tcp protocoll and the port you specified in your launch configuration. (You can do this over the Eclipse "External Tools" if you want) and launch your configuration by adding it to the shortcut's wich are accassible in the command bar or press debug in the configuartion dialog.
Remarks: The debug description refers to an older Eclipse/CDT version since I haven't done much in GBA programming in a while. Unfortunaly I can't say if this works. Last time I checked it out it didn't work because there was a bug in CDT (or at least I hope it was a bug ^_^).
NoMis
#38070 - brucesinner - Mon Mar 21, 2005 4:13 pm
Hi NoMis,
Thanks for the tips I will test it a little bit later today (im at work now)
Just some questions:
* External Tools option is used to set Eclipse to launch automatically VBA after a suscesfull make ?
* This can be user to automatically launch VBA in debug mode ?
* There is any way to make a template project for GBA programming ? If I follow your steps and save the newly fresh created project it can be used as template ? Or the configurations are for Eclipse and not for the project itself ?
* Is MSys required for DevKitArm to work with Eclipse ?
Thanks dude,
Bruce
#38122 - NoMis - Tue Mar 22, 2005 8:29 am
brucesinner wrote: |
External Tools option is used to set Eclipse to launch automatically VBA after a suscesfull make ?
This can be user to automatically launch VBA in debug mode ? |
It won't start automatically after make (unless you make your own makefile and specify it there manually) but you can start it in a single click. With the help of the "${resource_loc}" variable you can pass the selected file in the project browser to the programm. So all you have to do is select your elf file and start the external tool. After that you just have to launch your configuration. But don't forget to set VBA to "Launch in Background".
brucesinner wrote: |
There is any way to make a template project for GBA programming ? If I follow your steps and save the newly fresh created project it can be used as template ? Or the configurations are for Eclipse and not for the project itself ? |
I don't know if there is an easy way to do this. Eclipse is a plugin based platform so it is possible for sure. But I think you have to make your own plugin for it.
Maybe this would be something the CDT team should consider a future enhancement. You may specify your need in the Eclipse Bugzilla Page .
brucesinner wrote: |
Is MSys required for DevKitArm to work with Eclipse ? |
It isn't nessecary at all. The only thing that will fail without MSys is the clean command wich uses the "rm -f" command.
NoMis
#38165 - brucesinner - Wed Mar 23, 2005 10:36 am
Thanks for NoMis help, I'm managed to do a simple project and build with Eclipse.
Notice that I was using CDT Plugin version 2.02 with Eclipse 3.01 and IT DID NOT BUILD due probably a plugin bug. I updated to latest CDT 2.1 and everything works fine now.
I didnt try to debug yet, neither to run VBA automatically at the end of compilation. Will try it today and let you know the results (or post any doubts I have)
As soon as I have everything working fine I will post a how-to here for other beginners like me.
regards
#38183 - brucesinner - Wed Mar 23, 2005 7:17 pm
Hi again,
I managed to run VBA at the end of compilation adding this line to my makefile:
-@VisualBoyAdvance.exe $(PROJ).$(EXT)
Obviously $(PROJ).$(EXT) translates to my rom name.
Now I've come to the debug part and im getting a hard time here.
I did as NoMis said in other posts:
1) Created a new configuration, put the ELF name in Main tab, selected GDB Server and selected the name of gdb executable (i'm using the one from MingW32)
2) I left the default port (55555) and saved the new configuration.
3) Put the VBA SDL as External Tool using -Gtcp ${resource_loc} as startup parameter. It did run fine and stayed waiting for incoming connections.
4) I run de debug configuration and for my surprise (I was almost there! damn!) came the following error message:
Launching (Error:Error creating session: localhost:55555: No such file or directory)
I tried several things and hell, i can't debug it.
Any thoughts on this ???
Thanks
Bruce
#38255 - NoMis - Thu Mar 24, 2005 7:18 pm
Thats weird. Why should there be any file missing?
There are only the elf file and gdb and you seleted them through the file browsers.
Unfortunatly I can't check that myself since I alredy have CDT 3.0 M5 installed (wich finally came out after 1 1/2 weeks delay).
I checked it with CDT 3.0 and it works just fine.
You should consider using the new release as well. I tested it a bit and it really works very well and stable. It's still a lot to finish but it has some nice new features.
And debuging works without any issues :)
NoMis
#38256 - brucesinner - Thu Mar 24, 2005 7:27 pm
Finally I managed to get it working.
I was using default gdb from Eclipse instead of a ARM targeted one.
I swap to it and things started to work more fine. Then no break points were working. I downgraded VBA to 1.7 and now it works just fine...theres some warnings displayed in Eclipse Console but i can live with that. I got it from HAM distribution, wonder where I can get another? Googled for it and didnt find, VBA site is down too...
It was a pain to put it all working together but now I did it ! Kewl !
Now for the last question: why debugging is SOOOOOO slow. I hit F11 inside VBA to activate a SIG_TRAP and it takes ages to come back to Eclipse...and when i came back i hit F6 to Step Over and it took ages to do a single step...i changed VBA to lower versions but it didnt solve. Perhaps it is arm-elf-gdb faults ? or there is another way or thing i didnt do ?
any help on this ? thanks
EDIT: answering myself: DO NOT TRY TO RUN A TCP DEBUG WHILE DOWNLOADING SOFTWARE WITH P2P PROGS :-)
That's was the problem...shut down all the progs and now debug goes turbo fast...thanks folks, i will prepare an Eclipse how-to and post here.
#38267 - yaustar - Fri Mar 25, 2005 12:50 am
Excellent... I be waiting :)
_________________
[Blog] [Portfolio]
#38276 - brucesinner - Fri Mar 25, 2005 3:02 am
I'll post the how-to as a new thread.