[ Beginner ] Makefile Wont Work, Neither Will Build Script

Post Reply
User avatar
TheFloatingBrain
Posts: 3
Joined: Thu May 14, 2020 4:34 am

[ Beginner ] Makefile Wont Work, Neither Will Build Script

Post by TheFloatingBrain » Sat May 16, 2020 11:35 pm

Hello first post here!

(Windows 10, devkitPro 10.1.0 latest, mGBA 8.1 latest)

I have been through quite a bit trying to compile my first GBA program. I first tried to use the makefile and setup in a video tutorial I found on the net after hours modifying the makefile and I fixed all the errors I was getting, it told me "nothing to be done" and I decided to try a new approach.

So I wrote this build script based on some examples I saw based on the makefile and it works, however when I load the .gba file into the mGBA it does nothing and I can see no video memory has been written too (I see stuff at the . I tried tweeking the program but nothing happens. I think the program is just not executing.

A warning I got when linking was

Code: Select all

arm-none-eabi-ld.exe: warning: cannot find entry symbol _start; defaulting to 0000000000008000

if I ignore it mGBA says the file is in the wrong format. I managed to track down the entry point address so for ld I added

Code: Select all

-e 0x08000000
and it loads (as I said). If I change the address mGBA says its not in the correct format.


There is a bunch of stuff at the begging of the (emulated) GBA's memory, but when I go to 0x08000000 in memory, I dont see anything. It may be due to the debug information being stripped (or the program memory not being in the "view memory" view) but if I go into WSL and hexedit the .gba file I see tons of stuff that is not present in the memory of the emulator and it seems a TON bigger than anything there (but there is a lot of debug info).

I don't think the program is executing.

Any help is appreciated, thanks for reading!
- TFB

User avatar
TheFloatingBrain
Posts: 3
Joined: Thu May 14, 2020 4:34 am

Re: [ Beginner ] Makefile Wont Work, Neither Will Build Script

Post by TheFloatingBrain » Sun May 17, 2020 10:02 pm

Update, I am now using WSL and I am having some issues (which I will post about) but I am still curious about this.

Thank you

WinterMute
Site Admin
Posts: 1845
Joined: Tue Aug 09, 2005 3:21 am
Location: UK
Contact:

Re: [ Beginner ] Makefile Wont Work, Neither Will Build Script

Post by WinterMute » Mon May 18, 2020 7:39 pm

Unfortunately you seem to have become another victim of people making tutorials for things they don't understand and then putting them on the internet to confuse everyone. I've removed the links from your post since they all point to very broken things that serve only to show how bad the tutorial you found was. The reason your .gba file won't work in mGBA is because it's simply not a valid GBA binary. The linker not being able to find _start is an indication that the code is just broken, you can't just give it a start address and hope for the best.

The best way for us to proceed unfortunately is for you to uninstall the toolchains completely and start over. We find that when people follow these tutorials they end up with compromised tools that no longer work as intended. Once you've done that you can open an msys shell from the devkitPro start menu.You should end up in your user home directory in a bash shell. From there you can copy a libgba template using

Code: Select all

cp -r /opt/devkitpro/examples/gba/template myfirstgba
cd myfirstgba
make
That will get you a myfirstgba.gba file which should do this when run in mGBA for instance.Image

It would be preferable at this point if you didn't just use WSL instead of the windows native binaries.

Please do not follow any more tutorials or take advice from people outside these forums. It causes horrific problems like the ones you have just experienced.
Attachments
Screenshot 2020-05-18 at 19.36.10.png
(19.02 KiB) Not downloaded yet
Help keep devkitPro toolchains free, Donate today

Personal Blog

User avatar
TheFloatingBrain
Posts: 3
Joined: Thu May 14, 2020 4:34 am

Re: [ Beginner ] Makefile Wont Work, Neither Will Build Script

Post by TheFloatingBrain » Mon May 18, 2020 11:27 pm

Thank you, I did what you said too, it works. While I am at it, is there a way to build with debugging symbols for GDB?

Also, its a little off topic, but ``dprintf``, where does the output go? I cant see any in my console or anything. :(

Is there a way to log errors like this?

WinterMute
Site Admin
Posts: 1845
Joined: Tue Aug 09, 2005 3:21 am
Location: UK
Contact:

Re: [ Beginner ] Makefile Wont Work, Neither Will Build Script

Post by WinterMute » Tue Jun 02, 2020 3:51 am

Adding symbols for gdb is simply a matter of adding -g to your compile flags. if you add it to the ARCH line in the stock Makefile it will get added to compilation for assembly files too.

dprintf is a slightly complicated question to answer atm. Many things in libgba may have made sense at the time but possibly make little sense now. Getting an MBV2 now may be very difficult if not outright impossible. Even if you could get one then finding a parallel port or serial port to use it with is another problem entirely.

I have some code around that will send messages to mGBA debug print but haven't yet got around to sorting it out for libgba. I also have another couple of things in mind that may be helpful too. Hopefully very soon.

Sorry I don't have a better answer right now.
Help keep devkitPro toolchains free, Donate today

Personal Blog

Post Reply

Who is online

Users browsing this forum: No registered users and 4 guests