summaryrefslogtreecommitdiff
path: root/bsp
diff options
context:
space:
mode:
authorBunnaroath Sou <bsou@sifive.com>2019-03-31 21:25:50 -0700
committerBunnaroath Sou <bsou@sifive.com>2019-03-31 21:25:50 -0700
commit77114277bb35ebf1d0eae42dc2159cb6059261a9 (patch)
treed1dc1e0eff2493025ee92b10b5d7010369f55cb4 /bsp
parentcebbb7cb6c7b16767b4ba04e7f231a784be9697a (diff)
Enhance update-target script to also generate settings.mk
Diffstat (limited to 'bsp')
-rwxr-xr-xbsp/update-targets.sh17
1 files changed, 14 insertions, 3 deletions
diff --git a/bsp/update-targets.sh b/bsp/update-targets.sh
index dca5340..b79b5f5 100755
--- a/bsp/update-targets.sh
+++ b/bsp/update-targets.sh
@@ -5,6 +5,7 @@ help() {
$0: BSP Generator for the SiFive Freedom E SDK
--help Prints this help text.
--target-name Specify bsp target name.
+ --target-type Specify bsp target type [rtl | arty].
--sdk-path=* The path to the freedom-e-sdk clone directory, public or private.
--target-dts=*.dts The path to the target device tree that will be used.
EOF
@@ -21,6 +22,7 @@ do
--help) help "$0"; exit 0;;
--no-fixup) NO_FIXUP=1; shift 1;;
--target-name) CUSTOM_NAME="$2"; shift 2;;
+ --target-type) CUSTOM_TYPE="$2"; shift 2;;
--sdk-path=*) CUSTOM_PATH="$(echo "$1" | cut -d= -f2-)"; shift 1;;
--sdk-path) CUSTOM_PATH="$2"; shift 2;;
--target-dts=*) DTSFILE="$(echo "$1" | cut -d= -f2-)"; shift 1;;
@@ -46,12 +48,18 @@ else
help "$0"
exit 1
fi
+ if [ "$CUSTOM_TYPE" == "" ]
+ then
+ echo "[INFO] $0: --target-type is not given! Default to rtl" >&2
+ TARGET_TYPE="rtl"
+ else
+ TARGET_TYPE="$CUSTOM_TYPE"
+ fi
CUSTOM_TARGET="$CUSTOM_PATH/bsp/$CUSTOM_NAME"
if [ ! -d "$CUSTOM_TARGET" ]
then
- echo "[ERROR] $0: "$CUSTOM_TARGET" not found!" >&2
- help "$0"
- exit 1
+ echo "[INFO] $0: "$CUSTOM_TARGET" not found! Creating one" >&2
+ mkdir -p $CUSTOM_TARGET
fi
cp $DTSFILE $CUSTOM_TARGET
TARGET_LIST="$CUSTOM_TARGET "
@@ -60,6 +68,7 @@ fi
DTC=dtc
MEE_HEADER_GENERATOR=freedom-metal_header-generator
LDSCRIPT_GENERATOR=freedom-ldscript-generator
+MAKEATTRIB_GENERATOR=freedom-makeattributes-generator
DTS_FILENAME=design.dts
DTB_FILENAME=temp.dtb
@@ -67,6 +76,7 @@ HEADER_FILENAME=metal.h
LDS_DEFAULT_FILENAME=metal.default.lds
LDS_RAMRODATA_FILENAME=metal.ramrodata.lds
LDS_SCRATCHPAD_FILENAME=metal.scratchpad.lds
+SETTINGS_FILENAME=settings.mk
update_target() {
TARGET=$1
@@ -85,6 +95,7 @@ update_target() {
$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"
+ $MAKEATTRIB_GENERATOR -d $TARGET/$DTB_FILENAME -b $TARGET_TYPE -o $TARGET/$SETTINGS_FILENAME || die "Failed to produce $TARGET/$SETTINGS_FILENAME"
# Remove temporary .dtb
rm $TARGET/$DTB_FILENAME