GP32 So I've Taken The Plunge Into Dk-arm!


gp32rich

Never been accused of being subtle
Joined
Nov 16, 2003
Messages
840
Location
dev heck!
Website
www.geocities.com
So I've finally got around to grabbing DevKitArm_r8 (and Msys, and gpsdk.zip) and threw them all into a directory that now looks like this
Code:
c:\devkitarm
+devkitarm_r8
|+arm-elf
|+bin
|+include
|+info
|+lib
|+libexec
|+man
+gamepark_sdk
|+include
|+lib
+msys-1.0

I found a makefile from here and I fiddled with paths until I got a compile (it took a while to find the post that says 'put gpstart.o in your makefile' <_<

And I finally got a compile that works .. with GeePee32

When I try it on my gp32_console I just get a reset. :blink:
(Yes! I tried new batteries :rolleyes: Yes! Old compiles still work! B) )

What have I missed?
Should I have copied files from gamepark_sdk into devkitarm_r8?
Which crt0.o should I be pointing at (and where is it referenced?)

At the moment everything is pretty much vanilla

Here's the makefile
Code:
# Core Makefile for GP32 development using GCC
# Written 2002 by Christian Nowak <chnowak@web.de>
# Patched 2004 by DJWillis for GamePark SDK project
# compatability for newer GCC's using Patched GameParkSDK
# Version 2.0

# gpSDK root directory
export GPSDK  = c:/devkitARM
   #/cygdrive/c/gpTC/sdk/gp

# devkitadv base dir
export CCBASE=c:/devkitarm
# User options passed to the compiler
export CUSER=-DLITTLE_ENDIAN -DGP32
#include $(CCBASE)/gp32_gpsdk.mk
include $(GPSDK)/gp32.mk

# For creating .fxe
TARGET  = MyFirst
APPNAME = My First Compile with DevKitArm!
AUTHOR  = Rich
FXETOOL = b2fxec

.SFILES   =

.CFILES   = MyFirst.c

OBJS   = $(.SFILES:.s=.o) $(.CFILES:.c=.o)


# Outputs
ELF   = $(TARGET).elf
MAPFILE   = $(TARGET).map
BIN   = $(TARGET).gxb
FXE   = $(TARGET).fxe

.PHONY: all clean depend

all: $(FXE)


clean:
	rm -f $(OBJS) $(MAPFILE) $(BIN) $(ELF) $(FXE)

$(ELF): $(OBJS) $(GPSDK)/gamepark_sdk/gpstart.o
	$(LINK)

$(BIN): $(ELF)
	$(OBJCOPY) -O binary $< $@

$(FXE): $(BIN)
	$(FXETOOL) -b $(TARGET).bmp -f -a "$(AUTHOR)" -t "$(APPNAME)" $< $@

$(.CFILES):

Here's the include $(GPSDK)/gp32.mk file (It's how DKAdv used to do it and it makes the makefile look neat :) )

Code:
# Core Makefile for GP32 C development using GCC 3.x.x
# Written 2002 by Christian Nowak <chnowak@web.de>
# Rewritten 2004 by DJWillis <gp32@distant-earth.co.uk> for 
# GamePark SDK project compatability for newer GCC's using 
# GPSDK (non-interworking, correctly marked libs).
# Version 2.5

# GCC Tool-chain
CC  	=	arm-elf-gcc
CXX  	=	arm-elf-g++
LD  	=	arm-elf-gcc
AS  	=	arm-elf-as
OBJCOPY  =	arm-elf-objcopy

CFLAGS  =	$(CUSER) \
          $(OPT_LEVEL) \
    -marm \
    -march=armv4t \
          -mtune=arm920t \
          -mapcs \
          -fomit-frame-pointer \
          -finline-functions \
          -fshort-enums \
          -ffast-math \
          -fshort-double \
          -mstructure-size-boundary=8 \
          -mno-thumb-interwork \
    -I$(GPSDK)/gamepark_sdk/include \
    -Wno-multichar

