GP32 Linking Ain't Easy


majick

Still Fresh
Joined
Dec 4, 2004
Messages
38
Okay, so I built myself an arm-elf cross compiler, with a cross binutils and newlib. Got it. No problem. It took a little monkeying around, but the Frodo source now compiles happily. I'll have a white bar fix done in no time!

Well, except for one problem. It won't link. Now, I'm aware of the replacement crt0 out there (I grabbed this one) so I went and dropped it in. But here's what I get when I use it.
Code:
/usr/local/arm-elf/bin/g++ -o Frodo.elf main.o Display.o Prefs.o SID.o REU.o IEC.o 1541fs.o 1541d64.o 1541t64.o 1541job.o SAM.o C64.o CPUC64.o VIC.o CIA.o CPU1541.o gp32/menu.o gp32/ui.o gp32/input.o gp32/gpmisc.o gp32/xlatgp32.o gp32/chatboard/kbdrv.o -Wl,-T linkscript -Wl,--gc-sections -Lgp32/libpogo -lpogo -Lgp32/sound -lgpsound
/usr/local/lib/gcc/arm-elf/3.4.3/../../../../arm-elf/lib/crt0.o(.text+0x238): In function `CopyZIData':
: undefined reference to `_timepassed'
/usr/local/lib/gcc/arm-elf/3.4.3/../../../../arm-elf/lib/crt0.o(.text+0x244): In function `CopyZIData':
: undefined reference to `HEAPSTART'
/usr/local/lib/gcc/arm-elf/3.4.3/../../../../arm-elf/lib/crt0.o(.text+0x248): In function `CopyZIData':
: undefined reference to `HEAPEND'
/usr/local/lib/gcc/arm-elf/3.4.3/../../../../arm-elf/lib/crt0.o(.text+0x24c): In function `CopyZIData':
: undefined reference to `Main'
collect2: ld returned 1 exit status
make: *** [Frodo.elf] Error 1
What did I screw up? Is there a different crt0 I should be using?
 
What SDK are you using? Looks like Mirkos. Anything on Devr's is really old. If you are trying to fix the white bar with a "crt0.0", I don't think that'll work. Mirko has a new version of his SDK out which has a LCD init function for BLU+'s.

Or maybe I'm just stupid.
 
Blah posted on Dec 22 2004 at 03:47 PM said:
What SDK are you using? Looks like Mirkos.
I'm just trying to build the source using a gcc cross compiler. Inspection of the Makefile (and the fact that the only missing symbols are a handful of minor ones) leads me to believe it doesn't link to any SDK libraries.
Anything on Devr's is really old.
This could be part of the problem, then. What's the current C runtime for the GP32 and how do I get my hands on it?
If you are trying to fix the white bar with a "crt0.0", I don't think that'll work.
No, I'm changing the LCD initialization constants in Frodo. They seem to be set in Src/gp32/libpogo/screen.c. At this point I haven't even made it that far; I'm trying to build it as is to verify I have a working build environment. So far it looks like I almost do, since Frodo compiles perfectly but doesn't like the crt I'm linking to. I need some help to figure out what's missing.
Mirko has a new version of his SDK out which has a LCD init function for BLU+'s.
Frodo has its own LCD init function, and it looks fixable. I'm pretty sure what I'm doing will work, if I can get it to link. Can you help with that?
 
Last edited by a moderator:
Mirko's SDK comes with a CRT0.S if that is helpful. Sorry, I'm just a beginner... :unsure:

EDIT: Maybe there's a problem with your GCC, everyone uses DevkitARM now.
They used to use DevkitADV back in the day, since Frodo is old, that might just
fix it.

Do you have an old CRT0.o that came with your code? It may have been customized or something for Frodo. GCC is saying that its referencing variables that don't exist.
 
It's a looong time since I compiled Frodo (V7 .. i think it was! :blink: )

It used DKAdv back then and it also uses it's own init functions, so to get it to go you have to comment some lines that enable them in crt0.s that came with DKAdv

These are the lines that need fiddling, @ means they're commented out and I think this is how it is for Simple builds ;)
Code:
 .equ __OfficialEntry, 1
 .equ __OfficialInits, 1
@ .equ __OfficialUserInits, 1
I think Frodo might have them all commented out and do all it's own init's and startup :unsure:

You'll need to find them and try variations, and compile and copy it to the right place so it can be found by the compile

I used this batch file as a cover-all .. :ph34r:
Code:
c:\devkitadv\bin\as -o crt0.o crt0.s
copy crt0.o c:\devkitadv\lib\gcc-lib\arm-agb-elf\3.0.2\crt0.o
copy crt0.o c:\devkitadv\lib\gcc-lib\arm-agb-elf\3.0.2\interwork\crt0.o
copy crt0.o c:\devkitadv\lib\gcc-lib\arm-agb-elf\3.0.2\thumb\crt0.o
copy crt0.o c:\devkitadv\lib\gcc-lib\arm-agb-elf\3.0.2\thumb\interwork\crt0.o
Hopefully, having built your own toolchain you'll know where they should be :)


Hope this gives you some ideas ^_^
 
Thanks, gp32rich. I pulled down a copy of the devkitadv source but it appears to use a slightly patched newlib crt0 that seems to be even farther away (a total of 18 undefined symbols) from what I'm building.

I'll start poking around the various SDKs and seeing what I can glean from them. If I wind up at a dead end, I'll come back and start whining again. Or maybe turn to trying to fix OpenSnes9xGP instead (although I'm fairly sure it's my build environment that's sick, not the source).

Unfortunately, none of the binary toolchains will do me much good; I'm building on PPC Darwin. =)
 
Since I still haven't had any luck building Frodo, I'm working with Mike, who wrote the GP32 Frodo port, to test my patch. He seemed unaware of the issues with the new hardware -- perhaps I was the first "dodgy BLU" owner to contact him! -- but is willing to help sort things out.

Now on to fix OS9X, which looks a little harder (!!!) to compile.
 
majick posted on Dec 24 2004 at 03:20 AM said:
Since I still haven't had any luck building Frodo, I'm working with Mike, who wrote the GP32 Frodo port, to test my patch. He seemed unaware of the issues with the new hardware -- perhaps I was the first "dodgy BLU" owner to contact him! -- but is willing to help sort things out.
good news, I don't think he frequents the gp32 boards unless he releases a frodo update. Frodo is the centre of the earth for me (from a gp32 point of view) and definately needs addressing
 
Last edited by a moderator:
linkin' ain't easy but it's neccesairy
so I'm chasing makefiles like tom chases jerry
 
Back
Top