GP32 Mr Mirko's Sdk - Help!


Axeman

Axemeister
Joined
Apr 5, 2003
Messages
4,220
Location
Newport, Wales, UK
Website
Visit site
Hi there all,

Right... You gotta bear in mind that I am a total muppet at the moment when it comes to coding - i.e. I know virtually ZIP.

I've done Rico's tutorials with some success, and have been taking a look at various other things, including Mr Mirko's SDK.

I'm using Alessandro's IDE to write my code.

The question (first of MANY) is, how do I incorperate the functions provided by mr Mirko's SDK into my development environment. I.e. what files do I place where from the SDK distribution. I've found the lib files (e.g. gp_smc.a), but how do I use them? Do I just copy them somewhere in the devkitadv folder and then #include them in my code? where else do I have to put refs? What do I have to add to the makefile etc etc etc.

This is all very basic stuff, but I'm a basic kind of guy when it comes to C at the moment, so bear with me :)

Thanks in advance people...
 
Okay, i'm not a windows user, so I might not be able to help you with devkitadvance, but i'll try.
I bet there's some "lib" folder underneath the devkitadv folder. That's where all the .a files go. You'll need to #include them into your project AND add them to the linker flags in the Makefile. You might consider looking at the demo projects mirko made with the SDK. I don't know how makefiles are handled in Alessandro's IDE (maybe project based or templates).
Hope that helps a little bit.
 
Cheers - it's a start :). To be honest, its all the makefile stuff that confuses the hell out of me. And yes, there is a lib folder in devkitadv, but there seems to lots of subfolders in that :blink:

This is my standard makefile (with Alessandro's IDE and devkitadv) :-

# devkitadv base dir
export CCBASE=C:/devkitadv/
# User options passed to the compiler
export CUSER=-DLITTLE_ENDIAN -DGP32 -W -Wall -ansi -pedantic
include $(CCBASE)/gp32.mk
#------------------------------

all: gpmain.fxe

gpmain.o: gpmain.c

gpmain.elf: gpmain.o
$(LINK)

gpmain.fxe: gpmain.gxb
b2fxe -t "Program title" -b "icon.bmp" -a "Author name" -r "PD" gpmain.gxb gpmain.fxe


clean:
del gpmain.gxb gpmain.fxe gpmain.elf gpmain.o


What do I need to add to this - I have NO idea how makefiles are constructed!

Any help would be appreciated muchly.

Thanks again in advance.
 
i'm pretty sure the actual linker flags reside in gp32.mk. There should be a line with LIBS in it. That's where they go.

Okay, i'll just try to explain what makefiles are good for...
Depending on the project, compiling an application isn't just "gcc -o blabla blabla.c". The whole thing might need libs, in your case mirko's sdk libs. Those libs are linked to the executable (well, they're linked to the object files, but that doesn't matter here) so the actual procedure calls you do are executable. Basically, that's what a makefile is for, describing HOW the application is built.
As you can see, your makefiles includes gp32.mk. I'm pretty sure the actual libs are linked there, because they aren't elsewhere. ;)
 
Thanks again Don.

This is the actual gp32.mk file in the devkitadv folder :-


# Makefile for GP32 development using devkitadv under Win32
# Written 2002 by Christian Nowak <chnowak@web.de>

# Settings
PREFIX=arm-agb-elf-

CC=$(CCBASE)/bin/$(PREFIX)gcc
CFLAGS=$(CUSER) \
-mcpu=arm9tdmi \
-mtune=arm9tdmi \
-fexpensive-optimizations \
-mapcs \
-O3 \
-mstructure-size-boundary=8 \
-mno-thumb-interwork \
-fno-builtin \
-fno-common \
-fno-exceptions \
-finline-functions \
-fomit-frame-pointer \
-fshort-enums \
-ffast-math \
-fshort-double \
-fallow-single-precision \
-ffreestanding \
-I$(CCBASE)/arm-agb-elf/include/gp32 \
-I$(CCBASE)/arm-agb-elf/include

CPPFLAGS=$(CUSER) \
-mcpu=arm9tdmi \
-mtune=arm9tdmi \
-O3 \
-mstructure-size-boundary=32 \
-finline-functions \
-fomit-frame-pointer \
-mno-thumb-interwork \
-fno-exceptions \
-fno-common \
-fno-builtin \
-fshort-enums \
-ffast-math \
-fshort-double \
-fexpensive-optimizations \
-mapcs \
-I$(CCBASE)/arm-agb-elf/include/gp32 \
-I$(CCBASE)/arm-agb-elf/include

