#162553 - moonlightcheese - Thu Sep 04, 2008 8:54 pm
i've tried following tonc's guide for using the template libraries to make things compile and it just doesn't make any sense. besides, i'm very much a do-it-yourselfer.
so i'm trying to build gcc to cross-compile for arm targets using the guides i've found here:
http://nihilisme.ca:8080/arm/
my question is... once i get a cross-compiler that spits out raw (non-elf) arm binaries, can i make it work for building gba specific code and how?
edit: i also understand that the mainline kernel has all the support necessary for arm archs so i should just be able to download the latest stable kernel (2.6.x) and use those headers to build gcc right?
#162603 - tepples - Fri Sep 05, 2008 8:47 pm
The first thing you should know about the linker script is that code starts at 0x08000000 for ROM programs or 0x02000000 for RAM programs.
The first thing you should know about crt0 is that code must start with a header of 228 bytes[1] whose first instruction is a jump past the header. GBATEK describes the layout of this header.
[1] In ROM, the header is only 192 bytes, but GBA BIOS MultiBoot uses more of the header to indicate the player number.
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.
#162905 - moonlightcheese - Tue Sep 16, 2008 12:16 am
tepples wrote: |
The first thing you should know about the linker script is that code starts at 0x08000000 for ROM programs or 0x02000000 for RAM programs.
The first thing you should know about crt0 is that code must start with a header of 228 bytes[1] whose first instruction is a jump past the header. GBATEK describes the layout of this header.
[1] In ROM, the header is only 192 bytes, but GBA BIOS MultiBoot uses more of the header to indicate the player number. |
awesome. none of that makes any sense to me at all...
#162925 - moonlightcheese - Tue Sep 16, 2008 3:06 pm
so i got a compiler that builds for arm targets but i can't find the necessary header files to use. when i try to compile the template.c file from the devkitarm collection, i get several missing header errors (obviously, since i haven't placed them yet) and when i search for the headers that the template.c file references, they are nowhere to be found in devkitARM or in libgba directory. where do i get these headers?
gba_console.h
gba_video.h
gba_interrupt.h
gba_systemcalls.h
gba_input.h
edit: nevermind... i'm an idiot. found them.
#162931 - moonlightcheese - Tue Sep 16, 2008 5:09 pm
ok, now i think i've gotten far enough to understand what i need to do next but i'm not sure how...
i have the headers in the appropriate places and the sample code still isn't compiling. the first error in the list is:
Code: |
warning: cannot find entry symbol _start: defaulting to 00008000 |
which i assume has to do with the entry points not being correct, as tepples alludes to in the above post. i found crtls in the devkitadv set. i can't get it to compile for some reason...
#162940 - Dwedit - Tue Sep 16, 2008 8:31 pm
Devkitadv is widely considered to be old and outdated.
Have you tried using the specifications, linkscripts and ctr0's from devkitarm? Will your build of the compiler build any of the Devkitarm example projects?
_________________
"We are merely sprites that dance at the beck and call of our button pressing overlord."
#163034 - moonlightcheese - Fri Sep 19, 2008 5:21 pm
Dwedit wrote: |
Devkitadv is widely considered to be old and outdated.
Have you tried using the specifications, linkscripts and ctr0's from devkitarm? Will your build of the compiler build any of the Devkitarm example projects? |
i know it's outdated but i just don't have time for anything else. this will get me started with gba coding and i absolutely must get this project completed in a timely manner. i'm already going well above and beyond the project spec.
the students are supposed to be building an OS in Java and emulate a hardware CPU with code, basically chopping up hex programs into opcodes according to the hardware spec of the project. i asked the professor if i could code my OS for an actual machine, converting the hex programs he wrote into ARM compatible programs and he was fine with that because he knows i'm taking the opportunity to learn as much as possible about embedded systems.
when i have the time, i can revisit the compiler i'm working on in FreeBSD but for right now, i just need something that works so i can familiarize myself with coding for low level systems and risc embedded systems in particular.
#163048 - Ruben - Sat Sep 20, 2008 1:00 pm
Well, it doesn't take too long to download devKitARM, but anyway...
If you're only coding in C/C++, and not using any compiler specific things, then you should be fine in using devKitAdv for now but I still highly recommend devKitARM for everything.