Minor improvements to rename_sym.sh & Makefile

This commit is contained in:
David Benepe
2020-08-04 15:00:36 -05:00
parent 1ea984894c
commit fe1b14ba0a
10 changed files with 4229 additions and 4220 deletions
+17 -17
View File
@@ -1,4 +1,4 @@
# Makefile to rebuild DKR split image
# Makefile to build DKR
############################ Shell ###########################
@@ -17,7 +17,8 @@ GENERATE_LD := $(shell ./generate_ld.sh)
################ Target Executable and Sources ###############
# BUILD_DIR is location where all build artifacts are placed
BUILD_DIR = build
# TODO: Support other versions of DKR
BUILD_DIR = build/us_1.0
##################### Compiler Options #######################
@@ -189,10 +190,6 @@ $(BUILD_DIR)/lib/src/osTimer.o: OPT_FLAGS := -O1
$(BUILD_DIR)/lib/src/osViBlack.o: OPT_FLAGS := -O1
$(BUILD_DIR)/lib/src/osViSwapBuffer.o : OPT_FLAGS := -O1
######################## Targets #############################
default: all
@@ -204,20 +201,23 @@ all: $(BUILD_DIR)/$(TARGET).z64
clean:
ifneq ($(wildcard ./build/.*),)
rm -r $(BUILD_DIR)
rm -r build
else
@echo "/build/ directory has already been deleted."
endif
clean_lib:
ifneq ($(wildcard ./build/lib/.*),)
ifneq ($(wildcard $(BUILD_DIR)/lib/.*),)
rm -r $(BUILD_DIR)/lib/src/*.o
else
@echo "/build/lib directory has already been deleted."
@echo "build lib directory has already been deleted."
endif
$(BUILD_DIR):
mkdir $(BUILD_DIR) $(addprefix $(BUILD_DIR)/,$(LIB_DIRS) $(ASM_DIRS) $(SRC_DIRS) $(ASSETS_DIRS))
mkdir -p $(BUILD_DIR) $(addprefix $(BUILD_DIR)/,$(LIB_DIRS) $(ASM_DIRS) $(SRC_DIRS) $(ASSETS_DIRS))
# Helps fix an issue with parallel jobs.
$(ALL_ASSETS_BUILT): | $(BUILD_DIR)
# This is here to prevent make from deleting all the asset files after the build completes/fails.
dont_remove_asset_files: $(ALL_ASSETS_BUILT)
@@ -280,26 +280,26 @@ $(UCODE_OUT_DIR)/%.bin: $(UCODE_IN_DIR)/%.bin
###############################
$(BUILD_DIR)/%.o: %.s Makefile $(MAKEFILE_SPLIT) | $(BUILD_DIR) $(ALL_ASSETS_BUILT)
$(BUILD_DIR)/%.o: %.s | $(ALL_ASSETS_BUILT)
$(AS) $(ASFLAGS) -o $@ $<
$(BUILD_DIR)/%.o: %.c
$(BUILD_DIR)/%.o: %.c | $(ALL_ASSETS_BUILT)
$(CC) $(CFLAGS) -o $@ $<
$(BUILD_DIR)/$(LD_SCRIPT): $(LD_SCRIPT)
$(BUILD_DIR)/$(LD_SCRIPT): $(LD_SCRIPT) | $(ALL_ASSETS_BUILT)
$(CPP) $(VERSION_CFLAGS) -DBUILD_DIR=$(BUILD_DIR) -MMD -MP -MT $@ -MF $@.d -o $@ $<
$(BUILD_DIR)/$(TARGET).elf: $(O_FILES) $(BUILD_DIR)/$(LD_SCRIPT)
$(BUILD_DIR)/$(TARGET).elf: $(O_FILES) $(BUILD_DIR)/$(LD_SCRIPT) | $(ALL_ASSETS_BUILT)
$(LD) $(LDFLAGS) -o $@ $(O_FILES) $(LIBS)
$(BUILD_DIR)/$(TARGET).bin: $(BUILD_DIR)/$(TARGET).elf
$(BUILD_DIR)/$(TARGET).bin: $(BUILD_DIR)/$(TARGET).elf | $(ALL_ASSETS_BUILT)
$(OBJCOPY) $< $@ -O binary
# final z64 updates checksum
$(BUILD_DIR)/$(TARGET).z64: $(BUILD_DIR)/$(TARGET).bin
$(BUILD_DIR)/$(TARGET).z64: $(BUILD_DIR)/$(TARGET).bin | $(ALL_ASSETS_BUILT)
cp $< $@
$(N64CRC) $@
sha1sum -c $(TARGET).sha1
sha1sum -c sha1/dkr.us_1.0.sha1
$(BUILD_DIR)/$(TARGET).hex: $(BUILD_DIR)/$(TARGET).z64
xxd $< > $@
+4186 -4186
View File
File diff suppressed because it is too large Load Diff
+6 -6
View File
@@ -1,8 +1,8 @@
# This file was generated by generate_ld.py
.incbin "./build/ucode/ucode_unknown.0d8200.bin"
.incbin "./build/ucode/ucode_boot.0d90c0.bin"
.incbin "./build/ucode/ucode_f3ddkr_dram.0d9190.bin"
.incbin "./build/ucode/ucode_f3ddkr_fifo.0da390.bin"
.incbin "./build/ucode/ucode_f3ddkr_xbus.0db570.bin"
.incbin "./build/ucode/ucode_unknown.0dc770.bin"
.incbin "./build/us_1.0/ucode/ucode_unknown.0d8200.bin"
.incbin "./build/us_1.0/ucode/ucode_boot.0d90c0.bin"
.incbin "./build/us_1.0/ucode/ucode_f3ddkr_dram.0d9190.bin"
.incbin "./build/us_1.0/ucode/ucode_f3ddkr_fifo.0da390.bin"
.incbin "./build/us_1.0/ucode/ucode_f3ddkr_xbus.0db570.bin"
.incbin "./build/us_1.0/ucode/ucode_unknown.0dc770.bin"
+4 -1
View File
@@ -10,4 +10,7 @@ fi
#echo "Replace $1 with $2?"
#read
grep -rl "$1" asm/**/*.s src/**/*.{c,h} lib/**/*.{c,s} include/*.h data/dkr.data.s undefined_syms.txt | xargs sed -i "s/\b$1\b/$2/g"
grep -rl "$1" asm/**/*.s src/**/*.{c,h} lib/**/*.{c,s} include/*.h data/dkr.data.s undefined_syms.txt | xargs sed -i "s/\b$1\b/$2/g"
# This removes all the .o files that use the old name.
grep -rl "$1" build/**/*.o | rm
+1
View File
@@ -0,0 +1 @@
dd5d64dd140cb7aa28404fa35abdcaba33c29260 build/eu_1.0/dkr.z64
+1
View File
@@ -0,0 +1 @@
b7f628073237b3d211d40406aa0884ff8fdd70d5 build/eu_1.1/dkr.z64
+1
View File
@@ -0,0 +1 @@
23ba3d302025153d111416e751027cef11213a19 build/jp/dkr.z64
+1
View File
@@ -0,0 +1 @@
0cb115d8716dbbc2922fda38e533b9fe63bb9670 build/us_1.0/dkr.z64
+1
View File
@@ -0,0 +1 @@
6d96743d46f8c0cd0edb0ec5600b003c89b93755 build/us_1.1/dkr.z64
+11 -10
View File
@@ -14,6 +14,7 @@ ASSETS_S_FILENAME = './asm/assets/assets.s'
ASSETS_UCODE_S_FILENAME = './asm/assets/ucode.s'
ASSETS_DIR = './assets/us_1.0'
ASSETS_START = 0x0D8200
BUILD_DIR = 'build/us_1.0'
class LD:
def __init__(self, file):
@@ -61,8 +62,8 @@ class LD:
def gen_boot_section(self):
self.gen_line('.boot 0 : AT(romPos)')
self.gen_open_block()
self.gen_line('build/asm/boot/rom_header.o(.text);')
self.gen_line('build/asm/boot/rom_boot.o(.text);')
self.gen_line(BUILD_DIR + '/asm/boot/rom_header.o(.text);')
self.gen_line(BUILD_DIR + '/asm/boot/rom_boot.o(.text);')
self.gen_close_block()
self.gen_line('romPos += SIZEOF(.boot);')
self.gen_newline()
@@ -79,7 +80,7 @@ class LD:
def gen_ucode_section(self):
self.gen_line('.ucode 0 : AT(romPos)')
self.gen_open_block()
self.gen_line('build/asm/assets/ucode.o(.text);')
self.gen_line(BUILD_DIR + '/asm/assets/ucode.o(.text);')
self.gen_close_block()
self.gen_line('romPos += SIZEOF(.ucode);')
self.gen_newline()
@@ -87,7 +88,7 @@ class LD:
def gen_data_section(self):
self.gen_line('.main_data 0x80000400 : AT(romPos) SUBALIGN(16)')
self.gen_open_block()
self.gen_line('build/data/dkr.data.o(.data);')
self.gen_line(BUILD_DIR + '/data/dkr.data.o(.data);')
self.gen_close_block()
self.gen_line('romPos += SIZEOF(.main_data);')
self.gen_newline()
@@ -95,7 +96,7 @@ class LD:
def gen_assets_section(self):
self.gen_line('.assets 0 : AT(romPos)')
self.gen_open_block()
self.gen_line('build/asm/assets/assets.o(.text);')
self.gen_line(BUILD_DIR + '/asm/assets/assets.o(.text);')
self.gen_close_block()
self.gen_line('romPos += SIZEOF(.assets);')
self.gen_newline()
@@ -159,10 +160,10 @@ class LD:
def get_code_files(self):
files = []
self.append_files(files, ('.s',), ASM_DIR, 'build/asm/')
self.append_files(files, ('.c',), SRC_DIR, 'build/src/')
self.append_files(files, ('.s',), LIB_ASM_DIR, 'build/lib/asm/')
self.append_files(files, ('.c',), LIB_SRC_DIR, 'build/lib/src/')
self.append_files(files, ('.s',), ASM_DIR, BUILD_DIR + '/asm/')
self.append_files(files, ('.c',), SRC_DIR, BUILD_DIR + '/src/')
self.append_files(files, ('.s',), LIB_ASM_DIR, BUILD_DIR + '/lib/asm/')
self.append_files(files, ('.c',), LIB_SRC_DIR, BUILD_DIR + '/lib/src/')
files.sort(key = lambda x: (x[2], x[3])) # Sort tuples by RAM address and prioritize src files first.
return files
@@ -185,7 +186,7 @@ class LD:
outFileExtension = fileExtension
else:
outFileExtension = '.bin'
outFilename = 'build/' + matchedGroups[0] + '.' + matchedGroups[1] + outFileExtension
outFilename = BUILD_DIR + '/' + matchedGroups[0] + '.' + matchedGroups[1] + outFileExtension
if int(ramAddress, 16) >= ASSETS_START:
assetFiles.append((outFilename, ramAddress, fileExtension, isMicrocode))
assetFiles.sort(key = lambda x: x[1]) # Sort tuples by RAM address