DS: Started work on a new build system for the Nintendo DS port, based on configure (and thus suitable for buildbot). Currently only the ARM7 part is 'done'

svn-id: r42939
This commit is contained in:
Max Horn 2009-07-30 18:27:50 +00:00
parent 25d83581dc
commit f5112efa11
3 changed files with 220 additions and 8 deletions

111
backends/platform/ds/ds.mk Normal file
View file

@ -0,0 +1,111 @@
# Repeat "all" target here, to make sure it is the first target
# Currently disabled, so only arm7.bin gets build
#all:
# Files in this list will be optimisied for speed, otherwise they will be optimised for space
OPTLIST := actor.cpp ds_main.cpp osystem_ds.cpp blitters.cpp fmopl.cpp rate.cpp isomap.cpp image.cpp gfx.cpp sprite.cpp actor_path.cpp actor_walk.cpp
#OPTLIST :=
# Compiler options for files which should be optimised for speed
OPT_SPEED := -O3
# Compiler options for files which should be optimised for space
OPT_SIZE := -Os -mthumb
#-mthumb -fno-gcse -fno-schedule-insns2
OBJS := $(DATA_OBJS) $(LIBCARTRESET_OBJS) $(PORT_OBJS) $(COMPRESSOR_OBJS) $(FAT_OBJS)
# TODO: Handle files in OPTLIST.
# For this, the list should be made explicit. So, replace actor.cpp by path/to/actor.cpp --
# in fact, there are several actor.cpp files, and right now all are "optimized", but
# I think Neil only had the SAGA one in mind. Same for gfx.cpp
#############################################################################
#############################################################################
#############################################################################
#ndsdir = $(srcdir)/backends/platform/ds
ndsdir = backends/platform/ds
#############################################################################
#
# ARM7 rules.
# For ARM7 files, we need different compiler flags, which leads to the
# extra rules for .o files below
#
#############################################################################
$(ndsdir)/arm7/arm7.bin: $(ndsdir)/arm7/arm7.elf
$(ndsdir)/arm7/arm7.elf: \
$(ndsdir)/arm7/source/libcartreset/cartreset.o \
$(ndsdir)/arm7/source/main.o
# HACK/FIXME: C compiler, for cartreset.c -- we should switch this to use CXX
# as soon as possible.
CC := $(DEVKITARM)/bin/arm-eabi-gcc
# HACK/TODO: Pointer to objcopy. This should really be set by configure
OBJCOPY := $(DEVKITARM)/bin/arm-eabi-objcopy
#
# Set various flags
#
ARM7_ARCH := -mthumb-interwork
# note: arm9tdmi isn't the correct CPU arch, but anything newer and LD
# *insists* it has a FPU or VFP, and it won't take no for an answer!
ARM7_CFLAGS := -g -Wall -O2\
-mcpu=arm7tdmi -mtune=arm7tdmi -fomit-frame-pointer\
-ffast-math \
$(ARM7_ARCH) \
-I$(srcdir)/$(ndsdir)/arm7/source/libcartreset \
-I$(srcdir)/$(ndsdir)/commoninclude \
-I$(DEVKITPRO)/libnds/include \
-I$(DEVKITPRO)/libnds/include/nds \
-DARM7
ARM7_CXXFLAGS := $(ARM7_CFLAGS) -fno-exceptions -fno-rtti
ARM7_LDFLAGS := -g $(ARM7_ARCH) -mno-fpu
# HACK/FIXME: Define a custom build rule for cartreset.c.
# We do this because it is a .c file, not a .cpp file and so is outside our
# regular build system anyway. But this is *bad*. It should be changed into a
# .cpp file and this rule be removed.
%.o: %.c
$(MKDIR) $(*D)/$(DEPDIR)
$(CC) -Wp,-MMD,"$(*D)/$(DEPDIR)/$(*F).d",-MQ,"$@",-MP $(CXXFLAGS) $(CPPFLAGS) -c $(<) -o $*.o
# Set custom build flags for cartreset.o
$(ndsdir)/arm7/source/libcartreset/cartreset.o: CXXFLAGS=$(ARM7_CFLAGS)
$(ndsdir)/arm7/source/libcartreset/cartreset.o: CPPFLAGS=
# Set custom build flags for main.o
$(ndsdir)/arm7/source/main.o: CXXFLAGS=$(ARM7_CXXFLAGS)
$(ndsdir)/arm7/source/main.o: CPPFLAGS=
# Rule for creating ARM7 .bin files from .elf files
%.bin: %.elf
@echo ------
@echo Building $@...
$(OBJCOPY) -O binary $< $@
# Rule for creating ARM7 .elf files by linking .o files together with a special linker script
%.elf:
@echo ------
@echo Building $@...
$(CXX) $(ARM7_LDFLAGS) -specs=ds_arm7.specs $+ -L/opt/devkitPro/libnds/lib -lnds7 -o $@

