From 77114277bb35ebf1d0eae42dc2159cb6059261a9 Mon Sep 17 00:00:00 2001 From: Bunnaroath Sou Date: Sun, 31 Mar 2019 21:25:50 -0700 Subject: Enhance update-target script to also generate settings.mk --- bsp/update-targets.sh | 17 ++++++++++++++--- 1 file 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 -- cgit v1.2.3