summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile11
-rwxr-xr-xscripts/fixup-dts25
-rwxr-xr-xscripts/open-docs20
3 files changed, 54 insertions, 2 deletions
diff --git a/Makefile b/Makefile
index e742c35..39b4aed 100644
--- a/Makefile
+++ b/Makefile
@@ -100,8 +100,15 @@ help:
@echo " Exports a program for a single target into a standalone"
@echo " project directory at STANDALONE_DEST."
@echo ""
- @echo " For more information, view the Freedom E SDK Documentation at"
- @echo " https://sifive.github.io/freedom-e-sdk-docs/index.html"
+ @echo " open-docs"
+ @echo " Opens the Freedom E SDK documentation in your HTML"
+ @echo " viewer of choice. The documentation can also be found"
+ @echo " online at"
+ @echo " https://sifive.github.io/freedom-e-sdk-docs/index.html"
+
+.PHONY: open-docs
+open-docs: scripts/open-docs
+ $^
.PHONY: clean
clean:
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/open-docs b/scripts/open-docs
new file mode 100755
index 0000000..82d0f91
--- /dev/null
+++ b/scripts/open-docs
@@ -0,0 +1,20 @@
+#!/usr/bin/env sh
+
+SDK_PATH="$( cd "$(dirname "$0")/.." ; pwd -P )"
+DOCS_PATH=$SDK_PATH/doc/html/index.html
+
+XDG_OPEN=`which xdg-open`
+OPEN=`which open`
+
+if [ "$XDG_OPEN" != "" ]; then
+ echo "Opening $DOCS_PATH"
+ $XDG_OPEN $DOCS_PATH
+
+elif [ "$OPEN" != "" ]; then
+ echo "Opening $DOCS_PATH"
+ $OPEN $DOCS_PATH
+
+else
+ echo "Please open $DOCS_PATH in your preferred HTML viewer"
+fi
+