diff --git a/.gitignore b/.gitignore index a9cf9c89..97da1e5c 100644 --- a/.gitignore +++ b/.gitignore @@ -58,7 +58,6 @@ Temporary Items *.gba *.elf *.map -objects.lst *.o src/*.s *.dump diff --git a/Makefile b/Makefile index 0949f4e4..6a65abe8 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,18 @@ #### Tools #### +COMPARE ?= 0 +MODERN ?= 0 + +ifeq (,$(MAKECMDGOALS)) + COMPARE := 1 +else ifeq (compare,$(MAKECMDGOALS)) + COMPARE := 1 +endif + +ifeq (modern,$(MAKECMDGOALS)) + MODERN := 1 +endif + ifeq ($(OS),Windows_NT) EXE := .exe else @@ -11,20 +24,37 @@ UNAME := $(shell uname) TOOLCHAIN ?= $(DEVKITARM) PREFIX ?= arm-none-eabi- -export PATH := $(TOOLCHAIN)/bin:$(PATH) +ifneq (,$(TOOLCHAIN)) + ifneq (,$(wildcard $(TOOLCHAIN)/bin)) + export PATH := $(TOOLCHAIN)/bin:$(PATH) + endif +endif ifeq ($(UNAME),Darwin) - SHELL := env PATH=$(PATH) /bin/bash + SHELL := env PATH=$(PATH) /bin/bash endif -CPP ?= $(PREFIX)cpp$(EXE) +ifeq ($(MODERN),0) + CPP ?= $(PREFIX)cpp$(EXE) +else + CPP := $(PREFIX)cpp$(EXE) +endif AS := $(PREFIX)as$(EXE) LD := $(PREFIX)ld$(EXE) OBJCOPY := $(PREFIX)objcopy$(EXE) STRIP := $(PREFIX)strip$(EXE) -CC1 := tools/agbcc/bin/agbcc$(EXE) -CC1_OLD := tools/agbcc/bin/old_agbcc$(EXE) +# note: the makefile must be set up so MODERNCC is never called +# if MODERN=0 +MODERNCC := $(PREFIX)gcc$(EXE) +PATH_MODERNCC := PATH="$(PATH)" $(MODERNCC) + +ifeq ($(MODERN),0) + CC1 := tools/agbcc/bin/agbcc$(EXE) + CC1_OLD := tools/agbcc/bin/old_agbcc$(EXE) +else + CC1 := $(shell $(PATH_MODERNCC) -print-prog-name=cc1) -quiet +endif BIN2C := tools/bin2c/bin2c$(EXE) GBAGFX := tools/gbagfx/gbagfx$(EXE) @@ -35,90 +65,193 @@ TEXTENCODE := tools/textencode/textencode$(EXE) JSONPROC := tools/jsonproc/jsonproc$(EXE) ifeq ($(UNAME),Darwin) - SED := sed -i '' + SED := sed -i '' else - SED := sed -i + SED := sed -i endif ifeq ($(UNAME),Darwin) - SHASUM := shasum + SHASUM := shasum else - SHASUM := sha1sum + SHASUM := sha1sum endif -CC1FLAGS := -mthumb-interwork -Wimplicit -Wparentheses -Werror -O2 -fhex-asm -ffix-debug-line -g -CPPFLAGS := -I tools/agbcc/include -iquote include -iquote . -nostdinc -undef -ASFLAGS := -mcpu=arm7tdmi -mthumb-interwork -I include +ifeq ($(MODERN),0) + CC1FLAGS := -mthumb-interwork -Wimplicit -Wparentheses -Werror -O2 -fhex-asm -ffix-debug-line -g +else + CC1FLAGS := -mthumb -mthumb-interwork -mabi=apcs-gnu -mtune=arm7tdmi -march=armv4t -fno-toplevel-reorder -Werror -g +endif +CPPFLAGS := -iquote include -iquote . -DMODERN=$(MODERN) +ifeq ($(MODERN),0) + CPPFLAGS += -I tools/agbcc/include -nostdinc -undef +endif +ASFLAGS := -mcpu=arm7tdmi -mthumb-interwork -I include #### Files #### +ROM_NAME := fireemblem8.gba +ELF_NAME := $(ROM_NAME:.gba=.elf) +MAP_NAME := $(ROM_NAME:.gba=.map) +BUILD_DIR_NAME := build/fe8u + +MODERN_ROM_NAME := fireemblem8_modern.gba +MODERN_ELF_NAME := $(MODERN_ROM_NAME:.gba=.elf) +MODERN_MAP_NAME := $(MODERN_ROM_NAME:.gba=.map) +MODERN_BUILD_DIR_NAME := build/modern + +ifeq ($(MODERN),0) + BUILD_DIR := $(BUILD_DIR_NAME) +else + BUILD_DIR := $(MODERN_BUILD_DIR_NAME) +endif + C_SUBDIR = src ASM_SUBDIR = asm DATA_SUBDIR = data DATA_SRC_SUBDIR = src/data +SOUND_SUBDIR = sound SAMPLE_SUBDIR = sound/direct_sound_samples MID_SUBDIR = sound/songs/midi +BANIM_SUBDIR = data/banim + +C_BUILDDIR = $(BUILD_DIR)/$(C_SUBDIR) +ASM_BUILDDIR = $(BUILD_DIR)/$(ASM_SUBDIR) +DATA_BUILDDIR = $(BUILD_DIR)/$(DATA_SUBDIR) +SOUND_BUILDDIR = $(BUILD_DIR)/$(SOUND_SUBDIR) +MID_BUILDDIR = $(BUILD_DIR)/$(MID_SUBDIR) -ROM := fireemblem8.gba -ELF := $(ROM:.gba=.elf) -MAP := $(ROM:.gba=.map) -LDSCRIPT := ldscript.txt -SYM_FILES := sym_iwram.txt -CFILES_GENERATED := $(C_SUBDIR)/msg_data.c -CFILES := $(wildcard $(C_SUBDIR)/*.c) -ifeq (,$(findstring $(CFILES_GENERATED),$(CFILES))) -CFILES += $(CFILES_GENERATED) -endif -ASM_S_FILES := $(wildcard $(ASM_SUBDIR)/*.s) -DATA_S_FILES := $(wildcard $(DATA_SUBDIR)/*.s) -SOUND_S_FILES := $(wildcard sound/*.s sound/songs/*.s sound/songs/mml/*.s sound/voicegroups/*.s) -SFILES := $(ASM_S_FILES) $(DATA_S_FILES) $(SOUND_S_FILES) -C_OBJECTS := $(CFILES:.c=.o) -ASM_OBJECTS := $(SFILES:.s=.o) -BANIM_OBJECT := data/banim/data_banim.o -MID_FILES := $(wildcard $(MID_SUBDIR)/*.mid) -MID_OBJECTS := $(MID_FILES:.mid=.o) -ALL_OBJECTS := $(C_OBJECTS) $(ASM_OBJECTS) $(BANIM_OBJECT) $(MID_OBJECTS) -OBJECTS_LST := objects.lst -DEPS_DIR := .dep +ifeq ($(MODERN),0) + ROM := $(ROM_NAME) +else + ROM := $(MODERN_ROM_NAME) +endif +ELF := $(ROM:.gba=.elf) +MAP := $(ROM:.gba=.map) +ifeq ($(MODERN),0) + LDSCRIPT := ldscript.txt + SYM_FILES := sym_iwram.txt + LDSCRIPT_DEPS := linker_script_sound.txt $(SYM_FILES) +else + LDSCRIPT := ldscript_modern.txt + LDSCRIPT_DEPS := +endif + +C_FILES_GENERATED := $(C_SUBDIR)/msg_data.c + +LDSCRIPT_BUILD := $(BUILD_DIR)/$(LDSCRIPT) +LDSCRIPT_DEPS_BUILD := $(foreach dep,$(LDSCRIPT_DEPS),$(BUILD_DIR)/$(dep)) + +BANIM_OBJECT := $(BANIM_SUBDIR)/data_banim.o +BANIM_OBJECT_BUILD := $(BUILD_DIR)/$(BANIM_OBJECT) + +OBJECTS_LST := objects.lst +OBJECTS_LST_BUILD := $(BUILD_DIR)/$(OBJECTS_LST) + +DEPS_DIR := $(BUILD_DIR)/.dep + +# check if we need to scan dependencies based on the rule +ifeq (,$(MAKECMDGOALS)) + SCAN_DEPS ?= 1 +else + # clean, tidy, tidymodern, tidynonmodern don't even build the ROM + ifeq (,$(filter-out clean tidy tidymodern tidynonmodern,$(MAKECMDGOALS))) + SCAN_DEPS ?= 0 + else + SCAN_DEPS ?= 1 + endif +endif + +ifneq ($(SCAN_DEPS),0) + C_FILES := $(wildcard $(C_SUBDIR)/*.c) + ifeq (,$(findstring $(C_FILES_GENERATED),$(C_FILES))) + C_FILES += $(C_FILES_GENERATED) + endif + C_OBJECTS := $(patsubst $(C_SUBDIR)/%.c,$(C_BUILDDIR)/%.o,$(C_FILES)) + + ASM_S_FILES := $(wildcard $(ASM_SUBDIR)/*.s) + ASM_OBJECTS := $(patsubst $(ASM_SUBDIR)/%.s,$(ASM_BUILDDIR)/%.o,$(ASM_S_FILES)) + + DATA_S_FILES := $(wildcard $(DATA_SUBDIR)/*.s $(BANIM_SUBDIR)/*.s) + DATA_OBJECTS := $(patsubst $(DATA_SUBDIR)/%.s,$(DATA_BUILDDIR)/%.o,$(DATA_S_FILES)) + + SOUND_S_FILES := $(wildcard $(SOUND_SUBDIR)/*.s $(SOUND_SUBDIR)/songs/*.s $(SOUND_SUBDIR)/songs/mml/*.s $(SOUND_SUBDIR)/voicegroups/*.s) + SOUND_OBJECTS := $(patsubst $(SOUND_SUBDIR)/%.s,$(SOUND_BUILDDIR)/%.o,$(SOUND_S_FILES)) + + MID_FILES := $(wildcard $(MID_SUBDIR)/*.mid) + MID_OBJECTS := $(patsubst $(MID_SUBDIR)/%.mid,$(MID_BUILDDIR)/%.o,$(MID_FILES)) + + ALL_OBJECTS := $(C_OBJECTS) $(ASM_OBJECTS) $(DATA_OBJECTS) $(BANIM_OBJECT_BUILD) $(SOUND_OBJECTS) $(MID_OBJECTS) + OBJECTS_RELATIVE := $(patsubst $(BUILD_DIR)/%,%,$(ALL_OBJECTS)) + + SUBDIRS := $(sort $(dir $(ALL_OBJECTS))) + $(shell mkdir -p $(SUBDIRS)) + + BANIM_OBJECTS_DIRS := $(addprefix $(BUILD_DIR)/,$(sort $(dir $(shell ./scripts/arm_compressing_linker.py -t linker_script_banim.txt -m)))) + $(shell mkdir -p $(BANIM_OBJECTS_DIRS)) +endif AUTO_GEN_TARGETS := +ifeq ($(MODERN),0) # Use the older compiler to build library code -src/agb_sram.o: CC1FLAGS := -mthumb-interwork -Wimplicit -Wparentheses -Werror -O1 -ffix-debug-line -g -src/m4a.o: CC1 := $(CC1_OLD) +$(C_BUILDDIR)/agb_sram.o: CC1FLAGS := -mthumb-interwork -Wimplicit -Wparentheses -Werror -O1 -ffix-debug-line -g +$(C_BUILDDIR)/m4a.o: CC1 := $(CC1_OLD) +else +$(C_BUILDDIR)/bmpatharrowdisp.o: CC1FLAGS += -Wno-stringop-overflow +$(C_BUILDDIR)/cursor_hand.o: CC1FLAGS += -Wno-aggressive-loop-optimizations +$(C_BUILDDIR)/m4a.o: CC1FLAGS += -Wno-pointer-to-int-cast +endif # TODO: find a more elegant solution to the inlining issue -src/bmitem.o: CC1FLAGS += -Wno-error +$(C_BUILDDIR)/bmitem.o: CC1FLAGS += -Wno-error #### Main Targets #### -compare: $(ROM) +# Clear the default suffixes +.SUFFIXES: + +# Don't delete intermediate files +.SECONDARY: + +# Secondary expansion is required for dependency variables in object rules. +.SECONDEXPANSION: + +.PHONY: rom compare modern clean tidy tidynonmodern tidymodern tag + +rom: $(ROM) +ifneq ($(COMPARE),0) $(SHASUM) -c checksum.sha1 +endif + +compare: rom -.PHONY: compare +modern: rom -clean: +clean: tidy find . \( -iname '*.1bpp' -o -iname '*.4bpp' -o -iname '*.8bpp' -o -iname '*.gbapal' -o -iname '*.lz' -o -iname '*.fk' -o -iname '*.latfont' -o -iname '*.hwjpnfont' -o -iname '*.fwjpnfont' \) -exec rm {} + - $(RM) $(ROM) $(ELF) $(MAP) $(ALL_OBJECTS) $(OBJECTS_LST) src/*.s graphics/*.h $(CFILES_GENERATED) - $(RM) -rf $(DEPS_DIR) - # Remove battle animation binaries - $(RM) -f data/banim/*.bin data/banim/*.o data/banim/*.lz data/banim/*.bak + $(RM) graphics/*.h $(C_FILES_GENERATED) # Remove converted sound samples $(RM) -f $(SAMPLE_SUBDIR)/*.bin # Remove converted songs $(RM) -f $(MID_SUBDIR)/*.s $(RM) -f $(AUTO_GEN_TARGETS) -.PHONY: clean +tidy: tidynonmodern tidymodern + $(RM) -rf build + +tidynonmodern: + $(RM) -f $(ROM_NAME) $(ELF_NAME) $(MAP_NAME) + $(RM) -rf $(BUILD_DIR_NAME) + +tidymodern: + $(RM) -f $(MODERN_ROM_NAME) $(MODERN_ELF_NAME) $(MODERN_MAP_NAME) + $(RM) -rf $(MODERN_BUILD_DIR_NAME) tag: gtags ctags -R cscope -Rbkq -.PHONY: tag - # Graphics Recipes include graphics_file_rules.mk @@ -145,8 +278,8 @@ sound/%.bin: sound/%.aif ; $(AIF2PCM) $< $@ # Battle Animation Recipes -$(BANIM_OBJECT): $(shell ./scripts/arm_compressing_linker.py -t linker_script_banim.txt -m) - ./scripts/arm_compressing_linker.py -o $@ -t linker_script_banim.txt -b 0x8c02000 -l $(LD) --objcopy $(OBJCOPY) -c ./scripts/compressor.py +$(BANIM_OBJECT_BUILD): $(shell ./scripts/arm_compressing_linker.py -t linker_script_banim.txt -m --build-dir $(BUILD_DIR)) + ./scripts/arm_compressing_linker.py -o $@ -t linker_script_banim.txt -b 0x8c02000 -l $(LD) --objcopy $(OBJCOPY) -c ./scripts/compressor.py --build-dir $(BUILD_DIR) %_modes.bin: %_motion.o $(OBJCOPY) -O binary -j .data.modes $< $@ @@ -159,75 +292,75 @@ $(BANIM_OBJECT): $(shell ./scripts/arm_compressing_linker.py -t linker_script_ba #### Recipes #### -# Automatic dependency generation -MAKEDEP = mkdir -p $(DEPS_DIR)/$(dir $*) && $(CPP) $(CPPFLAGS) $< -MM -MG -MT $*.o > $(DEPS_DIR)/$*.d - --include $(addprefix $(DEPS_DIR)/,$(CFILES:.c=.d)) +$(OBJECTS_LST_BUILD): $(ALL_OBJECTS) + @echo $(OBJECTS_RELATIVE) > $@ -$(DEPS_DIR)/%.d: %.c - @$(MAKEDEP) +$(LDSCRIPT_BUILD): $(LDSCRIPT) $(LDSCRIPT_DEPS_BUILD) + @cp -f $< $@ -$(OBJECTS_LST): $(ALL_OBJECTS) - @echo $(ALL_OBJECTS) > $@ +$(LDSCRIPT_DEPS_BUILD): $(BUILD_DIR)/%: % + @cp -f $< $@ -$(ELF): $(ALL_OBJECTS) $(OBJECTS_LST) $(LDSCRIPT) $(SYM_FILES) - $(LD) -T $(LDSCRIPT) -Map $(MAP) @$(OBJECTS_LST) -R $(BANIM_OBJECT).sym.o -L tools/agbcc/lib -o $@ -lc -lgcc +$(ELF): $(ALL_OBJECTS) $(OBJECTS_LST_BUILD) $(LDSCRIPT_BUILD) $(LDSCRIPT_DEPS_BUILD) + cd $(BUILD_DIR) && $(LD) -T $(LDSCRIPT) -Map ../../$(MAP) @$(OBJECTS_LST) -R $(BANIM_OBJECT).sym.o -L ../../tools/agbcc/lib -o ../../$@ -lc -lgcc $(STRIP) -N .gcc2_compiled. $@ -%.gba: %.elf +$(ROM): $(ELF) $(OBJCOPY) --strip-debug -O binary --pad-to 0x9000000 --gap-fill=0xff $< $@ # Generate msg_data.c -src/msg_data.c: msg_list.txt +$(C_SUBDIR)/msg_data.c: msg_list.txt $(TEXTENCODE) $< $@ -$(C_OBJECTS): %.o: %.c $(DEPS_DIR)/%.d - @$(MAKEDEP) - $(CPP) $(CPPFLAGS) $< | iconv -f UTF-8 -t CP932 | $(CC1) $(CC1FLAGS) -o $*.s - echo '.ALIGN 2, 0' >> $*.s -ifeq ($(UNAME),Darwin) - $(SED) -f scripts/align_2_before_debug_section_for_osx.sed $*.s -else - $(SED) '/.section .debug_line/i\.align 2, 0' $*.s -endif - $(AS) $(ASFLAGS) $*.s -o $@ +ifneq ($(SCAN_DEPS),0) -ifeq ($(NODEP),1) -asm/%.o: data_dep := -else -asm/%.o: data_dep = $(shell $(SCANINC) -I include -I "" $*.s) -endif +# Automatic dependency generation +MAKE_C_DEP = mkdir -p $(DEPS_DIR)/$(C_SUBDIR)/$(dir $*) && $(CPP) $(CPPFLAGS) $< -MM -MG -MT $(C_BUILDDIR)/$*.o > $(DEPS_DIR)/$(C_SUBDIR)/$*.d +MAKE_ASM_DEP = mkdir -p $(DEPS_DIR)/$(ASM_SUBDIR)/$(dir $*) && echo "$(ASM_BUILDDIR)/$*.o:" > $(DEPS_DIR)/$(ASM_SUBDIR)/$*.d && $(SCANINC) -I include -I "" $< >> $(DEPS_DIR)/$(ASM_SUBDIR)/$*.d && $(SED) ':a;N;$$!ba;s/\n/ /g' $(DEPS_DIR)/$(ASM_SUBDIR)/$*.d +MAKE_DATA_DEP = mkdir -p $(DEPS_DIR)/$(DATA_SUBDIR)/$(dir $*) && echo "$(DATA_BUILDDIR)/$*.o:" > $(DEPS_DIR)/$(DATA_SUBDIR)/$*.d && $(SCANINC) -I include -I "" $< >> $(DEPS_DIR)/$(DATA_SUBDIR)/$*.d && $(SED) ':a;N;$$!ba;s/\n/ /g' $(DEPS_DIR)/$(DATA_SUBDIR)/$*.d +MAKE_SOUND_DEP = mkdir -p $(DEPS_DIR)/$(SOUND_SUBDIR)/$(dir $*) && echo "$(SOUND_BUILDDIR)/$*.o:" > $(DEPS_DIR)/$(SOUND_SUBDIR)/$*.d && $(SCANINC) -I include -I "" $< >> $(DEPS_DIR)/$(SOUND_SUBDIR)/$*.d && $(SED) ':a;N;$$!ba;s/\n/ /g' $(DEPS_DIR)/$(SOUND_SUBDIR)/$*.d -ifeq ($(NODEP),1) -src/%.o: data_dep := -else -src/%.o: data_dep = $(shell $(SCANINC) -I include -I "" $*.s) -endif +-include $(addprefix $(DEPS_DIR)/,$(C_FILES:.c=.d)) +-include $(addprefix $(DEPS_DIR)/,$(ASM_S_FILES:.s=.d)) +-include $(addprefix $(DEPS_DIR)/,$(DATA_S_FILES:.s=.d)) +-include $(addprefix $(DEPS_DIR)/,$(SOUND_S_FILES:.s=.d)) -ifeq ($(NODEP),1) -data/%.o: data_dep := -else -data/%.o: data_dep = $(shell $(SCANINC) -I include -I "" $*.s) -endif +$(DEPS_DIR)/$(C_SUBDIR)/%.d: $(C_SUBDIR)/%.c + @$(MAKE_C_DEP) -ifeq ($(NODEP),1) -banim/%.o: data_dep := -else -banim/%.o: data_dep = $(shell $(SCANINC) -I include -I "" $*.s) -endif +$(DEPS_DIR)/$(ASM_SUBDIR)/%.d: $(ASM_SUBDIR)/%.s + @$(MAKE_ASM_DEP) + +$(DEPS_DIR)/$(DATA_SUBDIR)/%.d: $(DATA_SUBDIR)/%.s + @$(MAKE_DATA_DEP) -ifeq ($(NODEP),1) -sound/%.o: data_dep := +$(DEPS_DIR)/$(SOUND_SUBDIR)/%.d: $(SOUND_SUBDIR)/%.s + @$(MAKE_SOUND_DEP) + +$(C_BUILDDIR)/%.o: $(C_SUBDIR)/%.c $(DEPS_DIR)/$(C_SUBDIR)/%.d + @$(MAKE_C_DEP) + $(CPP) $(CPPFLAGS) $< | iconv -f UTF-8 -t CP932 | $(CC1) $(CC1FLAGS) -o $(C_BUILDDIR)/$*.s + echo '.ALIGN 2, 0' >> $(C_BUILDDIR)/$*.s +ifeq ($(UNAME),Darwin) + $(SED) -f scripts/align_2_before_debug_section_for_osx.sed $(C_BUILDDIR)/$*.s else -sound/%.o: data_dep = $(shell $(SCANINC) -I include -I "" $*.s) + $(SED) '/.section .debug_line/i\.align 2, 0' $(C_BUILDDIR)/$*.s endif + $(AS) $(ASFLAGS) $(C_BUILDDIR)/$*.s -o $@ -.SECONDEXPANSION: -$(ASM_OBJECTS): %.o: %.s $$(data_dep) +$(ASM_OBJECTS): $(ASM_BUILDDIR)/%.o: $(ASM_SUBDIR)/%.s $(DEPS_DIR)/$(ASM_SUBDIR)/%.d $$(data_dep) + @$(MAKE_ASM_DEP) $(AS) $(ASFLAGS) -g $< -o $@ -# Don't delete intermediate files -.SECONDARY: +$(DATA_OBJECTS): $(DATA_BUILDDIR)/%.o: $(DATA_SUBDIR)/%.s $(DEPS_DIR)/$(DATA_SUBDIR)/%.d $$(data_dep) + @$(MAKE_DATA_DEP) + $(AS) $(ASFLAGS) -g $< -o $@ + +$(SOUND_OBJECTS): $(SOUND_BUILDDIR)/%.o: $(SOUND_SUBDIR)/%.s $(DEPS_DIR)/$(SOUND_SUBDIR)/%.d $$(data_dep) + @$(MAKE_SOUND_DEP) + $(AS) $(ASFLAGS) -g $< -o $@ + +endif # SCAN_DEPS # debug print, to use, call "make print-(your label here)" print-% : ; $(info $* is a $(flavor $*) variable set to [$($*)]) @true diff --git a/json_data_rules.mk b/json_data_rules.mk index c45d32b1..e99c8d59 100644 --- a/json_data_rules.mk +++ b/json_data_rules.mk @@ -23,8 +23,6 @@ $(MAP_OBJ_ANIM_TARGETS): %.inc: %.json $(DATA_SRC_SUBDIR)/map/obj_anim/map_obj_a $(MAP_PAL_ANIM_TARGETS): %.inc: %.json $(DATA_SRC_SUBDIR)/map/pal_anim/map_pal_anim.json.txt $(JSONPROC) $^ $@ -$(DATA_SUBDIR)/data_map_change.o: data_dep += $(MAP_CHANGE_TARGETS) +$(DATA_BUILDDIR)/data_map_change.o: data_dep += $(MAP_CHANGE_TARGETS) -$(DATA_SUBDIR)/data_map_anim.o: data_dep += $(MAP_OBJ_ANIM_TARGETS) $(MAP_PAL_ANIM_TARGETS) - -$(DATA_SUBDIR)/chapter_map_asset.o: data_dep += $(MAP_CHANGE_TARGETS) $(MAP_OBJ_ANIM_TARGETS) $(MAP_PAL_ANIM_TARGETS) +$(DATA_BUILDDIR)/data_map_anim.o: data_dep += $(MAP_OBJ_ANIM_TARGETS) $(MAP_PAL_ANIM_TARGETS) diff --git a/ldscript_modern.txt b/ldscript_modern.txt new file mode 100644 index 00000000..71e7a577 --- /dev/null +++ b/ldscript_modern.txt @@ -0,0 +1,1276 @@ +OUTPUT_ARCH(arm) + +MEMORY +{ + rom : ORIGIN = 0x08000000, LENGTH = 32M + iwram : ORIGIN = 0x03000000, LENGTH = 32K + ewram : ORIGIN = 0x02000000, LENGTH = 256K +} + +__text_start = ORIGIN(rom); +__ewram_start = ORIGIN(ewram); +__iwram_start = ORIGIN(iwram); +__iwram_top = ORIGIN(iwram) + LENGTH(iwram); +__sp_irq = __iwram_top - 0x060; +__sp_usr = __sp_irq - 0x1A0; +__irq_flags = 0x03007ff8; + +ENTRY(Init) + +gNumMusicPlayers = 9; +gMaxLines = 0; + +SECTIONS +{ + /* TODO: figure out what is COMMON and .bss */ + + ewram_overlay_0 __ewram_start (NOLOAD) : ALIGN(4) + { + . = 0x000000; gUnk_02000000 = .; + . = 0x000280; gMinimapWinBuf = .; + . = 0x000500; gMinimapFrontWinBuf = .; + . = 0x000504; gMinimapBackWinBuf = .; + . = 0x000508; gMinimapDisplayedWinBuf = .; + . = 0x00050C; gMinimapObjectFlashPal = .; + . = 0x0007A0; gUnknown_020007A0 = .; + . = 0x0007E0; gUnknown_020007E0 = .; + . = 0x000920; gUnknown_02000920 = .; + . = 0x000938; gUnknown_02000938 = .; + . = 0x000940; gUnknown_02000940 = .; + . = 0x000944; gUnknown_02000944 = .; + . = 0x000948; gUnknown_02000948 = .; + . = 0x000968; gBonusClaimData = .; + . = 0x000D68; gBonusClaimDataUpdated = .; + . = 0x000FA0; gUnknown_02000FA0 = .; + . = 0x001000; gBmMapBuffer = .; + . = 0x001168; gBonusClaimItemList = .; + . = 0x001368; gBonusClaimConfig = .; + . = 0x001568; gBonusClaimItemCount = .; + . = 0x001668; gBonusClaimText = .; + . = 0x0017A0; gUnknown_020017A0 = .; + . = 0x001F70; gConvoyItemCount = .; + . = 0x001FA0; gUnknown_02001FA0 = .; + . = 0x002038; gUnknown_02002038 = .; + . = 0x002774; gUnknown_02002774 = .; + . = 0x00278C; gTradeMenuText = .; + . = 0x0027A0; gUnknown_020027A0 = .; + . = 0x0027DC; src/bmio.o(ewram_overlay_0); + . = 0x002FDC; gaBattleForecastTextStructs = .; + . = 0x00300C; gBkselPals = .; + . = 0x00310C; gUnknown_0200310C = .; + . = 0x0038AC; gUnknown_020038AC = .; + . = 0x0038C4; gUnknown_020038C4 = .; + . = 0x0038C8; gUnknown_020038C8 = .; + . = 0x003B08; gUnknown_02003B08 = .; + . = 0x003B48; gUnknown_02003B48 = .; + . = 0x003B70; gUnknown_02003B70 = .; + . = 0x003B88; gUnknown_02003B88 = .; + . = 0x003BA8; gUnknown_02003BA8 = .; + . = 0x003BE8; gUnknown_02003BE8 = .; + . = 0x003BFC; + . = ALIGN(4); src/statscreen.o(ewram_overlay_0); + . = ALIGN(4); src/uichapterstatus.o(ewram_overlay_0); + . = 0x004BE0; gMUGfxBuffer = .; + . = 0x007838; gUnknown_02007838 = .; + . = 0x0078D8; gUnknown_020078D8 = .; + . = 0x008000; gUnknown_02008000 = .; + . = 0x0087A0; gUnknown_020087A0 = .; + . = 0x00A2D8; gUnknown_0200A2D8 = .; + . = 0x00A300; gUnknown_0200A300 = .; + . = 0x00AF00; gUnknown_0200AF00 = .; + . = 0x00C300; gUnknown_0200C300 = .; + . = 0x00CB00; gUnknown_0200CB00 = .; + . = 0x00D3E0; gSortedUnitsBuf = .; + . = 0x00D6E0; gSortedUnits = .; + . = 0x00D7E0; gUnknown_0200D7E0 = .; + . = 0x00DFE0; gUnknown_0200DFE0 = .; + . = 0x00E060; gUnknown_0200E060 = .; + . = 0x00E098; gUnknown_0200E098 = .; + . = 0x00E0A0; gUnknown_0200E0A0 = .; + . = 0x00E0A8; gUnknown_0200E0A8 = .; + . = 0x00E140; gUnknown_0200E140 = .; + . = 0x00E148; gUnknown_0200E148 = .; + . = 0x00E150; gUnknown_0200E150 = .; + . = 0x00E158; gUnknown_0200E158 = .; + . = 0x00F158; gUnknown_0200F158 = .; + . = 0x00F15C; gUnknown_0200F15C = .; + . = 0x00F17C; gStringBufferAlt = .; + . = 0x01117C; gPrepMainMenuTexts = .; + . = 0x0111CC; gPrepUnitPool = .; + . = 0x0121CC; gPrepUnitList = .; + . = 0x0122D4; gPrepScreenItemList = .; + . = 0x012914; gUnknown_02012914 = .; + . = 0x012F54; gUnknown_02012F54 = .; + . = 0x012F56; gUnknown_02012F56 = .; + . = 0x012F58; gUnknown_02012F58 = .; + . = 0x013458; gUnknown_02013458 = .; + . = 0x013460; gUnknown_02013460 = .; + . = 0x013498; gPrepItemTexts = .; + . = 0x013510; gPrepItemScreenTexts = .; + . = 0x013590; gUnknown_02013590 = .; + . = 0x013598; gPrepUnitTexts = .; + . = 0x013648; gUnknown_02013648 = .; + . = 0x013660; gUnknown_02013660 = .; + . = 0x013668; gUnknown_02013668 = .; + . = 0x013670; gUnknown_02013670 = .; + . = 0x013698; gUnknown_02013698 = .; + . = 0x0136D8; gUnknown_020136D8 = .; + . = 0x0136F0; sSupportScreenUnitCount = .; + . = 0x0136F4; gUnknown_020136F4 = .; + . = 0x014EF4; gUnknown_02014EF4 = .; + . = 0x019D00; gUnknown_02019D00 = .; + . = 0x01AFC0; gFont_0201AFC0 = .; + . = 0x01AFF0; gUnknown_0201AFF0 = .; + . = 0x01B0D8; gUnknown_0201B0D8 = .; + . = 0x01B100; gUnknown_0201B100 = .; + . = 0x01B104; gUnknown_0201B104 = .; + . = 0x01B1E4; gUnknown_0201B1E4 = .; + . = 0x01B3A4; gUnknown_0201B3A4 = .; + . = 0x01B430; gUnknown_0201B430 = .; + . = 0x01B458; gUnknown_0201B458 = .; + . = 0x01B718; gUnknown_0201B718 = .; + . = 0x01B71C; gUnknown_0201B71C = .; + . = 0x01B758; gUnknown_0201B758 = .; + . = 0x01B7DA; gUnknown_0201B7DA = .; + . = 0x01B864; gUnknown_0201B864 = .; + . = 0x01B930; gUnknown_0201B930 = .; + . = 0x01B958; gUnknown_0201B958 = .; + . = 0x01BBD8; gUnknown_0201BBD8 = .; + . = 0x01BE30; gWmHblankStatus = .; + . = 0x01BE32; gUnknown_0201BE32 = .; + . = 0x01C5B4; gUnknown_0201C5B4 = .; + . = 0x01C5C0; gUnknown_0201C5C0 = .; + . = 0x01C5CC; gUnknown_0201C5CC = .; + . = 0x01C5CF; gUnknown_0201C5CF = .; + . = 0x01C5D0; gUnknown_0201C5D0 = .; + . = 0x01C5D1; gUnknown_0201C5D1 = .; + . = 0x01C5D4; gUnknown_0201C5D4 = .; + . = 0x01F148; gUnk_SoundRoom_0201F148 = .; + . = 0x01F19C; gSoundRoomVolumeGraphBuffer = .; + } + + ewram_overlay_gamestart __ewram_start (NOLOAD) : ALIGN(4) + { + . = 0x000000; + . = ALIGN(4); src/opinfo.o(ewram_overlay_gamestart); + . = 0x01CDD4; gUnk_OpSubtitle_0201CDD4 = .; + . = 0x01DB00; gUnk_Opinfo_0201DB00 = .; + . = 0x01DB28; gUnk_OpInfo_0201DB28 = .; + . = 0x01FB28; gUnk_OpInfo_0201FB28 = .; + } + + ewram_overlay_banim __ewram_start (NOLOAD) : ALIGN(4) + { + . = ALIGN(4); src/banim-ekrbattle.o(ewram_overlay_banim); + . = ALIGN(4); src/banim-efxlvup.o(ewram_overlay_banim); + . = ALIGN(4); src/banim-ekrdragonstatus.o(ewram_overlay_banim); + . = ALIGN(4); src/banim-efxsound.o(ewram_overlay_banim); + . = ALIGN(4); src/banim-ekrclasschg.o(ewram_overlay_banim); + . = ALIGN(4); src/banim-ekrlvup.o(ewram_overlay_banim); + . = ALIGN(4); src/banim-ekrtriangle.o(ewram_overlay_banim); + . = ALIGN(4); src/banim-ekrpopup.o(ewram_overlay_banim); + . = ALIGN(4); src/banim-ekrdragon-demonking.o(ewram_overlay_banim); + } + + ewram_overlay_sio __ewram_start (NOLOAD) : ALIGN(4) + { + . = 0x000000; gUnk_Sio_02000000 = .; + . = 0x000C60; Font_Sio_02000C60 = .; + . = 0x000C78; gUnk_Sio_02000C78 = .; + . = 0x000F00; gUnk_Sio_02000F00 = .; + . = 0x001180; gUnk_Sio_02001180 = .; + . = 0x001184; gUnk_Sio_02001184 = .; + . = 0x001188; gUnk_Sio_02001188 = .; + } + + ewram_data __ewram_start (NOLOAD) : ALIGN(4) + { + . = 0x20188; gGenericBuffer = .; /* TODO: is this part of hardware.o ? */ + . = 0x22188; gOpAnimSt = .; + . = 0x22288; + . = ALIGN(4); src/hardware.o(ewram_data); + . = ALIGN(4); src/soundwrapper.o(ewram_data); + . = ALIGN(4); src/proc.o(ewram_data); + . = ALIGN(4); src/icon.o(ewram_data); + . = ALIGN(4); src/fontgrp.o(ewram_data); + . = ALIGN(4); src/animedrv.o(ewram_data); + . = ALIGN(4); src/ctc.o(ewram_data); + . = ALIGN(4); src/face.o(ewram_data); + . = ALIGN(4); src/msg.o(ewram_data); + . = ALIGN(4); src/bm.o(ewram_data); + . = ALIGN(4); src/bmunit.o(ewram_data); + . = ALIGN(4); src/bmmap.o(ewram_data); + . = ALIGN(4); src/bmtarget.o(ewram_data); + . = ALIGN(4); src/bmudisp.o(ewram_data); + . = ALIGN(4); src/bmbattle.o(ewram_data); + . = ALIGN(4); src/bmtrade.o(ewram_data); + . = ALIGN(4); src/bmtrick.o(ewram_data); + . = ALIGN(4); src/bmcontainer.o(ewram_data); + . = ALIGN(4); src/bmusort.o(ewram_data); + . = ALIGN(4); src/bmarena.o(ewram_data); + . = ALIGN(4); src/bmmind.o(ewram_data); + . = ALIGN(4); src/bmpatharrowdisp.o(ewram_data); + . = ALIGN(4); src/unitinfowindow.o(ewram_data); + . = ALIGN(4); src/cp_phase.o(ewram_data); + . = ALIGN(4); src/cp_decide.o(ewram_data); + . = ALIGN(4); src/cp_0803E2F4.o(ewram_data); + . = ALIGN(4); src/sio_core.o(ewram_data); + . = 0x3DA24; gLinkArenaSt = .; + . = 0x3DA78; gUnk_Sio_0203DA78 = .; + . = 0x3DA88; gUnk_Sio_0203DA88 = .; + . = 0x3DAB0; Texts_0203DAB0 = .; + . = 0x3DAC0; gUnk_Sio_0203DAC0 = .; + . = 0x3DAC5; gUnk_Sio_0203DAC5 = .; + . = 0x3DB10; gSioSaveConfig = .; + . = 0x3DB14; Texts_0203DB14 = .; + . = 0x3DB1C; gUnk_Sio_0203DB1C = .; + . = 0x3DB64; Font_0203DB64 = .; + . = 0x3DB7C; gLinkArenaTeamList = .; + . = 0x3DC44; gSioResultRankings = .; + . = 0x3DC48; gUnk_Sio_0203DC48 = .; + . = 0x3DD0C; gSioTexts = .; + . = 0x3DD1C; Text_0203DB14 = .; + . = 0x3DD24; gUnk_Sio_0203DD24 = .; + . = 0x3DD28; gUnk_Sio_0203DD28 = .; + . = 0x3DD2C; gKeyInputSequenceBuffer = .; + . = 0x3DD4C; gKeyInputSequenceTimer = .; + . = 0x3DD50; gUnk_Sio_0203DD50 = .; + . = 0x3DD8C; gUnk_Sio_0203DD8C = .; + . = 0x3DD90; gUnk_Sio_0203DD90 = .; + . = 0x3DD94; gUnk_Sio_0203DD94 = .; + . = 0x3DD95; gUnk_Sio_0203DD95 = .; + . = 0x3DD9A; gUnk_Sio_0203DD9A = .; + . = 0x3DD9F; gUnk_Sio_0203DD9F = .; + . = 0x3DDB4; gUnk_Sio_0203DDB4 = .; + . = 0x3DDDC; gUnk_Sio_0203DDDC = .; + . = 0x3DDE0; + . = ALIGN(4); src/uiutils.o(ewram_data); + . = ALIGN(4); src/uiselecttarget.o(ewram_data); + . = ALIGN(4); src/banim-ekrbattle.o(ewram_data); + . = ALIGN(4); src/banim-ekrbattleintro.o(ewram_data); + . = ALIGN(4); src/banim-ekrcmd.o(ewram_data); + . = ALIGN(4); src/banim-ekrarena.o(ewram_data); + . = ALIGN(4); src/banim-efxop.o(ewram_data); + . = ALIGN(4); src/mapanim.o(ewram_data); + . = ALIGN(4); src/mapanim_scanline.o(ewram_data); + . = ALIGN(4); src/statscreen.o(ewram_data); + . = ALIGN(4); src/chapter_title.o(ewram_data); + . = ALIGN(4); src/helpbox.o(ewram_data); + . = ALIGN(4); src/cgtext.o(ewram_data); + . = ALIGN(4); src/prepscreen.o(ewram_data); + . = ALIGN(4); src/bmsave-lib.o(ewram_data); + . = ALIGN(4); src/bmsave-bwl.o(ewram_data); + . = ALIGN(4); src/bmsave.o(ewram_data); + . = ALIGN(4); src/bmsave-multiarena.o(ewram_data); + . = ALIGN(4); src/bmsave-xmap.o(ewram_data); + . = ALIGN(4); src/savemenu.o(ewram_data); + . = ALIGN(4); src/bmshop.o(ewram_data); + . = 0x3EFBC; gLoadUnitBuffer = .; + . = 0x3EFBC; end = .; + } + + IWRAM __iwram_start (NOLOAD) : + ALIGN(4) + { + . = ALIGN(4); src/rng.o(.bss); + + /* hardware.c*/ + . = 0x00000C; gKeyComboResetEN = .; + . = 0x00000D; sModifiedBGs = .; + . = 0x00000E; sModifiedPalette = .; + . = 0x000010; gKeyStatusIgnoredSt = .; + + . = 0x000014; gGameClock = .; + . = 0x000018; gUnknown_03000018 = .; + . = 0x000019; gUnknown_03000019 = .; + . = 0x00001A; gSoftwareResetFlag = .; + . = 0x000020; sOamHi = .; + . = 0x000030; sOamLo = .; + . = 0x000040; + . = ALIGN(4); src/soundwrapper.o(.bss); + . = ALIGN(4); src/scene.o(.bss); + . = 0x000108; src/ap.o(.bss); /* sAPArray = .; */ + . = 0x000428; gUnknown_03000428 = .; + . = 0x000430; gUnknown_03000430 = .; + . = 0x000434; gLoadedUnitBuffer = .; + . = 0x000438; gEventCallQueue = .; + . = 0x0004B8; gEventSlots = .; + . = 0x0004F0; gEventSlotQueue = .; + . = 0x000568; gEventSlotCounter = .; + . = 0x000570; gEventActiveQueue = .; + . = 0x0005B0; gGenericProc = .; + . = 0x0005D0; + . = ALIGN(4); src/popup.o(.bss); + . = ALIGN(4); src/eventscr3.o(.bss); + . = 0x000600; gUnknown_03000600 = .; + . = 0x000700; + . = ALIGN(4); src/eventfx-fade.o(.bss); + . = ALIGN(4); src/bmlib.o(.bss); + . = ALIGN(4); src/bmmap.o(.bss); + . = 0x001780; gDebugChapterModeIndex = .; + . = 0x001788; gUnknown_03001788 = .; + . = 0x0017A0; gDungeonState = .; + . = 0x0017AC; gUnknown_030017AC = .; + . = 0x0017C8; + . = ALIGN(4); src/cp_script.o(.bss); + . = ALIGN(4); src/cp_battle.o(.bss); + . = ALIGN(4); src/sio_core.o(.bss); + . = ALIGN(4); gCurrentKeyInSeqIndex = .; + . = 0x00180C; gTargetKeyInSeqIndex = .; + . = 0x001810; gUnknown_03001810 = .; + . = 0x001818; gUnknown_03001818 = .; + . = 0x00182C; gUnknown_0300182C = .; + . = 0x001830; gUnknown_03001830 = .; + . = 0x001834; gUnknown_03001834 = .; + . = 0x001838; gUnknown_03001838 = .; + . = 0x001840; gUnknown_03001840 = .; + . = 0x001850; gUnknown_03001850 = .; + . = 0x001860; gUnknown_03001860 = .; + . = 0x001864; gUnknown_03001864 = .; + . = 0x001870; + . = ALIGN(4); src/uimenu.o(.bss); + . = 0x0018F0; gUnknown_030018F0 = .; + . = 0x0018F8; + . = ALIGN(4); src/mu.o(.bss); + . = 0x001A30; gEventREDAs = .; + . = 0x001C34; gUnknown_03001C34 = .; + . = 0x001C35; gUnknown_03001C35 = .; + . = 0x001C36; gUnknown_03001C36 = .; + . = 0x001C38; gUnitDef1 = .; + . = 0x001C48; gUnknown_03001C48 = .; + . = 0x001C50; gUnitDef2 = .; + . = 0x001C68; gUnitDefEggHatching = .; + . = 0x001C74; gUnknown_03001C74 = .; + . = 0x001C7C; gUnknown_03001C7C = .; + . = 0x001C80; gActiveEventRegistry = .; + . = 0x001CC0; gUdefCnt = .; + . = 0x001CC8; gUdefREDAs = .; + . = 0x001CE8; gUdefs = .; + . = 0x001D50; gUnknown_03001D50 = .; + . = 0x001DA0; gText_GoldBox = .; + . = 0x001DA8; gUnknown_03001DA8 = .; + . = 0x001DE8; gUnknown_03001DE8 = .; + . = 0x001E30; gUnknown_03001E30 = .; + + . = 0x001E38; + . = ALIGN(4); sound/music_player_table.o(.bss); + + . = 0x002A68; + . = ALIGN(4); src/agb_sram.o(.bss); + . = ALIGN(4); *libc.a:syscalls.o(.bss); + /*. = ALIGN(4); *libgcc.a:dp-bit.o(.bss); + . = ALIGN(4); *libgcc.a:fp-bit.o(.bss);*/ + + /* COMMON */ + . = 0x002C60; SoundMainRAM_Buffer = .; + . = 0x002C61; gUnknown_03002C61 = .; + . = 0x003060; gUnknown_03003060 = .; + . = 0x003070; gOamLoPutIt = .; + . = 0x003070; gOamLoPutIt = .; + . = 0x003080; gLCDControlBuffer = .; + . = 0x0030C8; gOpAnimBgAffineDstData = .; + . = 0x0030D8; gUnknown_030030D8 = .; + . = 0x0030F0; gIRQHandlers = .; + . = 0x003128; gUnknown_03003128 = .; + . = 0x00312C; gOamAffinePutId = .; + . = 0x003130; gUnknown_03003130 = .; + . = 0x003134; sHBlankHandler1 = .; + . = 0x003140; gOam = .; + . = 0x003740; gUnknown_03003740 = .; + . = 0x003744; gOamHiPutIt = .; + . = 0x003748; sHBlankHandler2 = .; + . = 0x003750; gUnknown_03003750 = .; + . = 0x004150; gUnknown_03004150 = .; + . = 0x004154; gUnknown_03004154 = .; + . = 0x004158; gOamAffinePutIt = .; + . = 0x004160; IntrMain_Buffer = .; + . = 0x004960; gUnknown_03004960 = .; + . = 0x004970; gSpriteAllocIt = .; + . = 0x004980; gFaces = .; + . = 0x004990; gUnknown_03004990 = .; + . = 0x0049A0; gWorkingBmMap = .; + . = 0x0049B0; gMovMapFillStPool1 = .; + . = 0x004BB0; gWorkingTerrainMoveCosts = .; + . = 0x004C00; gStatGainSimUnit = .; + . = 0x004C50; gMovMapFillStPool2 = .; + . = 0x004E50; gActiveUnit = .; + . = 0x004E60; gMovMapFillState = .; + . = 0x004E70; gUnknown_03004E70 = .; + . = 0x004E74; gUnknown_03004E74 = .; + . = 0x004E80; gUnknown_03004E80 = .; + . = 0x004E86; gUnknown_03004E86 = .; + . = 0x004F08; gSioStateId = .; + . = 0x004F0C; gSioMsgBuf = .; + . = 0x004F10; AiDecideMainFunc = .; + . = 0x004F20; gUnknown_03004F20 = .; + . = 0x004FA0; gUnknown_03004FA0 = .; + . = 0x004FA4; gUnknown_03004FA4 = .; + . = 0x004FA8; gEkrXQuakeOff = .; + . = 0x004FAC; gBanimDebugCurrentIndex = .; + . = 0x004FB0; gEkrYQuakeOff = .; + . = 0x004FC0; + . = ALIGN(4); src/mapanim_debug.o(.bss); + . = ALIGN(4); src/mapanim_spellassocfx.o(.bss); + . = 0x005250; gPermanentFlagBits = .; + . = 0x005270; gChapterFlagBits = .; + . = 0x005280; gGMData = .; + . = 0x005324; gUnknown_03005324 = .; + . = 0x005349; gUnknown_03005349 = .; + . = 0x00534E; gGmMonsterRnState = .; + . = 0x005360; gFontClassChgMenu = .; + . = 0x005380; gFontClassChg = .; + . = 0x005398; gUnknown_03005398 = .; + . = 0x0053A0; gUnknown_030053A0 = .; + . = 0x0053E0; gUnknown_030053E0 = .; + . = 0x005408; gUnknown_03005408 = .; + . = 0x005410; gSoundInfo = .; + . = 0x0063C0; gMPlayInfo_SE4_BMP2 = .; + . = 0x006400; gMPlayInfo_SE5_BMP3 = .; + . = 0x006440; gMPlayInfo_BGM1 = .; + . = 0x006480; gMPlayJumpTable = .; + . = 0x006484; gUnknown_03006484 = .; + . = 0x006508; gUnknown_03006508 = .; + . = 0x00650C; gUnknown_0300650C = .; + . = 0x006510; gCgbChans = .; + . = 0x006610; gMPlayInfo_SE6_BMP4 = .; + . = 0x006650; gMPlayInfo_BGM2 = .; + . = 0x006690; gMPlayInfo_SE1_SYS1 = .; + . = 0x0066D0; gMPlayInfo_SE3_BMP1 = .; + . = 0x006710; gMPlayMemAccArea = .; + . = 0x006720; gMPlayInfo_SE7_EVT = .; + . = 0x006760; gMPlayInfo_SE2_SYS2 = .; + + /* src/agb_sram.o(COMMON); */ + . = 0x0067A0; ReadSramFast = .; + . = 0x0067A4; VerifySramFast = .; + + . = 0x67A8; + . = ALIGN(4); *libc.a:sbrkr.o(COMMON); + + . = ALIGN(4); *libgcc.a:dp-bit.o(.bss); + . = ALIGN(4); *libgcc.a:fp-bit.o(.bss); + } + + ROM __text_start : + ALIGN(4) + { + /* .text */ + asm/crt0.o(.text); + asm/arm.o(.text); + src/main.o(.text); + src/fe3_dummy.o(.text); + src/irq.o(.text); + src/rng.o(.text); + src/time.o(.text); + src/hardware.o(.text); + src/soundwrapper.o(.text); + src/ramfunc.o(.text); + src/proc.o(.text); + src/icon.o(.text); + src/fontgrp.o(.text); + src/animedrv.o(.text); + src/ctc.o(.text); + src/face.o(.text); + src/scene.o(.text); + src/sprite-animfx.o(.text); + src/ap.o(.text); + src/gamecontrol.o(.text); + src/msg.o(.text); + asm/spline.o(.text); + src/eventscr_utils.o(.text); + src/eventscr_gmap.o(.text); + src/event.o(.text); + src/eventscr.o(.text); + src/eventscr2.o(.text); + src/popup.o(.text); + src/eventscr3.o(.text); + src/eventfx-fade.o(.text); + src/eventcmd_warp.o(.text); + src/eventfx-shinningstone.o(.text); + src/eventfx-boomfog.o(.text); + src/eventfx-earthquake.o(.text); + src/eventfx-stoneshatter.o(.text); + src/bmlib.o(.text); + asm/bmlib-hblank.o(.text); + src/bmlib-math.o(.text); + src/bm.o(.text); + src/bmitem.o(.text); + src/bmunit.o(.text); + src/bmmap.o(.text); + src/bmidoten.o(.text); + src/bmdebug.o(.text); + src/playerphase.o(.text); + src/koido.o(.text); + src/bmxfade.o(.text); + src/bmcamadjust.o(.text); + src/convoymenu.o(.text); + src/fogmap.o(.text); + src/menuitempanel.o(.text); + src/prep_unitswap.o(.text); + src/phasechangefx.o(.text); + src/unit_facing.o(.text); + src/trapfx.o(.text); + src/popup2.o(.text); + src/chapterintrofx.o(.text); + src/gameoverbgfx.o(.text); + src/lightrunefx.o(.text); + src/danceringfx.o(.text); + src/eventwarpfx.o(.text); + src/whitecircularfadefx.o(.text); + src/emitstarfx.o(.text); + src/minefx.o(.text); + src/chapterintrofx_title.o(.text); + src/bmmenu.o(.text); + src/bmphase.o(.text); + src/bmgold.o(.text); + src/bmtarget.o(.text); + src/bmudisp.o(.text); + src/bmreliance.o(.text); + src/bmitemuse.o(.text); + src/bmbattle.o(.text); + src/bmtrade.o(.text); + src/bmtrick.o(.text); + src/bmusemind.o(.text); + src/bmio.o(.text); + src/bmcontainer.o(.text); + src/bmusort.o(.text); + src/bmarena.o(.text); + src/bmmind.o(.text); + src/bmpatharrowdisp.o(.text); + src/prep_sallycursor.o(.text); + asm/bmcommanddbg.o(.text); + src/chapterdata.o(.text); + src/unitinfowindow.o(.text); + src/bb.o(.text); + src/bmusailment.o(.text); + src/bksel.o(.text); + src/bmtrap.o(.text); + src/bmarch.o(.text); + src/bmdifficulty.o(.text); + src/cp_phase.o(.text); + src/cp_order.o(.text); + src/cp_decide.o(.text); + src/cp_perform.o(.text); + src/cp_utility.o(.text); + src/cp_script.o(.text); + src/cp_battle.o(.text); + src/cp_0803E2F4.o(.text); + src/cp_staff.o(.text); + src/cpextra_80407F0.o(.text); + src/sio_core.o(.text); + src/sio_main.o(.text); + src/sio_main2.o(.text); + src/sio_teamlist.o(.text); + asm/code_sio_8042DC8.o(.text); + src/sio_tactician.o(.text); + src/sio_postbattle.o(.text); + asm/code_sio.o(.text); + src/sio_result.o(.text); + src/sio_rulesettings.o(.text); + src/sio_menu.o(.text); + src/sio_event.o(.text); + src/sio_points.o(.text); + src/sio_battlemap.o(.text); + asm/code_sio_8048260.o(.text); + src/uiutils.o(.text); + src/uimenu.o(.text); + src/uiselecttarget.o(.text); + src/banim-ekrbattle.o(.text); + src/banim-ekrlvupfan.o(.text); + src/banim-ekrgauge.o(.text); + asm/banim-ekrgauge.o(.text); + src/banim-ekrdispup.o(.text); + src/banim-efxhpbar.o(.text); + src/banim-efxdeath.o(.text); + src/banim-efxbattle.o(.text); + src/banim-efxflashbg.o(.text); + src/banim-efxflashunit.o(.text); + src/banim-efxstatusunit.o(.text); + src/banim-efxflashobj.o(.text); + src/banim-ekrutils.o(.text); + src/banim-ekrbattlestarting.o(.text); + src/banim-ekrbattleending.o(.text); + src/banim-ekrbattleintro.o(.text); + src/banim-battleparse.o(.text); + src/banim-ekrcmd.o(.text); + src/banim-main.o(.text); + src/banim-ekrmain.o(.text); + src/banim-ekrmainmini.o(.text); + asm/code_battleanim.o(.text); + src/banim-ekrarena.o(.text); + src/banim-efxmagic.o(.text); + src/banim-efxmagic-phywpn.o(.text); + src/banim-efxmagic-refresh.o(.text); + src/banim-efxmagic-ballista.o(.text); + src/banim-efxmagic-bindingblade.o(.text); + src/banim-efxmagic-breath.o(.text); + src/banim-efxmagic-thunder.o(.text); + src/banim-efxmagic-fire.o(.text); + src/banim-efxmagic-fimbulvetr.o(.text); + src/banim-efxmagic-bolting.o(.text); + src/banim-efxmagic-aircalibur.o(.text); + src/banim-efxmagic-flux.o(.text); + src/banim-efxmagic-nosferatu.o(.text); + src/banim-efxmagic-light.o(.text); + src/banim-efxmagic-eclipse.o(.text); + src/banim-efxmagic-fenrir.o(.text); + src/banim-efxmagic-healstaves.o(.text); + src/banim-efxmagic-effectstaves.o(.text); + src/banim-efxmagic-shine.o(.text); + src/banim-efxmagic-luna.o(.text); + src/banim-efxmagic-excalibur.o(.text); + src/banim-efxmagic-gespenst.o(.text); + src/banim-efxmagic-aura.o(.text); + src/banim-efxmagic-ereshkigal.o(.text); + src/banim-efxmagic-dancerings.o(.text); + src/banim-efxmagic-ivaldi.o(.text); + src/banim-efxmagic-demonlight.o(.text); + src/banim-efxmagic-stone.o(.text); + src/banim-efxmagic-evileye.o(.text); + src/banim-efxmagic-naglfar.o(.text); + src/banim-efxmagic-wretchedair.o(.text); + src/banim-efxmagic-gleipnir.o(.text); + src/banim-efxmagic-crimsoneye.o(.text); + src/banim-efxmagic-shadowshot.o(.text); + src/banim-efxmagic-demonsurge.o(.text); + src/banim-efxhit.o(.text); + src/banim-efxmisc.o(.text); + src/banim-efxskill.o(.text); + src/banim-efxop.o(.text); + src/banim-ekrdragonstatus.o(.text); + src/banim-ekrdragon-dracozombie.o(.text); + src/banim-ekrdragon-utils.o(.text); + asm/banim-ekrdragon.o(.text); + src/banim-ekrdragon-8070710.o(.text); + src/banim-ekrdragon-myrrh.o(.text); + src/banim-efxutils.o(.text); + src/banim-efxsound.o(.text); + src/banim-ekrclasschg.o(.text); + src/banim-ekrlvup.o(.text); + src/banim-efxlvup.o(.text); + src/banim-ekrtriangle.o(.text); + src/banim-ekrpopup.o(.text); + src/banim-ekrhensei.o(.text); + src/banim-ekrdragon-demonking.o(.text); + src/banim-ekrdragon-demonkingobj.o(.text); + src/spellassoc.o(.text); + src/monstergen.o(.text); + src/mu.o(.text); + src/muctrl.o(.text); + src/mapanim.o(.text); + src/mapanim_summon.o(.text); + src/mapanim_api.o(.text); + src/mapanim_infobox.o(.text); + src/mapanim_expbar.o(.text); + src/mapanim_debug.o(.text); + src/mapanim_eventbattle.o(.text); + src/mapanim_specialeffect.o(.text); + src/mapanim_staffeffect.o(.text); + src/mapanim_lvupfx.o(.text); + src/mapanim_lvup.o(.text); + src/mapanim_spellassocfx.o(.text); + src/mapanim_eventcall.o(.text); + asm/mapanim_eventcall.o(.text); + src/mapanim_spellassoc.o(.text); + src/mapanim_scanline.o(.text); + asm/code_mapanim.o(.text); + src/eventinfo.o(.text); + src/uidebug.o(.text); + src/eventcall.o(.text); + src/events_script_utils.o(.text); + src/events_script.o(.text); + asm/code_8086934.o(.text); + src/statbar.o(.text); + src/mural_background.o(.text); + src/statscreen.o(.text); + src/chapter_title.o(.text); + src/helpbox.o(.text); + src/player_interface.o(.text); + src/sioerror.o(.text); + src/uichapterstatus.o(.text); + src/cgtext.o(.text); + src/unitlistscreen.o(.text); + src/prepscreen.o(.text); + src/prep_atmenu.o(.text); + src/prep_menuproc.o(.text); + src/prep_menuscroll.o(.text); + src/prep_sallycir.o(.text); + src/prep_utils.o(.text); + src/prep_itemscreen.o(.text); + src/prep_unitselect.o(.text); + src/prep_itemtrade.o(.text); + src/prep_itemuse.o(.text); + src/prep_itemusemind.o(.text); + src/prep_itemsupply.o(.text); + src/prep_itemlist.o(.text); + src/prep_wm_sell.o(.text); + src/prep_80A0760.o(.text); + src/uisupport.o(.text); + src/bmsave-lib.o(.text); + src/bmsave-bwl.o(.text); + src/bmsave.o(.text); + src/bmsave-multiarena.o(.text); + src/bmsave-xmap.o(.text); + src/bmsave-gmap.o(.text); + src/bmsave-misc.o(.text); + src/minimap.o(.text); + src/savemenu.o(.text); + src/savedraw.o(.text); + src/difficultymenu.o(.text); + asm/code_80AC6AC.o(.text); + src/cursor_hand.o(.text); + src/spinning_arrow.o(.text); + src/sysutil.o(.text); + src/sysutil-bmbgfx.o(.text); + src/code_80AE86C.o(.text); + src/soundroom.o(.text); + src/extramenu_unk.o(.text); + src/bonusclaim.o(.text); + src/uiconfig.o(.text); + src/colorfade.o(.text); + src/opinfo.o(.text); + src/classdisplayfont.o(.text); + src/bmshop.o(.text); + src/uiarena.o(.text); + src/gamerankings.o(.text); + src/cg.o(.text); + src/ending_details.o(.text); + src/worldmap_face.o(.text); + src/worldmap_main.o(.text); + src/worldmap_screen.o(.text); + src/worldmap_gmapunit.o(.text); + src/worldmap_screen2.o(.text); + src/worldmap_cursor.o(.text); + src/worldmap_path.o(.text); + src/worldmap_mapmu.o(.text); + src/worldmap_player_interface.o(.text); + src/worldmap_scrollmanage.o(.text); + src/worldmap_draw.o(.text); + src/worldmap_palette_fade.o(.text); + src/worldmap_entry.o(.text); + src/worldmap_line_fade.o(.text); + src/worldmap_tm_confront.o(.text); + src/worldmap_80C0834.o(.text); + src/worldmap_status_ui.o(.text); + src/worldmap_effect.o(.text); + src/worldmap_sogu.o(.text); + src/worldmap_timemons.o(.text); + src/worldmap_hb.o(.text); + src/worldmap_rm.o(.text); + src/worldmap_automu.o(.text); + src/worldmap_text.o(.text); + src/worldmap_radar.o(.text); + src/worldmap_basemenu.o(.text); + src/ending_credits.o(.text); + src/opsubtitle.o(.text); + src/titlescreen.o(.text); + src/opanimfx.o(.text); + asm/opanimfx.o(.text); + src/opanim-main.o(.text); + src/opanim-healthsafetyscreen.o(.text); + src/classchg-main.o(.text); + src/classchg-handler.o(.text); + src/classchg-sel.o(.text); + src/classchg-event.o(.text); + src/classchg-menuconfirm.o(.text); + src/classchg-menuselect.o(.text); + src/classchg-postconfirm.o(.text); + src/bmguide.o(.text); + asm/m4a_1.o(.text); + src/m4a.o(.text); + asm/libagbsyscall.o(.text); + src/agb_sram.o(.text); + *libgcc.a:_ashldi3.o(.text); + *libgcc.a:_call_via_rX.o(.text); + *libgcc.a:_divsi3.o(.text); + *libgcc.a:_dvmd_tls.o(.text); + *libgcc.a:_modsi3.o(.text); + *libgcc.a:_muldi3.o(.text); + *libgcc.a:_udivsi3.o(.text); + *libgcc.a:_umodsi3.o(.text); + *libc.a:memcpy.o(.text); + *libc.a:memset.o(.text); + *libc.a:sprintf.o(.text); + *libc.a:strcpy.o(.text); + *libc.a:strlen.o(.text); + *libc.a:strstr.o(.text); + *libc.a:vfprintf.o(.text); + *libc.a:vsprintf.o(.text); + *libc.a:wsetup.o(.text); + *libc.a:dtoa.o(.text); + *libc.a:fflush.o(.text); + *libc.a:findfp.o(.text); + *libc.a:freer.o(.text); + *libc.a:fvwrite.o(.text); + *libc.a:fwalk.o(.text); + *libc.a:locale.o(.text); + *libc.a:makebuf.o(.text); + *libc.a:mallocr.o(.text); + *libc.a:mbtowc_r.o(.text); + *libc.a:memchr.o(.text); + *libc.a:memmove.o(.text); + *libc.a:mlock.o(.text); + *libc.a:mprec.o(.text); + *libc.a:s_isinf.o(.text); + *libc.a:s_isnan.o(.text); + *libc.a:sbrkr.o(.text); + *libc.a:stdio.o(.text); + *libc.a:strcmp.o(.text); + *libc.a:syscalls.o(.text); + *libc.a:writer.o(.text); + *libc.a:callocr.o(.text); + *libc.a:closer.o(.text); + *libc.a:errno.o(.text); + *libc.a:fstatr.o(.text); + *libc.a:libcfunc.o(.text); + *libc.a:lseekr.o(.text); + *libc.a:readr.o(.text); + *libgcc.a:dp-bit.o(.text); + *libgcc.a:fp-bit.o(.text); + *libgcc.a:_lshrdi3.o(.text); + *libgcc.a:_negdi2.o(.text); + asm/arm_call.o(.text); + + /* .rodata */ + . = ALIGN(4); src/*.o(.rodata*); + . = ALIGN(4); data/trig_rodata.o(.rodata); + . = ALIGN(4); data/const_data_sio.o(.rodata); + . = ALIGN(4); data/const_data_D8714.o(.rodata); + . = ALIGN(4); data/const_data_D9F18.o(.rodata); + . = ALIGN(4); data/const_data_DAD68.o(.rodata); + . = ALIGN(4); data/const_data_DAEF0.o(.rodata); + . = ALIGN(4); data/const_data_DB034.o(.rodata); + . = ALIGN(4); data/const_data_efxmagic_DC944.o(.rodata); + . = ALIGN(4); data/const_data_banimekrdk.o(.rodata); + . = ALIGN(4); data/const_data_efxutils.o(.rodata); + . = ALIGN(4); data/const_data_E162A.o(.rodata); + . = ALIGN(4); data/const_data_chapter_maps.o(.rodata); + . = ALIGN(4); data/const_data_unit_icon_wait.o(.rodata); + . = ALIGN(4); data/const_data_1C0AFC.o(.rodata); + . = ALIGN(4); data/const_data_unit_icon_move.o(.rodata); + . = ALIGN(4); data/const_data_205714.o(.rodata); + . = ALIGN(4); sound/*.o(.rodata); + . = ALIGN(4); *libc.a:vfprintf.o(.rodata); + . = ALIGN(4); *libc.a:dtoa.o(.rodata); + . = ALIGN(4); *libc.a:impure.o(.rodata); + . = ALIGN(4); *libc.a:locale.o(.rodata); + . = ALIGN(4); *libc.a:mprec.o(.rodata); + . = ALIGN(4); *libc.a:syscalls.o(.rodata); + + /* .data */ + . = ALIGN(4); src/main.o(.data); + . = ALIGN(4); src/hardware.o(.data); + . = ALIGN(4); src/soundwrapper.o(.data); + . = ALIGN(4); src/proc.o(.data); + . = ALIGN(4); src/fontgrp.o(.data); + . = ALIGN(4); src/fontgrp-data.o(.data); + . = ALIGN(4); src/ctc.o(.data); + . = ALIGN(4); src/face.o(.data); + . = ALIGN(4); src/scene.o(.data); + . = ALIGN(4); src/sprite-animfx.o(.data); + . = ALIGN(4); src/ap.o(.data); + . = ALIGN(4); src/gamecontrol.o(.data); + . = ALIGN(4); src/msg.o(.data); + . = ALIGN(4); src/event.o(.data); + . = ALIGN(4); src/eventscr.o(.data); + . = ALIGN(4); src/popup.o(.data); + . = ALIGN(4); src/eventscr3.o(.data); + . = ALIGN(4); src/eventfx-fade.o(.data); + . = ALIGN(4); src/eventfx-shinningstone.o(.data); + . = ALIGN(4); src/eventfx-boomfog.o(.data); + . = ALIGN(4); src/eventfx-earthquake.o(.data); + . = ALIGN(4); src/eventfx-stoneshatter.o(.data); + . = ALIGN(4); data/data_item_icon.o(.data); + . = ALIGN(4); data/generic_icon.o(.data); + . = ALIGN(4); src/bmlib.o(.data); + . = ALIGN(4); src/bm.o(.data); + . = ALIGN(4); src/bmunit.o(.data); + . = ALIGN(4); src/bmmap.o(.data); + . = ALIGN(4); src/bmdebug.o(.data); + . = ALIGN(4); src/playerphase.o(.data); + . = ALIGN(4); src/koido.o(.data); + . = ALIGN(4); src/bmxfade.o(.data); + . = ALIGN(4); src/bmcamadjust.o(.data); + . = ALIGN(4); src/convoymenu.o(.data); + . = ALIGN(4); src/menuitempanel.o(.data); + . = ALIGN(4); src/prep_unitswap.o(.data); + . = ALIGN(4); src/phasechangefx.o(.data); + . = ALIGN(4); src/trapfx.o(.data); + . = ALIGN(4); src/popup2.o(.data); + . = ALIGN(4); src/chapterintrofx.o(.data); + . = ALIGN(4); src/gameoverbgfx.o(.data); + . = ALIGN(4); src/lightrunefx.o(.data); + . = ALIGN(4); src/danceringfx.o(.data); + . = ALIGN(4); src/eventwarpfx.o(.data); + . = ALIGN(4); src/whitecircularfadefx.o(.data); + . = ALIGN(4); src/emitstarfx.o(.data); + . = ALIGN(4); src/minefx.o(.data); + . = ALIGN(4); src/chapterintrofx_title.o(.data); + . = ALIGN(4); src/bmmenu.o(.data); + . = ALIGN(4); src/bmudisp.o(.data); + . = ALIGN(4); src/bmreliance.o(.data); + . = ALIGN(4); src/bmitemuse.o(.data); + . = ALIGN(4); src/bmbattle.o(.data); + . = ALIGN(4); src/bmtrade.o(.data); + . = ALIGN(4); src/bmtrick.o(.data); + . = ALIGN(4); src/bmusemind.o(.data); + . = ALIGN(4); src/menu_def.o(.data); + . = ALIGN(4); data/data_map_anim.o(.data); + . = ALIGN(4); src/bmio.o(.data); + . = ALIGN(4); src/bmarena.o(.data); + . = ALIGN(4); src/bmmind.o(.data); + . = ALIGN(4); src/bmpatharrowdisp.o(.data); + . = ALIGN(4); src/prep_sallycursor.o(.data); + . = ALIGN(4); src/unitinfowindow.o(.data); + . = ALIGN(4); src/bb.o(.data); + . = ALIGN(4); src/bmusailment.o(.data); + . = ALIGN(4); src/bksel.o(.data); + . = ALIGN(4); src/bmtrap.o(.data); + . = ALIGN(4); src/bmdifficulty.o(.data); + . = ALIGN(4); data/data_59E8E0.o(.data); + . = ALIGN(4); src/cp_phase.o(.data); + . = ALIGN(4); src/cp_order.o(.data); + . = ALIGN(4); src/cp_decide.o(.data); + . = ALIGN(4); src/cp_perform.o(.data); + . = ALIGN(4); src/cp_utility.o(.data); + . = ALIGN(4); src/cp_data.o(.data); + . = ALIGN(4); src/cp_battle.o(.data); + . = ALIGN(4); src/cp_0803E2F4.o(.data); + . = ALIGN(4); src/cp_staff.o(.data); + . = ALIGN(4); src/cpextra_80407F0.o(.data); + . = ALIGN(4); src/sio_core.o(.data); + . = ALIGN(4); src/sio_main.o(.data); + . = ALIGN(4); src/sio_main2.o(.data); + . = ALIGN(4); src/sio_teamlist.o(.data); + . = ALIGN(4); data/sio_tactician.o(.data); + . = ALIGN(4); src/sio_postbattle.o(.data); + . = ALIGN(4); data/data_5A92E0.o(.data); + . = ALIGN(4); src/sio_result.o(.data); + . = ALIGN(4); src/sio_rulesettings.o(.data); + . = ALIGN(4); src/sio_menu.o(.data); + . = ALIGN(4); src/sio_event.o(.data); + . = ALIGN(4); src/sio_points.o(.data); + . = ALIGN(4); src/sio_battlemap.o(.data); + . = ALIGN(4); data/data_5A9F48.o(.data); + . = ALIGN(4); src/uiutils.o(.data); + . = ALIGN(4); src/uimenu.o(.data); + . = ALIGN(4); src/uiselecttarget.o(.data); + . = ALIGN(4); data/data_5B65C0.o(.data); + . = ALIGN(4); src/banim-ekrbattle.o(.data); + . = ALIGN(4); src/banim-ekrlvupfan.o(.data); + . = ALIGN(4); src/banim-ekrgauge.o(.data); + . = ALIGN(4); data/data-ekrgauge.o(.data); + . = ALIGN(4); src/banim-ekrdispup.o(.data); + . = ALIGN(4); src/banim-efxhpbar.o(.data); + . = ALIGN(4); src/banim-efxdeath.o(.data); + . = ALIGN(4); src/banim-efxbattle.o(.data); + . = ALIGN(4); src/banim-efxflashbg.o(.data); + . = ALIGN(4); src/banim-efxflashunit.o(.data); + . = ALIGN(4); src/banim-efxstatusunit.o(.data); + . = ALIGN(4); src/banim-efxflashobj.o(.data); + . = ALIGN(4); src/banim-ekrutils.o(.data); + . = ALIGN(4); src/banim-ekrbattlestarting.o(.data); + . = ALIGN(4); src/banim-ekrbattleending.o(.data); + . = ALIGN(4); src/banim-ekrbattleintro.o(.data); + . = ALIGN(4); src/banim-ekrmain.o(.data); + . = ALIGN(4); src/banim-ekrmainmini.o(.data); + . = ALIGN(4); src/banim-ekrarena.o(.data); + . = ALIGN(4); data/data_banim_5B9D6C.o(.data); + . = ALIGN(4); data/banim-efxlvupfx.o(.data); + . = ALIGN(4); data/banim-ekrmainminifx.o(.data); + . = ALIGN(4); data/banim-efxhitfx.o(.data); + . = ALIGN(4); data/data_banim_5B9D5C.o(.data); + . = ALIGN(4); src/banim-efxmagic.o(.data); + . = ALIGN(4); src/banim-efxmagic-phywpn.o(.data); + . = ALIGN(4); src/banim-efxmagic-refresh.o(.data); + . = ALIGN(4); src/banim-efxmagic-ballista.o(.data); + . = ALIGN(4); src/banim-efxmagic-bindingblade.o(.data); + . = ALIGN(4); src/banim-efxmagic-breath.o(.data); + . = ALIGN(4); data/banim-efxmagic-thunder.o(.data); + . = ALIGN(4); data/banim-efxmagic-fire.o(.data); + . = ALIGN(4); src/banim-efxmagic-fimbulvetr.o(.data); + . = ALIGN(4); src/banim-efxmagic-bolting.o(.data); + . = ALIGN(4); src/banim-efxmagic-aircalibur.o(.data); + . = ALIGN(4); src/banim-efxmagic-flux.o(.data); + . = ALIGN(4); src/banim-efxmagic-nosferatu.o(.data); + . = ALIGN(4); src/banim-efxmagic-light.o(.data); + . = ALIGN(4); src/banim-efxmagic-eclipse.o(.data); + . = ALIGN(4); src/banim-efxmagic-fenrir.o(.data); + . = ALIGN(4); src/banim-efxmagic-healstaves.o(.data); + . = ALIGN(4); src/banim-efxmagic-effectstaves.o(.data); + . = ALIGN(4); src/banim-efxmagic-shine.o(.data); + . = ALIGN(4); src/banim-efxmagic-luna.o(.data); + . = ALIGN(4); src/banim-efxmagic-excalibur.o(.data); + . = ALIGN(4); src/banim-efxmagic-gespenst.o(.data); + . = ALIGN(4); src/banim-efxmagic-aura.o(.data); + . = ALIGN(4); src/banim-efxmagic-ereshkigal.o(.data); + . = ALIGN(4); src/banim-efxmagic-dancerings.o(.data); + . = ALIGN(4); src/banim-efxmagic-ivaldi.o(.data); + . = ALIGN(4); src/banim-efxmagic-demonlight.o(.data); + . = ALIGN(4); src/banim-efxmagic-stone.o(.data); + . = ALIGN(4); src/banim-efxmagic-evileye.o(.data); + . = ALIGN(4); src/banim-efxmagic-naglfar.o(.data); + . = ALIGN(4); src/banim-efxmagic-wretchedair.o(.data); + . = ALIGN(4); src/banim-efxmagic-gleipnir.o(.data); + . = ALIGN(4); src/banim-efxmagic-crimsoneye.o(.data); + . = ALIGN(4); src/banim-efxmagic-shadowshot.o(.data); + . = ALIGN(4); src/banim-efxmagic-demonsurge.o(.data); + . = ALIGN(4); src/banim-efxhit.o(.data); + . = ALIGN(4); src/banim-efxmisc.o(.data); + . = ALIGN(4); src/banim-efxskill.o(.data); + . = ALIGN(4); src/banim-efxop.o(.data); + . = ALIGN(4); data/data_banim.o(.data); + . = ALIGN(4); src/banim-ekrdragon-dracozombie.o(.data); + . = ALIGN(4); src/banim-ekrdragon-utils.o(.data); + . = ALIGN(4); data/data-ekrdragon.o(.data); + . = ALIGN(4); src/banim-ekrdragon-myrrh.o(.data); + . = ALIGN(4); src/banim-efxutils.o(.data); + . = ALIGN(4); src/banim-efxsound.o(.data); + . = ALIGN(4); src/banim-efxsound-data.o(.data); + . = ALIGN(4); src/banim-ekrclasschg.o(.data); + . = ALIGN(4); src/banim-ekrlvup.o(.data); + . = ALIGN(4); src/banim-efxlvup.o(.data); + . = ALIGN(4); src/banim-ekrtriangle.o(.data); + . = ALIGN(4); data/banim-ekrtriangle.o(.data); + . = ALIGN(4); data/data_btl_bg.o(.data); + . = ALIGN(4); src/banim-ekrpopup.o(.data); + . = ALIGN(4); src/banim-ekrhensei.o(.data); + . = ALIGN(4); data/data_banim_78D500.o(.data); + . = ALIGN(4); src/banim-ekrdragon-demonking.o(.data); + . = ALIGN(4); data/data-ekrdk.o(.data); + . = ALIGN(4); src/banim-ekrdragon-demonkingobj.o(.data); + . = ALIGN(4); data/data-ekrdk2.o(.data); + . = ALIGN(4); src/data_characters.o(.data); + . = ALIGN(4); src/data_classes.o(.data); + . = ALIGN(4); src/data_items.o(.data); + . = ALIGN(4); src/data_terrains.o(.data); + . = ALIGN(4); data/data_portrait.o(.data); + . = ALIGN(4); src/portrait_data.o(.data); + . = ALIGN(4); src/data_itemuse.o(.data); + . = ALIGN(4); src/data_debugpinfo.o(.data); + . = ALIGN(4); src/data_supports.o(.data); + . = ALIGN(4); src/data_itembonus.o(.data); + . = ALIGN(4); src/data_banimconf.o(.data); + . = ALIGN(4); src/data_banimconfunk.o(.data); + . = ALIGN(4); src/unit_icon_wait_data.o(.data); + . = ALIGN(4); src/spellassoc-data.o(.data); + . = ALIGN(4); src/bmreliance-data.o(.data); + . = ALIGN(4); src/data_debug_creditinfo.o(.data); + . = ALIGN(4); src/chapterdata.o(.data); + . = ALIGN(4); data/data_8B363C.o(.data); + . = ALIGN(4); src/events_udefs.o(.data); + . = ALIGN(4); src/monstergen_data.o(.data); + . = ALIGN(4); data/data_bg.o(.data); + . = ALIGN(4); src/eventscr2.o(.data); + . = ALIGN(4); src/classchg-data.o(.data); + . = ALIGN(4); data/data_map_anim_frames.o(.data); + . = ALIGN(4); data/data_99D6DC.o(.data); + . = ALIGN(4); src/mu.o(.data); + . = ALIGN(4); src/muctrl.o(.data); + . = ALIGN(4); src/unit_icon_move_data.o(.data); + . = ALIGN(4); src/mapanim.o(.data); + . = ALIGN(4); src/mapanim_summon.o(.data); + . = ALIGN(4); src/mapanim_api.o(.data); + . = ALIGN(4); src/mapanim_infobox.o(.data); + . = ALIGN(4); src/mapanim_expbar.o(.data); + . = ALIGN(4); src/mapanim_debug.o(.data); + . = ALIGN(4); src/mapanim_eventbattle.o(.data); + . = ALIGN(4); src/mapanim_specialeffect.o(.data); + . = ALIGN(4); src/mapanim_staffeffect.o(.data); + . = ALIGN(4); src/mapanim_lvupfx.o(.data); + . = ALIGN(4); src/mapanim_lvup.o(.data); + . = ALIGN(4); src/mapanim_spellassocfx.o(.data); + . = ALIGN(4); src/mapanim_eventcall.o(.data); + . = ALIGN(4); data/mapanim_eventcall.o(.data); + . = ALIGN(4); src/mapanim_spellassoc.o(.data); + . = ALIGN(4); data/data_9A31F8.o(.data); + . = ALIGN(4); src/eventinfo.o(.data); + . = ALIGN(4); src/events_info.o(.data); + . = ALIGN(4); src/data_battlequotes.o(.data); + . = ALIGN(4); src/data_event_trigger.o(.data); + . = ALIGN(4); src/uidebug.o(.data); + . = ALIGN(4); src/events_shoplist.o(.data); + . = ALIGN(4); src/events_trapdata.o(.data); + . = ALIGN(4); src/eventcall.o(.data); + . = ALIGN(4); src/events_script_utils.o(.data); + . = ALIGN(4); src/events_script.o(.data); + . = ALIGN(4); src/mural_background.o(.data); + . = ALIGN(4); src/statscreen.o(.data); + . = ALIGN(4); src/chap_title_data.o(.data); + . = ALIGN(4); src/helpbox.o(.data); + . = ALIGN(4); src/player_interface.o(.data); + . = ALIGN(4); src/uichapterstatus.o(.data); + . = ALIGN(4); src/cgtext.o(.data); + . = ALIGN(4); data/data_A01CC4.o(.data); + . = ALIGN(4); data/data_chap_title.o(.data); + . = ALIGN(4); data/data_A167C8.o(.data); + . = ALIGN(4); src/unitlistscreen.o(.data); + . = ALIGN(4); src/prepscreen.o(.data); + . = ALIGN(4); src/prep_atmenu.o(.data); + . = ALIGN(4); src/prep_menuproc.o(.data); + . = ALIGN(4); src/prep_menuscroll.o(.data); + . = ALIGN(4); src/prep_sallycir.o(.data); + . = ALIGN(4); src/prep_utils.o(.data); + . = ALIGN(4); src/prep_itemscreen.o(.data); + . = ALIGN(4); src/prep_unitselect.o(.data); + . = ALIGN(4); src/prep_itemtrade.o(.data); + . = ALIGN(4); src/prep_itemuse.o(.data); + . = ALIGN(4); src/prep_itemusemind.o(.data); + . = ALIGN(4); src/prep_itemsupply.o(.data); + . = ALIGN(4); src/prep_itemlist.o(.data); + . = ALIGN(4); src/prep_wm_sell.o(.data); + . = ALIGN(4); src/prep_80A0760.o(.data); + . = ALIGN(4); src/uisupport.o(.data); + . = ALIGN(4); data/data_A195B0.o(.data); + . = ALIGN(4); data/data_map_change.o(.data); + . = ALIGN(4); src/bmsave-lib.o(.data); + . = ALIGN(4); src/bmsave-multiarena.o(.data); + . = ALIGN(4); src/bmsave-xmap.o(.data); + . = ALIGN(4); data/data_A1FAF4.o(.data); + . = ALIGN(4); src/minimap.o(.data); + . = ALIGN(4); data/data_minimap.o(.data); + . = ALIGN(4); src/savemenu.o(.data); + . = ALIGN(4); src/savedraw.o(.data); + . = ALIGN(4); src/savemenu_data.o(.data); + . = ALIGN(4); src/difficultymenu.o(.data); + . = ALIGN(4); src/cursor_hand.o(.data); + . = ALIGN(4); src/spinning_arrow.o(.data); + . = ALIGN(4); src/sysutil.o(.data); + . = ALIGN(4); src/sysutil-bmbgfx.o(.data); + . = ALIGN(4); src/code_80AE86C.o(.data); + . = ALIGN(4); src/soundroom_data.o(.data); + . = ALIGN(4); src/soundroom.o(.data); + . = ALIGN(4); src/extramenu_unk.o(.data); + . = ALIGN(4); src/bonusclaim.o(.data); + . = ALIGN(4); data/data_A21658.o(.data); + . = ALIGN(4); src/uiconfig.o(.data); + . = ALIGN(4); src/colorfade.o(.data); + . = ALIGN(4); src/opinfo.o(.data); + . = ALIGN(4); src/classdisplayfont.o(.data); + . = ALIGN(4); data/data_A2EEF0.o(.data); + . = ALIGN(4); src/bmshop.o(.data); + . = ALIGN(4); src/uiarena.o(.data); + . = ALIGN(4); src/events_wm.o(.data); + . = ALIGN(4); src/gamerankings.o(.data); + . = ALIGN(4); src/cg.o(.data); + . = ALIGN(4); src/ending_details.o(.data); + . = ALIGN(4); src/worldmap_face.o(.data); + . = ALIGN(4); src/worldmap_main.o(.data); + . = ALIGN(4); src/worldmap_screen.o(.data); + . = ALIGN(4); src/worldmap_gmapunit.o(.data); + . = ALIGN(4); src/worldmap_screen2.o(.data); + . = ALIGN(4); src/worldmap_cursor.o(.data); + . = ALIGN(4); src/worldmap_path.o(.data); + . = ALIGN(4); src/worldmap_mapmu.o(.data); + . = ALIGN(4); src/worldmap_player_interface.o(.data); + . = ALIGN(4); src/worldmap_scrollmanage.o(.data); + . = ALIGN(4); src/worldmap_palette_fade.o(.data); + . = ALIGN(4); src/worldmap_entry.o(.data); + . = ALIGN(4); src/worldmap_line_fade.o(.data); + . = ALIGN(4); src/worldmap_tm_confront.o(.data); + . = ALIGN(4); src/worldmap_status_ui.o(.data); + . = ALIGN(4); src/worldmap_effect.o(.data); + . = ALIGN(4); src/worldmap_sogu.o(.data); + . = ALIGN(4); src/worldmap_timemons.o(.data); + . = ALIGN(4); src/worldmap_rm.o(.data); + . = ALIGN(4); src/worldmap_automu.o(.data); + . = ALIGN(4); src/worldmap_text.o(.data); + . = ALIGN(4); src/worldmap_radar.o(.data); + . = ALIGN(4); src/worldmap_basemenu.o(.data); + . = ALIGN(4); data/data_A3E4D4.o(.data); + . = ALIGN(4); src/ending_credits.o(.data); + . = ALIGN(4); src/opsubtitle.o(.data); + . = ALIGN(4); data/data_opsubtitle.o(.data); + . = ALIGN(4); src/titlescreen.o(.data); + . = ALIGN(4); src/opanimfx.o(.data); + . = ALIGN(4); src/opanim-main.o(.data); + . = ALIGN(4); data/data_AA6BFA.o(.data); + . = ALIGN(4); data/opanim.o(.data); + . = ALIGN(4); src/opanim-healthsafetyscreen.o(.data); + . = ALIGN(4); data/data_AA7760.o(.data); + . = ALIGN(4); data/data_opanim_gfx.o(.data); + . = ALIGN(4); src/classchg-main.o(.data); + . = ALIGN(4); src/classchg-handler.o(.data); + . = ALIGN(4); src/classchg-sel.o(.data); + . = ALIGN(4); src/classchg-event.o(.data); + . = ALIGN(4); src/classchg-menuconfirm.o(.data); + . = ALIGN(4); src/classchg-menuselect.o(.data); + . = ALIGN(4); src/classchg-postconfirm.o(.data); + . = ALIGN(4); src/bmguide.o(.data); + . = ALIGN(4); data/data_B12A60.o(.data); + . = ALIGN(4); *libc.a:impure.o(.data); + . = ALIGN(4); *libc.a:locale.o(.data); + . = ALIGN(4); *libc.a:mallocr.o(.data); + . = ALIGN(4); data/data_B1FE7C.o(.data); + FILL(0xFF); + . = 0xC00000; src/banim_data.o(.data.banim_array_len); + . = 0xC00008; src/banim_data.o(.data.banim_array); + FILL(0x00); /* TODO: This padding is handled by banim linking process itself? */ + . = 0xC02000; data/banim/data_banim.o(.data); + FILL(0xFF); + . = 0xEE0000; src/banim_terrain_data.o(.data.banim_terrain_head); src/banim_terrain_data.o(.data.banim_terrain_ptr_table); + FILL(0x00); + . = 0xEE0C00; data/data_banim_terrain.o(.data); + FILL(0xFF); + _banim_pal_start = 0xEF8000; + . = _banim_pal_start; + src/banim_pal_chara.o(.data.banim_pal_head); + src/banim_pal_chara.o(.data.banim_pal_ptr_table); + FILL(0x00); + . = _banim_pal_start + 0x1000; data/data_banim_pal.o(.data); + _banim_pal_end = .; + _banim_pal_size = . - _banim_pal_start; + FILL(0xFF); + . = 0xFE0000; data/data_FE0000.o(.data); + . = 0xFFF000; data/data_FFF000.o(.data); + } = 0 + + /* Stabs debugging sections. */ + .stab 0 : { *(.stab) } + .stabstr 0 : { *(.stabstr) } + .stab.excl 0 : { *(.stab.excl) } + .stab.exclstr 0 : { *(.stab.exclstr) } + .stab.index 0 : { *(.stab.index) } + .stab.indexstr 0 : { *(.stab.indexstr) } + .comment 0 : { *(.comment) } + .gnu.build.attributes : { *(.gnu.build.attributes .gnu.build.attributes.*) } + /* DWARF debug sections. + Symbols in the DWARF debugging sections are relative to the beginning + of the section so we begin them at 0. */ + /* DWARF 1 */ + .debug 0 : { *(.debug) } + .line 0 : { *(.line) } + /* GNU DWARF 1 extensions */ + .debug_srcinfo 0 : { *(.debug_srcinfo) } + .debug_sfnames 0 : { *(.debug_sfnames) } + /* DWARF 1.1 and DWARF 2 */ + .debug_aranges 0 : { *(.debug_aranges) } + .debug_pubnames 0 : { *(.debug_pubnames) } + /* DWARF 2 */ + .debug_info 0 : { *(.debug_info .gnu.linkonce.wi.*) } + .debug_abbrev 0 : { *(.debug_abbrev) } + .debug_line 0 : { *(.debug_line .debug_line.* .debug_line_end) } + .debug_frame 0 : { *(.debug_frame) } + .debug_str 0 : { *(.debug_str) } + .debug_loc 0 : { *(.debug_loc) } + .debug_macinfo 0 : { *(.debug_macinfo) } + /* SGI/MIPS DWARF 2 extensions */ + .debug_weaknames 0 : { *(.debug_weaknames) } + .debug_funcnames 0 : { *(.debug_funcnames) } + .debug_typenames 0 : { *(.debug_typenames) } + .debug_varnames 0 : { *(.debug_varnames) } + /* DWARF 3 */ + .debug_pubtypes 0 : { *(.debug_pubtypes) } + .debug_ranges 0 : { *(.debug_ranges) } + /* DWARF Extension. */ + .debug_macro 0 : { *(.debug_macro) } + .debug_addr 0 : { *(.debug_addr) } + .ARM.attributes 0 : { KEEP (*(.ARM.attributes)) KEEP (*(.gnu.attributes)) } + .note.gnu.arm.ident 0 : { KEEP (*(.note.gnu.arm.ident)) } + + /* Discard everything not specifically mentioned above. */ + /DISCARD/ : + { + *(*); + } +} diff --git a/scripts/arm_compressing_linker.py b/scripts/arm_compressing_linker.py index 89d425f7..e0667f0b 100755 --- a/scripts/arm_compressing_linker.py +++ b/scripts/arm_compressing_linker.py @@ -40,7 +40,10 @@ def parse_linker_script(filename): obj_list.append((obj, sec, comp)) return obj_list -def convert_binary_to_object(filename, objcopy, with_label, is_debug): +def convert_binary_to_object(filename, objcopy, with_label, is_debug, build_dir): + build_filename = filename + if build_dir != '' and not filename.startswith(build_dir): + build_filename = build_dir + '/' + filename if with_label: label = os.path.basename(filename).split(".") # omit extension name .4bpp @@ -49,14 +52,14 @@ def convert_binary_to_object(filename, objcopy, with_label, is_debug): else: label = label[0] + '_' + label[1] cmd = '%s -I binary -O elf32-littlearm -B armv4t -S --add-symbol %s=.data:0 %s %s.o' \ - % (objcopy, label, filename, filename) + % (objcopy, label, filename, build_filename) else: cmd = '%s -I binary -O elf32-littlearm -B armv4t -S %s %s.o' \ - % (objcopy, filename, filename) + % (objcopy, filename, build_filename) if is_debug: print(cmd) os.system(cmd) - return filename + '.o' + return build_filename + '.o' def is_binary(filename): return os.path.splitext(filename)[-1] not in ('.o', '.obj', '.elf') @@ -104,7 +107,7 @@ def extract_symbol_file(filename, objcopy, is_debug): def change_outputfile_type(outputfile, objcopy, is_debug): cmd = 'mv %s %s' % (convert_binary_to_object( dump_binary_from_object(outputfile, '', objcopy, is_debug), - objcopy, False, is_debug), outputfile) + objcopy, False, is_debug, ''), outputfile) if is_debug: print(cmd) os.system(cmd) @@ -139,25 +142,25 @@ def remove_section_in_object(filename, section, objcopy, is_debug): os.system(cmd) def process_first_object(filename, section, objcopy, comptype, compressor, - is_debug): + is_debug, build_dir): if is_binary(filename): if comptype is not None: filename = compress_binary(filename, comptype, compressor, is_debug) - filename = convert_binary_to_object(filename, objcopy, True, is_debug) + filename = convert_binary_to_object(filename, objcopy, True, is_debug, build_dir) else: if comptype is not None: filename = dump_binary_from_object(filename, section, objcopy, is_debug) filename = compress_binary(filename, comptype, compressor, is_debug) - filename = convert_binary_to_object(filename, objcopy, True, is_debug) + filename = convert_binary_to_object(filename, objcopy, True, is_debug, '') return filename def process_input_object(filename, outputfile, section, base_addr, ld, objcopy, - comptype, compressor, is_debug): + comptype, compressor, is_debug, build_dir): if is_binary(filename): if comptype is not None: filename = compress_binary(filename, comptype, compressor, is_debug) - filename = convert_binary_to_object(filename, objcopy, True, is_debug) + filename = convert_binary_to_object(filename, objcopy, True, is_debug, build_dir) else: if comptype is not None: cmd = 'cp %s %s.bak.o' % (outputfile, outputfile) @@ -179,11 +182,17 @@ def process_input_object(filename, outputfile, section, base_addr, ld, objcopy, print(cmd) os.system(cmd) filename = compress_binary(filename, comptype, compressor, is_debug) - filename = convert_binary_to_object(filename, objcopy, True, is_debug) + filename = convert_binary_to_object(filename, objcopy, True, is_debug, '') return filename +def get_build_filename(filename, build_dir): + if build_dir != '' and filename.startswith('data/banim/'): + return build_dir + '/' + filename + else: + return filename + def link_objects(obj_list, outputfile, base_addr, - ld, objcopy, compressor, is_debug): + ld, objcopy, compressor, is_debug, build_dir): # os.mkdir('link_temp') # os.chdir('link_temp') # handle the first object @@ -192,21 +201,23 @@ def link_objects(obj_list, outputfile, base_addr, comptype = obj_list[0][2] section = obj_list[0][1] print('Compressing linking (1/%d): %s' % (total_number, filename)) + filename = get_build_filename(filename, build_dir) filename = process_first_object(filename, section, objcopy, - comptype, compressor, is_debug) + comptype, compressor, is_debug, build_dir) link_first_object(outputfile, filename, base_addr, ld, is_debug) extract_symbol_file(outputfile, objcopy, is_debug) change_outputfile_type(outputfile, objcopy, is_debug) # link other objects for i, obj in enumerate(obj_list[1:]): - print('Compressing linking (%d/%d): %s' - % (i + 2, total_number, filename)) filename = obj[0] comptype = obj[2] section = obj[1] + print('Compressing linking (%d/%d): %s' + % (i + 2, total_number, filename)) + filename = get_build_filename(filename, build_dir) filename = process_input_object(filename, outputfile, section, base_addr, ld, objcopy, - comptype, compressor, is_debug) + comptype, compressor, is_debug, build_dir) link_to_output(outputfile, filename, section, base_addr, ld, True, is_debug) extract_symbol_file(outputfile, objcopy, is_debug) @@ -224,6 +235,7 @@ def main(argv): objcopy = '' compressor = '' linker_script = 'linker_script.txt' + build_dir = '' base_addr = 0 is_debug = False is_dependency = False @@ -231,7 +243,7 @@ def main(argv): opts, args = getopt.getopt(argv, "ho:l:c:t:b:dm", ["help", "output=", "script=", "base=", "ld=", "objcopy=", "compressor=", "debug", - "dependency"]) + "dependency", "build-dir="]) except getopt.GetoptError: print('Error: wrong option. Use -h for help information.') sys.exit(1) @@ -256,6 +268,7 @@ def main(argv): print('\t-d, --debug\tEnable debug infomation output.\n') print('\t-m, --dependency\tOutput dependency from linker script \ for makefile.\n') + print('\t--build-dir