View file

@ -0,0 +1,71 @@
MODULE := backends/platform/ds
ARM7_MODULE_OBJS := \
arm7/source/main.o \
arm7/source/libcartreset/cartreset.o \
PORT_OBJS := \
arm9/source/blitters_arm.o \
arm9/source/cdaudio.o \
arm9/source/dsmain.o \
../../fs/ds/ds-fs.o \
arm9/source/gbampsave.o \
arm9/source/scummhelp.o \
arm9/source/osystem_ds.o \
arm9/source/portdefs.o \
arm9/source/ramsave.o \
arm9/source/touchkeyboard.o \
arm9/source/zipreader.o \
arm9/source/dsoptions.o \
arm9/source/keys.o \
arm9/source/wordcompletion.o \
arm9/source/interrupt.o
ifdef USE_PROFILER
PORT_OBJS += arm9/source/profiler/cyg-profile.o
endif
DATA_OBJS := \
arm9/data/icons.o \
arm9/data/keyboard.o \
arm9/data/keyboard_pal.o \
arm9/data/default_font.o \
arm9/data/8x8font_tga.o
COMPRESSOR_OBJS := #arm9/source/compressor/lz.o
FAT_OBJS := arm9/source/fat/disc_io.o arm9/source/fat/gba_nds_fat.o\
arm9/source/fat/io_fcsr.o \
arm9/source/fat/io_m3cf.o \
arm9/source/fat/io_mpcf.o \
arm9/source/fat/io_sccf.o \
arm9/source/fat/io_m3sd.o \
arm9/source/fat/io_nmmc.o \
arm9/source/fat/io_scsd.o \
arm9/source/fat/io_scsd_asm.o \
arm9/source/fat/io_njsd.o \
arm9/source/fat/io_mmcf.o \
arm9/source/fat/io_sd_common.o \
arm9/source/fat/io_m3_common.o \
arm9/source/fat/io_dldi.o \
arm9/source/fat/m3sd.o
# arm9/source/fat/io_cf_common.o arm9/source/fat/io_m3_common.o\
# arm9/source/fat/io_sd_common.o arm9/source/fat/io_scsd_s.o \
# arm9/source/fat/io_sc_common.o arm9/source/fat/io_sd_common.o
LIBCARTRESET_OBJS :=
#arm9/source/libcartreset/cartreset.o
MODULE_OBJS :=
# TODO: Should add more dirs to MODULE_DIRS so that "make distclean" can remove .deps dirs.
MODULE_DIRS += \
backends/platform/ds/
# We don't use the rules.mk here on purpose
OBJS := $(addprefix $(MODULE)/, $(MODULE_OBJS)) $(OBJS)

46
configure vendored
View file

