GP32 Setting Up An Sdk To Work In Bloodshed Dev-c++


Drag

Member
Joined
Jan 11, 2004
Messages
371
Age
35
Location
USA
Website
drag.wootest.net
I'm exhausted from searching, nothing helped.

I have Bloodshed Dev-C++. I managed to get it in the state where when I click "compile", it will run the correct arm-elf compiler.

I would like to set up Dev-C++ to use Mr.Mirko's SDK. I don't know what to put in my directories or anything, because when I try to compile an example program, I get a bunch of "undefined reference to gp_setCPUspeed" "undefined reference to gp_initFramebuffer" etc etc errors.

I don't know anything about makefiles, because it is my understanding that bloodshed generates them automatically when you compile.

I am farely new with C++, as I'm taking a class, and all we've done so far was windows console programs.

Please help, thanks.

Edit: Ok, it looks like the problem probably resides in the makefile that is generated. I'm going to have to set up a batch or something to compile it manually, but it'd be nicer to be able to click the 'compile' button, and it'll compile and load it up in geepee.

Anyone have any optimal ways of doing this? And do I *really* need to set up my environment variables? I'm kinda hesitant on that...

Edit 2: Gah, finally got it to compile and run in geepee32. :D I just had to include the SDK makefile, and change some labels. That's what I did originally, but it still wasn't working, so that's where I needed help here. After some experienting, I figured out that the tool chain programs only supported 8.3 filenames, so I just had to fix the paths. All is working now. :) It's just a simple program that prints some text, and tells you when A is pressed. I'm going to test it on my GP32 now.

Edit 3: It works! Yahoo! Random text looks MUCH BETTER when it's on a game system, from a program you made. :D
 
How do you set it up. Im so confused? Is there any online documents!
Thanks
 
Although bloodshed devc++ is a great tool, may I suggest you try visual studio? I use visual studio.net together with visual assist.net wich is a great and fast combination of tools.
 
Hey! Can you tell me how to start setting this up. I try and try again with no avail. Please help. I dont know how to set it to use the SDK nor how to setup the compiler.
:blink:
 
Although bloodshed devc++ is a great tool, may I suggest you try visual studio? I use visual studio.net together with visual assist.net wich is a great and fast combination of tools.

But visual studio costs money... dev-c++ doesn't. :p

Ok, now that I have some free time, I can explain how I did it.

Some complications of my method include:
- the fxe is generated, and so is an exe. I don't know if the exe is the .elf file or what, but all I know is that you just throw it away.
- the makefile doesn't clean. That means test.map and the .o files don't get deleted. all it does is make your project folder look kinda messy.
- you have to include a seperate makefile for each project file you make (ie, you can't just have 20 projects in one folder that use one makefile, you have to have an individual makefile for each project. You'll see why later.)

Ok. What these steps do exactly is it will set up bloodshed dev-c++ to compile your code using Mr.Mirko's SDK, and generate a working .fxe with devkitarm, using the compile button. No batches needed, no need to add stuff to environment variables. :D

Ok, here's how to do it:

- Download and install bloodshed dev-c++, and devkitarm. You'll probably have this done already.
- Go into /program files/dev-cpp/bin/ (assuming you installed it in /program files/dev-cpp/), and copy the programs MAKE and RM. Paste MAKE and RM into the BIN directory (NOT arm-elf/bin, just plain bin) of your devkitarm folder.
- Go to your Mr.Mirko SDK folder, and into one of the example folders (I went to example.font)
- Copy MAKEFILE and paste it wherever you're keeping your cpp project file.

