mirror of
https://github.com/devkitPro/buildscripts.git
synced 2026-04-17 15:26:12 -05:00
*** empty log message ***
This commit is contained in:
parent
5b221fbb78
commit
d6b6559e10
23
templates/devkitARM/nds/template/combined/Makefile
Normal file
23
templates/devkitARM/nds/template/combined/Makefile
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
#---------------------------------------------------------------------------------
|
||||
.SUFFIXES:
|
||||
#---------------------------------------------------------------------------------
|
||||
-include $(DEVKITARM)/ds_rules
|
||||
|
||||
export TARGET := template
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# main targets
|
||||
#---------------------------------------------------------------------------------
|
||||
.PHONY: $(TARGET).nds
|
||||
|
||||
$(TARGET).ds.gba : $(TARGET).nds
|
||||
|
||||
$(TARGET).nds :
|
||||
@make -C arm7
|
||||
@make -C arm9
|
||||
@ndstool -c $(TARGET).nds -7 arm7/$(TARGET).arm7 -9 arm9/$(TARGET).arm9
|
||||
|
||||
clean:
|
||||
@make -C arm9 clean
|
||||
@make -C arm7 clean
|
||||
|
||||
135
templates/devkitARM/nds/template/combined/arm7/Makefile
Normal file
135
templates/devkitARM/nds/template/combined/arm7/Makefile
Normal file
|
|
@ -0,0 +1,135 @@
|
|||
#---------------------------------------------------------------------------------
|
||||
.SUFFIXES:
|
||||
#---------------------------------------------------------------------------------
|
||||
-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
|
||||
#---------------------------------------------------------------------------------
|
||||
BUILD := build
|
||||
SOURCES := gfx source data
|
||||
INCLUDES := include build
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# options for code generation
|
||||
#---------------------------------------------------------------------------------
|
||||
ARCH := -mthumb -mthumb-interwork
|
||||
|
||||
CFLAGS := -g -Wall -O2\
|
||||
-mcpu=arm7tdmi -mtune=arm7tdmi -fomit-frame-pointer\
|
||||
-ffast-math \
|
||||
$(ARCH)
|
||||
|
||||
CFLAGS += $(INCLUDE) -DARM7
|
||||
|
||||
ASFLAGS := -g $(ARCH)
|
||||
LDFLAGS = -g $(ARCH) -mno-fpu -Wl,-Map,$(notdir $*).map
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# path to tools - this can be deleted if you set the path in windows
|
||||
#---------------------------------------------------------------------------------
|
||||
export PATH := $(DEVKITARM)/bin:$(PATH)
|
||||
|
||||
LIBS := -lnds7
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# 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))
|
||||
|
||||
export CC := $(PREFIX)gcc
|
||||
export CXX := $(PREFIX)g++
|
||||
export AR := $(PREFIX)ar
|
||||
export OBJCOPY := $(PREFIX)objcopy
|
||||
|
||||
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)))
|
||||
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)
|
||||
|
||||
export INCLUDE := $(foreach dir,$(INCLUDES),-I$(CURDIR)/$(dir)) \
|
||||
$(foreach dir,$(LIBDIRS),-I$(dir)/include) \
|
||||
-I$(CURDIR)/$(BUILD)
|
||||
|
||||
export LIBPATHS := $(foreach dir,$(LIBDIRS),-L$(dir)/lib)
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# use CXX for linking C++ projects, CC for standard C
|
||||
#---------------------------------------------------------------------------------
|
||||
ifeq ($(strip $(CPPFILES)),)
|
||||
#---------------------------------------------------------------------------------
|
||||
export LD := $(CC)
|
||||
#---------------------------------------------------------------------------------
|
||||
else
|
||||
#---------------------------------------------------------------------------------
|
||||
export LD := $(CXX)
|
||||
#---------------------------------------------------------------------------------
|
||||
endif
|
||||
#---------------------------------------------------------------------------------
|
||||
|
||||
.PHONY: $(BUILD) clean
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
$(BUILD):
|
||||
@[ -d $@ ] || mkdir -p $@
|
||||
@make --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
clean:
|
||||
@echo clean ...
|
||||
@rm -fr $(BUILD) *.elf
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
else
|
||||
|
||||
DEPENDS := $(OFILES:.o=.d)
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# main targets
|
||||
#---------------------------------------------------------------------------------
|
||||
|
||||
$(OUTPUT).arm7 : $(OUTPUT).elf
|
||||
|
||||
$(OUTPUT).elf : $(OFILES)
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
%.arm7: %.elf
|
||||
@echo built ... $(notdir $@)
|
||||
@$(OBJCOPY) -O binary $< $@
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
%.elf:
|
||||
@echo linking binary
|
||||
@$(LD) $(LDFLAGS) -specs=ds_arm7.specs $(OFILES) $(LIBPATHS) $(LIBS) -o $@
|
||||
|
||||
|
||||
-include $(DEPENDS)
|
||||
|
||||
#---------------------------------------------------------------------------------------
|
||||
endif
|
||||
#---------------------------------------------------------------------------------------
|
||||
|
|
@ -0,0 +1,63 @@
|
|||
//---------------------------------------------------------------------------------
|
||||
// Simple ARM7 stub (sends RTC, TSC, and X/Y data to the ARM 9)
|
||||
//---------------------------------------------------------------------------------
|
||||
#include "nds.h"
|
||||
#include "nds/bios.h"
|
||||
#include "nds/arm7/touch.h"
|
||||
#include "nds/arm7/clock.h"
|
||||
|
||||
//---------------------------------------------------------------------------------
|
||||
void InterruptHandler(void) {
|
||||
//---------------------------------------------------------------------------------
|
||||
int t1, t2;
|
||||
static int heartbeat = 0;
|
||||
|
||||
if (IF & IRQ_VBLANK) {
|
||||
// Update the heartbeat
|
||||
heartbeat++;
|
||||
IPC->heartbeat = heartbeat;
|
||||
|
||||
// Read the X/Y buttons and the /PENIRQ line
|
||||
IPC->buttons = XKEYS;
|
||||
|
||||
// Read the touch screen
|
||||
IPC->touchX = touchRead(TSC_MEASURE_X);
|
||||
IPC->touchY = touchRead(TSC_MEASURE_Y);
|
||||
IPC->touchZ1 = touchRead(TSC_MEASURE_Z1);
|
||||
IPC->touchZ2 = touchRead(TSC_MEASURE_Z2);
|
||||
|
||||
// Read the time
|
||||
rtcGetTime((uint8 *)IPC->curtime);
|
||||
BCDToInteger((uint8 *)&(IPC->curtime[1]), 7);
|
||||
|
||||
// Read the temperature
|
||||
IPC->temperature = touchReadTemperature(&t1, &t2);
|
||||
IPC->tdiode1 = t1;
|
||||
|
||||
IPC->tdiode2 = t2;
|
||||
}
|
||||
|
||||
// Acknowledge interrupts
|
||||
IF = IF;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------
|
||||
int main(int argc, char ** argv) {
|
||||
//---------------------------------------------------------------------------------
|
||||
// Reset the clock if needed
|
||||
rtcReset();
|
||||
|
||||
// Set up the interrupt handler
|
||||
IME = 0;
|
||||
IRQ_HANDLER = &InterruptHandler;
|
||||
IE = IRQ_VBLANK;
|
||||
IF = ~0;
|
||||
DISP_SR = DISP_VBLANK_IRQ;
|
||||
IME = 1;
|
||||
|
||||
// Keep the ARM7 out of main RAM
|
||||
while (1) swiWaitForVBlank();
|
||||
return 0;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
135
templates/devkitARM/nds/template/combined/arm9/Makefile
Normal file
135
templates/devkitARM/nds/template/combined/arm9/Makefile
Normal file
|
|
@ -0,0 +1,135 @@
|
|||
#---------------------------------------------------------------------------------
|
||||
.SUFFIXES:
|
||||
#---------------------------------------------------------------------------------
|
||||
-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
|
||||
#---------------------------------------------------------------------------------
|
||||
BUILD := build
|
||||
SOURCES := source
|
||||
INCLUDES := include
|
||||
#---------------------------------------------------------------------------------
|
||||
# options for code generation
|
||||
#---------------------------------------------------------------------------------
|
||||
ARCH := -mthumb -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!
|
||||
CFLAGS := -g -Wall -O2\
|
||||
-mcpu=arm9tdmi -mtune=arm9tdmi -fomit-frame-pointer\
|
||||
-ffast-math \
|
||||
$(ARCH)
|
||||
|
||||
CFLAGS += $(INCLUDE) -DARM9
|
||||
|
||||
ASFLAGS := -g $(ARCH)
|
||||
LDFLAGS = -g $(ARCH) -mno-fpu -Wl,-Map,$(notdir $*.map)
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# path to tools - this can be deleted if you set the path in windows
|
||||
#---------------------------------------------------------------------------------
|
||||
export PATH := $(DEVKITARM)/bin:$(PATH)
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# any extra libraries we wish to link with the project
|
||||
#---------------------------------------------------------------------------------
|
||||
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))
|
||||
|
||||
export CC := $(PREFIX)gcc
|
||||
export CXX := $(PREFIX)g++
|
||||
export AR := $(PREFIX)ar
|
||||
export OBJCOPY := $(PREFIX)objcopy
|
||||
|
||||
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)))
|
||||
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)))
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# use CXX for linking C++ projects, CC for standard C
|
||||
#---------------------------------------------------------------------------------
|
||||
ifeq ($(strip $(CPPFILES)),)
|
||||
#---------------------------------------------------------------------------------
|
||||
export LD := $(CC)
|
||||
#---------------------------------------------------------------------------------
|
||||
else
|
||||
#---------------------------------------------------------------------------------
|
||||
export LD := $(CXX)
|
||||
#---------------------------------------------------------------------------------
|
||||
endif
|
||||
#---------------------------------------------------------------------------------
|
||||
|
||||
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)
|
||||
|
||||
export INCLUDE := $(foreach dir,$(INCLUDES),-I$(CURDIR)/$(dir)) \
|
||||
$(foreach dir,$(LIBDIRS),-I$(dir)/include) \
|
||||
$(foreach dir,$(LIBDIRS),-I$(dir)/include) \
|
||||
-I$(CURDIR)/$(BUILD)
|
||||
|
||||
export LIBPATHS := $(foreach dir,$(LIBDIRS),-L$(dir)/lib)
|
||||
|
||||
.PHONY: $(BUILD) clean
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
$(BUILD):
|
||||
@[ -d $@ ] || mkdir -p $@
|
||||
@make --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
clean:
|
||||
@echo clean ...
|
||||
@rm -fr $(BUILD) *.elf *.nds* *.bin
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
else
|
||||
|
||||
DEPENDS := $(OFILES:.o=.d)
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# main targets
|
||||
#---------------------------------------------------------------------------------
|
||||
$(OUTPUT).arm9 : $(OUTPUT).elf
|
||||
$(OUTPUT).elf : $(OFILES)
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
%.arm9: %.elf
|
||||
@$(OBJCOPY) -O binary $< $@
|
||||
@echo built ... $(notdir $@)
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
%.elf:
|
||||
@echo linking binary
|
||||
@$(LD) $(LDFLAGS) -specs=ds_arm9.specs $(OFILES) $(LIBPATHS) $(LIBS) -o $@
|
||||
|
||||
-include $(DEPENDS)
|
||||
|
||||
#---------------------------------------------------------------------------------------
|
||||
endif
|
||||
#---------------------------------------------------------------------------------------
|
||||
|
|
@ -0,0 +1,56 @@
|
|||
//---------------------------------------------------------------------------------
|
||||
#include "nds.h"
|
||||
|
||||
//---------------------------------------------------------------------------------
|
||||
void irqVBlank(void) {
|
||||
//---------------------------------------------------------------------------------
|
||||
IF = IF;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------
|
||||
int main(void) {
|
||||
//---------------------------------------------------------------------------------
|
||||
static int screen =0;
|
||||
u16* back = VRAM_A;
|
||||
u16* front = VRAM_B;
|
||||
|
||||
//turn on the power to the system
|
||||
powerON(POWER_ALL);
|
||||
|
||||
//set main display to render directly from the frame buffer
|
||||
videoSetMode(MODE_FB1);
|
||||
|
||||
//set up the sub display
|
||||
videoSetModeSub(MODE_0_2D |
|
||||
DISPLAY_SPR_1D_LAYOUT |
|
||||
DISPLAY_SPR_ACTIVE |
|
||||
DISPLAY_BG0_ACTIVE |
|
||||
DISPLAY_BG1_ACTIVE );
|
||||
|
||||
//vram banks are somewhat complex
|
||||
vramSetMainBanks(VRAM_A_LCD, VRAM_B_LCD, VRAM_C_SUB_BG, VRAM_D_SUB_SPRITE);
|
||||
|
||||
//irqs are nice..ndslib comes with a very unoptimised default handler
|
||||
irqInitHandler(irqDefaultHandler);
|
||||
irqSet(IRQ_VBLANK, irqVBlank);
|
||||
|
||||
while (1) {
|
||||
|
||||
swiWaitForVBlank();
|
||||
|
||||
//flip screens
|
||||
if(screen) {
|
||||
videoSetMode(MODE_FB1);
|
||||
front = VRAM_B;
|
||||
back = VRAM_A;
|
||||
screen = 0;
|
||||
} else {
|
||||
videoSetMode(MODE_FB0);
|
||||
front = VRAM_A;
|
||||
back = VRAM_B;
|
||||
screen = 1;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
48
templates/devkitARM/nds/template/combined/template.prj
Normal file
48
templates/devkitARM/nds/template/combined/template.prj
Normal file
|
|
@ -0,0 +1,48 @@
|
|||
[Project ID]
|
||||
Signature=UE Proj: v.1
|
||||
[Group]
|
||||
0=arm7
|
||||
1=arm7 - include
|
||||
2=arm7 - source
|
||||
3=arm9
|
||||
4=arm9 - include
|
||||
5=arm9 - source
|
||||
6=
|
||||
[Project Information]
|
||||
Filter=*.*
|
||||
Project Directory=C:\projects\devkitPro\buildscripts\templates\devkitARM\nds\template\combined\
|
||||
Use Relative Directory=1
|
||||
Relative to Project File=1
|
||||
Project Wordfile=
|
||||
Project Tagfile=
|
||||
Create Tagfile=0
|
||||
Include Sub Directories=0
|
||||
[Files - arm7 - source]
|
||||
0=arm7\source\template.c
|
||||
[Files - arm7]
|
||||
0=arm7\Makefile
|
||||
[Files - arm9 - source]
|
||||
0=arm9\source\template.c
|
||||
[Files - arm9]
|
||||
0=arm9\Makefile
|
||||
[Files]
|
||||
0=Makefile
|
||||
[Open Files]
|
||||
Open File0=C:\projects\devkitPro\buildscripts\templates\devkitARM\nds\template\combined\Makefile
|
||||
Active File Display Mode=3
|
||||
Open File Pos0=0
|
||||
Open File Line0=0
|
||||
Open File Window Pos0=0,1,-1,-1,-4,-23,22,22,896,462
|
||||
Open File1=C:\projects\devkitPro\buildscripts\templates\devkitARM\nds\template\combined\arm7\Makefile
|
||||
Open File Pos1=0
|
||||
Open File Line1=0
|
||||
Open File Window Pos1=0,1,-1,-1,-4,-23,44,44,922,488
|
||||
Open File2=C:\projects\USB\neowriter\source\neousb.cpp
|
||||
Open File Pos2=0
|
||||
Open File Line2=13296
|
||||
Active File Index=2
|
||||
Open File Window Pos2=2,3,-1,-1,-4,-23,88,88,966,532
|
||||
Open File3=
|
||||
[File View]
|
||||
Current Select=Project Files\
|
||||
Scroll Position=0
|
||||
Loading…
Reference in New Issue
Block a user