From 5f515a20d4ab72e72527b304fe42feb5f96f1b1e Mon Sep 17 00:00:00 2001 From: Zack Buhman Date: Sun, 23 Jul 2023 06:23:05 +0000 Subject: [PATCH] move most sys_ files to ip directory --- common.mk | 28 ++++++++++++++-------------- ip/segasmp/.empty | 0 smpsys.c => ip/smpsys.c | 0 {area => ip}/sys_area.s | 0 {area => ip}/sys_areb.s | 0 {area => ip}/sys_aree.s | 0 {area => ip}/sys_arej.s | 0 {area => ip}/sys_arek.s | 0 {area => ip}/sys_arel.s | 0 {area => ip}/sys_aret.s | 0 {area => ip}/sys_areu.s | 0 sys_id.s => ip/sys_id.s | 0 {segasmp/lib => ip}/sys_init.s | 0 m68k/common.mk | 11 +++++++++++ 14 files changed, 25 insertions(+), 14 deletions(-) create mode 100644 ip/segasmp/.empty rename smpsys.c => ip/smpsys.c (100%) rename {area => ip}/sys_area.s (100%) rename {area => ip}/sys_areb.s (100%) rename {area => ip}/sys_aree.s (100%) rename {area => ip}/sys_arej.s (100%) rename {area => ip}/sys_arek.s (100%) rename {area => ip}/sys_arel.s (100%) rename {area => ip}/sys_aret.s (100%) rename {area => ip}/sys_areu.s (100%) rename sys_id.s => ip/sys_id.s (100%) rename {segasmp/lib => ip}/sys_init.s (100%) diff --git a/common.mk b/common.mk index 456e693..2c0ba56 100644 --- a/common.mk +++ b/common.mk @@ -40,7 +40,7 @@ endef %.o: %.cpp $(CXX) $(CARCH) $(CFLAGS) $(CXXFLAGS) $(OPT) $(DEBUG) -c $< -o $@ -%.elf: +%.elf: $(LIB)/start.o $(LD) $(LDFLAGS) -T $(LIB)/sh2.lds $^ -o $@ %.bin: %.elf @@ -52,20 +52,20 @@ endef --rename-section .data=.rodata,alloc,load,readonly,data,contents \ $< $@ -SYS_IP_OBJ += $(LIB)/sys_id.o -SYS_IP_OBJ += $(LIB)/sys_sec.o -SYS_IP_OBJ += $(LIB)/area/sys_area.o -SYS_IP_OBJ += $(LIB)/area/sys_areb.o -SYS_IP_OBJ += $(LIB)/area/sys_aree.o -SYS_IP_OBJ += $(LIB)/area/sys_arej.o -SYS_IP_OBJ += $(LIB)/area/sys_arek.o -SYS_IP_OBJ += $(LIB)/area/sys_arel.o -SYS_IP_OBJ += $(LIB)/area/sys_aret.o -SYS_IP_OBJ += $(LIB)/area/sys_areu.o -SYS_IP_OBJ += $(LIB)/sys_init.o -SYS_IP_OBJ += $(LIB)/smpsys.o +SYS_IP_OBJ += $(LIB)/ip/sys_id.o +SYS_IP_OBJ += $(LIB)/ip/segasmp/sys_sec.o +SYS_IP_OBJ += $(LIB)/ip/sys_area.o +SYS_IP_OBJ += $(LIB)/ip/sys_areb.o +SYS_IP_OBJ += $(LIB)/ip/sys_aree.o +SYS_IP_OBJ += $(LIB)/ip/sys_arej.o +SYS_IP_OBJ += $(LIB)/ip/sys_arek.o +SYS_IP_OBJ += $(LIB)/ip/sys_arel.o +SYS_IP_OBJ += $(LIB)/ip/sys_aret.o +SYS_IP_OBJ += $(LIB)/ip/sys_areu.o +SYS_IP_OBJ += $(LIB)/ip/sys_init.o +SYS_IP_OBJ += $(LIB)/ip/smpsys.o -$(LIB)/sys_%.o: $(LIB)/segasmp/lib/sys_%.o +$(LIB)/ip/segasmp/sys_%.o: $(LIB)/segasmp/lib/sys_%.o $(OBJCOPY) -I coff-sh -O elf32-sh -g \ --rename-section .text=.text.$* \ $< $@ diff --git a/ip/segasmp/.empty b/ip/segasmp/.empty new file mode 100644 index 0000000..e69de29 diff --git a/smpsys.c b/ip/smpsys.c similarity index 100% rename from smpsys.c rename to ip/smpsys.c diff --git a/area/sys_area.s b/ip/sys_area.s similarity index 100% rename from area/sys_area.s rename to ip/sys_area.s diff --git a/area/sys_areb.s b/ip/sys_areb.s similarity index 100% rename from area/sys_areb.s rename to ip/sys_areb.s diff --git a/area/sys_aree.s b/ip/sys_aree.s similarity index 100% rename from area/sys_aree.s rename to ip/sys_aree.s diff --git a/area/sys_arej.s b/ip/sys_arej.s similarity index 100% rename from area/sys_arej.s rename to ip/sys_arej.s diff --git a/area/sys_arek.s b/ip/sys_arek.s similarity index 100% rename from area/sys_arek.s rename to ip/sys_arek.s diff --git a/area/sys_arel.s b/ip/sys_arel.s similarity index 100% rename from area/sys_arel.s rename to ip/sys_arel.s diff --git a/area/sys_aret.s b/ip/sys_aret.s similarity index 100% rename from area/sys_aret.s rename to ip/sys_aret.s diff --git a/area/sys_areu.s b/ip/sys_areu.s similarity index 100% rename from area/sys_areu.s rename to ip/sys_areu.s diff --git a/sys_id.s b/ip/sys_id.s similarity index 100% rename from sys_id.s rename to ip/sys_id.s diff --git a/segasmp/lib/sys_init.s b/ip/sys_init.s similarity index 100% rename from segasmp/lib/sys_init.s rename to ip/sys_init.s diff --git a/m68k/common.mk b/m68k/common.mk index 9f83b7e..8f04531 100644 --- a/m68k/common.mk +++ b/m68k/common.mk @@ -27,6 +27,17 @@ define BUILD_BINARY_O $< $@ endef +as_obj_binary = _binary_$(subst /,_,$(subst .,_,$(basename $(1)))) + +define BUILD_BINARY_H + @echo $@ + @echo '#pragma once' > $@ + @echo '#include ' >> $@ + @echo 'extern uint32_t $(call as_obj_binary,$@)_start __asm("$(call as_obj_binary,$@)_start");' >> $@ + @echo 'extern uint32_t $(call as_obj_binary,$@)_end __asm("$(call as_obj_binary,$@)_end");' >> $@ + @echo 'extern uint32_t $(call as_obj_binary,$@)_size __asm("$(call as_obj_binary,$@)_size");' >> $@ +endef + all: main.bin %.o: %.s