summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile20
-rwxr-xr-xbsp/update-targets.sh8
-rwxr-xr-xscripts/fixup-dts20
-rw-r--r--scripts/standalone.mk2
4 files changed, 27 insertions, 23 deletions
diff --git a/Makefile b/Makefile
index 2be82e1..8c795d4 100644
--- a/Makefile
+++ b/Makefile
@@ -56,6 +56,11 @@ PROGRAM_LST = $(SRC_DIR)/$(CONFIGURATION)/$(PROGRAM).lst
# Finds the directory in which this BSP is located, ensuring that there is
# exactly one.
BSP_DIR := $(wildcard $(TARGET_ROOT)/bsp/$(TARGET))
+
+# Only perform these error checks and include the standalone.mk fragment
+# if we're not processing one of the "list-" targets
+ifneq ($@,$(filter $@, list-targets list-target-tags list-programs list-options))
+
ifeq ($(words $(BSP_DIR)),0)
$(error Unable to find BSP for $(TARGET), expected to find "bsp/$(TARGET)")
endif
@@ -77,6 +82,9 @@ endif
include scripts/standalone.mk
+# End of exclusion when procesinng "list-" targets.
+endif
+
#############################################################
# Prints help message
#############################################################
@@ -214,7 +222,11 @@ standalone: \
find $</scripts/elf2hex -name ".git*" | xargs rm -rf
+ifeq ($(PORT_DIR),)
$(MAKE) -C $(SRC_DIR) clean
+else
+ $(MAKE) -C $(SRC_DIR) PORT_DIR=${PORT_DIR} clean
+endif
cp -r $(SRC_DIR)/* $</src/
cp debug.mk $</debug.mk
@@ -222,7 +234,7 @@ standalone: \
echo "PROGRAM = $(PROGRAM)" > $</Makefile
ifneq ($(PORT_DIR),)
- echo "PORT_DIR = $(PORT_DIR)" > $</Makefile
+ echo "PORT_DIR = $(PORT_DIR)" >> $</Makefile
endif
cat scripts/standalone.mk >> $</Makefile
cat scripts/libmetal.mk >> $</Makefile
@@ -243,7 +255,11 @@ standalone: \
find $</freedom-metal -name ".git*" | xargs rm -rf
+ifeq ($(PORT_DIR),)
$(MAKE) -C $(SRC_DIR) clean
+else
+ $(MAKE) -C $(SRC_DIR) PORT_DIR=${PORT_DIR} clean
+endif
cp -r $(SRC_DIR)/* $</src/
cp debug.mk $</debug.mk
@@ -251,7 +267,7 @@ standalone: \
echo "PROGRAM = $(PROGRAM)" > $</Makefile
ifneq ($(PORT_DIR),)
- echo "PORT_DIR = $(PORT_DIR)" > $</Makefile
+ echo "PORT_DIR = $(PORT_DIR)" >> $</Makefile
endif
cat scripts/standalone.mk >> $</Makefile
cat scripts/libmetal.mk >> $</Makefile
diff --git a/bsp/update-targets.sh b/bsp/update-targets.sh
index e080bb0..81b48a3 100755
--- a/bsp/update-targets.sh
+++ b/bsp/update-targets.sh
@@ -79,6 +79,7 @@ MEE_HEADER_GENERATOR=freedom-metal_header-generator
LDSCRIPT_GENERATOR=freedom-ldscript-generator
MAKEATTRIB_GENERATOR=freedom-makeattributes-generator
BARE_HEADER_GENERATOR=freedom-bare_header-generator
+OPENOCDCFG_GENERATOR=freedom-openocdcfg-generator
DTS_FILENAME=design.dts
DTB_FILENAME=temp.dtb
@@ -88,6 +89,7 @@ LDS_RAMRODATA_FILENAME=metal.ramrodata.lds
LDS_SCRATCHPAD_FILENAME=metal.scratchpad.lds
SETTINGS_FILENAME=settings.mk
BARE_HEADER_FILENAME=metal-platform.h
+OPENOCDCFG_FILENAME=openocd.cfg
update_target() {
TARGET=$1
@@ -112,6 +114,12 @@ update_target() {
$MAKEATTRIB_GENERATOR -d $TARGET/$DTB_FILENAME -b $TARGET_TYPE -o $TARGET/$SETTINGS_FILENAME || warn "Failed to produce $TARGET/$SETTINGS_FILENAME"
$BARE_HEADER_GENERATOR -d $TARGET/$DTB_FILENAME -o $TARGET/$BARE_HEADER_FILENAME || warn "Failed to produce $TARGET/$BARE_HEADER_FILENAME"
+ if [[ "$TARGET_TYPE" =~ "arty" || "$TARGET_TYPE" =~ "hifive" ]] ; then
+ if [ `grep -c "jlink" $TARGET/$SETTINGS_FILENAME` -ne 1 ] ; then
+ $OPENOCDCFG_GENERATOR -d $TARGET/$DTB_FILENAME -o $TARGET/$OPENOCDCFG_FILENAME || warn "Failed to produce $TARGET/$OPENOCDCFG_FILENAME"
+ fi
+ fi
+
# Remove temporary .dtb
rm $TARGET/$DTB_FILENAME
diff --git a/scripts/fixup-dts b/scripts/fixup-dts
index 8b2457f..e1f7d57 100755
--- a/scripts/fixup-dts
+++ b/scripts/fixup-dts
@@ -29,26 +29,6 @@ else
SED=gsed
fi
-# Add a PMP node if it doesn't exist
-
-if [ `grep -c 'riscv,pmp' ${dts}` -eq 0 ]; then
-
- echo "$0: PMP node not found in ${dts}."
-
- # Check for targets without PMP support
-
- TARGET=`echo ${dts} | cut -d '/' -f 1`
- if [ "$TARGET" != "freedom-e310-arty" -a \
- "$TARGET" != "sifive-hifive1" -a \
- "$TARGET" != "coreip-e20-rtl" -a \
- "$TARGET" != "coreip-e20-arty" ]; then
-
- ${SED} -i '/riscv,isa/a riscv,pmpregions = <1>;' ${dts}
-
- echo -e "$0: \tAdded pmp@0"
- fi
-fi
-
# Add numintbits for the clic node if it doesn't exist
if [ `grep -c 'sifive,clic0' ${dts}` -ne 0 ]; then
diff --git a/scripts/standalone.mk b/scripts/standalone.mk
index a29bce4..2378b12 100644
--- a/scripts/standalone.mk
+++ b/scripts/standalone.mk
@@ -221,7 +221,7 @@ endif
.PHONY: clean-software
clean-software:
- $(MAKE) -C $(SRC_DIR) clean
+ $(MAKE) -C $(SRC_DIR) PORT_DIR=$(PORT_DIR) clean
rm -rf $(SRC_DIR)/$(CONFIGURATION)
.PHONY: clean
clean: clean-software