-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
67 lines (52 loc) · 1.92 KB
/
Makefile
File metadata and controls
67 lines (52 loc) · 1.92 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
# Project Name
TARGET = Daisy_SPC
# Deployment mode switch:
# - internal_split : app in internal flash via DFU, QSPI assets emitted separately
# - boot_qspi : Daisy bootloader app linked for QSPI execution
DEPLOY_MODE ?= internal_split
# Bootloader mode must set APP_TYPE before including libDaisy core makefile.
ifeq ($(DEPLOY_MODE),boot_qspi)
APP_TYPE = BOOT_QSPI
endif
# Sources
CPP_SOURCES = Daisy_SPC.cpp \
lib/snes_spc/snes_spc/spc.cpp \
lib/snes_spc/snes_spc/SNES_SPC.cpp \
lib/snes_spc/snes_spc/SNES_SPC_misc.cpp \
lib/snes_spc/snes_spc/SNES_SPC_state.cpp \
lib/snes_spc/snes_spc/SPC_DSP.cpp \
lib/snes_spc/snes_spc/SPC_Filter.cpp \
lib/snes_spc/snes_spc/dsp.cpp
# Library Locations
LIBDAISY_DIR = ../../libDaisy/
DAISYSP_DIR = ../../DaisySP/
# Core location, and generic Makefile.
SYSTEM_FILES_DIR = $(LIBDAISY_DIR)/core
include $(SYSTEM_FILES_DIR)/Makefile
# Mode-specific outputs/programming behavior.
ifeq ($(DEPLOY_MODE),internal_split)
# core/Makefile sets TARGET_BIN to $(TARGET).bin; force DFU to app-only binary.
TARGET_BIN = $(TARGET)_APP.bin
# Split artifacts so DFU flashes only internal app sections.
APP_BIN = $(BUILD_DIR)/$(TARGET)_APP.bin
QSPI_BIN = $(BUILD_DIR)/$(TARGET)_QSPIFLASH.bin
$(APP_BIN): $(BUILD_DIR)/$(TARGET).elf | $(BUILD_DIR)
$(CP) -O binary -S \
--remove-section=.qspiflash_text \
--remove-section=.qspiflash_data \
--remove-section=.qspiflash_bss \
$< $@
$(QSPI_BIN): $(BUILD_DIR)/$(TARGET).elf | $(BUILD_DIR)
$(CP) -O binary -S \
--only-section=.qspiflash_text \
--only-section=.qspiflash_data \
$< $@
all: $(APP_BIN) $(QSPI_BIN)
split-bins: $(APP_BIN) $(QSPI_BIN)
else ifeq ($(DEPLOY_MODE),boot_qspi)
# In BOOT_QSPI mode, keep core defaults:
# - build/$(TARGET).bin
# - program-dfu flashes to bootloader QSPI address (0x90040000)
else
$(error Unsupported DEPLOY_MODE "$(DEPLOY_MODE)". Use DEPLOY_MODE=internal_split or DEPLOY_MODE=boot_qspi)
endif