Archived

This topic is now archived and is closed to further replies.

arsenius

Anyone deving for Gameboy advance, with gcc? I need help:'(

Recommended Posts

I dont currently make things for GBA so i can''t help you there, but where can i get information on doing this as im also intrested :D

Share this post


Link to post
Share on other sites
Here are some links that seem to be good


www.agbdev.net
gbadev.org
http://www.devrs.com/gba/

Hope these help


ps I am going to start looking into this properly soon as it looks really cool

regards,

Paul

Share this post


Link to post
Share on other sites
Yeah, i''ve been to those sites already, and they have some information, but not what I need. I need help learning how to set up gcc for arm, so that I can compile things I know I could use the official arm compiler, and it produces code, but i''d rather like to use something legal (the arm compiler is a 60 day trial, but the sites circulate a crack)

anyone interested, there is a tutorial in the works at
the Pern Project
of course, it explains how to set up the compiler i''m trying to avoid using




-arsenius
''after three days without programming, life becomes meaningless'' -The Tao of Programming

Share this post


Link to post
Share on other sites
I''m using GCC but I didn''t have any problems running it.
You have to put the following line in your autoexec.bat:
PATH=C:\Gba\dev\armgcc;%path%

replace the directory where you''ve put your compiler in.
when you want to compile something, you have to be in DOS (or DOS-box) and run gcc or use makefiles (which is much more convenient)

Share this post


Link to post
Share on other sites
I''m not an expert when it comes to makefiles, but I''ll do my best. This is what my makefile looks like (and don''t include the comments I''ve put in it):

_AGBINC = C:\Emu\Gba\dev\armgcc\include
_AGBLIB = C:\Emu\Gba\dev\armgcc\lib

/* These variables are used later in the makefile. _AGBINC will tell the compiler where it can find the include-files, _AGBLIB will tell where the libraries are.
*/

.CFILES = main.c

// This line makes sure main.c will be compiled

.OFILES = C:\Emu\Gba\dev\armgcc\gfxlib\crt0.o $(.CFILES:.c=.o)

// This is for including an object file I use.

CFLAGS = -g -O2 -I$(_AGBINC) -mthumb-interwork \
-nostdlib -Wall -save-temps -fverbose-asm

/* These are the flags used when compiling all the code. You can see here that _AGBINC is used here to tell where the header-files are. */

LDFLAGS += -Map $(MAPFILE) -nostartfiles \
-Ttext 0x08000000 -Tbss 0x03000000 \
-L$(_AGBLIB) \
-L. \
-Tlnkscript

//These are the flags used when linking everything together.

MAPFILE = fruit.map
TARGET_ELF = fruit.elf
TARGET_BIN = fruit.bin

/* TARGET_BIG specifies the file that can be run with the emulators */

$(TARGET_BIN): $(TARGET_ELF)
objcopy -v -O binary $< $@

$(TARGET_ELF): $(.OFILES) Makefile $(.AFILES)
@echo > $(MAPFILE)
$(CC) -g -o $@ $(.OFILES) -Wl,$(LDFLAGS)

.PHONY: all clean depend data

all: clean depend data $(TARGET_BIN)

clean:
# -rm $(.OFILES)
clean_data:
$(foreach .ADIR_TMP, $(dir $(.AFILES)), make -C $(.ADIR_TMP) clean

.SUFFIXES: .s .c .o .a

You don''t really need to know what the rest of the makefile is used for (I don''t know it too), it just works.

I hope you found this helpful.

Share this post


Link to post
Share on other sites