summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorcgsfv <cgsfv@users.noreply.github.com>2019-03-19 16:43:47 +0100
committercgsfv <cgsfv@users.noreply.github.com>2019-03-19 16:43:47 +0100
commit1e7df67a9cf7e98bcc0750a566796b3a2a51c61f (patch)
tree90d4b039e23b9ff24b0e428cbb47b011673b79b4 /scripts
parent0f8c780d82b2ec3eda351229e79953bbde7bb95a (diff)
Added .map + .lst + .rtl extra output files
Diffstat (limited to 'scripts')
-rw-r--r--scripts/standalone.mk22
1 files changed, 10 insertions, 12 deletions
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)