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.

C/C++ > unable to produce gba-binaries using my toolchain

#67396 - hns - Tue Jan 17, 2006 7:56 pm

hello there..

i've built a cross compiler, but i'm unable to produce any binaries, which the emulators (VirtualBoy Advance and Boycott) are able to run..

i've used a few different gcc-packages / binutils / newlib combinations, but everytime i run a binary in the emulatoir, the emulator just shows a black screen, not doing anything... (The emulator just works fine, using other precompiled gba-binaries. )

i'm using: debian amd64 sarge, binutils-2.12.1, gcc-3.1, newlib-1.10.0 (from the devkitadv distribution)

i use a pong example somewhere from the net ( i don't know where i got it..).

i can compile the source to an elf binary and objcopy to a gba-binary. But im unable to run it!..

What am i doing wrong? i guess its my compiler but i have no idea how to debug..

any hints

regards sven

#67398 - kusma - Tue Jan 17, 2006 8:01 pm

do you have a reason not to simply use devkitPro?

#67400 - hns - Tue Jan 17, 2006 8:06 pm

i considered.. but i'm unable to access http://www.devkitpro.org/downloads.shtml

do you know any other url?

#67401 - hns - Tue Jan 17, 2006 8:10 pm

me again... i made it thru http://www.devkitpro.org/downloads.shtml

but i only see a windows version to download.. so where to fetch packages for x86_64 linux?

P.S: i know, this topic belongs to the "newbie section".. but i just wanted to know why my compiler is *?"%-up

#67971 - hns - Sat Jan 21, 2006 7:29 pm

ok.. i have a working toolchain now.

i've used the buildscripts from devkitpro.. which caused to same effect after compiling a demo.

The problem boils down, that my tool chain (now the devkitARM one) creates binaries whit the wrong entry point and section layout..

i've downloaded the crt0.o/linkerscript files from this site and voil?:

i can compile !!AND RUN!! gba files.. Juhu..

Sadly i have to use the following procedure:

arm-elf-gcc -c pong.c
arm-elf-ld -Tlnkscript crt0.o pong.o -lc
arm-elf-objcopy -O binary a.out test.bin

if i dont, i get errors like:

arm-elf-gcc -Tlnkscript -o test27.elf main.c -lc

/opt/devkitARM/lib/gcc/arm-elf/4.0.1/../../../../arm-elf/bin/ld: section .data [0000000008009b64 -> 0000000008009b6b] overlaps section .rodata [0000000008000480 -> 0000000008009b8b]
/opt/devkitARM/lib/gcc/arm-elf/4.0.1/../../../../arm-elf/bin/ld: section .jcr [0000000008009b6c -> 0000000008009b6f] overlaps section .rodata [0000000008000480 -> 0000000008009b8b]
collect2: ld returned 1 exit status



Now: if someone is still reading my monolg here, there are some questions that came up during this odysee:

- could someone point me to some resource explaining the crt0.o file for the gba?
- what causes the error above?

Thanks in "Advance"(TM)

Hns

#67988 - Cearn - Sat Jan 21, 2006 10:24 pm

devkitARM uses the '-specs' linker option to let the linker know where to find the boot code (ctr0.s) and where the sections are. See the FAQ on C/C++.

#68003 - hns - Sat Jan 21, 2006 11:47 pm

thank you!!... i just was not able to find those hints until now..

sorry for wasting your time..

greez hns

P.S: it is all written down in the FAQ.. RTFM! RTFM! shame on me..