You are going to need to make changes to MAKEFILE:
- change all: to all-before:
- change clean: to clean-custom:
- look for LIBS, CRT0, LNKSCRIPT, and INCLUDES. Change the paths to those files to the absolute paths. (for example, instead of it saying "../lib/crt0.s", change it to "c:/progra~1/gamepark/dev/gp32_sdk/lib/crt0.s" (as an example path) MAKE SURE you 'translate' the path into 8.3 format (add ~1, etc))
- the PRG variable should be the name of your main c or cpp file, minus the .c/.cpp. (so if my main source was called blah.c, I'd put blah there)
- the OBJ variable is almost the same thing, but instead, put EVERY .c/.cpp file's name there, but change the extensions to .o (so if I had blah.c, and blah.c includes crap.c, I'd put "blah.o crap.o" in the OBJS variable. (crap.c isn't part of the SDK, which is why I have to put it in OBJS.)).
- you are almost done modifying the makefile. Search for the b2fxec line. Change Mirko_Roller to your name, since you're the author, and change SDK_EXAMPLE_$(PRG) to the name of your program, as you want it to appear in Free Launcher or whatever you use.
- save. That is your makefile. When you make a new project, you'll have to copy this makefile and edit it according to your new project.

Ok. Unless I'm forgetting something, your files are now set up. Now you have to set up bloodshed dev-c++.

- first, open dev-cpp. Durrrr
- Go to compiler options
- click the add button next to the dropdown box. This adds a new set of compiler options for use when you're compiling a GP32 program, as opposed to a regular windows program.
- name it something that indicates it's a compiler for GP32 programs. :p
- make sure your newly added set is selected in the dropdown box.
- in the settings tab, set everything to 'no'.
- in the directories tab, remove everything, and set this up:
for binaries, put the devkitarm folder's BIN\ and ARM-ELF\BIN\.
add the SDK's LIB directory for libraries, and the LIB.SRC\INCLUDE directory for both the C and C++ includes.
- go to the programs tab, and put arm-elf-gcc.exe for gcc, arm-elf-g++.exe for g++. Everything else is fine as it is.
- click ok! :D

Whenever you create a new project:
- choose "console application". I know it says MS-DOS, just do it! :p
- remember where you save the project.
- dev-c++ will probably display an example cpp file for you; just clear it out and save it with your project.
- copy your makefile to the project's directory, and modify it to suit the needs of your new project.
- go into project options
- in the compiler tab, change the compiler to your GP32 compiler.
- in the makefile tab, add your custom makefile to the list, and click ok. (what this does is it will append the generated makefile with YOUR makefile.)
- you are finished! ^_^ Just remember to #include "gp32.h", or else the SDK functions will not work.

To compile, click the compile button, or use the menu bar. Don't click run, because that opens the generated EXE in a dos window, and I really don't know what it'll do.

That's as best as I can remember. I'm pretty sure that this will work.

Edit:
Apparently, the makefile above should be used if you are compiling C. To compile C++, make the same edits, but use the pure_c++ example's makefile instead.

Or, do this:
change LD from arm-elf-gcc to arm-elf-g++
add "CXX = arm-elf-c++"
add "CXXFLAGS = $(CFLAGS)"
 
Last edited by a moderator:
It's "Drag" actually, with a g. :p

But anyway, you're welcome! I'm assuming it works, from the way you said it. :D I hope this guide thingy helps other fellow new developers in need as well.

I need to figure out a way to get geepee32 to run when you hit RUN now...
 
Ok a quick question. Ive started editing the MAKEFILE and have got sutck :D

Code:
# This Makefile is very easy to use !
# Only edit PRG and OBJS 
# Dont touch anything else

CC = arm-elf-gcc
LD = arm-elf-gcc
AS = arm-elf-as
AR = arm-elf-ar

PRG  = font
OBJS = font.o

LIBS      = c:/gp32_M~1/mirkoS~1/gp32_SDK/lib -lmirkoSDK -lm
CRT0      = c:/gp32_M~1/mirkoS~1/gp32_SDK/lib/crt0.S
LNKSCRIPT = c:/gp32_M~1/mirkoS~1/gp32_SDK/lib/lnkscript
INCLUDES  = c:/gp32_M~1/mirkoS~1/gp32_SDK/lib.src/include
CFLAGS    = $(INCLUDES) -O2 -s -mtune=arm9tdmi

all-before:	$(OBJS)
	$(CC) -c -o crt0.o $(CRT0)
	$(LD) -nostartfiles -s -Wall -Wl,-Map,Test.map  -T $(LNKSCRIPT) crt0.o -o $(PRG).elf $(OBJS) $(LIBS)
	arm-elf-objcopy -O binary $(PRG).elf $(PRG).bin
	b2fxec -a Mirko_Roller -t SDK_EXAMPLE_$(PRG) $(PRG).bin $(PRG).fxe

install:
	gplink put $(PRG).fxe gpmm

clean-custom:
	rm -f *.o *~ Test.map *.bin *.elf

With changing the directories where are teh CFLAGS in the MrMirko SDK or do i leave that one?

Thanks in advance
 
Back
Top