summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorNathaniel Graff <nathaniel.graff@sifive.com>2019-03-14 17:28:26 +0000
committerGitHub <noreply@github.com>2019-03-14 17:28:26 +0000
commit2983888c432211fe3eafa18fcf58c69f69473e9e (patch)
tree812f3c044fc8287b5c9fd490bfd641ed894fcdb3 /scripts
parentd4bbb7cef2fc15cdb6300ffb34a2c6935986459c (diff)
parent266a2118af56c0fb6f123a5622192b22e0ca8a57 (diff)
Merge pull request #205 from sifive/standalone-hex
Include elf2hex in Standalone Projects
Diffstat (limited to 'scripts')
-rw-r--r--scripts/standalone.mk27
1 files changed, 27 insertions, 0 deletions
diff --git a/scripts/standalone.mk b/scripts/standalone.mk
index 17fec17..c9da448 100644
--- a/scripts/standalone.mk
+++ b/scripts/standalone.mk
@@ -155,8 +155,15 @@ $(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)
+$(PROGRAM_HEX): \
+ scripts/elf2hex/install/bin/$(CROSS_COMPILE)-elf2hex \
+ $(PROGRAM_ELF)
+ $< --output $@ --input $(PROGRAM_ELF) --bit-width $(COREIP_MEM_WIDTH)
endif
+
.PHONY: clean-software
clean-software:
$(MAKE) -C $(SRC_DIR) clean
@@ -164,3 +171,23 @@ clean-software:
.PHONY: clean
clean: clean-software
+#############################################################
+# elf2hex
+#############################################################
+scripts/elf2hex/build/Makefile: scripts/elf2hex/configure
+ @rm -rf $(dir $@)
+ @mkdir -p $(dir $@)
+ cd $(dir $@); \
+ $(abspath $<) \
+ --prefix=$(abspath $(dir $<))/install \
+ --target=$(CROSS_COMPILE)
+
+scripts/elf2hex/install/bin/$(CROSS_COMPILE)-elf2hex: scripts/elf2hex/build/Makefile
+ $(MAKE) -C $(dir $<) install
+ touch -c $@
+
+.PHONY: clean-elf2hex
+clean-elf2hex:
+ rm -rf scripts/elf2hex/build scripts/elf2hex/install
+clean: clean-elf2hex
+