summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorNathaniel Graff <nathaniel.graff@sifive.com>2019-03-06 13:08:22 -0800
committerNathaniel Graff <nathaniel.graff@sifive.com>2019-03-06 13:39:36 -0800
commit6aab6996dbd890c5788bf4e330454a3490268174 (patch)
tree83596e3e6ed4d1fa832f6771cdee2ee35c070b95 /Makefile
parentcc49f2721ad0c59ce829b4547644345e7a399068 (diff)
Add support for Segger J-Link
Signed-off-by: Nathaniel Graff <nathaniel.graff@sifive.com>
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile21
1 files changed, 16 insertions, 5 deletions
diff --git a/Makefile b/Makefile
index 20a4a5d..4afdacf 100644
--- a/Makefile
+++ b/Makefile
@@ -216,20 +216,21 @@ endif
endif
#############################################################
-# MEE Software Compilation
+# CoreIP RTL Simulation Hex File Creation
#############################################################
-# Generation of $(PROGRAM_ELF) is handled by scripts/standalone.mk
-# In this top level Makefile, just describe how to turn the elf into
-# $(PROGRAM_HEX)
-
ifeq ($(BSP),metal)
+
+# Use elf2hex if we're not using Segger J-Link OB (i.e. for coreip-rtl targets)
+ifeq ($(SEGGER_JLINK_OB),)
$(PROGRAM_HEX): \
scripts/elf2hex/install/bin/$(CROSS_COMPILE)-elf2hex \
$(PROGRAM_ELF)
$< --output $@ --input $(PROGRAM_ELF) --bit-width $(COREIP_MEM_WIDTH)
endif
+endif
+
#############################################################
# Legacy Software Compilation
#############################################################
@@ -263,11 +264,21 @@ endif
ifeq ($(BSP),metal)
+ifneq ($(SEGGER_JLINK_OB),)
+upload: $(PROGRAM_HEX)
+ scripts/upload --hex $(PROGRAM_HEX) --jlink $(SEGGER_JLINK_EXE)
+else
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),)
+debug: $(PROGRAM_ELF)
+ scripts/debug --elf $(PROGRAM_ELF) --jlink $(SEGGER_JLINK_GDB_SERVER) --gdb $(RISCV_GDB)
+else
debug: $(PROGRAM_ELF)
scripts/debug --elf $(PROGRAM_ELF) --openocd $(RISCV_OPENOCD) --gdb $(RISCV_GDB) --openocd-config bsp/$(TARGET)/openocd.cfg
+endif
else # BSP != metal