Skip to content

Commit

Permalink
scsd: Update to libnds 1.8.2
Browse files Browse the repository at this point in the history
  • Loading branch information
lifehackerhansol committed Feb 15, 2024
1 parent 1543a37 commit eaec01c
Show file tree
Hide file tree
Showing 6 changed files with 73 additions and 297 deletions.
38 changes: 17 additions & 21 deletions staging/scsd/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#---------------------------------------------------------------------------------

ifeq ($(strip $(DEVKITARM)),)
$(error "Please set DEVKITARM in your environment. export DEVKITARM=<path to>devkitARM)
$(error "Please set DEVKITARM in your environment. export DEVKITARM=<path to>devkitARM")
endif

include $(DEVKITARM)/ds_rules
Expand All @@ -21,7 +21,6 @@ BUILD := build
SOURCES := source
DATA := data
INCLUDES := include
SPECS := specs


#---------------------------------------------------------------------------------
Expand All @@ -34,29 +33,29 @@ CFLAGS := -g -Wall -O2\
-ffast-math \
$(ARCH)

CFLAGS += $(INCLUDE) -DARM9 -fPIC
CFLAGS += $(INCLUDE) -DARM7 -fPIC

CXXFLAGS := $(CFLAGS) -fno-rtti -fno-exceptions

ASFLAGS := -g $(ARCH)
LDFLAGS = -specs=$(CURDIR)/../$(SPECS)/dldi.specs -T $(CURDIR)/../$(SPECS)/dldi.ld -g $(ARCH) -mno-fpu -Wl,-Map,$(TARGET).map
ASFLAGS := -g $(ARCH) $(INCLUDE)
LDFLAGS = -nostartfiles -nostdlib -T dldi.ld -g $(ARCH) -Wl,-Map,$(TARGET).map

LIBS := -lnds9
LIBS :=

#---------------------------------------------------------------------------------
# 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)) \
Expand Down Expand Up @@ -93,28 +92,25 @@ export INCLUDE := $(foreach dir,$(INCLUDES),-I$(CURDIR)/$(dir)) \
export LIBPATHS := $(foreach dir,$(LIBDIRS),-L$(dir)/lib)

.PHONY: $(BUILD) clean all

#---------------------------------------------------------------------------------
all: $(BUILD)

$(BUILD):
@[ -d $@ ] || mkdir -p $@
@make -C $(SPECS)
@make --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile

@$(MAKE) --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile

#---------------------------------------------------------------------------------
clean:
@echo clean ...
@rm -fr $(BUILD) $(TARGET).dldi $(TARGET).elf

@make -C $(SPECS) clean



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

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

#---------------------------------------------------------------------------------
# main targets
#---------------------------------------------------------------------------------
Expand All @@ -126,11 +122,11 @@ $(OUTPUT).elf : $(OFILES)
%.dldi: %.elf
@$(OBJCOPY) -O binary $< $@
@echo built ... $(notdir $@)


-include $(DEPENDS)


#---------------------------------------------------------------------------------------
endif
#---------------------------------------------------------------------------------------
#---------------------------------------------------------------------------------------
4 changes: 2 additions & 2 deletions staging/scsd/source/disc_io.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
#endif

#ifdef NDS
#include <nds/jtypes.h>
#include <nds/ndstypes.h>
#else
#include "gba_types.h"
#endif
Expand All @@ -67,7 +67,7 @@
#define _IO_ALLOW_UNALIGNED

#if defined _IO_USE_DMA && defined _IO_ALLOW_UNALIGNED
#error You can't use both DMA and unaligned memory
#error You cannot use both DMA and unaligned memory
#endif

#define FEATURE_MEDIUM_CANREAD 0x00000001
Expand Down
54 changes: 54 additions & 0 deletions staging/scsd/source/dldi_header.s
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
// SPDX-License-Identifier: Zlib
//
// Copyright (C) 2006-2016 Michael Chisholm (Chishm)
// Copyright (C) 2006-2016 Dave Murphy (WinterMute)

#include <nds/arm9/dldi_asm.h>

.section ".crt0","ax"
.global _start
.align 4
.arm

@ Driver patch file standard header -- 16 bytes

.word 0xBF8DA5ED @ Magic number to identify this region
.asciz " Chishm" @ Identifying Magic string (8 bytes with null terminator)
.byte 0x01 @ Version number
.byte DLDI_SIZE_4KB @ Log [base-2] of the size of this driver in bytes.
.byte FIX_GOT | FIX_BSS | FIX_GLUE @ Sections to fix
.byte 0x00 @ Space allocated in the application, leave empty.

@ Text identifier - can be anything up to 47 chars + terminating null -- 48 bytes

.align 4
.asciz "SuperCard (SD Card)"

@ Offsets to important sections within the data -- 32 bytes

.align 6
.word __text_start @ data start
.word __data_end @ data end
.word __glue_start @ Interworking glue start -- Needs address fixing
.word __glue_end @ Interworking glue end
.word __got_start @ GOT start -- Needs address fixing
.word __got_end @ GOT end
.word __bss_start @ bss start -- Needs setting to zero
.word __bss_end @ bss end

@ IO_INTERFACE data -- 32 bytes

.ascii "XXXX" @ ioType (Normally "DLDI")
.word FEATURE_MEDIUM_CANREAD | FEATURE_MEDIUM_CANWRITE | FEATURE_SLOT_GBA
.word _SCSD_startUp @ Function pointers to standard device driver functions
.word _SCSD_isInserted
.word _SCSD_readSectors
.word _SCSD_writeSectors
.word _SCSD_clearStatus
.word _SCSD_shutdown

_start:

.align
.pool
.end
22 changes: 0 additions & 22 deletions staging/scsd/specs/Makefile

This file was deleted.

189 changes: 0 additions & 189 deletions staging/scsd/specs/dldi.ld

This file was deleted.

Loading

0 comments on commit eaec01c

Please sign in to comment.