CPPFLAGS	=	$(CUSER) \
          $(OPT_LEVEL) \
    -marm \
    -march=armv4t \
    -mtune=arm920t \
          -mapcs \
          -fomit-frame-pointer \
          -finline-functions \
          -fshort-enums \
          -ffast-math \
          -fshort-double \
          -mstructure-size-boundary=8 \
          -mno-thumb-interwork \
    -I$(GPSDK)/gamepark_sdk/include \
    -Wno-multichar

LIBDIRS  =	-L$(GPSDK)/gamepark_sdk/lib

LDSPECS  =	-specs=$(GPSDK)/gamepark_sdk/gp32_gpsdk.specs

LDFLAGS  =  $(LDSPECS) \
    -Wl,-Map,$(MAPFILE) \
    $(LIBDIRS) \
    $(GP_LIBS) \
    $(LIBS_USER)
    
GP_LIBS  =	-lgpgraphic -lgpgraphic16 -lgpmem -lgpos -lgpstdlib -lgpstdio -lgpsound -lgpg_ex01 -lgpfont -lgpfont16

# Startup GP32 Objects
GP_START	=	$(GPSDK)/gamepark_sdk/gpstartup.o
GP_FILEIO	=	$(GPSDK)/sdk/extra_sdk/gp32_fileio/gp32_fileio.o

# Uncomment the link(s) below to use the default SDK startup in preferance to custom startup.
GP_OBJS  =	$(GP_START) 
#    $(GP_FILEIO)

LINK  =	$(LD) $(STRIP_DEBUG) -o $@ $^ $(LDFLAGS) 

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

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

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

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



Any help would be very much appreciated and will save the little hair I have left :unsure:
And I might just get out of dev-heck and around to updating some hanging projects too ^_^

Cheers!
Rich
 
Its not a devkitadv makefile.

It's a devkitarm makefile I cut/pasted from here, but twiddled to look like a dk-adv stylee with an included gp32.mk in the devkitarm base folder.
Makes the makefiles much easier. IMO ;)

Code:
# devkitadv base dir
This is just a comment ;) to help me add the include directive.
ALL the paths point into the dkARM base directory
The rest is from a devkitARM makefile from these hallowed threads.


As for the Q about where crt0.o is added. I found it hiding in the .spec file
Now I just need to be sure it's the right one.

Thanks for looking at it :)
Any ideas why the hardware won't have at it?

I'm wondering about where specific files like the *_crt0.o's should be and which I should be using .. from which .spec file


btw. I would have downloaded the gpTC files as pointed at by devkit.tk
But they weren't there :(
 
Well....

I have only crt0.o in ../devkitarm_r8/arm-elf/lib
and the .specs file in there references gp32_gpsdk_crt0%O%s
but no path, so I don't *know* which it's supposed to be :/
Is the one supplied with DKArm okay?

I also have ..

in ../devkitarm_r8/arm-elf/lib
er_crt0.o
gba_crt0.o
gp32_crt0.o
gp32_gpsdk_crt0.o
er_crt0.s
gba_crt0.s
gp32_crt0.s
gp32_gpsdk_crt0.s

and in ../gamepark_sdk
gp32_gpsdk_crt0.o -- this one is recent and possibly created by me :S
gpstart.o -- created by the makefiles
gp32_crt0.s
gp32_gpsdk_crt0.S


So I guess I've got to compile the correct gp32*crt0.s and put it in the right place as crt0.o .. but where?

Ah well. Back to trial and error :rolleyes:

Thanks for your interest ;) :)
 
k, try this:

Make sure you downloaded msys and devkitarm stuff and put them in thier default places so your path in windows points to C:\msys\1.0\bin and C:\devkitARM_r8\bin

Then download the gamepark_sdk.zip and extract it to C:\devkitARM_r8\

