diff options
-rw-r--r-- | Makefile | 15 | ||||
-rwxr-xr-x | bsp/update-targets.sh | 2 | ||||
-rwxr-xr-x | scripts/fixup-dts | 10 |
3 files changed, 20 insertions, 7 deletions
@@ -20,6 +20,19 @@ endif PROGRAM ?= hello TARGET ?= sifive-hifive1 +# Setup differences between host platforms +ifeq ($(OS),Windows_NT) + SED_RE_FLAG = -r +else + UNAME_S := $(shell uname -s) + ifeq ($(UNAME_S),Linux) + SED_RE_FLAG = -r + endif + ifeq ($(UNAME_S),Darwin) + SED_RE_FLAG = -E + endif +endif + # Coremark require PORT_DIR set for different OS, freedom-metal for us! ifeq ($(PROGRAM),coremark) ifeq ($(PORT_DIR),) @@ -145,7 +158,7 @@ list-targets: list-target-tags: @echo target-tags: $(shell find $(TARGET_ROOT)/bsp -name settings.mk | \ xargs grep -he "TARGET_TAGS" | \ - sed -r 's/TARGET_TAGS.*=(.*)/\1/' | \ + sed $(SED_RE_FLAG) 's/TARGET_TAGS.*=(.*)/\1/' | \ tr ' ' '\n' | \ sort | \ uniq) diff --git a/bsp/update-targets.sh b/bsp/update-targets.sh index 63d7e24..d26aa25 100755 --- a/bsp/update-targets.sh +++ b/bsp/update-targets.sh @@ -1,4 +1,4 @@ -#!/usr/bin/env sh +#!/usr/bin/env bash help() { cat >&2 <<EOF diff --git a/scripts/fixup-dts b/scripts/fixup-dts index 37c2105..7192aea 100755 --- a/scripts/fixup-dts +++ b/scripts/fixup-dts @@ -154,7 +154,7 @@ if [ `grep -c 'sifive,testram0' ${dts}` -eq 0 ]; then if [ `grep -c "${protocol}-${port_type}-port" ${dts}` -ne 0 ]; then # Build the node name - port_node_name=`egrep -o "${protocol}-${port_type}-port@[a-fA-F0-9]+" ${dts}` + port_node_name=`egrep -o "${protocol}-${port_type}-port@[a-fA-F0-9]+" ${dts} | head -n 1` echo -e "$0: \tUsing node \t${port_node_name}" # Get the address and size cells @@ -165,19 +165,19 @@ if [ `grep -c 'sifive,testram0' ${dts}` -eq 0 ]; then # Get the base address and size if [ ${address_cells} -eq 1 -a ${size_cells} -eq 1 ]; then - address_and_size=(`cat ${dts} | tr -d '\n\t' | grep -oP "${port_node_name}.*?ranges = <0x\d+ \K(0x\d+ 0x\d+)"`) + address_and_size=(`cat ${dts} | tr -d '\n\t' | grep -oP "${port_node_name}.*?ranges = <0x[[:xdigit:]]+ \K(0x[[:xdigit:]]+ 0x[[:xdigit:]]+)"`) base_address=${address_and_size[0]} size=${address_and_size[1]} elif [ ${address_cells} -eq 1 -a ${size_cells} -eq 2 ]; then - address_and_size=(`cat ${dts} | tr -d '\n\t' | grep -oP "${port_node_name}.*?ranges = <0x\d+ \K(0x\d+ 0x\d+ 0x\d+)"`) + address_and_size=(`cat ${dts} | tr -d '\n\t' | grep -oP "${port_node_name}.*?ranges = <0x[[:xdigit:]]+ \K(0x[[:xdigit:]]+ 0x[[:xdigit:]]+ 0x[[:xdigit:]]+)"`) base_address=${address_and_size[0]} size="${address_and_size[1]} ${address_and_size[2]}" elif [ ${address_cells} -eq 2 -a ${size_cells} -eq 1 ]; then - address_and_size=(`cat ${dts} | tr -d '\n\t' | grep -oP "${port_node_name}.*?ranges = <0x\d+ 0x\d+ \K(0x\d+ 0x\d+ 0x\d+)"`) + address_and_size=(`cat ${dts} | tr -d '\n\t' | grep -oP "${port_node_name}.*?ranges = <0x[[:xdigit:]]+ 0x[[:xdigit:]]+ \K(0x[[:xdigit:]]+ 0x[[:xdigit:]]+ 0x[[:xdigit:]]+)"`) base_address="${address_and_size[0]} ${address_and_size[1]}" size=${address_and_size[2]} elif [ ${address_cells} -eq 2 -a ${size_cells} -eq 2 ]; then - address_and_size=(`cat ${dts} | tr -d '\n\t' | grep -oP "${port_node_name}.*?ranges = <0x\d+ 0x\d+ \K(0x\d+ 0x\d+ 0x\d+ 0x\d+)"`) + address_and_size=(`cat ${dts} | tr -d '\n\t' | grep -oP "${port_node_name}.*?ranges = <0x[[:xdigit:]]+ 0x[[:xdigit:]]+ \K(0x[[:xdigit:]]+ 0x[[:xdigit:]]+ 0x[[:xdigit:]]+ 0x[[:xdigit:]]+)"`) base_address="${address_and_size[0]} ${address_and_size[1]}" size="${address_and_size[2]} ${address_and_size[3]}" fi |