From 705a26cf41946d9a97d0153e1bf7f2d9f2488e65 Mon Sep 17 00:00:00 2001 From: normmatt234 Date: Thu, 1 Jul 2010 05:27:33 +0000 Subject: [PATCH] Armwrestler now uses standard devkitarm makefiles. --- tools/ds_tests/armwrestler/Makefile | 150 ++++++++++++++++++ tools/ds_tests/armwrestler/armwrestler9.asm | 5 - tools/ds_tests/armwrestler/build.bat | 2 + .../armwrestler/{ => data}/font8x8.pat | Bin tools/ds_tests/armwrestler/make.bat | 10 -- .../armwrestler-arm7.s} | 0 .../armwrestler-ds.s} | 3 +- .../thumbwrestler-ds.s} | 0 tools/ds_tests/armwrestler/template.pnproj | 1 + tools/ds_tests/armwrestler/template.prj | 32 ++++ 10 files changed, 187 insertions(+), 16 deletions(-) create mode 100644 tools/ds_tests/armwrestler/Makefile delete mode 100644 tools/ds_tests/armwrestler/armwrestler9.asm create mode 100644 tools/ds_tests/armwrestler/build.bat rename tools/ds_tests/armwrestler/{ => data}/font8x8.pat (100%) delete mode 100644 tools/ds_tests/armwrestler/make.bat rename tools/ds_tests/armwrestler/{armwrestler-arm7.asm => source/armwrestler-arm7.s} (100%) rename tools/ds_tests/armwrestler/{armwrestler-ds.asm => source/armwrestler-ds.s} (93%) rename tools/ds_tests/armwrestler/{thumbwrestler-ds.asm => source/thumbwrestler-ds.s} (100%) create mode 100644 tools/ds_tests/armwrestler/template.pnproj create mode 100644 tools/ds_tests/armwrestler/template.prj diff --git a/tools/ds_tests/armwrestler/Makefile b/tools/ds_tests/armwrestler/Makefile new file mode 100644 index 000000000..b2ed64a7e --- /dev/null +++ b/tools/ds_tests/armwrestler/Makefile @@ -0,0 +1,150 @@ +#--------------------------------------------------------------------------------- +.SUFFIXES: +#--------------------------------------------------------------------------------- + +ifeq ($(strip $(DEVKITARM)),) +$(error "Please set DEVKITARM in your environment. export DEVKITARM=devkitARM") +endif + +include $(DEVKITARM)/ds_rules + +#--------------------------------------------------------------------------------- +# TARGET is the name of the output +# BUILD is the directory where object files & intermediate files will be placed +# SOURCES is a list of directories containing source code +# INCLUDES is a list of directories containing extra header files +# DATA is a list of directories containing binary files embedded using bin2o +# GRAPHICS is a list of directories containing image files to be converted with grit +#--------------------------------------------------------------------------------- +TARGET := $(shell basename $(CURDIR)) +BUILD := build +SOURCES := source +INCLUDES := include +DATA := +GRAPHICS := gfx + +#--------------------------------------------------------------------------------- +# options for code generation +#--------------------------------------------------------------------------------- +ARCH := -mthumb -mthumb-interwork + +CFLAGS := -g -Wall -O2\ + -march=armv5te -fomit-frame-pointer\ + -ffast-math \ + $(ARCH) + +CFLAGS += $(INCLUDE) -DARM9 +CXXFLAGS := $(CFLAGS) -fno-rtti -fno-exceptions + +ASFLAGS := -g -march=armv5te $(ARCH) +LDFLAGS = -specs=ds_arm9.specs -g $(ARCH) -Wl,-Map,$(notdir $*.map) + +#--------------------------------------------------------------------------------- +# any extra libraries we wish to link with the project (order is important) +#--------------------------------------------------------------------------------- +LIBS := -lnds9 + + +#--------------------------------------------------------------------------------- +# list of directories containing libraries, this must be the top level containing +# include and lib +#--------------------------------------------------------------------------------- +LIBDIRS := $(LIBNDS) + +#--------------------------------------------------------------------------------- +# no real need to edit anything past this point unless you need to add additional +# rules for different file extensions +#--------------------------------------------------------------------------------- +ifneq ($(BUILD),$(notdir $(CURDIR))) +#--------------------------------------------------------------------------------- + +export OUTPUT := $(CURDIR)/$(TARGET) + +export VPATH := $(foreach dir,$(SOURCES),$(CURDIR)/$(dir)) \ + $(foreach dir,$(DATA),$(CURDIR)/$(dir)) \ + $(foreach dir,$(GRAPHICS),$(CURDIR)/$(dir)) + +export DEPSDIR := $(CURDIR)/$(BUILD) + +CFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.c))) +CPPFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.cpp))) +SFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.s))) +PNGFILES := $(foreach dir,$(GRAPHICS),$(notdir $(wildcard $(dir)/*.png))) +BINFILES := $(foreach dir,$(DATA),$(notdir $(wildcard $(dir)/*.*))) + +#--------------------------------------------------------------------------------- +# use CXX for linking C++ projects, CC for standard C +#--------------------------------------------------------------------------------- +ifeq ($(strip $(CPPFILES)),) +#--------------------------------------------------------------------------------- + export LD := $(CC) +#--------------------------------------------------------------------------------- +else +#--------------------------------------------------------------------------------- + export LD := $(CXX) +#--------------------------------------------------------------------------------- +endif +#--------------------------------------------------------------------------------- + +export OFILES := $(addsuffix .o,$(BINFILES)) \ + $(PNGFILES:.png=.o) \ + $(CPPFILES:.cpp=.o) $(CFILES:.c=.o) $(SFILES:.s=.o) + +export INCLUDE := $(foreach dir,$(INCLUDES),-iquote $(CURDIR)/$(dir)) \ + $(foreach dir,$(LIBDIRS),-I$(dir)/include) \ + -I$(CURDIR)/$(BUILD) + +export LIBPATHS := $(foreach dir,$(LIBDIRS),-L$(dir)/lib) + +icons := $(wildcard *.bmp) + +ifneq (,$(findstring $(TARGET).bmp,$(icons))) + export GAME_ICON := $(CURDIR)/$(TARGET).bmp +else + ifneq (,$(findstring icon.bmp,$(icons))) + export GAME_ICON := $(CURDIR)/icon.bmp + endif +endif + +.PHONY: $(BUILD) clean + +#--------------------------------------------------------------------------------- +$(BUILD): + @[ -d $@ ] || mkdir -p $@ + @make --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile + +#--------------------------------------------------------------------------------- +clean: + @echo clean ... + @rm -fr $(BUILD) $(TARGET).elf $(TARGET).nds + +#--------------------------------------------------------------------------------- +else + +#--------------------------------------------------------------------------------- +# main targets +#--------------------------------------------------------------------------------- +$(OUTPUT).nds : $(OUTPUT).elf +$(OUTPUT).elf : $(OFILES) + +#--------------------------------------------------------------------------------- +%.bin.o : %.bin +#--------------------------------------------------------------------------------- + @echo $(notdir $<) + $(bin2o) + +#--------------------------------------------------------------------------------- +# This rule creates assembly source files using grit +# grit takes an image file and a .grit describing how the file is to be processed +# add additional rules like this for each image extension +# you use in the graphics folders +#--------------------------------------------------------------------------------- +%.s %.h : %.png %.grit +#--------------------------------------------------------------------------------- + grit $< -fts -o$* + +-include $(DEPSDIR)/*.d + +#--------------------------------------------------------------------------------------- +endif +#--------------------------------------------------------------------------------------- diff --git a/tools/ds_tests/armwrestler/armwrestler9.asm b/tools/ds_tests/armwrestler/armwrestler9.asm deleted file mode 100644 index 00a23712d..000000000 --- a/tools/ds_tests/armwrestler/armwrestler9.asm +++ /dev/null @@ -1,5 +0,0 @@ -.arm - -.include "armwrestler-ds.asm" -.include "thumbwrestler-ds.asm" - diff --git a/tools/ds_tests/armwrestler/build.bat b/tools/ds_tests/armwrestler/build.bat new file mode 100644 index 000000000..5e6002b9f --- /dev/null +++ b/tools/ds_tests/armwrestler/build.bat @@ -0,0 +1,2 @@ +make +pause \ No newline at end of file diff --git a/tools/ds_tests/armwrestler/font8x8.pat b/tools/ds_tests/armwrestler/data/font8x8.pat similarity index 100% rename from tools/ds_tests/armwrestler/font8x8.pat rename to tools/ds_tests/armwrestler/data/font8x8.pat diff --git a/tools/ds_tests/armwrestler/make.bat b/tools/ds_tests/armwrestler/make.bat deleted file mode 100644 index 4a758f3a6..000000000 --- a/tools/ds_tests/armwrestler/make.bat +++ /dev/null @@ -1,10 +0,0 @@ -arm-eabi-as -march=armv5te -mthumb -EL -o armwrestler9.o armwrestler9.asm -arm-eabi-ld -Ttext 0x02004000 -EL -e main armwrestler9.o -arm-eabi-objcopy -O binary a.out armwrestler.arm9 -arm-eabi-as -mcpu=arm7tdmi -EL -o armwrestler-arm7.o armwrestler-arm7.asm -arm-eabi-ld -Ttext 0x3800000 -EL -e arm7_main armwrestler-arm7.o -arm-eabi-objcopy -O binary a.out armwrestler.arm7 -ndstool -c armwrestler.nds -r9 0x2004000 -e9 0x2004000 -r7 0x3800000 -e7 0x3800000 -9 armwrestler.arm9 -7 armwrestler.arm7 -del *.o -del a.out -pause \ No newline at end of file diff --git a/tools/ds_tests/armwrestler/armwrestler-arm7.asm b/tools/ds_tests/armwrestler/source/armwrestler-arm7.s similarity index 100% rename from tools/ds_tests/armwrestler/armwrestler-arm7.asm rename to tools/ds_tests/armwrestler/source/armwrestler-arm7.s diff --git a/tools/ds_tests/armwrestler/armwrestler-ds.asm b/tools/ds_tests/armwrestler/source/armwrestler-ds.s similarity index 93% rename from tools/ds_tests/armwrestler/armwrestler-ds.asm rename to tools/ds_tests/armwrestler/source/armwrestler-ds.s index 9aabd863c..e0c97dc9f 100644 --- a/tools/ds_tests/armwrestler/armwrestler-ds.asm +++ b/tools/ds_tests/armwrestler/source/armwrestler-ds.s @@ -16,6 +16,7 @@ .equ BAD_Rd, 0x10 .equ BAD_Rn, 0x20 +.global main main: @@ -2621,7 +2622,7 @@ jumptable: .word Test0,Test1,Test2,Test3 .word Test8,Test9,Menu,TestTmb,TestTmb,TestTmb .global font -font: .incbin "font8x8.pat" +font: .incbin "../data/font8x8.pat" szADC: .asciz "ADC" szADD: .asciz "ADD" diff --git a/tools/ds_tests/armwrestler/thumbwrestler-ds.asm b/tools/ds_tests/armwrestler/source/thumbwrestler-ds.s similarity index 100% rename from tools/ds_tests/armwrestler/thumbwrestler-ds.asm rename to tools/ds_tests/armwrestler/source/thumbwrestler-ds.s diff --git a/tools/ds_tests/armwrestler/template.pnproj b/tools/ds_tests/armwrestler/template.pnproj new file mode 100644 index 000000000..b3eb171b6 --- /dev/null +++ b/tools/ds_tests/armwrestler/template.pnproj @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/tools/ds_tests/armwrestler/template.prj b/tools/ds_tests/armwrestler/template.prj new file mode 100644 index 000000000..bb41e6e57 --- /dev/null +++ b/tools/ds_tests/armwrestler/template.prj @@ -0,0 +1,32 @@ +[Project ID] +Signature=UE Proj: v.1 +[Project Information] +Filter=*.* +Project Directory=C:\projects\devkitPro\test\nds_template\arm9\ +Use Relative Directory=1 +Relative to Project File=1 +Project Wordfile= +Project Tagfile= +Create Tagfile=0 +Include Sub Directories=0 +[Files] +0=include\ +1=Makefile +2=source\ +[Group] +0= +[Open Files] +Open File0=C:\projects\devkitPro\examples\nds\templates\arm9\source\main.c +Active File Display Mode=3 +Open File Pos0=751 +Open File Line0=0 +Active File Index=0 +Open File Window Pos0=2,3,-1,-1,-4,-23,0,0,918,359 +Open File1=C:\projects\devkitPro\examples\nds\templates\arm9\build\arm9.map +Open File Pos1=9864 +Open File Line1=15129 +Open File Window Pos1=0,1,-1,-1,-4,-23,22,22,944,385 +Open File2= +[File View] +Current Select=Project Files\source\main.c +Scroll Position=0