Now copy and paste this makefile I got from Dalto. All you have to do is place it in a project folder like c:\gp32\projects\hellotest\ which has a c\c++ file that calls GpMain() in it and has the file gpstart.c. (You might want to change the targetname and other stuff in the makefile but its really easy to do).

It should compile now...

Here is an example project with the make file below included. Try to compile it and see if it works.

Hope any of this helped! :)

Code:
#---------------------------------------------------------------------------------
# Clear the implicit built in rules
#---------------------------------------------------------------------------------
.SUFFIXES:
#---------------------------------------------------------------------------------

#---------------------------------------------------------------------------------
# TARGET is the name of the output
# BUILD is the directory where object files & intermediate files will be placed
# SOURCES is a list of directories containing source code
# INCLUDES is a list of directories containing extra header files
#---------------------------------------------------------------------------------
TARGET  :=	hellotest
BUILD  :=	build
SOURCES  :=	.
INCLUDES	:=	.

#---------------------------------------------------------------------------------
# path to tools - this can be deleted if you set the path in windows
#---------------------------------------------------------------------------------
export PATH  :=	/c/devkitARM_r8/bin:/bin
#---------------------------------------------------------------------------------
# options for code generation
#---------------------------------------------------------------------------------
CFLAGS	:=	-save-temps -g -Wall -O2\
  	-mcpu=arm920t -mtune=arm920t\
    -fomit-frame-pointer\
  	-ffast-math -std=c99

CFLAGS	+=	$(INCLUDE)

AFLAGS	:=
LDFLAGS	=	-g -Wall -W -Wl,-Map,$(notdir $@).map

#---------------------------------------------------------------------------------
# the prefix on the compiler executables
#---------------------------------------------------------------------------------
PREFIX  	:=	arm-elf-
#---------------------------------------------------------------------------------
# any extra libraries we wish to link with the project
#---------------------------------------------------------------------------------
LIBS	:=	-lgpfont -lgpgraphic -lgpos -lgpstdio -lgpg_ex01 \
  	-lgpmem -lgpsound -lgpstdlib -lm 

#---------------------------------------------------------------------------------
# list of directories containing libraries, this must be the top level containing
# include and lib
#---------------------------------------------------------------------------------
LIBDIRS	:=	/c/devkitARM_r8/gamepark_sdk

#---------------------------------------------------------------------------------
# no real need to edit anything past this point unless you need to add additional
# rules for different file extensions
#---------------------------------------------------------------------------------
ifneq ($(BUILD),$(notdir $(CURDIR)))
#---------------------------------------------------------------------------------

export OUTPUT	:=	$(CURDIR)/$(TARGET)

export VPATH	:=	$(foreach dir,$(SOURCES),$(CURDIR)/$(dir))

export CC	:=	$(PREFIX)gcc
export CXX	:=	$(PREFIX)g++
export AR	:=	$(PREFIX)ar
export OBJCOPY	:=	$(PREFIX)objcopy
#---------------------------------------------------------------------------------
# use CXX for linking C++ projects, CC for standard C
#---------------------------------------------------------------------------------
#export LD	:=	$(CXX)
export LD	:=	$(CC)

#---------------------------------------------------------------------------------
# automatically build a list of object files for our project
#---------------------------------------------------------------------------------
CFILES  :=	$(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.c)))
SFILES  :=	$(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.s)))

export OFILES	:=	$(CFILES:.c=.o) $(SFILES:.s=.o)

#---------------------------------------------------------------------------------
# build a list of include paths
#---------------------------------------------------------------------------------
export INCLUDE	:=	$(foreach dir,$(INCLUDES),-I$(CURDIR)/$(dir)) \
  	$(foreach dir,$(LIBDIRS),-I$(dir)/include) \
  	-I$(CURDIR)/$(BUILD)

#---------------------------------------------------------------------------------
# build a list of library paths
#---------------------------------------------------------------------------------
export LIBPATHS	:=	$(foreach dir,$(LIBDIRS),-L$(dir)/lib)

