summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/fixup-dts25
-rw-r--r--scripts/standalone.mk18
2 files changed, 43 insertions, 0 deletions
diff --git a/scripts/fixup-dts b/scripts/fixup-dts
index 278b835..37c2105 100755
--- a/scripts/fixup-dts
+++ b/scripts/fixup-dts
@@ -105,6 +105,31 @@ if [ `grep -c 'stdout-path' ${dts}` -eq 0 ]; then
fi
+# FPGA targets need a 0x400000 byte offset into their SPI flash
+
+# Is the target an FPGA?
+if [ `echo ${dts} | grep -c 'arty'` -ne 0 -o `echo ${dts} | grep -c 'fpga'` -ne 0 ] ; then
+ # Is there a metal,entry property in the chosen node?
+ if [ `grep -c 'metal,entry' ${dts}` -eq 0 ] ; then
+ echo "$0: FPGA target needs metal,entry property to set boot offset."
+
+ # Find the SPI device with the lowest base address
+ first_spi_node=`grep -oE "spi@[[:xdigit:]]+?" ${dts} | sort | head -n 1`
+
+ # Get the DTS node label of that SPI device
+ spi_entry_label=`grep -oE "[^[:space:]]+?:\s+?${first_spi_node}" ${dts} | cut -d ':' -f 1`
+
+ if [ `grep -c 'chosen' ${dts}` -eq 0 ]; then
+ ${SED} -i "/cpus/i chosen {\n};" ${dts}
+ fi
+
+ ${SED} -i "/chosen/a metal,entry = <&${spi_entry_label} 0x400000>;" ${dts}
+
+ echo -e "$0: \tAdded metal,entry for SPI node ${first_spi_node} with label ${spi_entry_label}"
+ fi
+fi
+
+
# Add a test memory node if one doesn't exist
if [ `grep -c 'sifive,testram0' ${dts}` -eq 0 ]; then
diff --git a/scripts/standalone.mk b/scripts/standalone.mk
index 6f87950..d0740cd 100644
--- a/scripts/standalone.mk
+++ b/scripts/standalone.mk
@@ -49,6 +49,14 @@ ifeq ($(LINK_TARGET),)
endif
endif
+ifeq ($(PROGRAM),coremark)
+ifeq ($(CONFIGURATION),release)
+ifeq ($(LINK_TARGET),)
+LINK_TARGET = ramrodata
+endif
+endif
+endif
+
ifeq ($(LINK_TARGET),)
LINK_TARGET = default
endif
@@ -127,6 +135,15 @@ endif
RISCV_XCFLAGS += -DDHRY_ITERS=$(TARGET_DHRY_ITERS)
endif
+ifeq ($(PROGRAM),coremark)
+ifeq ($(RISCV_SERIES),sifive-7-series)
+RISCV_XCFLAGS += -O2 -fno-common -funroll-loops -finline-functions -funroll-all-loops --param max-inline-insns-auto=20 -falign-functions=8 -falign-jumps=8 -falign-loops=8 --param inline-min-speedup=10 -mtune=sifive-7-series -ffast-math
+else
+RISCV_XCFLAGS += -O2 -fno-common -funroll-loops -finline-functions --param max-inline-insns-auto=20 -falign-functions=4 -falign-jumps=4 -falign-loops=4 --param inline-min-speedup=10
+endif
+RISCV_XCFLAGS += -DITERATIONS=$(TARGET_CORE_ITERS)
+endif
+
# Turn on garbage collection for unused sections
RISCV_LDFLAGS += -Wl,--gc-sections
# Turn on linker map file generation
@@ -171,6 +188,7 @@ $(PROGRAM_ELF): \
$(BSP_DIR)/metal.$(LINK_TARGET).lds
mkdir -p $(dir $@)
$(MAKE) -C $(SRC_DIR) $(basename $(notdir $@)) \
+ PORT_DIR=$(PORT_DIR) \
AR=$(RISCV_AR) \
CC=$(RISCV_GCC) \
CXX=$(RISCV_GXX) \