From 2077ff04a25b4393d9b88cd0ee69db3f8eb40276 Mon Sep 17 00:00:00 2001 From: Palmer Dabbelt Date: Thu, 13 Dec 2018 18:45:09 -0800 Subject: Add support for generating coreip hex files via elf2hex This just calls elf2hex on the compiled elf files, producing a hex file that can be fed into RTL simulation. Signed-off-by: Palmer Dabbelt --- Makefile | 32 +++++++++++++++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index ec363a9..7900baa 100644 --- a/Makefile +++ b/Makefile @@ -191,17 +191,42 @@ endif mee_install: mee $(MAKE) -C $(MEE_SOURCE_PATH) install +############################################################# +# This Section is for elf2hex Compliation +############################################################# +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 + ############################################################# # This Section is for Software Compilation ############################################################# PROGRAM_ELF = software/$(PROGRAM)/$(PROGRAM) +PROGRAM_HEX = software/$(PROGRAM)/$(PROGRAM).hex ifeq ($(BSP),mee) .PHONY: software software: $(PROGRAM_ELF) +ifneq ($(COREIP_MEM_WIDTH),) +software: $(PROGRAM_HEX) +endif + $(PROGRAM_ELF): \ - $(shell find $(abspath $(dir $(PROGRAM_ELF))) -type f) \ + $(addprefix software/$(PROGRAM)/,$(shell git -C software/$(PROGRAM) ls-files)) \ $(MEE_BSP_PATH)/install/lib/libmee.a \ $(MEE_BSP_PATH)/install/lib/libmee-gloss.a \ $(MEE_BSP_PATH)/mee.lds @@ -214,6 +239,11 @@ $(PROGRAM_ELF): \ LDLIBS="-Wl,--start-group -lc -lmee -lmee-gloss -Wl,--end-group" touch -c $@ +$(PROGRAM_HEX): \ + scripts/elf2hex/install/bin/$(CROSS_COMPILE)-elf2hex \ + $(PROGRAM_ELF) + $< --output $@ --input $(PROGRAM_ELF) --bit-width $(COREIP_MEM_WIDTH) + .PHONY: clean-software clean-software: $(MAKE) -C $(dir $(PROGRAM_ELF)) clean -- cgit v1.2.1-18-gbd029