LD=$(CC)
LNKSCRIPT=$(CCBASE)/arm-agb-elf/lib/lnkscript
LDFLAGS=-Wl,-T $(LNKSCRIPT)
GPLIBS=-lgpsdk -lgpgraphic -lgpmem -lgpos -lgpstdlib -lgpstdio -lgpsound -lgpfont -lgpg_ex01

AS=$(CCBASE)/bin/$(PREFIX)as

# OBJS
GPSTART=$(CCBASE)/arm-agb-elf/lib/gpsdk/gpstart/gpstart.o
GPOBJS=$(GPSTART)
# $(CCBASE)/arm-agb-elf/lib/gp32_fileio/gp32_fileio.o

LINK=$(LD) $(LDFLAGS) -o $@ $^ $(GPOBJS) $(GPLIBS)
<--- Anything to do with this???

OBJCOPY=$(CCBASE)/bin/$(PREFIX)objcopy

# Implicit Rules
%.o: %.c
$(CC) $(CFLAGS) -c $<

%.o: %.cpp
$(CC) $(CPPFLAGS) -c $<

%.gxb: %.elf
$(OBJCOPY) -O binary $< $@

%.o: %.s
$(AS) -o $@ $<



I've marked the line I thought was most likely to be the one to do with what I want to do, but I dont know if I'm even remotely in the right area!

Anyone know? Or even better, anyone actually using it like I'm trying to?

Cheers again!
 
Yep, That's the line... But I am using mirko's linux toolchain, and the whole lib linking is quite a bit different from that. It seems to me that Mirko is linking those libs against the other object files without the use of the -l switch.
I hope you'll get some help by someone using Mirko's sdk and devkitadv, i'm kinda stuck with that...
 
Axeman posted on Apr 12 2004 at 01:00 AM said:
Ah! Just noticed this line....

GPLIBS=-lgpsdk -lgpgraphic -lgpmem -lgpos -lgpstdlib -lgpstdio -lgpsound -lgpfont -lgpg_ex01

Am I getting warmer? :)
GPLIBS=-lgpsdk -lgpgraphic -lgpmem -lgpos -lgpstdlib -lgpstdio -lgpsound -lgpfont -lgpg_ex01

replace the line with complete paths to the libs dir in the sdk folder

GPLIBS=c:\gp32_SDK\lib\gp_common.a c:\gp32_SDK\lib\gp_font8.a

and so on with all *.a files in the lib dir.
 
Last edited by a moderator:
Mr Mirko - you are a genius! To be honest, it's the simplest answers that are usually the ones that are correct :) I'll give this a go and get back to you. Can I just add the paths at the end, so I could use the original SDK functions as well as your ones - for comparisons etc? (I'll give it a try anyway).
 
Hmmm - I added the paths to the file and then tried compiling one of the examples but got loads of errors. Hmmmm. Still compiles standars stuff fine though.
 
Axeman posted on Apr 11 2004 at 06:33 PM said:
Cheers - it's a start :). To be honest, its all the makefile stuff that confuses the hell out of me. And yes, there is a lib folder in devkitadv, but there seems to lots of subfolders in that :blink:

This is my standard makefile (with Alessandro's IDE and devkitadv) :-

# devkitadv base dir
export CCBASE=C:/devkitadv/
# User options passed to the compiler
export CUSER=-DLITTLE_ENDIAN -DGP32 -W -Wall -ansi -pedantic
include $(CCBASE)/gp32.mk
#------------------------------

all: gpmain.fxe

gpmain.o: gpmain.c

gpmain.elf: gpmain.o
$(LINK)

gpmain.fxe: gpmain.gxb
b2fxe -t "Program title" -b "icon.bmp" -a "Author name" -r "PD" gpmain.gxb gpmain.fxe


clean:
del gpmain.gxb gpmain.fxe gpmain.elf gpmain.o


What do I need to add to this - I have NO idea how makefiles are constructed!

Any help would be appreciated muchly.

Thanks again in advance.
if the makefile stuff confuses you (like me) then get the eval version of arm developer suite, it rocks my socks off! no makefiles are needed, you just add your all of the files to be compiled into your project and compile em...plus it can actually do the math stuff pretty well... cuz doing the sin cos demo with devkit adv got someone an F'ed up box...where as with ADS i got the perfect circle..pretty fun stuff...

i'm done...
 
Last edited by a moderator:
hrmm... in synkro's tute 1 he begins it with

#include <gp32.h>

should I not be listing the .h files from the 'gp32_SDK\lib.src' folder (and subfolders), as well as the .a files, under the GPLIBS section of gp32.mk??

or do the .a files act as a link to these apparently 'main' ones?? :ph34r:
 
Back
Top