aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--backends/platform/ds/ds.mk10
-rw-r--r--backends/platform/ds/module.mk33
2 files changed, 37 insertions, 6 deletions
diff --git a/backends/platform/ds/ds.mk b/backends/platform/ds/ds.mk
index 555e7ece06..40a7e14965 100644
--- a/backends/platform/ds/ds.mk
+++ b/backends/platform/ds/ds.mk
@@ -18,7 +18,7 @@ OPT_SIZE := -Os -mthumb
#-mthumb -fno-gcse -fno-schedule-insns2
-OBJS := $(DATA_OBJS) $(LIBCARTRESET_OBJS) $(PORT_OBJS) $(COMPRESSOR_OBJS) $(FAT_OBJS)
+#OBJS := $(DATA_OBJS) $(LIBCARTRESET_OBJS) $(PORT_OBJS) $(COMPRESSOR_OBJS) $(FAT_OBJS)
# TODO: Handle files in OPTLIST.
@@ -99,10 +99,10 @@ $(ndsdir)/arm7/source/main.o: CXXFLAGS=$(ARM7_CXXFLAGS)
$(ndsdir)/arm7/source/main.o: CPPFLAGS=
# Rule for creating ARM7 .bin files from .elf files
-%.bin: %.elf
- @echo ------
- @echo Building $@...
- $(OBJCOPY) -O binary $< $@
+#%.bin: %.elf
+# @echo ------
+# @echo Building $@...
+# $(OBJCOPY) -O binary $< $@
# Rule for creating ARM7 .elf files by linking .o files together with a special linker script
%.elf:
diff --git a/backends/platform/ds/module.mk b/backends/platform/ds/module.mk
index 16630dc070..676fd20628 100644
--- a/backends/platform/ds/module.mk
+++ b/backends/platform/ds/module.mk
@@ -59,7 +59,38 @@ LIBCARTRESET_OBJS :=
#arm9/source/libcartreset/cartreset.o
-MODULE_OBJS :=
+#MODULE_OBJS := $(PORT_OBJS) $(DATA_OBJS) $(FAT_OBJS)
+MODULE_OBJS := $(DATA_OBJS) $(LIBCARTRESET_OBJS) $(PORT_OBJS) $(COMPRESSOR_OBJS) $(FAT_OBJS)
+
+
+#---------------------------------------------------------------------------------
+# canned command sequence for binary data
+#---------------------------------------------------------------------------------
+define bin2o
+ bin2s $< | $(AS) -mthumb -mthumb-interwork -o $(@)
+ echo "extern const u8" `(echo $(<F) | sed -e 's/^\([0-9]\)/_\1/' | tr . _)`"_end[];" > `(echo $(<F) | tr . _)`.h
+ echo "extern const u8" `(echo $(<F) | sed -e 's/^\([0-9]\)/_\1/' | tr . _)`"[];" >> `(echo $(<F) | tr . _)`.h
+ echo "extern const u32" `(echo $(<F) | sed -e 's/^\([0-9]\)/_\1/' | tr . _)`_size";" >> `(echo $(<F) | tr . _)`.h
+endef
+
+#---------------------------------------------------------------------------------
+%.o : %.bin
+#---------------------------------------------------------------------------------
+ @echo $(notdir $<)
+ @$(bin2o)
+
+#---------------------------------------------------------------------------------
+%.o : %.raw
+#---------------------------------------------------------------------------------
+ @echo $(notdir $<)
+ @$(bin2o)
+
+#---------------------------------------------------------------------------------
+%.o : %.pal
+#---------------------------------------------------------------------------------
+ @echo $(notdir $<)
+ @$(bin2o)
+