From 5570f0ed5e13a6d5e011afbeb169f56df38889d3 Mon Sep 17 00:00:00 2001 From: Nathaniel Graff Date: Thu, 7 Mar 2019 09:47:43 -0800 Subject: Remove BSP checks from Makefile Signed-off-by: Nathaniel Graff --- Makefile | 120 ++++++++------------------------------------------ scripts/libmetal.mk | 16 +++---- scripts/standalone.mk | 4 -- 3 files changed, 27 insertions(+), 113 deletions(-) diff --git a/Makefile b/Makefile index 4afdacf..355524e 100644 --- a/Makefile +++ b/Makefile @@ -11,31 +11,16 @@ $(info Obtaining additional make variables from $(extra_configs)) include $(extra_configs) endif -# Select Legacy BSP or Freedom Metal BSP -# Allowed values are 'legacy' and 'metal' -BSP ?= legacy - -# Use BOARD as a synonym for TARGET +# Allow BOARD as a synonym for TARGET ifneq ($(BOARD),) TARGET ?= $(BOARD) endif -ifeq ($(BSP),legacy) -BSP_SUBDIR ?= env -TARGET ?= freedom-e300-hifive1 -PROGRAM ?= demo_gpio -LINK_TARGET ?= flash -GDB_PORT ?= 3333 - -else # MEE -override BSP = metal -BSP_SUBDIR ?= +# Default PROGRAM and TARGET PROGRAM ?= hello TARGET ?= sifive-hifive1 -endif # $(BSP) - -TARGET_ROOT ?= $(abspath .) +TARGET_ROOT ?= $(abspath .) PROGRAM_ROOT ?= $(abspath .) SRC_DIR = $(PROGRAM_ROOT)/software/$(PROGRAM) @@ -49,9 +34,9 @@ PROGRAM_HEX = $(SRC_DIR)/$(PROGRAM).hex # Finds the directory in which this BSP is located, ensuring that there is # exactly one. -BSP_DIR := $(wildcard $(TARGET_ROOT)/bsp/$(BSP_SUBDIR)/$(TARGET)) +BSP_DIR := $(wildcard $(TARGET_ROOT)/bsp/$(TARGET)) ifeq ($(words $(BSP_DIR)),0) -$(error Unable to find BSP for $(TARGET), expected to find either "bsp/$(TARGET)" or "bsp-addons/$(TARGET)") +$(error Unable to find BSP for $(TARGET), expected to find "bsp/$(TARGET)") endif ifneq ($(words $(BSP_DIR)),1) $(error Found multiple BSPs for $(TARGET): "$(BSP_DIR)") @@ -67,7 +52,7 @@ endif # The standalone Makefile handles the following tasks: # - Including $(BSP_DIR)/settings.mk and validating RISCV_ARCH, RISCV_ABI # - Setting the toolchain path with CROSS_COMPILE and RISCV_PATH -# - Providing the software and $(PROGRAM_ELF) Make targets for the MEE +# - Providing the software and $(PROGRAM_ELF) Make targets for Metal include scripts/standalone.mk @@ -79,25 +64,25 @@ help: @echo " SiFive Freedom E Software Development Kit " @echo " Makefile targets:" @echo "" - @echo " software BSP=metal [PROGRAM=$(PROGRAM) TARGET=$(TARGET)]:" + @echo " software [PROGRAM=$(PROGRAM) TARGET=$(TARGET)]:" @echo " Build a software program to load with the" @echo " debugger." @echo "" - @echo " metal BSP=metal [TARGET=$(TARGET)]" - @echo " Build the MEE library for TARGET" + @echo " metal [TARGET=$(TARGET)]" + @echo " Build the Freedom Metal library for TARGET" @echo "" - @echo " clean BSP=metal [PROGRAM=$(PROGRAM) TARGET=$(TARGET)]:" + @echo " clean [PROGRAM=$(PROGRAM) TARGET=$(TARGET)]:" @echo " Clean compiled objects for a specified " @echo " software program." @echo "" - @echo " upload BSP=metal [PROGRAM=$(PROGRAM) TARGET=$(TARGET)]:" + @echo " upload [PROGRAM=$(PROGRAM) TARGET=$(TARGET)]:" @echo " Launch OpenOCD to flash your program to the" @echo " on-board Flash." @echo "" - @echo " debug BSP=metal [PROGRAM=$(PROGRAM) TARGET=$(TARGET)]:" + @echo " debug [PROGRAM=$(PROGRAM) TARGET=$(TARGET)]:" @echo " Launch OpenOCD and attach GDB to the running program." @echo "" - @echo " standalone BSP=metal STANDALONE_DEST=/path/to/desired/location" + @echo " standalone STANDALONE_DEST=/path/to/desired/location" @echo " [INCLUDE_METAL_SOURCES=1] [PROGRAM=$(PROGRAM)]" @echo " [TARGET=$(TARGET)]:" @echo " Export a program for a single target into a standalone" @@ -109,34 +94,30 @@ help: clean: ############################################################# -# Enumerate MEE BSPs and Programs +# Enumerate BSPs and Programs # -# List all available MEE boards and programs in a form that +# List all available boards and programs in a form that # Freedom Studio knows how to parse. Do not change the # format or fixed text of the output without consulting the # Freedom Studio dev team. ############################################################# -ifeq ($(BSP),metal) - -# MEE boards are any folders that aren't the Legacy BSP or update-targets.sh +# +# Metal boards are any folders that aren't the Legacy BSP or update-targets.sh EXCLUDE_TARGET_DIRS = drivers env include libwrap update-targets.sh list-targets: @echo bsp-list: $(sort $(filter-out $(EXCLUDE_TARGET_DIRS),$(notdir $(wildcard bsp/*)))) -# MEE programs are any submodules in the software folder +# Metal programs are any submodules in the software folder list-programs: @echo program-list: $(shell grep -o '= software/.*$$' .gitmodules | sed 's/.*\///') list-options: list-programs list-targets -endif - ############################################################# # Import rules to build Freedom Metal ############################################################# -ifeq ($(BSP),metal) + include scripts/libmetal.mk -endif ############################################################# # elf2hex @@ -162,7 +143,6 @@ clean: clean-elf2hex # Standalone Project Export ############################################################# -ifeq ($(BSP),metal) ifeq ($(STANDALONE_DEST),) standalone: $(error Please provide STANDALONE_DEST to create a standalone project) @@ -213,14 +193,11 @@ standalone: \ cat scripts/standalone.mk >> $