Skip to content

Commit

Permalink
Add support for 32KB DLDI drivers
Browse files Browse the repository at this point in the history
  • Loading branch information
RocketRobz committed Oct 23, 2024
1 parent e8f9c39 commit 8525110
Show file tree
Hide file tree
Showing 21 changed files with 155 additions and 127 deletions.
4 changes: 4 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,7 @@
path = booter_fc/flashcart_specifics/DLDI
url = https://github.com/DS-Homebrew/DLDI
branch = builds
[submodule "libnds32"]
path = universal/libnds32
url = https://github.com/lifehackerhansol/libnds32
branch = master
2 changes: 2 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ export PROJECT := $(CURDIR)
all: booter booter_fc 3dssplash gbapatcher quickmenu manual resources romsel_aktheme romsel_dsimenutheme romsel_r4theme settings slot1launch title

package:
@$(MAKE) -C universal/libnds32
@$(MAKE) -C booter dist
@$(MAKE) -C booter_fc dist
@$(MAKE) -C 3dssplash dist
Expand Down Expand Up @@ -79,6 +80,7 @@ title:

clean:
@echo clean build directories
@$(MAKE) -C universal/libnds32 clean
@$(MAKE) -C booter clean
@$(MAKE) -C booter_fc clean
@$(MAKE) -C 3dssplash clean
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ You can help translate TWiLight Menu++ on the [Crowdin project](https://crowdin.
- [Pk11](https://github.com/Epicpkmn11): Adding the ability to load skins off the SD card for the R4 theme, implemented sorting & made manuals use PNG, improved font rendering, providing a custom background for Unlaunch, managing translations, and various bug fixes
## Secondary Developers
- [DieGo](https://github.com/DieGo367): Adding support for custom ROM/folder icons and improvements for custom skins
- [lifehackerhansol](https://github.com/lifehackerhansol): Improving support for flashcard autobooting and kernel loading
- [lifehackerhansol](https://github.com/lifehackerhansol): Improving support for flashcard autobooting and kernel loading, and [libnds32](https://github.com/lifehackerhansol/libnds32) fork for 32KB DLDI driver support
- [NightScript](https://github.com/NightScript370): Code cleanup, defining code standards, added flashcard functionality for Wood UI theme, manual pages
## App Launchers
- [ahezard](https://github.com/ahezard), [shutterbug2000](https://github.com/shutterbug2000) and [Rocket Robz](https://github.com/RocketRobz): [nds-bootstrap](https://github.com/ahezard/nds-bootstrap) (used for launching Nintendo DS(i) ROMs off the SD card)
Expand Down
6 changes: 3 additions & 3 deletions booter/bootloader/source/io_dldi.s
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,9 @@ _dldi_start:
#endif
.asciz " Chishm" @ Identifying Magic string (8 bytes with null terminator)
.byte 0x01 @ Version number
.byte 0x0e @ 16KiB @ Log [base-2] of the size of this driver in bytes.
.byte 0x0f @ 32KiB @ Log [base-2] of the size of this driver in bytes.
.byte 0x00 @ Sections to fix
.byte 0x0e @ 16KiB @ Log [base-2] of the allocated space in bytes.
.byte 0x0f @ 32KiB @ Log [base-2] of the allocated space in bytes.

@---------------------------------------------------------------------------------
@ Text identifier - can be anything up to 47 chars + terminating null -- 16 bytes
Expand Down Expand Up @@ -93,7 +93,7 @@ _DLDI_shutdown:
.align
.pool

.space (_dldi_start + 16384) - . @ Fill to 16KiB
.space (_dldi_start + 32768) - . @ Fill to 32KiB

_dldi_end:
.end
Expand Down
20 changes: 11 additions & 9 deletions booter_fc/arm9/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -42,15 +42,16 @@ LDFLAGS = -specs=../$(UNIVERSAL)/arm9/ds_arm9_twlm.specs -g $(ARCH) -Wl,-Map,$(n
#---------------------------------------------------------------------------------
# any extra libraries we wish to link with the project (order is important)
#---------------------------------------------------------------------------------
LIBS := -lfat -lnds9
LIBS := -lfat -lnds329


#---------------------------------------------------------------------------------
# list of directories containing libraries, this must be the top level containing
# include and lib
#---------------------------------------------------------------------------------
LIBDIRS := $(LIBNDS)

LIBDIRS32 := $(CURDIR)/$(UNIVERSAL)/libnds32

#---------------------------------------------------------------------------------
# no real need to edit anything past this point unless you need to add additional
# rules for different file extensions
Expand All @@ -72,7 +73,7 @@ CFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.c)))
CPPFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.cpp)))
SFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.s)))
BINFILES := $(foreach dir,$(DATA),$(notdir $(wildcard $(dir)/*.*)))

#---------------------------------------------------------------------------------
# use CXX for linking C++ projects, CC for standard C
#---------------------------------------------------------------------------------
Expand All @@ -89,20 +90,21 @@ endif

export OFILES := $(addsuffix .o,$(BINFILES)) \
$(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)

export LIBPATHS := $(foreach dir,$(LIBDIRS),-L$(dir)/lib) \
$(foreach dir,$(LIBDIRS32),-L$(dir)/lib)


export OUTPUT := $(CURDIR)/$(TARGET)

.PHONY: $(BUILD) clean

all : $(BUILD)

#---------------------------------------------------------------------------------
$(BUILD):
@[ -d $@ ] || mkdir -p $@
Expand All @@ -114,7 +116,7 @@ clean:

#---------------------------------------------------------------------------------
else

DEPENDS := $(OFILES:.o=.d)

#---------------------------------------------------------------------------------
Expand Down
6 changes: 3 additions & 3 deletions booter_fc/bootloader/source/io_dldi.s
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,9 @@ _dldi_start:
#endif
.asciz " Chishm" @ Identifying Magic string (8 bytes with null terminator)
.byte 0x01 @ Version number
.byte 0x0e @ 16KiB @ Log [base-2] of the size of this driver in bytes.
.byte 0x0f @ 32KiB @ Log [base-2] of the size of this driver in bytes.
.byte 0x00 @ Sections to fix
.byte 0x0e @ 16KiB @ Log [base-2] of the allocated space in bytes.
.byte 0x0f @ 32KiB @ Log [base-2] of the allocated space in bytes.

@---------------------------------------------------------------------------------
@ Text identifier - can be anything up to 47 chars + terminating null -- 16 bytes
Expand Down Expand Up @@ -93,7 +93,7 @@ _DLDI_shutdown:
.align
.pool

.space (_dldi_start + 16384) - . @ Fill to 16KiB
.space (_dldi_start + 32768) - . @ Fill to 32KiB

_dldi_end:
.end
Expand Down
24 changes: 13 additions & 11 deletions gbapatcher/arm9/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -46,15 +46,16 @@ LDFLAGS = -specs=../$(UNIVERSAL)/arm9/ds_arm9_twlm.specs -g $(ARCH) -Wl,-Map,$(n
#---------------------------------------------------------------------------------
# any extra libraries we wish to link with the project (order is important)
#---------------------------------------------------------------------------------
LIBS := -lfat -lnds9
LIBS := -lfat -lnds329


#---------------------------------------------------------------------------------
# list of directories containing libraries, this must be the top level containing
# include and lib
#---------------------------------------------------------------------------------
LIBDIRS := $(CURDIR) ../ $(LIBNDS)

LIBDIRS32 := $(CURDIR)/$(UNIVERSAL)/libnds32

#---------------------------------------------------------------------------------
# no real need to edit anything past this point unless you need to add additional
# rules for different file extensions
Expand All @@ -78,7 +79,7 @@ BMPFILES := $(foreach dir,$(GRAPHICS),$(notdir $(wildcard $(dir)/*.bmp)))
PNGFILES := $(foreach dir,$(GRAPHICS),$(notdir $(wildcard $(dir)/*.png)))
SFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.s)))
BINFILES := $(foreach dir,$(DATA),$(notdir $(wildcard $(dir)/*.*)))

#---------------------------------------------------------------------------------
# use CXX for linking C++ projects, CC for standard C
#---------------------------------------------------------------------------------
Expand All @@ -97,20 +98,21 @@ export OFILES := $(addsuffix .o,$(BINFILES)) \
$(BMPFILES:.bmp=.o) \
$(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)

export LIBPATHS := $(foreach dir,$(LIBDIRS),-L$(dir)/lib) \
$(foreach dir,$(LIBDIRS32),-L$(dir)/lib)


export OUTPUT := $(CURDIR)/$(TARGET)

.PHONY: $(BUILD) clean

all : $(BUILD)

#---------------------------------------------------------------------------------
$(BUILD):
@[ -d $@ ] || mkdir -p $@
Expand All @@ -122,14 +124,14 @@ clean:

#---------------------------------------------------------------------------------
else

DEPENDS := $(OFILES:.o=.d)

#---------------------------------------------------------------------------------
# main targets
#---------------------------------------------------------------------------------
$(OUTPUT).elf : $(OFILES)

#---------------------------------------------------------------------------------
%.bin.o : %.bin
#---------------------------------------------------------------------------------
Expand All @@ -153,7 +155,7 @@ $(OUTPUT).elf : $(OFILES)
grit $< -fts -o$*

-include $(DEPSDIR)/*.d

#---------------------------------------------------------------------------------------
endif
#---------------------------------------------------------------------------------------
6 changes: 3 additions & 3 deletions gbapatcher/bootloader/source/io_dldi.s
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,9 @@ _dldi_start:
#endif
.asciz " Chishm" @ Identifying Magic string (8 bytes with null terminator)
.byte 0x01 @ Version number
.byte 0x0e @ 16KiB @ Log [base-2] of the size of this driver in bytes.
.byte 0x0f @ 32KiB @ Log [base-2] of the size of this driver in bytes.
.byte 0x00 @ Sections to fix
.byte 0x0e @ 16KiB @ Log [base-2] of the allocated space in bytes.
.byte 0x0f @ 32KiB @ Log [base-2] of the allocated space in bytes.

@---------------------------------------------------------------------------------
@ Text identifier - can be anything up to 47 chars + terminating null -- 16 bytes
Expand Down Expand Up @@ -93,7 +93,7 @@ _DLDI_shutdown:
.align
.pool

.space (_dldi_start + 16384) - . @ Fill to 16KiB
.space (_dldi_start + 32768) - . @ Fill to 32KiB

_dldi_end:
.end
Expand Down
6 changes: 4 additions & 2 deletions imageview/arm9/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -48,14 +48,15 @@ LDFLAGS = -specs=../$(UNIVERSAL)/arm9/ds_arm9_twlm.specs -g $(ARCH) -Wl,-Map,$(n
#---------------------------------------------------------------------------------
# any extra libraries we wish to link with the project (order is important)
#---------------------------------------------------------------------------------
LIBS := -lfat -lmm9 -lnds9
LIBS := -lfat -lmm9 -lnds329


#---------------------------------------------------------------------------------
# list of directories containing libraries, this must be the top level containing
# include and lib
#---------------------------------------------------------------------------------
LIBDIRS := $(CURDIR) ../ $(LIBNDS)
LIBDIRS32 := $(CURDIR)/$(UNIVERSAL)/libnds32

#---------------------------------------------------------------------------------
# no real need to edit anything past this point unless you need to add additional
Expand Down Expand Up @@ -104,7 +105,8 @@ 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)
export LIBPATHS := $(foreach dir,$(LIBDIRS),-L$(dir)/lib) \
$(foreach dir,$(LIBDIRS32),-L$(dir)/lib)


export OUTPUT := $(CURDIR)/$(TARGET)
Expand Down
6 changes: 4 additions & 2 deletions manual/arm9/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -47,14 +47,15 @@ LDFLAGS = -specs=../$(UNIVERSAL)/arm9/ds_arm9_twlm.specs -g $(ARCH) -Wl,-Map,$(n
#---------------------------------------------------------------------------------
# any extra libraries we wish to link with the project (order is important)
#---------------------------------------------------------------------------------
LIBS := -lfat -lmm9 -lnds9
LIBS := -lfat -lmm9 -lnds329


#---------------------------------------------------------------------------------
# list of directories containing libraries, this must be the top level containing
# include and lib
#---------------------------------------------------------------------------------
LIBDIRS := $(CURDIR) ../ $(LIBNDS)
LIBDIRS32 := $(CURDIR)/$(UNIVERSAL)/libnds32

#---------------------------------------------------------------------------------
# no real need to edit anything past this point unless you need to add additional
Expand Down Expand Up @@ -103,7 +104,8 @@ 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)
export LIBPATHS := $(foreach dir,$(LIBDIRS),-L$(dir)/lib) \
$(foreach dir,$(LIBDIRS32),-L$(dir)/lib)


export OUTPUT := $(CURDIR)/$(TARGET)
Expand Down
24 changes: 13 additions & 11 deletions quickmenu/arm9/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -47,15 +47,16 @@ LDFLAGS = -specs=../$(UNIVERSAL)/arm9/ds_arm9_twlm.specs -g $(ARCH) -Wl,-Map,$(n
#---------------------------------------------------------------------------------
# any extra libraries we wish to link with the project (order is important)
#---------------------------------------------------------------------------------
LIBS := -lfat -lmm9 -lnds9
LIBS := -lfat -lmm9 -lnds329


#---------------------------------------------------------------------------------
# list of directories containing libraries, this must be the top level containing
# include and lib
#---------------------------------------------------------------------------------
LIBDIRS := $(CURDIR) ../ $(LIBNDS)

LIBDIRS32 := $(CURDIR)/$(UNIVERSAL)/libnds32

#---------------------------------------------------------------------------------
# no real need to edit anything past this point unless you need to add additional
# rules for different file extensions
Expand All @@ -79,7 +80,7 @@ BMPFILES := $(foreach dir,$(GRAPHICS),$(notdir $(wildcard $(dir)/*.bmp)))
PNGFILES := $(foreach dir,$(GRAPHICS),$(notdir $(wildcard $(dir)/*.png)))
SFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.s)))
BINFILES := $(foreach dir,$(DATA),$(notdir $(wildcard $(dir)/*.*))) soundbank.bin

#---------------------------------------------------------------------------------
# use CXX for linking C++ projects, CC for standard C
#---------------------------------------------------------------------------------
Expand All @@ -98,20 +99,21 @@ export OFILES := $(addsuffix .o,$(BINFILES)) \
$(BMPFILES:.bmp=.o) \
$(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)

export LIBPATHS := $(foreach dir,$(LIBDIRS),-L$(dir)/lib) \
$(foreach dir,$(LIBDIRS32),-L$(dir)/lib)


export OUTPUT := $(CURDIR)/$(TARGET)

.PHONY: $(BUILD) clean

all : $(BUILD)

#---------------------------------------------------------------------------------
$(BUILD):
@[ -d $@ ] || mkdir -p $@
Expand All @@ -123,14 +125,14 @@ clean:

#---------------------------------------------------------------------------------
else

DEPENDS := $(OFILES:.o=.d)

#---------------------------------------------------------------------------------
# main targets
#---------------------------------------------------------------------------------
$(OUTPUT).elf : $(OFILES)

#---------------------------------------------------------------------------------
# rule to build soundbank from music files
#---------------------------------------------------------------------------------
Expand Down Expand Up @@ -161,7 +163,7 @@ soundbank.bin : $(AUDIOFILES)
grit $< -fts -o$*

-include $(DEPSDIR)/*.d

#---------------------------------------------------------------------------------------
endif
#---------------------------------------------------------------------------------------
Loading

0 comments on commit 8525110

Please sign in to comment.