summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBunnaroath Sou <bsou@sifive.com>2019-03-18 12:49:20 -0700
committerBunnaroath Sou <bsou@sifive.com>2019-03-18 12:49:20 -0700
commit6695a994b01585ae3dce0e492de3c4e3feb2ae4f (patch)
tree27c338467535c69d5d1c418314d1d607838b1698
parent30c143eb5445f47edb351ba54c84ff8285dc27a9 (diff)
Add link target options to tools and env
-rwxr-xr-xbsp/update-targets.sh8
-rw-r--r--scripts/libmetal.mk2
-rw-r--r--scripts/standalone.mk6
3 files changed, 12 insertions, 4 deletions
diff --git a/bsp/update-targets.sh b/bsp/update-targets.sh
index 8657883..c4c90cb 100755
--- a/bsp/update-targets.sh
+++ b/bsp/update-targets.sh
@@ -61,7 +61,9 @@ LDSCRIPT_GENERATOR=freedom-ldscript-generator
DTS_FILENAME=design.dts
DTB_FILENAME=temp.dtb
HEADER_FILENAME=metal.h
-LDSCRIPT_FILENAME=metal.lds
+LDS_DEFAULT_FILENAME=metal.default.lds
+LDS_RAMRODATA_FILENAME=metal.ramrodata.lds
+LDS_SCRATCHPAD_FILENAME=metal.scratchpad.lds
update_target() {
TARGET=$1
@@ -73,7 +75,9 @@ update_target() {
# Produce parameterized files
$MEE_HEADER_GENERATOR -d $TARGET/$DTB_FILENAME -o $TARGET/$HEADER_FILENAME || die "Failed to produce $TARGET/$HEADER_FILENAME"
- $LDSCRIPT_GENERATOR -d $TARGET/$DTB_FILENAME -l $TARGET/$LDSCRIPT_FILENAME || die "Failed to produce $TARGET/$LDSCRIPT_FILENAME"
+ $LDSCRIPT_GENERATOR -d $TARGET/$DTB_FILENAME -l $TARGET/$LDS_DEFAULT_FILENAME || die "Failed to produce $TARGET/$LDS_DEFAULT_FILENAME"
+ $LDSCRIPT_GENERATOR -d $TARGET/$DTB_FILENAME -l $TARGET/$LDS_RAMRODATA_FILENAME --ramrodata || die "Failed to produce $TARGET/$LDS_RAMRODATA_FILENAME"
+ $LDSCRIPT_GENERATOR -d $TARGET/$DTB_FILENAME -l $TARGET/$LDS_SCRATCHPAD_FILENAME --scratchpad || die "Failed to produce $TARGET/$LDS_SCRATCHPAD_FILENAME"
# Remove temporary .dtb
rm $TARGET/$DTB_FILENAME
diff --git a/scripts/libmetal.mk b/scripts/libmetal.mk
index b50c599..c45972a 100644
--- a/scripts/libmetal.mk
+++ b/scripts/libmetal.mk
@@ -3,7 +3,7 @@
# Compiles an instance of Metal targeted at $(TARGET)
#############################################################
METAL_SOURCE_PATH ?= freedom-metal
-METAL_LDSCRIPT = $(BSP_DIR)/metal.lds
+METAL_LDSCRIPT = $(BSP_DIR)/metal.$(LINK_TARGET).lds
METAL_HEADER = $(BSP_DIR)/metal.h
METAL_PREFIX = $(abspath $(BSP_DIR)/install)
diff --git a/scripts/standalone.mk b/scripts/standalone.mk
index fd7486b..06063b9 100644
--- a/scripts/standalone.mk
+++ b/scripts/standalone.mk
@@ -37,6 +37,10 @@ ifeq ($(RISCV_CMODEL),)
RISCV_CMODEL = medany
endif
+ifeq ($(LINK_TARGET),)
+LINK_TARGET = default
+endif
+
# Determines the XLEN from the toolchain tuple
ifeq ($(patsubst rv32%,rv32,$(RISCV_ARCH)),rv32)
RISCV_XLEN := 32
@@ -131,7 +135,7 @@ $(PROGRAM_ELF): \
$(PROGRAM_SRCS) \
$(BSP_DIR)/install/lib/$(CONFIGURATION)/libmetal.a \
$(BSP_DIR)/install/lib/$(CONFIGURATION)/libmetal-gloss.a \
- $(BSP_DIR)/metal.lds
+ $(BSP_DIR)/metal.$(LINK_TARGET).lds
mkdir -p $(dir $@)
$(MAKE) -C $(SRC_DIR) $(basename $(notdir $@)) \
AR=$(RISCV_AR) \