Skip to content
This repository has been archived by the owner on Jul 3, 2024. It is now read-only.

Commit

Permalink
Merge pull request #438 from sifive/standalone-touch-bsp-outputs
Browse files Browse the repository at this point in the history
Standalone touch bsp outputs
  • Loading branch information
nategraff-sifive authored Mar 11, 2020
2 parents 0ddc1a2 + f60c299 commit e838102
Show file tree
Hide file tree
Showing 2 changed files with 55 additions and 9 deletions.
53 changes: 49 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,25 @@ ifneq ($(BOARD),)
TARGET ?= $(BOARD)
endif

# If the make command goal is any of the Freedom Studio goals
# then there is no need to include any of the other makefiles
# as we are not really building anything real.
ifeq ($(MAKECMDGOALS),standalone)
NO_INCLUDES = true
endif
ifeq ($(MAKECMDGOALS),list-targets)
NO_INCLUDES = true
endif
ifeq ($(MAKECMDGOALS),list-target-tags)
NO_INCLUDES = true
endif
ifeq ($(MAKECMDGOALS),list-programs)
NO_INCLUDES = true
endif
ifeq ($(MAKECMDGOALS),list-options)
NO_INCLUDES = true
endif

# Default PROGRAM and TARGET
PROGRAM ?= hello
TARGET ?= $(shell find $(TARGET_ROOT)/bsp/* -type d | head -n 1 | rev | cut -d '/' -f 1 | rev)
Expand Down Expand Up @@ -87,13 +106,17 @@ endif
# - Setting the toolchain path with CROSS_COMPILE and RISCV_PATH
# - Providing the software and $(PROGRAM_ELF) Make targets for Metal

ifeq ($(NO_INCLUDES),)
include scripts/standalone.mk
endif

#############################################################
##############################################################
# Virtualenv Script Include
#############################################################
##############################################################

ifeq ($(NO_INCLUDES),)
include scripts/virtualenv.mk
endif

#############################################################
# Prints help message
Expand Down Expand Up @@ -226,7 +249,9 @@ list-options: list-programs list-targets
# Import rules to build Freedom Metal
#############################################################

ifeq ($(NO_INCLUDES),)
include scripts/libmetal.mk
endif

#############################################################
# Standalone Project Export
Expand Down Expand Up @@ -283,6 +308,7 @@ ifneq ($(shell grep SystemView.mk $(SRC_DIR)/Makefile),)
endif

mkdir -p $</scripts
cp scripts/virtualenv.mk $</scripts

cp -r scripts/elf2hex $</scripts
find $</scripts/elf2hex -name ".git*" | xargs rm -rf
Expand Down Expand Up @@ -313,6 +339,16 @@ endif
cp release.mk $</release.mk
cp requirements.txt $</requirements.txt

touch $</bsp/core.dts
touch $</bsp/design.dts
touch $</bsp/metal.default.lds
touch $</bsp/metal.ramrodata.lds
touch $</bsp/metal.scratchpad.lds
touch $</bsp/metal.h
touch $</bsp/metal-platform.h
touch $</bsp/design.svd
touch $</bsp/settings.mk

echo "PROGRAM = $(PROGRAM)" > $</Makefile
echo "TARGET = ${TARGET}" >> $</Makefile
ifneq ($(PORT_DIR),)
Expand All @@ -326,7 +362,6 @@ endif
echo "" >> $</Makefile
cat scripts/standalone.mk >> $</Makefile
cat scripts/libmetal.mk >> $</Makefile
cat scripts/virtualenv.mk >> $</Makefile
else # "rtl" not in TARGET_TAGS
standalone: \
$(STANDALONE_DEST) \
Expand Down Expand Up @@ -365,6 +400,7 @@ ifneq ($(shell grep SystemView.mk $(SRC_DIR)/Makefile),)
endif

mkdir -p $</scripts
cp scripts/virtualenv.mk $</scripts

cp -r scripts/devicetree-overlay-generator $</scripts
find $</scripts/devicetree-overlay-generator -name ".git*" | xargs rm -rf
Expand Down Expand Up @@ -392,6 +428,16 @@ endif
cp release.mk $</release.mk
cp requirements.txt $</requirements.txt

touch $</bsp/core.dts
touch $</bsp/design.dts
touch $</bsp/metal.default.lds
touch $</bsp/metal.ramrodata.lds
touch $</bsp/metal.scratchpad.lds
touch $</bsp/metal.h
touch $</bsp/metal-platform.h
touch $</bsp/design.svd
touch $</bsp/settings.mk

echo "PROGRAM = $(PROGRAM)" > $</Makefile
echo "TARGET = ${TARGET}" >> $</Makefile
ifneq ($(PORT_DIR),)
Expand All @@ -405,7 +451,6 @@ endif
echo "" >> $</Makefile
cat scripts/standalone.mk >> $</Makefile
cat scripts/libmetal.mk >> $</Makefile
cat scripts/virtualenv.mk >> $</Makefile
endif # rtl in TARGET_TAGS

endif # STANDALONE_DEST
Expand Down
11 changes: 6 additions & 5 deletions scripts/libmetal.mk
Original file line number Diff line number Diff line change
Expand Up @@ -27,27 +27,28 @@ SETTINGS_GENERATOR = scripts/esdk-settings-generator/generate_settings.py
# This allows user changes to the devicetree in $(BSP_DIR)/design.dts to be
# propagated through to the end application with a single invocation of Make

$(OVERLAY_GENERATOR): virtualenv
$(LDSCRIPT_GENERATOR): virtualenv
$(CMSIS_SVD_GENERATOR): virtualenv
$(SETTINGS_GENERATOR): virtualenv

$(BSP_DIR)/design.dts: $(BSP_DIR)/core.dts $(OVERLAY_GENERATOR)
$(MAKE) -f scripts/virtualenv.mk virtualenv
. venv/bin/activate && $(OVERLAY_GENERATOR) --type $(TARGET) --output $@ --rename-include $(notdir $<) $<

$(BSP_DIR)/metal.default.lds: $(BSP_DIR)/design.dts $(LDSCRIPT_GENERATOR)
$(MAKE) -f scripts/virtualenv.mk virtualenv
. venv/bin/activate && $(LDSCRIPT_GENERATOR) -d $< -o $@

$(BSP_DIR)/metal.ramrodata.lds: $(BSP_DIR)/design.dts $(LDSCRIPT_GENERATOR)
$(MAKE) -f scripts/virtualenv.mk virtualenv
. venv/bin/activate && $(LDSCRIPT_GENERATOR) -d $< -o $@ --ramrodata

$(BSP_DIR)/metal.scratchpad.lds: $(BSP_DIR)/design.dts $(LDSCRIPT_GENERATOR)
$(MAKE) -f scripts/virtualenv.mk virtualenv
. venv/bin/activate && $(LDSCRIPT_GENERATOR) -d $< -o $@ --scratchpad

$(BSP_DIR)/design.svd: $(BSP_DIR)/design.dts $(CMSIS_SVD_GENERATOR)
$(MAKE) -f scripts/virtualenv.mk virtualenv
. venv/bin/activate && $(CMSIS_SVD_GENERATOR) -d $< -o $@

$(BSP_DIR)/settings.mk: $(BSP_DIR)/design.dts $(SETTINGS_GENERATOR)
$(MAKE) -f scripts/virtualenv.mk virtualenv
. venv/bin/activate && $(SETTINGS_GENERATOR) -d $< -o $@ -t $(TARGET)

ifeq ($(findstring spike,$(TARGET)),spike)
Expand Down

0 comments on commit e838102

Please sign in to comment.