.PHONY: $(BUILD) clean

#---------------------------------------------------------------------------------
$(BUILD):
	@echo Building source code...
	@[ -d $@ ] || mkdir -p $@
	@make --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile

#---------------------------------------------------------------------------------
clean:
	@echo Make me clean! ...
	@rm -fr $(BUILD) *.elf *.bin

#---------------------------------------------------------------------------------
runonly:

	geepee/geepee32.exe //smc gp32/$(TARGET).smc //run
  
#---------------------------------------------------------------------------------

#---------------------------------------------------------------------------------
run:	

	cp $(TARGET).fxe gp32/gp/gpmm/.
	gp32/makesmc gp32/gp gp32/$(TARGET).smc
	geepee/geepee32.exe //smc gp32/$(TARGET).smc //run
  
#---------------------------------------------------------------------------------

else

DEPENDS	:=	$(OFILES:.o=.d)

#---------------------------------------------------------------------------------
# main targets
#---------------------------------------------------------------------------------
$(OUTPUT).fxe	:	$(OUTPUT).elf

$(OUTPUT).elf	:	$(OFILES)


#---------------------------------------------------------------------------------
%.fxe	:	%.elf
	@$(OBJCOPY) -O binary $< $*.bin
	@echo Creating a .fxe file...
	@b2fxec -a Ksmiler -t $(TARGET) $*.bin $@
	@echo All Done!
	@echo.
	@echo Thank Dalto for this makefile ^_^
	@echo.
	
#End of make!
	
#---------------------------------------------------------------------------------
%.elf:
	@echo.
	@echo Linking into an .elf file...
	@$(LD)  $(LDFLAGS) -specs=gp32_gpsdk.specs $(OFILES) $(LIBPATHS) $(LIBS) -o $@

#---------------------------------------------------------------------------------
# Compile Targets for C/C++
#---------------------------------------------------------------------------------


#---------------------------------------------------------------------------------
%.o : %.cpp
	@echo $(notdir $<)
	@$(CXX) -MMD $(CFLAGS) -o $@ -c $<

#---------------------------------------------------------------------------------
%.o : %.c
	@echo Compiling $(notdir $<)
	@$(CC) -MMD $(CFLAGS) -o $@ -c $<

#---------------------------------------------------------------------------------
%.o : %.s
	@echo $(notdir $<)
	@$(CC) -MMD $(ASFLAGS) -o $@ -c $<


-include $(DEPENDS)

#---------------------------------------------------------------------------------
endif
#---------------------------------------------------------------------------------
 
Yes!! That worked!! It ran on the hardware!
Thankyou Thank you! :)

Turns out that I had extracted the gamepark_sdk[_lib].zip file to it's own directory instead of over devkitarm_r8! :rolleyes:

Phew! And that was one heck of a makefile :wacko: :blink: :unsure:

Thanks again! ^_^
 
Just an update ;)

I found a DevKitARM group at yahoo...
http://groups.yahoo.com/group/devkitARM
That gives some good info about how things should be set up.

Some code doesn't compile since __FUNCTION__ is no longer defined as a literal string <_< :rolleyes:
It was very handy in debugging so them bits'll need a rewrite ;)

I also had a problem where the linker couldn't find GpMain()
'There it is!' I'd shout. 'Right in this file!' :angry:

The problem was this new makefile makes a distinction between effdup.c and EFFDUP.C <_<
I'm going to twiddle some ;)

Yes! I make on a windows machine B)
Is there a switch to ignore case? :D
Ah! Ain't cross platform compatiblity fun! :D :lol: :|


Thanks again for all your help! :)
 
If you want a hand with those makefiles drop me a mail, they where made to make going from DKAdv to DKArm less grief but they still need some work and the readme got left out of the version on the DKArm site. I'll sort a new release when I get some time over xmas and chuck them on the DKArm site.
 
Back
Top