From 1e7df67a9cf7e98bcc0750a566796b3a2a51c61f Mon Sep 17 00:00:00 2001 From: cgsfv Date: Tue, 19 Mar 2019 16:43:47 +0100 Subject: Added .map + .lst + .rtl extra output files --- Makefile | 2 ++ scripts/standalone.mk | 22 ++++++++++------------ 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/Makefile b/Makefile index 7eb7229..d573825 100644 --- a/Makefile +++ b/Makefile @@ -27,6 +27,8 @@ SRC_DIR = $(PROGRAM_ROOT)/software/$(PROGRAM) PROGRAM_ELF = $(SRC_DIR)/$(CONFIGURATION)/$(PROGRAM).elf PROGRAM_HEX = $(SRC_DIR)/$(CONFIGURATION)/$(PROGRAM).hex +PROGRAM_LST = $(SRC_DIR)/$(CONFIGURATION)/$(PROGRAM).lst +PROGRAM_RTL = $(SRC_DIR)/$(CONFIGURATION)/$(PROGRAM).rtl ############################################################# # BSP Loading diff --git a/scripts/standalone.mk b/scripts/standalone.mk index 06063b9..cb8ffdb 100644 --- a/scripts/standalone.mk +++ b/scripts/standalone.mk @@ -97,6 +97,8 @@ RISCV_CXXFLAGS += -I$(abspath $(BSP_DIR)/install/include/) # Turn on garbage collection for unused sections RISCV_LDFLAGS += -Wl,--gc-sections +# Turn on linker map file generation +RISCV_LDFLAGS += -Wl,-Map,$(PROGRAM).map # Turn off the C standard library RISCV_LDFLAGS += -nostartfiles -nostdlib # Find the archive files and linker scripts @@ -118,6 +120,8 @@ include $(CONFIGURATION).mk PROGRAM_ELF ?= $(SRC_DIR)/$(CONFIGURATION)/$(PROGRAM).elf PROGRAM_HEX ?= $(SRC_DIR)/$(CONFIGURATION)/$(PROGRAM).hex +PROGRAM_LST ?= $(SRC_DIR)/$(CONFIGURATION)/$(PROGRAM).lst +PROGRAM_RTL ?= $(SRC_DIR)/$(CONFIGURATION)/$(PROGRAM).rtl .PHONY: all all: software @@ -125,8 +129,8 @@ all: software .PHONY: software software: $(PROGRAM_ELF) -ifneq ($(filter jlink rtl,$(TARGET_TAGS)),) -software: $(PROGRAM_HEX) +ifneq ($(filter rtl,$(TARGET_TAGS)),) +software: $(PROGRAM_RTL) endif PROGRAM_SRCS = $(wildcard $(SRC_DIR)/*.c) $(wildcard $(SRC_DIR)/*.h) $(wildcard $(SRC_DIR)/*.S) @@ -145,23 +149,17 @@ $(PROGRAM_ELF): \ CXXFLAGS="$(RISCV_CXXFLAGS)" \ LDFLAGS="$(RISCV_LDFLAGS)" \ LDLIBS="$(RISCV_LDLIBS)" + mv $(SRC_DIR)/$(basename $(notdir $@)).map $(dir $@) mv $(SRC_DIR)/$(basename $(notdir $@)) $@ touch -c $@ - + $(RISCV_OBJCOPY) -O ihex $(PROGRAM_ELF) $(PROGRAM_HEX) + $(RISCV_OBJDUMP) --source --all-headers --demangle --line-numbers --wide $@ > $(PROGRAM_LST) $(RISCV_SIZE) $@ -# 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) $@ -endif - # Use elf2hex if we're creating a hex file for RTL simulation ifneq ($(filter rtl,$(TARGET_TAGS)),) .PHONY: software -$(PROGRAM_HEX): \ +$(PROGRAM_RTL): \ scripts/elf2hex/install/bin/$(CROSS_COMPILE)-elf2hex \ $(PROGRAM_ELF) $< --output $@ --input $(PROGRAM_ELF) --bit-width $(COREIP_MEM_WIDTH) -- cgit v1.2.3