Line 44... |
Line 44... |
# SW_ROOT should be set by whatever is running this
|
# SW_ROOT should be set by whatever is running this
|
|
|
# Special case for CPU drivers
|
# Special case for CPU drivers
|
CPU_DRIVER ?=$(SW_ROOT)/drivers/or1200
|
CPU_DRIVER ?=$(SW_ROOT)/drivers/or1200
|
|
|
# Rest of drivers, check if we have any that we should use board-specific
|
# If BOARD_PATH is set, we'll first scan that path for which drivers they have
|
# versions of.
|
# and will override any locally named driver directories here.
|
# Expecting BOARD_SPECIFIC_DRIVERS and BOARD_PATH to be set
|
ifdef BOARD_PATH
|
|
#$(info BOARD_PATH is being used: $(BOARD_PATH))
|
|
BOARD_SPECIFIC_DRIVERS=$(shell if [ -e $(BOARD_PATH)/sw/drivers ]; then ls $(BOARD_PATH)/sw/drivers; fi)
|
|
endif
|
|
|
COMMON_SW_DRIVERS=$(shell ls $(SW_ROOT)/drivers )
|
COMMON_SW_DRIVERS=$(shell ls $(SW_ROOT)/drivers )
|
COMMON_SW_DRIVERS_EXCLUDE_BOARD_DRIVERS_CMD=$(shell for driver in $(BOARD_SPECIFIC_DRIVERS); do echo -n "grep -v $$driver"; done)
|
COMMON_SW_DRIVERS_WITHOUT_BOARD_DRIVERS=$(filter-out $(BOARD_SPECIFIC_DRIVERS),$(COMMON_SW_DRIVERS))
|
COMMON_SW_DRIVERS_WITHOUT_BOARD_DRIVERS=$(shell echo $(COMMON_SW_DRIVERS) $(COMMON_SW_DRIVERS_EXCLUDE_BOARD_DRIVERS_CMD))
|
|
|
|
# Add paths to the common drivers
|
#
|
SW_DRIVER_PATHS=$(shell for driver in $(COMMON_SW_DRIVERS_WITHOUT_BOARD_DRIVERS); do echo $(SW_ROOT)/drivers/$$driver; done)
|
# Create paths pointing to each driver directory
|
# If anything in BOARD_SPECIFIC_DRIVERS, add it to SW_DRIVER_PATHS
|
#
|
# It's expected BOARD_PATH points to the board's path and the heirarchy of
|
SW_DRIVER_PATHS=$(addprefix $(SW_ROOT)/drivers/,$(COMMON_SW_DRIVERS_WITHOUT_BOARD_DRIVERS))
|
# sw/drivers exists
|
# If any board paths add them here
|
SW_DRIVER_PATHS += $(shell for driver in $(BOARD_SPECIFIC_DRIVERS); do echo $(BOARD_PATH)/sw/drivers/$$driver; done)
|
SW_DRIVER_PATHS += $(addprefix $(BOARD_PATH)/sw/drivers/,$(BOARD_SPECIFIC_DRIVERS))
|
|
|
|
|
|
# Add /include to each path - the expected include directories
|
|
SW_DRIVER_INCLUDE_PATHS=$(addsuffix /include,$(SW_DRIVER_PATHS))
|
|
# Now add the -I to the front of each so we can pass this to GCC
|
|
INCLUDE_FLAGS=$(addprefix -I,$(SW_DRIVER_INCLUDE_PATHS))
|
|
|
|
|
|
print-driver-paths:
|
|
$(Q)echo "\tDrivers in use from common sw path"; echo;
|
|
@echo $(COMMON_SW_DRIVERS); echo; echo
|
|
$(Q)echo "\tDrivers in use from board sw path"; echo;
|
|
@echo $(BOARD_SPECIFIC_DRIVERS); echo; echo;
|
|
$(Q)echo "\tCommon sw drivers without board drivers"; echo;
|
|
@echo $(COMMON_SW_DRIVERS_WITHOUT_BOARD_DRIVERS); echo; echo;
|
|
$(Q)echo "\tAll drivers and their paths"; echo;
|
|
@echo $(SW_DRIVER_PATHS); echo; echo
|
|
|
# Now assemble all of the include paths for the drivers, prefix with -I for GCC
|
|
DRIVER_INCLUDE_PATHS=$(shell for driverpath in $(SW_DRIVER_PATHS); do echo "-I$$driverpath/include"; done)
|
|
|
|
# If BOARD_PATH isn't set, then we're not compiling for a board, so use the
|
# If BOARD_PATH isn't set, then we're not compiling for a board, so use the
|
# generic board.h include path, otherwise, use that board's
|
# generic board.h include path, otherwise, use that board's
|
ifeq ($(BOARD_PATH),)
|
ifdef BOARD_PATH
|
DRIVER_INCLUDE_PATHS +=-I$(SW_ROOT)/board/include
|
INCLUDE_FLAGS +=-I$(BOARD_PATH)/sw/board/include
|
else
|
else
|
DRIVER_INCLUDE_PATHS +=-I$(BOARD_PATH)/sw/board/include
|
INCLUDE_FLAGS +=-I$(SW_ROOT)/board/include
|
endif
|
endif
|
|
|
# For now, only apps path is in root sw directory
|
# For now, only apps path is in root sw directory
|
SW_APPS_PATH=$(SW_ROOT)/apps
|
SW_APPS_PATH=$(SW_ROOT)/apps
|
|
|
Line 91... |
Line 109... |
#MARCH_FLAGS ?=-mhard-mul -mhard-div -mhard-float
|
#MARCH_FLAGS ?=-mhard-mul -mhard-div -mhard-float
|
# Hardware integer arith, soft float
|
# Hardware integer arith, soft float
|
MARCH_FLAGS ?=-mhard-mul -mhard-div -msoft-float
|
MARCH_FLAGS ?=-mhard-mul -mhard-div -msoft-float
|
|
|
OR32_CFLAGS ?=-g -nostdlib -O2 $(MARCH_FLAGS) \
|
OR32_CFLAGS ?=-g -nostdlib -O2 $(MARCH_FLAGS) \
|
$(DRIVER_INCLUDE_PATHS) \
|
$(INCLUDE_FLAGS) \
|
-I$(SW_ROOT)/lib/include
|
-I$(SW_ROOT)/lib/include
|
|
|
OR32_LDFLAGS ?=-lgcc -T$(CPU_DRIVER)/link.ld -e 256
|
OR32_LDFLAGS ?=-lgcc -T$(CPU_DRIVER)/link.ld -e 256
|
OR32_ARFLAGS ?=-r
|
OR32_ARFLAGS ?=-r
|
# RTL_VERILOG_INCLUDE_DIR *MUST* be set!
|
# RTL_VERILOG_INCLUDE_DIR *MUST* be set!
|
Line 185... |
Line 203... |
$(Q)$(MAKE) -C $(SW_ROOT)/lib liborpsoc.a
|
$(Q)$(MAKE) -C $(SW_ROOT)/lib liborpsoc.a
|
|
|
$(VECTORS_OBJ):
|
$(VECTORS_OBJ):
|
$(Q)$(MAKE) -C $(CPU_DRIVER) crt0.o
|
$(Q)$(MAKE) -C $(CPU_DRIVER) crt0.o
|
|
|
# This relies on the local clean rule of each makefile
|
|
clean-all: distclean
|
|
|
|
clean-support:
|
|
$(Q)$(MAKE) -C ../support clean
|
|
|
|
# List of software directories, exclude include/
|
# Get a list of the tests
|
SWDIRS=$(shell ls ../ | grep -v include)
|
SW_TESTS=$(shell ls $(SW_ROOT)/tests)
|
|
# A list of the directories in each test directory (not always the same) and
|
|
# get a list of what's in them.
|
|
SW_TESTS_SUBDIRS=$(shell for test in $(SW_TESTS); do ls -d $(SW_ROOT)/tests/$$test/*; done)
|
|
|
|
print-sw-tests:
|
|
$(Q)echo; echo "\tSoftware tests"; echo;
|
|
$(Q)echo $(SW_TESTS); echo
|
|
|
|
print-sw-tests-subdirs:
|
|
$(Q)echo; echo "\tSoftware tests subdirs"; echo;
|
|
$(Q)echo $(SW_TESTS_SUBDIRS); echo
|
|
|
distclean:
|
# This relies on the local clean rule of each makefile
|
$(Q)for dir in $(SWDIRS); do if [ -d ../$$dir ]; then $(MAKE) -C ../$$dir clean; fi; done
|
clean-all: clean
|
|
$(Q)for testssubdir in $(SW_TESTS_SUBDIRS); do $(MAKE) -C $$testssubdir clean; done
|
$(Q)for dir in $(SW_DRIVER_PATHS); do $(MAKE) -C $$dir clean; done
|
$(Q)for dir in $(SW_DRIVER_PATHS); do $(MAKE) -C $$dir clean; done
|
$(Q)for dir in `ls $(SW_APPS_PATH)`; do $(MAKE) -C $(SW_ROOT)/apps/$$dir clean; done
|
$(Q)for dir in `ls $(SW_APPS_PATH)`; do $(MAKE) -C $(SW_ROOT)/apps/$$dir clean; done
|
|
$(Q)for dir in `ls $(SW_APPS_PATH)`; do $(MAKE) -C $(SW_ROOT)/apps/$$dir clean; done
|
$(Q)rm -f $(PROCESSED_DEFINES)
|
$(Q)rm -f $(PROCESSED_DEFINES)
|