@ -279,7 +279,7 @@ get_system_exe_extension() {
gp2x-linux)
_exeext=".gp2x"
;;
dreamcast | wii | gamecube | psp)
dreamcast | wii | gamecube | nds | psp)
_exeext=".elf"
;;
*)
@ -553,7 +553,7 @@ Usage: $0 [OPTIONS]...
Configuration:
-h, --help display this help and exit
--backend=BACKEND backend to build (sdl, morphos, dc, gp2x, gp2xwiz, iphone, wince, wii, psp, null) [sdl]
--backend=BACKEND backend to build (sdl, dc, gp2x, gp2xwiz, iphone, morphos, nds, psp, wii, wince, null) [sdl]
Installation directories:
--prefix=DIR use this prefix for installing ScummVM [/usr/local]
@ -568,6 +568,7 @@ Special configuration feature:
dreamcast for Sega Dreamcast
wii for Nintendo Wii
gamecube for Nintendo Gamecube
nds for Nintendo DS
iphone for Apple iPhone
wince for Windows CE
psp for PlayStation Portable
@ -841,17 +842,22 @@ wii)
_host_cpu=ppc
_host_alias=powerpc-gekko
;;
gamecube)
_host_os=gamecube
_host_cpu=ppc
_host_alias=powerpc-gekko
;;
nds)
_host_os=nds
_host_cpu=arm
_host_alias=arm-eabi
;;
psp)
_host_os=psp
_host_cpu=mipsallegrexel
_host_alias=psp
LDFLAGS="$LDFLAGS -L$PSPDEV/psp/sdk/lib -specs=$_srcdir/backends/platform/psp/psp.spec"
;;
gamecube)
_host_os=gamecube
_host_cpu=ppc
_host_alias=powerpc-gekko
;;
*)
if test -n "$_host"; then
guessed_host=`$_srcdir/config.sub $_host`
@ -888,7 +894,7 @@ esac
# Platform specific sanity checks
#
case $_host_os in
wii | gamecube)
wii | gamecube | nds)
if test -z "$DEVKITPRO"; then
echo "Please set DEVKITPRO in your environment. export DEVKITPRO=<path to devkitPRO>"
exit 1
@ -1168,6 +1174,9 @@ case $_host_os in
CXXFLAGS="$CXXFLAGS -I$DEVKITPRO/libogc/include"
LDFLAGS="$LDFLAGS -mogc -mcpu=750 -L$DEVKITPRO/libogc/lib/cube"
;;
nds)
# TODO nds
;;
psp)
CXXFLAGS="$CXXFLAGS -O2 -G0 -I$PSPDEV/psp/sdk/include -D_PSP_FW_VERSION=150"
;;
@ -1399,6 +1408,24 @@ if test -n "$_host"; then
add_line_to_config_h "/* #define DEBUG_WII_MEMSTATS */"
add_line_to_config_h "/* #define DEBUG_WII_GDB */"
;;
nds)
echo "Cross-compiling to $_host, forcing endianness, alignment and type sizes"
# TODO: complete this
# TODO: Maybe rename nds -> ds (would be more consistent with other backends)
DEFINES="$DEFINES -DUSE_ARM_SMUSH_ASM"
_endian=little
_need_memalign=yes
type_1_byte='char'
type_2_byte='short'
type_4_byte='int'
_backend="nds"
_build_hq_scalers="no"
_mt32emu="no"
add_line_to_config_mk 'include $(srcdir)/backends/platform/ds/ds.mk'
# TODO: Enable more ARM optimizations -- requires testing!
add_line_to_config_mk 'USE_ARM_SOUND_ASM = 1'
add_line_to_config_mk 'USE_ARM_SMUSH_ASM = 1'
;;
psp)
echo "Cross-compiling to $_host, forcing endianness, alignment and type sizes"
_endian=little
@ -2046,6 +2073,9 @@ case $_backend in
;;
esac
;;
nds)
# TODO nds
;;
psp)
DEFINES="$DEFINES -D__PSP__ -DDISABLE_TEXT_CONSOLE -DDISABLE_COMMAND_LINE"
INCLUDES="$INCLUDES -I$PSPDEV/psp/include/SDL"