From 9fd4443c3536ea3af9ab160b94dcfc0917331b9c Mon Sep 17 00:00:00 2001 From: Zack Buhman Date: Mon, 10 Jul 2023 15:35:20 -0700 Subject: [PATCH] common.mk: separate cflags and opt --- common.mk | 15 +++++++++------ scsp.h | 2 ++ 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/common.mk b/common.mk index f9e5c5b..84858e4 100644 --- a/common.mk +++ b/common.mk @@ -1,12 +1,13 @@ LIB ?= . OPT ?= -Og +DEBUG ?= -g -gdwarf-4 AARCH = --isa=sh2 --big -AFLAGS = -g -gdwarf-4 --fatal-warnings +AFLAGS = --fatal-warnings CARCH = -m2 -mb CFLAGS += -falign-functions=4 -ffunction-sections -fdata-sections -fshort-enums -ffreestanding -nostdlib -CFLAGS += -Wall -Werror -Wfatal-errors -Wno-error=unused-variable -g -gdwarf-4 $(OPT) +CFLAGS += -Wall -Werror -Wfatal-errors -Wno-error=unused-variable LDFLAGS = --gc-sections --print-gc-sections --no-warn-rwx-segment --print-memory-usage --entry=_start --orphan-handling=error CXXFLAGS = -std=c++20 -fno-exceptions -fno-non-call-exceptions -fno-rtti -fno-threadsafe-statics @@ -18,6 +19,8 @@ LD = $(TARGET)ld OBJCOPY = $(TARGET)objcopy OBJDUMP = $(TARGET)objdump +LIBGCC = $(shell $(CC) -print-file-name=libgcc.a) + define BUILD_BINARY_O $(OBJCOPY) \ -I binary -O elf32-sh -B sh2 \ @@ -38,16 +41,16 @@ SYS_IP_OBJ += $(LIB)/sys_init.o SYS_IP_OBJ += $(LIB)/smpsys.o %.o: %.s - $(AS) $(AFLAGS) $(AARCH) $< -o $@ + $(AS) $(AARCH) $(AFLAGS) $(DEBUG) $< -o $@ %.o: %.S - $(CC) $(CFLAGS) $(CARCH) -c $< -o $@ + $(CC) $(CARCH) $(CFLAGS) $(OPT) $(DEBUG) -c $< -o $@ %.o: %.c - $(CC) $(CFLAGS) $(CARCH) -c $< -o $@ + $(CC) $(CARCH) $(CFLAGS) $(OPT) $(DEBUG) -c $< -o $@ %.o: %.cpp - $(CXX) $(CFLAGS) $(CXXFLAGS) $(CARCH) -c $< -o $@ + $(CXX) $(CARCH) $(CFLAGS) $(CXXFLAGS) $(OPT) $(DEBUG) -c $< -o $@ %.elf: $(LD) $(LDFLAGS) -T $(LIB)/sh2.lds $^ -o $@ diff --git a/scsp.h b/scsp.h index fef6f4c..05d6e0d 100644 --- a/scsp.h +++ b/scsp.h @@ -60,6 +60,8 @@ typedef struct scsp_slot { } scsp_slot; static_assert((sizeof (struct scsp_slot)) == 0x20); +static_assert((offsetof (struct scsp_slot, EGU)) == 0x08); +static_assert((offsetof (struct scsp_slot, EGL)) == 0x0a); static_assert((offsetof (struct scsp_slot, MIXER)) == 0x14); // Formal register names are poorly documented; these are as faithfully as