diff options
author | Bunnaroath Sou <35707615+bsousi5@users.noreply.github.com> | 2019-04-02 10:35:35 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-04-02 10:35:35 -0700 |
commit | a4b55a67c32b6ab7caefba27e53d9e109ef192b3 (patch) | |
tree | 1105906530853804552e204c6b732b63061b054a | |
parent | cebbb7cb6c7b16767b4ba04e7f231a784be9697a (diff) | |
parent | 6f1f98b4ceeae8cdc3a85dd4e418d04473cb74cb (diff) |
Merge pull request #229 from sifive/mk-settings
Add generating settings.mk
-rwxr-xr-x | bsp/update-targets.sh | 17 | ||||
-rwxr-xr-x | scripts/fixup-dts | 12 |
2 files changed, 26 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 diff --git a/scripts/fixup-dts b/scripts/fixup-dts index 31ce04f..adea17d 100755 --- a/scripts/fixup-dts +++ b/scripts/fixup-dts @@ -31,6 +31,18 @@ then echo -e "$0: \tAdded pmp@0" fi +# Add numintbits for the clic node if it doesn't exist + +if [ `grep -c 'sifive,clic0' ${dts}` -ne 0 ]; then + if [ `grep -c 'sifive,numintbits' ${dts}` -eq 0 ]; then + echo "$0: Clic missing numintbits in ${dts}." + + sed -i 's/interrupt-controller@2000000 {/interrupt-controller@2000000 {\n\t\t\tsifive,numintbits = <2>;/g' ${dts} + + echo -e "$0: \tAdded numintbits to clic." + fi +fi + # Add compat string for the global-interrupt node if it doesn't exist if [ `grep -c 'global-external-interrupts {' ${dts}` -ne 0 ]; then |