Skip to content

Commit

Permalink
treewide: update project to BlocksDS v0.9.1
Browse files Browse the repository at this point in the history
- Updated Makefiles
- Updated ARM7 init code
  • Loading branch information
lifehackerhansol committed Nov 4, 2023
1 parent 5d18bdf commit c9d82b1
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 12 deletions.
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ SDIMAGE := image.bin
# Source code paths
# -----------------

NITROFATDIR :=
NITROFATDIR := # A single directory that is the root of NitroFAT

# Tools
# -----
Expand Down Expand Up @@ -80,7 +80,7 @@ NDSTOOL_FAT := -F $(NITROFAT_IMG)

$(NITROFAT_IMG): $(NITROFATDIR)
@echo " MKFATIMG $@ $(NITROFATDIR)"
$(V)$(BLOCKSDS)/tools/mkfatimg/mkfatimg -t $(NITROFATDIR) $@ 0
$(V)$(BLOCKSDS)/tools/mkfatimg/mkfatimg -t $(NITROFATDIR) $@

# Make the NDS ROM depend on the filesystem image only if it is needed
$(ROM): $(NITROFAT_IMG)
Expand All @@ -102,7 +102,7 @@ $(ROM): arm9 arm7

sdimage:
@echo " MKFATIMG $(SDIMAGE) $(SDROOT)"
$(V)$(BLOCKSDS)/tools/mkfatimg/mkfatimg -t $(SDROOT) $(SDIMAGE) 0
$(V)$(BLOCKSDS)/tools/mkfatimg/mkfatimg -t $(SDROOT) $(SDIMAGE)

dldipatch: $(ROM)
@echo " DLDITOOL $(ROM)"
Expand Down
18 changes: 15 additions & 3 deletions Makefile.arm7
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ DEFINES :=
# Libraries
# ---------

LIBS := -lnds7 -lc
LIBS := -lnds7
LIBDIRS := $(BLOCKSDS)/libs/libnds

# Build artifacts
Expand Down Expand Up @@ -73,9 +73,11 @@ ARCH := -mcpu=arm7tdmi -mtune=arm7tdmi
WARNFLAGS := -Wall

ifeq ($(SOURCES_CPP),)
LD := $(CC)
LD := $(CC)
LIBS += -lc
else
LD := $(CXX)
LD := $(CXX)
LIBS += -lstdc++ -lc
endif

INCLUDEFLAGS := $(foreach path,$(INCLUDEDIRS),-I$(path)) \
Expand Down Expand Up @@ -153,11 +155,21 @@ $(BUILDDIR)/%.c.o : %.c
@$(MKDIR) -p $(@D)
$(V)$(CC) $(CFLAGS) -MMD -MP -c -o $@ $<

$(BUILDDIR)/%.arm.c.o : %.arm.c
@echo " CC.7 $<"
@$(MKDIR) -p $(@D)
$(V)$(CC) $(CFLAGS) -MMD -MP -marm -mlong-calls -c -o $@ $<

$(BUILDDIR)/%.cpp.o : %.cpp
@echo " CXX.7 $<"
@$(MKDIR) -p $(@D)
$(V)$(CXX) $(CXXFLAGS) -MMD -MP -c -o $@ $<

$(BUILDDIR)/%.arm.cpp.o : %.arm.cpp
@echo " CXX.7 $<"
@$(MKDIR) -p $(@D)
$(V)$(CXX) $(CXXFLAGS) -MMD -MP -marm -mlong-calls -c -o $@ $<

$(BUILDDIR)/%.bin.o $(BUILDDIR)/%_bin.h : %.bin
@echo " BIN2C.7 $<"
@$(MKDIR) -p $(@D)
Expand Down
18 changes: 15 additions & 3 deletions Makefile.arm9
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ DEFINES :=
# Libraries
# ---------

LIBS := -lnds9 -lc
LIBS := -lnds9
LIBDIRS := $(BLOCKSDS)/libs/libnds

# Build artifacts
Expand Down Expand Up @@ -86,9 +86,11 @@ ARCH := -march=armv5te -mtune=arm946e-s
WARNFLAGS := -Wall

ifeq ($(SOURCES_CPP),)
LD := $(CC)
LD := $(CC)
LIBS += -lc
else
LD := $(CXX)
LD := $(CXX)
LIBS += -lstdc++ -lc
endif

INCLUDEFLAGS := $(foreach path,$(INCLUDEDIRS),-I$(path)) \
Expand Down Expand Up @@ -174,11 +176,21 @@ $(BUILDDIR)/%.c.o : %.c
@$(MKDIR) -p $(@D)
$(V)$(CC) $(CFLAGS) -MMD -MP -c -o $@ $<

$(BUILDDIR)/%.arm.c.o : %.arm.c
@echo " CC.9 $<"
@$(MKDIR) -p $(@D)
$(V)$(CC) $(CFLAGS) -MMD -MP -marm -mlong-calls -c -o $@ $<

$(BUILDDIR)/%.cpp.o : %.cpp
@echo " CXX.9 $<"
@$(MKDIR) -p $(@D)
$(V)$(CXX) $(CXXFLAGS) -MMD -MP -c -o $@ $<

$(BUILDDIR)/%.arm.cpp.o : %.arm.cpp
@echo " CXX.9 $<"
@$(MKDIR) -p $(@D)
$(V)$(CXX) $(CXXFLAGS) -MMD -MP -marm -mlong-calls -c -o $@ $<

$(BUILDDIR)/%.bin.o $(BUILDDIR)/%_bin.h : %.bin
@echo " BIN2C.9 $<"
@$(MKDIR) -p $(@D)
Expand Down
6 changes: 3 additions & 3 deletions arm7/source/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,11 @@ int main(void) {
ledBlink(0);

irqInit();
initClockIRQ();
irqSet(IRQ_VBLANK, VblankHandler);
fifoInit();
installSystemFIFO();
irqSet(IRQ_VBLANK, VblankHandler);
irqEnable(IRQ_VBLANK);
initClockIRQTimer(3);
irqEnable(IRQ_VBLANK);

u32 isRegularDS = REG_SNDEXCNT == 0 ? 1 : 0; // If sound frequency setting is found, then the console is not a DS Phat/Lite
fifoSendValue32(FIFO_RETURN, isRegularDS); // notify ARM9 that things ready
Expand Down

0 comments on commit c9d82b1

Please sign in to comment.