gbadev.org forum archive

This is a read-only mirror of the content originally found on forum.gbadev.org (now offline), salvaged from Wayback machine copies. A new forum can be found here.

Coding > Compiling GBA apps under Linux (knoppix)

#55367 - enliteneer - Wed Sep 28, 2005 1:58 am

Ive normally used Cygwin to compile under windows, and havent had any problems, but recently, I tried compiling the gba port of Contik (a tiny os and web browser designed for tiny microcontrollers)i:

http://www.sics.se/~adam/contiki/ports/index.html

and while it 'makes' without any errors, no output file is generated. I figured I should try under a real linux environment, but I rather not do an install at the moment. Has anyone ever got a working GBA developing environment under the linux live cd knoppix? What do I have to add/modify to the iso to support the devkitarm compiler?

BTW, this is the GBA makefile:
# portlib gba makefile

include ./../../makefile.config

all: gba

ascchar.o: ascchar.raw
bin2o .rodata ascchar.raw ascchar.o

gba: ascchar.o
# -W -Wall
@$(ARMAS) -I./../ -I. -o crt0.o crt0.s
@$(ARMCC) -W -Wall -O6 -c -I./../ -I. -D__GBA__ \
conio.c \
joystick.c \
./../none/joytokbd.c \
vsprintf.c \
ltostr.c \
_sbrk.c \
_oserror.c \
_exit.c \
_kill.c \
_getpid.c \
clock.c \
waitvblank.c \
gettv.c \
gba.c

@$(CP) crt0.o ./../../lib/gbastart.o
@$(ARMAR) -r ./../../lib/gbaport.a \
crt0.o \
gba.o \
conio.o \
joystick.o \
joytokbd.o \
ascchar.o \
vsprintf.o \
ltostr.o \
_sbrk.o \
_oserror.o \
_exit.o \
_kill.o \
clock.o \
waitvblank.o \
gettv.o \
_getpid.o

clean:
@$(RM) *.o
@$(RM) *.joy
@$(RM) *.lst


---------------------------------------------------------------------------

makefile.config:


#RM=/usr/bin/rm -f
RM=rm -f
CP=cp
NULL=/dev/null
FIND=/usr/bin/find
#XARGS=/usr/bin/xargs

#########################################################################################
# 6502/cc65 options
##########################################################################################

PUCRUNCH=pucrunch -fshort
EXOMIZER=exomizer

CC65_ASMINC=/ecos-c/xport/projects/contiki/arch/vic20/c65/asminc
export CC65_ASMINC
CC65_INCLUDE=/ecos-c/xport/projects/contiki/arch/vic20/c65/include
export CC65_INC

# location of the joystick drivers
JOYDRV=/usr/lib/cc65/joy

CCFLAGS=--asm-include-dir $(CC65_ASMINC)
OPTFLAGS=-Osir
CCFLAGS+=$(OPTFLAGS)
#CCFLAGS=-g --mapfile main.map

#########################################################################################
# Z80 Options
##########################################################################################

export PATH+=:/usr/local/bin

Z80CC=/usr/local/bin/sdcc
Z80AS=/usr/local/bin/as-z80
Z80LD=/usr/local/bin/link-z80

Z80ASFLAGS=-g
Z80CFLAGS=-Wall -lang-c++ -DSDCC=1 -DSDCC_PORT=z80 \
-DSDCC_PLAT=z80 -DSDCC_MODEL_SMALL -DINT_16_BITS \
-D__SDCC__ -I./ -I /usr/local/share/sdcc/include -D__SPECTRUM__ \
-mz80 --nostdinc --nostdlib --model-small \
\
-A -A --noinvariant --noinduction --callee-saves --callee-saves-bc \
--nojtbound --noloopreverse --int-long-reent --float-reent --no-peep \
--xram-movc

Z88DKCC=/usr/local/bin/zcc
Z88DKAS=/usr/local/bin/z80asm
Z88DKCFLAGS=+zx -vn -Wall -O0 -no-smartpf -D__Z88DK__ -D__SPECTRUM__
Z88DKCLIBS=-lmalloc -lndos

export Z80_OZFILES=/home/groepaz/devarchive/z80/z88dk/cvs/z88dk/lib/
export ZCCCFG=/home/groepaz/devarchive/z80/z88dk/cvs/z88dk/lib/config/
export Z80_STDLIB=/home/groepaz/devarchive/z80/z88dk/cvs/z88dk/lib/clibs/s.lib


GBCC=/usr/local/bin/sdcc
GBAS=/usr/local/bin/as-gbz80
GBASFLAGS=-g
GBCCFLAGS=-Wall -lang-c++ -DSDCC=1 -DSDCC_PORT=gbz80 \
-DSDCC_PLAT=gb -DSDCC_MODEL_SMALL -DGB=1 -DGAMEBOY=1 -DINT_16_BITS \
-D__SDCC__ -I./gb -I./ -I /usr/local/share/sdcc/include -D__GAMEBOY__ \
-mgbz80 --nostdinc --nostdlib --model-small \
\
-A -A --noinvariant --noinduction --callee-saves --callee-saves-bc \
--nojtbound --noloopreverse --int-long-reent --float-reent --no-peep \
--xram-movc

# --fommit-frame-pointer
# -lang-c++ -lang-c
# --noinvariant --noinduction
# --callee-saves --callee-saves-bc

GBLD=/usr/local/bin/link-gbz80

#########################################################################################
# Arm/GCC options
##########################################################################################

# ARMCC=/opt/ham/gcc-arm/bin/arm-elf-gcc
# ARMLD=/opt/ham/gcc-arm/bin/arm-elf-ld
# ARMOBJCOPY=/opt/ham/gcc-arm/bin/arm-elf-objcopy

ARMAS=/devkitadv/bin/arm-agb-elf-as
ARMCC=/devkitadv/bin/arm-agb-elf-gcc
ARMLD=/devkitadv/bin/arm-agb-elf-ld
ARMAR=/devkitadv/bin/arm-agb-elf-ar
ARMOBJCOPY=/devkitadv/bin/arm-agb-elf-objcopy

#55468 - Quirky - Wed Sep 28, 2005 7:44 pm

I'd change DevkitAdv for DevkitARM. Add the -specs=gba.specs link flag. Don't link with a "project specific" crt0 (unless it is really specific and has extra changes) and it may work. Having hard coded paths to the binary tools is a bit hacky. mv cp rm and friends should be in the PATH already. DevkitArm sticks to the standard naming convention and has arm-elf-gcc, etc instead of arm-elf-agb-gcc. You could add devkitArm/bin to the PATH too. crt0.o will have some kind of interrupt code that you may need to work around (singe_int.s in libgba is usually a direct replacement).

Failing that, download the Linux devkitAdv build and see if it works. Also, keep in mind that Knoppix is fairly memory intensive, so make sure you've got enough ram to play around with it.