summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNathaniel Graff <nathaniel.graff@sifive.com>2019-03-14 13:55:43 -0700
committerNathaniel Graff <nathaniel.graff@sifive.com>2019-03-14 16:24:59 -0700
commitdb199c80c3b3b2cfaf6bc86fcf98987e47985c03 (patch)
tree1ca286c3c616e47fc93bf10afeef51a23a102c76
parent72efc798890672897fd54332d29afb0956a1c73e (diff)
Use TARGET_TAGS in Makefile
Signed-off-by: Nathaniel Graff <nathaniel.graff@sifive.com>
-rw-r--r--Makefile15
-rw-r--r--scripts/standalone.mk14
2 files changed, 15 insertions, 14 deletions
diff --git a/Makefile b/Makefile
index 7f3eafb..1769d44 100644
--- a/Makefile
+++ b/Makefile
@@ -131,13 +131,14 @@ include scripts/libmetal.mk
ifeq ($(STANDALONE_DEST),)
standalone:
$(error Please provide STANDALONE_DEST to create a standalone project)
-else
+else # STANDALONE_DEST != ""
$(STANDALONE_DEST):
$(STANDALONE_DEST)/%:
mkdir -p $@
-ifneq ($(COREIP_MEM_WIDTH),)
+ifneq ($(filter rtl,$(TARGET_TAGS)),)
+# TARGETs with the "rtl" TARGET_TAG need elf2hex in their standalone project
standalone: \
$(STANDALONE_DEST) \
$(STANDALONE_DEST)/bsp \
@@ -169,7 +170,7 @@ standalone: \
echo "PROGRAM = $(PROGRAM)" > $</Makefile
cat scripts/standalone.mk >> $</Makefile
cat scripts/libmetal.mk >> $</Makefile
-else
+else # "rtl" not in TARGET_TAGS
standalone: \
$(STANDALONE_DEST) \
$(STANDALONE_DEST)/bsp \
@@ -195,9 +196,9 @@ standalone: \
echo "PROGRAM = $(PROGRAM)" > $</Makefile
cat scripts/standalone.mk >> $</Makefile
cat scripts/libmetal.mk >> $</Makefile
-endif
+endif # rtl in TARGET_TAGS
-endif
+endif # STANDALONE_DEST
#############################################################
# Upload and Debug
@@ -210,7 +211,7 @@ else
RISCV_OPENOCD=openocd
endif
-ifneq ($(SEGGER_JLINK_OB),)
+ifneq ($(filter jlink,$(TARGET_TAGS)),)
upload: $(PROGRAM_HEX)
scripts/upload --hex $(PROGRAM_HEX) --jlink $(SEGGER_JLINK_EXE)
else
@@ -218,7 +219,7 @@ upload: $(PROGRAM_ELF)
scripts/upload --elf $(PROGRAM_ELF) --openocd $(RISCV_OPENOCD) --gdb $(RISCV_GDB) --openocd-config bsp/$(TARGET)/openocd.cfg
endif
-ifneq ($(SEGGER_JLINK_OB),)
+ifneq ($(filter jlink,$(TARGET_TAGS)),)
debug: $(PROGRAM_ELF)
scripts/debug --elf $(PROGRAM_ELF) --jlink $(SEGGER_JLINK_GDB_SERVER) --gdb $(RISCV_GDB)
else
diff --git a/scripts/standalone.mk b/scripts/standalone.mk
index c9da448..fd7486b 100644
--- a/scripts/standalone.mk
+++ b/scripts/standalone.mk
@@ -121,10 +121,7 @@ all: software
.PHONY: software
software: $(PROGRAM_ELF)
-ifneq ($(COREIP_MEM_WIDTH),)
-software: $(PROGRAM_HEX)
-endif
-ifneq ($(SEGGER_JLINK_OB),)
+ifneq ($(filter jlink rtl,$(TARGET_TAGS)),)
software: $(PROGRAM_HEX)
endif
@@ -149,14 +146,17 @@ $(PROGRAM_ELF): \
$(RISCV_SIZE) $@
-ifneq ($(SEGGER_JLINK_OB),)
# If we're using Segger J-Link OB, use objcopy to create an Intel hex file for programming
+ifneq ($(filter jlink,$(TARGET_TAGS)),)
$(PROGRAM_HEX): \
$(RISCV_OBJCOPY) \
$(PROGRAM_ELF)
$< -O ihex $(PROGRAM_ELF) $@
-else
-# Use elf2hex if we're not using Segger J-Link OB (i.e. for coreip-rtl targets)
+endif
+
+# Use elf2hex if we're creating a hex file for RTL simulation
+ifneq ($(filter rtl,$(TARGET_TAGS)),)
+.PHONY: software
$(PROGRAM_HEX): \
scripts/elf2hex/install/bin/$(CROSS_COMPILE)-elf2hex \
$(PROGRAM_ELF)