common.mk: separate cflags and opt
This commit is contained in:
parent
912c67e2e6
commit
9fd4443c35
15
common.mk
15
common.mk
@ -1,12 +1,13 @@
|
|||||||
LIB ?= .
|
LIB ?= .
|
||||||
OPT ?= -Og
|
OPT ?= -Og
|
||||||
|
DEBUG ?= -g -gdwarf-4
|
||||||
|
|
||||||
AARCH = --isa=sh2 --big
|
AARCH = --isa=sh2 --big
|
||||||
AFLAGS = -g -gdwarf-4 --fatal-warnings
|
AFLAGS = --fatal-warnings
|
||||||
|
|
||||||
CARCH = -m2 -mb
|
CARCH = -m2 -mb
|
||||||
CFLAGS += -falign-functions=4 -ffunction-sections -fdata-sections -fshort-enums -ffreestanding -nostdlib
|
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
|
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
|
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
|
OBJCOPY = $(TARGET)objcopy
|
||||||
OBJDUMP = $(TARGET)objdump
|
OBJDUMP = $(TARGET)objdump
|
||||||
|
|
||||||
|
LIBGCC = $(shell $(CC) -print-file-name=libgcc.a)
|
||||||
|
|
||||||
define BUILD_BINARY_O
|
define BUILD_BINARY_O
|
||||||
$(OBJCOPY) \
|
$(OBJCOPY) \
|
||||||
-I binary -O elf32-sh -B sh2 \
|
-I binary -O elf32-sh -B sh2 \
|
||||||
@ -38,16 +41,16 @@ SYS_IP_OBJ += $(LIB)/sys_init.o
|
|||||||
SYS_IP_OBJ += $(LIB)/smpsys.o
|
SYS_IP_OBJ += $(LIB)/smpsys.o
|
||||||
|
|
||||||
%.o: %.s
|
%.o: %.s
|
||||||
$(AS) $(AFLAGS) $(AARCH) $< -o $@
|
$(AS) $(AARCH) $(AFLAGS) $(DEBUG) $< -o $@
|
||||||
|
|
||||||
%.o: %.S
|
%.o: %.S
|
||||||
$(CC) $(CFLAGS) $(CARCH) -c $< -o $@
|
$(CC) $(CARCH) $(CFLAGS) $(OPT) $(DEBUG) -c $< -o $@
|
||||||
|
|
||||||
%.o: %.c
|
%.o: %.c
|
||||||
$(CC) $(CFLAGS) $(CARCH) -c $< -o $@
|
$(CC) $(CARCH) $(CFLAGS) $(OPT) $(DEBUG) -c $< -o $@
|
||||||
|
|
||||||
%.o: %.cpp
|
%.o: %.cpp
|
||||||
$(CXX) $(CFLAGS) $(CXXFLAGS) $(CARCH) -c $< -o $@
|
$(CXX) $(CARCH) $(CFLAGS) $(CXXFLAGS) $(OPT) $(DEBUG) -c $< -o $@
|
||||||
|
|
||||||
%.elf:
|
%.elf:
|
||||||
$(LD) $(LDFLAGS) -T $(LIB)/sh2.lds $^ -o $@
|
$(LD) $(LDFLAGS) -T $(LIB)/sh2.lds $^ -o $@
|
||||||
|
2
scsp.h
2
scsp.h
@ -60,6 +60,8 @@ typedef struct scsp_slot {
|
|||||||
} scsp_slot;
|
} scsp_slot;
|
||||||
|
|
||||||
static_assert((sizeof (struct scsp_slot)) == 0x20);
|
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);
|
static_assert((offsetof (struct scsp_slot, MIXER)) == 0x14);
|
||||||
|
|
||||||
// Formal register names are poorly documented; these are as faithfully as
|
// Formal register names are poorly documented; these are as faithfully as
|
||||||
|
Loading…
x
Reference in New Issue
Block a user