From 31abbc14aef7e3a8088b4c2ad11ee43e67bc5a92 Mon Sep 17 00:00:00 2001 From: Neil Millstone Date: Fri, 19 Jan 2007 21:38:03 +0000 Subject: Changed to ARM7 for libcartreset svn-id: r25123 --- backends/platform/ds/arm7/Makefile | 17 ++++++++++++----- backends/platform/ds/arm7/source/main.cpp | 29 +++++++++++++++++++++++++---- 2 files changed, 37 insertions(+), 9 deletions(-) (limited to 'backends/platform/ds') diff --git a/backends/platform/ds/arm7/Makefile b/backends/platform/ds/arm7/Makefile index 600842e812..5c62d7df58 100644 --- a/backends/platform/ds/arm7/Makefile +++ b/backends/platform/ds/arm7/Makefile @@ -10,11 +10,12 @@ #--------------------------------------------------------------------------------- TARGET := arm7 BUILD := build -SOURCES := gfx source data +SOURCES := gfx source source/libcartreset data INCLUDES := include build + # Enable support for debugger (must be the same as in the arm9 makefile) -USE_DEBUGGER = 1 +#USE_DEBUGGER = 1 #--------------------------------------------------------------------------------- # options for code generation @@ -91,7 +92,7 @@ export OBJCOPY := $(PREFIX)objcopy export LD := $(CXX) #export LD := $(CC) -CFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.c))) +CFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.c))) CPPFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.cpp))) SFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.s))) PCXFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.pcx))) @@ -99,6 +100,8 @@ BINFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.bin))) PALFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.pal))) RAWFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.raw))) MAPFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.map))) + + export OFILES := $(MAPFILES:.map=.o) $(RAWFILES:.raw=.o) $(PALFILES:.pal=.o) $(BINFILES:.bin=.o) $(PCXFILES:.pcx=.o)\ $(CPPFILES:.cpp=.o) $(CFILES:.c=.o) $(SFILES:.s=.o) @@ -106,7 +109,7 @@ export OFILES := $(MAPFILES:.map=.o) $(RAWFILES:.raw=.o) $(PALFILES:.pal=.o) $(B export INCLUDE := $(foreach dir,$(INCLUDES),-I$(CURDIR)/$(dir)) -I- -I$(CURDIR)/../commoninclude\ $(foreach dir,$(LIBDIRS),-I$(dir)/include) \ $(foreach dir,$(LIBDIRS),-I$(dir)/include/nds)\ - -I$(CURDIR)/$(BUILD) + -I$(CURDIR)/$(BUILD) -I$(CURDIR)/source/libcartreset export LIBPATHS := $(foreach dir,$(LIBDIRS),-L$(dir)/lib) @@ -115,6 +118,8 @@ export LIBPATHS := $(foreach dir,$(LIBDIRS),-L$(dir)/lib) #--------------------------------------------------------------------------------- $(BUILD): @[ -d $@ ] || mkdir -p $@ + @echo $(OFILES) + @echo $(CFILES) @make --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile #--------------------------------------------------------------------------------- @@ -146,6 +151,7 @@ $(OUTPUT).elf : $(OFILES) #--------------------------------------------------------------------------------- %.elf: echo ELF + @echo $(LD) $(LDFLAGS) -specs=ds_arm7.specs $(OFILES) $(LIBPATHS) $(LIBS) -o $(TARGET).elf @$(LD) $(LDFLAGS) -specs=ds_arm7.specs $(OFILES) $(LIBPATHS) $(LIBS) -o $(TARGET).elf @@ -153,7 +159,7 @@ $(OUTPUT).elf : $(OFILES) #--------------------------------------------------------------------------------- # Compile Targets for C/C++ #--------------------------------------------------------------------------------- - + #--------------------------------------------------------------------------------- %.o : %.cpp @echo $(notdir $<) @@ -164,6 +170,7 @@ $(OUTPUT).elf : $(OFILES) #--------------------------------------------------------------------------------- %.o : %.c @echo $(notdir $<) + @echo $(CC) $(CFLAGS) -c $< -o$@ @$(CC) -MM $(CFLAGS) -o $*.d $< @$(CC) $(CFLAGS) -c $< -o$@ diff --git a/backends/platform/ds/arm7/source/main.cpp b/backends/platform/ds/arm7/source/main.cpp index cfa2d1fb2f..d36b038e05 100644 --- a/backends/platform/ds/arm7/source/main.cpp +++ b/backends/platform/ds/arm7/source/main.cpp @@ -25,6 +25,7 @@ // -- modified by Darkain and others ////////////////////////////////////////////////////////////////////// +#define USE_LIBCARTRESET #include @@ -40,6 +41,7 @@ #include #endif +#include "cartreset_nolibfat.h" #define TOUCH_CAL_X1 (*(vs16*)0x027FFCD8) #define TOUCH_CAL_Y1 (*(vs16*)0x027FFCDA) @@ -344,6 +346,9 @@ void performSleep() { powerManagerWrite(0, 0x30, false); } +void powerOff() { + powerManagerWrite(0, 0x40, true); +} ////////////////////////////////////////////////////////////////////// @@ -558,6 +563,13 @@ void initDebugger() { } #endif +#ifdef USE_LIBCARTRESET +void reboot() { + cartExecute(); +} +#endif + + int main(int argc, char ** argv) { #ifdef USE_DEBUGGER @@ -605,20 +617,29 @@ int main(int argc, char ** argv) { DISP_SR = DISP_VBLANK_IRQ; REG_IME = 1; */ + #ifdef USE_DEBUGGER initDebugger(); #endif // Keep the ARM7 out of main RAM - while (1) { + while ((1)) { if (needSleep) { performSleep(); needSleep = false; } -// if (IPC->reset) { -// swiSoftReset(); -// } + +#ifdef USE_LIBCARTRESET + if (passmeloopQuery()) { + reboot(); + } +#endif + + if (IPC->reset) { + powerOff(); + } + swiWaitForVBlank(); } return 0; } -- cgit v1.2.3