The big picture :
The specs are :
I compile for an arm7tdmi, arm-eabi :
TARGET="arm-eabi"
TARGET_CPU="arm7tdmi"
I use the combined tree method, so i had to "recombine" the tree :
rm -fr ${SOURCES}/combined
cp -R ${SOURCES}/gcc-${GCC_VER} ${SOURCES}/combined
ln -s ${SOURCES}/gmp-${GMP_VER} ${SOURCES}/combined/gmp
ln -s ${SOURCES}/mpfr-${MPFR_VER} ${SOURCES}/combined/mpfr
ln -s ${SOURCES}/binutils-${BINUTILS_VER}/bfd ${SOURCES}/combined/
ln -s ${SOURCES}/binutils-${BINUTILS_VER}/binutils ${SOURCES}/combined/
ln -s ${SOURCES}/binutils-${BINUTILS_VER}/gas ${SOURCES}/combined/
ln -s ${SOURCES}/binutils-${BINUTILS_VER}/ld ${SOURCES}/combined/
ln -s ${SOURCES}/binutils-${BINUTILS_VER}/opcodes ${SOURCES}/combined/
ln -s ${SOURCES}/binutils-${BINUTILS_VER}/include/* ${SOURCES}/combined/include/
ln -s ${SOURCES}/newlib-${NEWLIB_VER}/newlib ${SOURCES}/combined/
ln -s ${SOURCES}/newlib-${NEWLIB_VER}/libgloss ${SOURCES}/combined/
ln -s ${SOURCES}/insight-${INSIGHT_VER}/gdb ${SOURCES}/combined/
ln -s ${SOURCES}/insight-${INSIGHT_VER}/itcl ${SOURCES}/combined/
ln -s ${SOURCES}/insight-${INSIGHT_VER}/libgui ${SOURCES}/combined/
ln -s ${SOURCES}/insight-${INSIGHT_VER}/readline ${SOURCES}/combined/
ln -s ${SOURCES}/insight-${INSIGHT_VER}/sim ${SOURCES}/combined/
ln -s ${SOURCES}/insight-${INSIGHT_VER}/tcl ${SOURCES}/combined/
ln -s ${SOURCES}/insight-${INSIGHT_VER}/tk ${SOURCES}/combined/
Then there is only one configure invocation :
mkdir -p ${BUILDS}/combined
cd ${BUILDS}/combined
${SOURCES}/combined/configure \
--prefix=${PREFIX} \
--target=${TARGET} \
--with-cpu=${TARGET_CPU} \
--with-newlib \
--disable-shared \
--disable-nls \
--disable-libgomp \
--disable-libmudflap \
--disable-libssp \
--enable-languages=c,c++ \
-v
Then the famous make && make install
. Here is the script i use for automatic building and a patch for bfd and zlib issues.
All you need is an ld script and a startup (kind of minimalist project). Then the makefile can look like this :
AS=arm-thumb-elf-as
CC=arm-thumb-elf-gcc
LD=arm-thumb-elf-ld
AR=arm-thumb-elf-ar
OBJCOPY=arm-thumb-elf-objcopy
ASFLAGS=-Wall -mthumb
CFLAGS=-Wall -mthumb
LDFLAGS=-mthumb -T gba.ld -nostartfiles
default: main.gba
main : main.o printf.o text_disp.o startup.o
main.gba : main
$(OBJCOPY) -v -O binary $< $@
clean :
rm -fr main main.gba *.o
For running your code, you can use a real hardware or an emulator (VisualBoyAdvance is good).
VisualBoyAdvance main.gba
We need the sources.
cd ${BASE}/sources/
cvs -z3 -d :pserver:anoncvs@ecos.sourceware.org:/cvs/ecos co -P ecos
cvs -z3 -d :pserver:anoncvs@ecos.sourceware.org:/cvs/ecos co -P host
export ECOSSRCDIR=${BASE}/sources/ecos/host
or
cd ${BASE}/downloads/
wget ftp://ecos.sourceware.org/pub/ecos/releases/ecos-3.0/ecos-3.0.i386linux.tar.bz2
cd ${BASE}/sources/
tar -jxvf ${BASE}/downloads/ecos-3.0.i386linux.tar.bz2
export ECOSSRCDIR=${BASE}/sources/ecos-3.0/tools/src
Then, we build the host tools.
mkdir -p ${BASE}/builds/ecos-tools
cd ${BASE}/builds/ecos-tools
${BASE}/sources/ecos/configure --prefix=${BASE}/ecos-tools
make
make install
mkdir -p tools/src/tools/configtool/standalone/wxwin/
ou
mkdir -p host/tools/configtool/standalone/wxwin/
make -f ${ECOSSRCDIR}/tools/configtool/standalone/wxwin/makefile.gnu install WXDIR=/path/to/wx/installation INSTALLDIR=${BASE}/ecos-tools OSTYPE=linux-gnu
Launch the config tool.
cd $(base)/builds/ecos-$(ECOS_VER)
export ECOS_REPOITORY=${BASE}/sources/ecos-3.0/packages
configtool
Import the gba package.
Tools->Administration : Add : browse to gbax.epk : Ok.
Choose the target.
Build->Template : in Hardware choose 'Game Boy Advance with Xport' : Ok.
Configure and save the configuration.
File->save : choose : $(BASE)/builds/ecos-gba/redboot.ecc : Ok.
Build the tree.
Build->Generate Build Tree
Run the compilation.
Build->Library
Refs :
ecos for gba
The Flash2Advance linkers allow to flash a Gameboy Advance card via USB (see if2a project).
However we can customize the linker for making a serial debuger for example.
The linker have one usb plug on one side, and a gba serial plug on the other.
Between, there is an AN2135 chip (cypress AN21xx, AN2131, or EZ-Usb family) with a 8051 core. It's firmware is loadable and customizable.
The pinout to the serial port is :
PIN0 PC0 RXD0 = 1 <---- So PIN1 PC1 TXD0 = 1 ----> Si GBA PIN4 PC4 T0 = 0 <---- Sd PIN6 PC6 WR# = 0 ----> Sc |
![]() |
Here is a kernel module to recognize the flash2advance as an usb serial tty.
Refs :
http://www.reinerziegler.de/GBA/flashmanager.htm
http://mootan.hg.to/
http://www.geocities.co.jp/Technopolis-Mars/9120/
http://www.linux-usb.org/ezusb/
http://wiki.erazor-zone.de/doku.php?id=wiki:projects:linux:ez-usb#writing_firmware et http://www.robmeerman.co.uk/project/gba
http://sourceforge.net/projects/ezusb2131