| 1 |
2 |
specular |
#------------------------------------------------------------------------------
|
| 2 |
|
|
# VARIABLES APPENDED TO BY INCLUDED MAKEFILE FRAGMENTS
|
| 3 |
|
|
#------------------------------------------------------------------------------
|
| 4 |
|
|
|
| 5 |
|
|
# List of include directories for -I compiler option (-I added when used).
|
| 6 |
|
|
# Includes the BSP.
|
| 7 |
|
|
ALT_INCLUDE_DIRS :=
|
| 8 |
|
|
|
| 9 |
|
|
# List of library directories for -L linker option (-L added when used).
|
| 10 |
|
|
# Includes the BSP.
|
| 11 |
|
|
ALT_LIBRARY_DIRS :=
|
| 12 |
|
|
|
| 13 |
|
|
# List of library names for -l linker option (-l added when used).
|
| 14 |
|
|
# Includes the BSP.
|
| 15 |
|
|
ALT_LIBRARY_NAMES :=
|
| 16 |
|
|
|
| 17 |
|
|
# List of library names for -msys-lib linker option (-msys-lib added when used).
|
| 18 |
|
|
# These are libraries that might be located in the BSP and depend on the BSP
|
| 19 |
|
|
# library, or vice versa
|
| 20 |
|
|
ALT_BSP_DEP_LIBRARY_NAMES :=
|
| 21 |
|
|
|
| 22 |
|
|
# List of dependencies for the linker. This is usually the full pathname
|
| 23 |
|
|
# of each library (*.a) file.
|
| 24 |
|
|
# Includes the BSP.
|
| 25 |
|
|
ALT_LDDEPS :=
|
| 26 |
|
|
|
| 27 |
|
|
# List of root library directories that support running make to build them.
|
| 28 |
|
|
# Includes the BSP and any ALT libraries.
|
| 29 |
|
|
MAKEABLE_LIBRARY_ROOT_DIRS :=
|
| 30 |
|
|
|
| 31 |
|
|
# Generic flags passed to the compiler for different types of input files.
|
| 32 |
|
|
ALT_CFLAGS :=
|
| 33 |
|
|
ALT_CXXFLAGS :=
|
| 34 |
|
|
ALT_CPPFLAGS :=
|
| 35 |
|
|
ALT_ASFLAGS :=
|
| 36 |
|
|
ALT_LDFLAGS :=
|
| 37 |
|
|
|
| 38 |
|
|
|
| 39 |
|
|
#------------------------------------------------------------------------------
|
| 40 |
|
|
# The adjust-path macro
|
| 41 |
|
|
#
|
| 42 |
|
|
# If COMSPEC/ComSpec is defined, Make is launched from Windows through
|
| 43 |
|
|
# Cygwin. The adjust-path macro converts absolute windows paths into
|
| 44 |
|
|
# unix style paths (Example: c:/dir -> /c/dir). This will ensture
|
| 45 |
|
|
# paths are readable by GNU Make.
|
| 46 |
|
|
#
|
| 47 |
|
|
# If COMSPEC/ComSpec is not defined, Make is launched from linux, and no
|
| 48 |
|
|
# adjustment is necessary
|
| 49 |
|
|
#
|
| 50 |
|
|
#------------------------------------------------------------------------------
|
| 51 |
|
|
|
| 52 |
|
|
ifndef COMSPEC
|
| 53 |
|
|
ifdef ComSpec
|
| 54 |
|
|
COMSPEC = $(ComSpec)
|
| 55 |
|
|
endif # ComSpec
|
| 56 |
|
|
endif # COMSPEC
|
| 57 |
|
|
|
| 58 |
|
|
ifdef COMSPEC # if Windows OS
|
| 59 |
|
|
|
| 60 |
|
|
ifeq ($(MAKE_VERSION),3.81)
|
| 61 |
|
|
#
|
| 62 |
|
|
# adjust-path/adjust-path-mixed for Mingw Gnu Make on Windows
|
| 63 |
|
|
#
|
| 64 |
|
|
# Example Usage:
|
| 65 |
|
|
# $(call adjust-path,c:/aaa/bbb) => /c/aaa/bbb
|
| 66 |
|
|
# $(call adjust-path-mixed,/c/aaa/bbb) => c:/aaa/bbb
|
| 67 |
|
|
# $(call adjust-path-mixed,/cygdrive/c/aaa/bbb) => c:/aaa/bbb
|
| 68 |
|
|
#
|
| 69 |
|
|
|
| 70 |
|
|
#
|
| 71 |
|
|
# adjust-path
|
| 72 |
|
|
# - converts back slash characters into forward slashes
|
| 73 |
|
|
# - if input arg ($1) is an empty string then return the empty string
|
| 74 |
|
|
# - if input arg ($1) does not contain the string ":/", then return input arg
|
| 75 |
|
|
# - using sed, convert mixed path [c:/...] into mingw path [/c/...]
|
| 76 |
|
|
define adjust-path
|
| 77 |
|
|
$(strip \
|
| 78 |
|
|
$(if $1,\
|
| 79 |
|
|
$(if $(findstring :/,$(subst \,/,$1)),\
|
| 80 |
|
|
$(shell echo $(subst \,/,$1) | sed -e 's,^\([a-zA-Z]\):/,/\1/,'),\
|
| 81 |
|
|
$(subst \,/,$1))))
|
| 82 |
|
|
endef
|
| 83 |
|
|
|
| 84 |
|
|
#
|
| 85 |
|
|
# adjust-path-mixed
|
| 86 |
|
|
# - converts back slash characters into forward slashes
|
| 87 |
|
|
# - if input arg ($1) is an empty string then return the empty string
|
| 88 |
|
|
# - if input arg ($1) does not begin with a forward slash '/' char, then
|
| 89 |
|
|
# return input arg
|
| 90 |
|
|
# - using sed, convert mingw path [/c/...] or cygwin path [/c/cygdrive/...]
|
| 91 |
|
|
# into a mixed path [c:/...]
|
| 92 |
|
|
define adjust-path-mixed
|
| 93 |
|
|
$(strip \
|
| 94 |
|
|
$(if $1,\
|
| 95 |
|
|
$(if $(findstring $(subst \,/,$1),$(patsubst /%,%,$(subst \,/,$1))),\
|
| 96 |
|
|
$(subst \,/,$1),\
|
| 97 |
|
|
$(shell echo $(subst \,/,$1) | sed -e 's,^/cygdrive/\([a-zA-Z]\)/,\1:/,' -e 's,^/\([a-zA-Z]\)/,\1:/,'))))
|
| 98 |
|
|
endef
|
| 99 |
|
|
|
| 100 |
|
|
else # MAKE_VERSION != 3.81 (MAKE_VERSION == 3.80 or MAKE_VERSION == 3.79)
|
| 101 |
|
|
#
|
| 102 |
|
|
# adjust-path for Cygwin Gnu Make
|
| 103 |
|
|
# $(call adjust-path,c:/aaa/bbb) = /cygdrive/c/aaa/bbb
|
| 104 |
|
|
# $(call adjust-path-mixed,/cygdrive/c/aaa/bbb) = c:/aaa/bbb
|
| 105 |
|
|
#
|
| 106 |
|
|
adjust-path = $(if $1,$(shell cygpath -u "$1"),)
|
| 107 |
|
|
adjust-path-mixed = $(if $1,$(shell cygpath -m "$1"),)
|
| 108 |
|
|
endif
|
| 109 |
|
|
|
| 110 |
|
|
else # !COMSPEC
|
| 111 |
|
|
|
| 112 |
|
|
adjust-path = $1
|
| 113 |
|
|
adjust-path-mixed = $1
|
| 114 |
|
|
|
| 115 |
|
|
endif # COMSPEC
|
| 116 |
|
|
|
| 117 |
|
|
|
| 118 |
|
|
#vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
|
| 119 |
|
|
# GENERATED SETTINGS START v
|
| 120 |
|
|
#vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
|
| 121 |
|
|
|
| 122 |
|
|
#START GENERATED
|
| 123 |
|
|
ACTIVE_BUILD_CONFIG := default
|
| 124 |
|
|
BUILD_CONFIGS := default
|
| 125 |
|
|
|
| 126 |
|
|
# The following TYPE comment allows tools to identify the 'type' of target this
|
| 127 |
|
|
# makefile is associated with.
|
| 128 |
|
|
# TYPE: APP_MAKEFILE
|
| 129 |
|
|
|
| 130 |
|
|
# This following VERSION comment indicates the version of the tool used to
|
| 131 |
|
|
# generate this makefile. A makefile variable is provided for VERSION as well.
|
| 132 |
|
|
# ACDS_VERSION: 13.1
|
| 133 |
|
|
ACDS_VERSION := 13.1
|
| 134 |
|
|
|
| 135 |
|
|
# This following BUILD_NUMBER comment indicates the build number of the tool
|
| 136 |
|
|
# used to generate this makefile.
|
| 137 |
|
|
# BUILD_NUMBER: 162
|
| 138 |
|
|
|
| 139 |
|
|
# Define path to the application ELF.
|
| 140 |
|
|
# It may be used by the makefile fragments so is defined before including them.
|
| 141 |
|
|
#
|
| 142 |
|
|
ELF := simple_cube.elf
|
| 143 |
|
|
|
| 144 |
|
|
# Paths to C, C++, and assembly source files.
|
| 145 |
|
|
C_SRCS += ../../../../../../demo_app/simple_cube.c
|
| 146 |
|
|
C_SRCS += ../../../../../../clib/mp_lib.c
|
| 147 |
|
|
C_SRCS += ../../../../../../clib/mp_matrix3.c
|
| 148 |
|
|
C_SRCS += ../../../../../../clib/mp_matrix4.c
|
| 149 |
|
|
C_SRCS += ../../../../../../clib/mp_vector3.c
|
| 150 |
|
|
C_SRCS += ../../../../../../clib/mp_vector4.c
|
| 151 |
|
|
C_SRCS += ../../../../../../clib/hw_dep/de0/mp_hwdep.c
|
| 152 |
|
|
CXX_SRCS :=
|
| 153 |
|
|
ASM_SRCS :=
|
| 154 |
|
|
|
| 155 |
|
|
|
| 156 |
|
|
# Path to root of object file tree.
|
| 157 |
|
|
OBJ_ROOT_DIR := obj
|
| 158 |
|
|
|
| 159 |
|
|
# Options to control objdump.
|
| 160 |
|
|
CREATE_OBJDUMP := 1
|
| 161 |
|
|
OBJDUMP_INCLUDE_SOURCE := 1
|
| 162 |
|
|
OBJDUMP_FULL_CONTENTS := 0
|
| 163 |
|
|
|
| 164 |
|
|
# Options to enable/disable optional files.
|
| 165 |
|
|
CREATE_ELF_DERIVED_FILES := 0
|
| 166 |
|
|
CREATE_LINKER_MAP := 1
|
| 167 |
|
|
|
| 168 |
|
|
# Common arguments for ALT_CFLAGSs
|
| 169 |
|
|
APP_CFLAGS_DEFINED_SYMBOLS :=
|
| 170 |
|
|
APP_CFLAGS_UNDEFINED_SYMBOLS :=
|
| 171 |
|
|
APP_CFLAGS_OPTIMIZATION := -O3
|
| 172 |
|
|
APP_CFLAGS_DEBUG_LEVEL :=
|
| 173 |
|
|
APP_CFLAGS_WARNINGS := -Wall
|
| 174 |
|
|
APP_CFLAGS_USER_FLAGS :=
|
| 175 |
|
|
|
| 176 |
|
|
APP_ASFLAGS_USER :=
|
| 177 |
|
|
APP_LDFLAGS_USER :=
|
| 178 |
|
|
|
| 179 |
|
|
# Linker options that have default values assigned later if not
|
| 180 |
|
|
# assigned here.
|
| 181 |
|
|
LINKER_SCRIPT :=
|
| 182 |
|
|
CRT0 :=
|
| 183 |
|
|
SYS_LIB :=
|
| 184 |
|
|
|
| 185 |
|
|
# Define path to the root of the BSP.
|
| 186 |
|
|
BSP_ROOT_DIR := ../test_bsp/
|
| 187 |
|
|
|
| 188 |
|
|
# List of application specific include directories, library directories and library names
|
| 189 |
|
|
APP_INCLUDE_DIRS += ../../../../../../clib
|
| 190 |
|
|
APP_INCLUDE_DIRS += ../../../../../../clib/hw_dep/de0
|
| 191 |
|
|
APP_LIBRARY_DIRS :=
|
| 192 |
|
|
APP_LIBRARY_NAMES :=
|
| 193 |
|
|
|
| 194 |
|
|
# Pre- and post- processor settings.
|
| 195 |
|
|
BUILD_PRE_PROCESS :=
|
| 196 |
|
|
BUILD_POST_PROCESS :=
|
| 197 |
|
|
|
| 198 |
|
|
QUARTUS_PROJECT_DIR := ../../
|
| 199 |
|
|
|
| 200 |
|
|
|
| 201 |
|
|
#END GENERATED
|
| 202 |
|
|
|
| 203 |
|
|
#^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
| 204 |
|
|
# GENERATED SETTINGS END ^
|
| 205 |
|
|
#^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
| 206 |
|
|
|
| 207 |
|
|
|
| 208 |
|
|
#------------------------------------------------------------------------------
|
| 209 |
|
|
# DEFAULT TARGET
|
| 210 |
|
|
#------------------------------------------------------------------------------
|
| 211 |
|
|
|
| 212 |
|
|
# Define the variable used to echo output if not already defined.
|
| 213 |
|
|
ifeq ($(ECHO),)
|
| 214 |
|
|
ECHO := echo
|
| 215 |
|
|
endif
|
| 216 |
|
|
|
| 217 |
|
|
# Put "all" rule before included makefile fragments because they may
|
| 218 |
|
|
# define rules and we don't want one of those to become the default rule.
|
| 219 |
|
|
.PHONY : all
|
| 220 |
|
|
|
| 221 |
|
|
all:
|
| 222 |
|
|
@$(ECHO) [$(APP_NAME) build complete]
|
| 223 |
|
|
|
| 224 |
|
|
all : build_pre_process libs app build_post_process
|
| 225 |
|
|
|
| 226 |
|
|
|
| 227 |
|
|
#------------------------------------------------------------------------------
|
| 228 |
|
|
# VARIABLES DEPENDENT ON GENERATED CONTENT
|
| 229 |
|
|
#------------------------------------------------------------------------------
|
| 230 |
|
|
|
| 231 |
|
|
# Define object file directory per build configuration
|
| 232 |
|
|
CONFIG_OBJ_DIR := $(OBJ_ROOT_DIR)/$(ACTIVE_BUILD_CONFIG)
|
| 233 |
|
|
|
| 234 |
|
|
ifeq ($(BSP_ROOT_DIR),)
|
| 235 |
|
|
$(error Edit Makefile and provide a value for BSP_ROOT_DIR)
|
| 236 |
|
|
endif
|
| 237 |
|
|
|
| 238 |
|
|
ifeq ($(wildcard $(BSP_ROOT_DIR)),)
|
| 239 |
|
|
$(error BSP directory does not exist: $(BSP_ROOT_DIR))
|
| 240 |
|
|
endif
|
| 241 |
|
|
|
| 242 |
|
|
# Define absolute path to the root of the BSP.
|
| 243 |
|
|
ABS_BSP_ROOT_DIR := $(call adjust-path-mixed,$(shell cd "$(BSP_ROOT_DIR)"; pwd))
|
| 244 |
|
|
|
| 245 |
|
|
# Include makefile fragments. Define variable ALT_LIBRARY_ROOT_DIR before
|
| 246 |
|
|
# including each makefile fragment so that it knows the path to itself.
|
| 247 |
|
|
BSP_INCLUDE_FILE := $(BSP_ROOT_DIR)/public.mk
|
| 248 |
|
|
ALT_LIBRARY_ROOT_DIR := $(BSP_ROOT_DIR)
|
| 249 |
|
|
include $(BSP_INCLUDE_FILE)
|
| 250 |
|
|
# C2H will need this to touch the BSP public.mk and avoid the sopc file
|
| 251 |
|
|
# out-of-date error during a BSP make
|
| 252 |
|
|
ABS_BSP_INCLUDE_FILE := $(ABS_BSP_ROOT_DIR)/public.mk
|
| 253 |
|
|
|
| 254 |
|
|
|
| 255 |
|
|
ifneq ($(WARNING.SMALL_STACK_SIZE),)
|
| 256 |
|
|
# This WARNING is here to protect you from unknowingly using a very small stack
|
| 257 |
|
|
# If the warning is set, increase your stack size or enable the BSP small stack
|
| 258 |
|
|
# setting to eliminate the warning
|
| 259 |
|
|
$(warning WARNING: $(WARNING.SMALL_STACK_SIZE))
|
| 260 |
|
|
endif
|
| 261 |
|
|
|
| 262 |
|
|
|
| 263 |
|
|
# If the BSP public.mk indicates that ALT_SIM_OPTIMIZE is set, rename the ELF
|
| 264 |
|
|
# by prefixing it with RUN_ON_HDL_SIMULATOR_ONLY_.
|
| 265 |
|
|
ifneq ($(filter -DALT_SIM_OPTIMIZE,$(ALT_CPPFLAGS)),)
|
| 266 |
|
|
ELF := RUN_ON_HDL_SIMULATOR_ONLY_$(ELF)
|
| 267 |
|
|
endif
|
| 268 |
|
|
|
| 269 |
|
|
# If the BSP public.mk indicates that ALT_PROVIDE_GMON is set, add option to
|
| 270 |
|
|
# download_elf target
|
| 271 |
|
|
ifneq ($(filter -DALT_PROVIDE_GMON,$(ALT_CPPFLAGS)),)
|
| 272 |
|
|
GMON_OUT_FILENAME := gmon.out
|
| 273 |
|
|
WRITE_GMON_OPTION := --write-gmon $(GMON_OUT_FILENAME)
|
| 274 |
|
|
endif
|
| 275 |
|
|
|
| 276 |
|
|
# Name of ELF application.
|
| 277 |
|
|
APP_NAME := $(basename $(ELF))
|
| 278 |
|
|
|
| 279 |
|
|
# Set to defaults if variables not already defined in settings.
|
| 280 |
|
|
ifeq ($(LINKER_SCRIPT),)
|
| 281 |
|
|
LINKER_SCRIPT := $(BSP_LINKER_SCRIPT)
|
| 282 |
|
|
endif
|
| 283 |
|
|
ifeq ($(CRT0),)
|
| 284 |
|
|
CRT0 := $(BSP_CRT0)
|
| 285 |
|
|
endif
|
| 286 |
|
|
ifeq ($(SYS_LIB),)
|
| 287 |
|
|
SYS_LIB := $(BSP_SYS_LIB)
|
| 288 |
|
|
endif
|
| 289 |
|
|
|
| 290 |
|
|
OBJDUMP_NAME := $(APP_NAME).objdump
|
| 291 |
|
|
OBJDUMP_FLAGS := --disassemble --syms --all-header
|
| 292 |
|
|
ifeq ($(OBJDUMP_INCLUDE_SOURCE),1)
|
| 293 |
|
|
OBJDUMP_FLAGS += --source
|
| 294 |
|
|
endif
|
| 295 |
|
|
ifeq ($(OBJDUMP_FULL_CONTENTS),1)
|
| 296 |
|
|
OBJDUMP_FLAGS += --full-contents
|
| 297 |
|
|
endif
|
| 298 |
|
|
|
| 299 |
|
|
# Create list of linker dependencies (*.a files).
|
| 300 |
|
|
APP_LDDEPS := $(ALT_LDDEPS) $(LDDEPS)
|
| 301 |
|
|
|
| 302 |
|
|
# Take lists and add required prefixes.
|
| 303 |
|
|
APP_INC_DIRS := $(addprefix -I, $(ALT_INCLUDE_DIRS) $(APP_INCLUDE_DIRS) $(INC_DIRS))
|
| 304 |
|
|
ASM_INC_PREFIX := -Wa,-I
|
| 305 |
|
|
APP_ASM_INC_DIRS := $(addprefix $(ASM_INC_PREFIX), $(ALT_INCLUDE_DIRS) $(APP_INCLUDE_DIRS) $(INC_DIRS))
|
| 306 |
|
|
APP_LIB_DIRS := $(addprefix -L, $(ALT_LIBRARY_DIRS) $(APP_LIBRARY_DIRS) $(LIB_DIRS))
|
| 307 |
|
|
APP_LIBS := $(addprefix -l, $(ALT_LIBRARY_NAMES) $(APP_LIBRARY_NAMES) $(LIBS))
|
| 308 |
|
|
|
| 309 |
|
|
ifneq ($(AVOID_NIOS2_GCC3_OPTIONS),)
|
| 310 |
|
|
|
| 311 |
|
|
#
|
| 312 |
|
|
# Avoid Nios II GCC 3.X options.
|
| 313 |
|
|
#
|
| 314 |
|
|
|
| 315 |
|
|
# Detect if small newlib C library is requested.
|
| 316 |
|
|
# If yes, remove the -msmallc option because it is
|
| 317 |
|
|
# now handled by other means.
|
| 318 |
|
|
ifneq ($(filter -msmallc,$(ALT_LDFLAGS)),)
|
| 319 |
|
|
ALT_LDFLAGS := $(filter-out -msmallc,$(ALT_LDFLAGS))
|
| 320 |
|
|
ALT_C_LIBRARY := smallc
|
| 321 |
|
|
else
|
| 322 |
|
|
ALT_C_LIBRARY := c
|
| 323 |
|
|
endif
|
| 324 |
|
|
|
| 325 |
|
|
# Put each BSP dependent library in a group to avoid circular dependencies.
|
| 326 |
|
|
APP_BSP_DEP_LIBS := $(foreach l,$(ALT_BSP_DEP_LIBRARY_NAMES),-Wl,--start-group -l$(ALT_C_LIBRARY) -lgcc -l$(l) -Wl,--end-group)
|
| 327 |
|
|
|
| 328 |
|
|
else # !AVOID_NIOS2_GCC3_OPTIONS
|
| 329 |
|
|
|
| 330 |
|
|
#
|
| 331 |
|
|
# Use Nios II GCC 3.X options.
|
| 332 |
|
|
#
|
| 333 |
|
|
APP_BSP_DEP_LIBS := $(addprefix -msys-lib=, $(ALT_BSP_DEP_LIBRARY_NAMES))
|
| 334 |
|
|
|
| 335 |
|
|
endif # !AVOID_NIOS2_GCC3_OPTIONS
|
| 336 |
|
|
|
| 337 |
|
|
# Arguments for the C preprocessor, C/C++ compiler, assembler, and linker.
|
| 338 |
|
|
APP_CFLAGS := $(APP_CFLAGS_DEFINED_SYMBOLS) \
|
| 339 |
|
|
$(APP_CFLAGS_UNDEFINED_SYMBOLS) \
|
| 340 |
|
|
$(APP_CFLAGS_OPTIMIZATION) \
|
| 341 |
|
|
$(APP_CFLAGS_DEBUG_LEVEL) \
|
| 342 |
|
|
$(APP_CFLAGS_WARNINGS) \
|
| 343 |
|
|
$(APP_CFLAGS_USER_FLAGS) \
|
| 344 |
|
|
$(ALT_CFLAGS) \
|
| 345 |
|
|
$(CFLAGS)
|
| 346 |
|
|
|
| 347 |
|
|
# Arguments only for the C++ compiler.
|
| 348 |
|
|
APP_CXXFLAGS := $(ALT_CXXFLAGS) $(CXXFLAGS)
|
| 349 |
|
|
|
| 350 |
|
|
# Arguments only for the C preprocessor.
|
| 351 |
|
|
# Prefix each include directory with -I.
|
| 352 |
|
|
APP_CPPFLAGS := $(APP_INC_DIRS) \
|
| 353 |
|
|
$(ALT_CPPFLAGS) \
|
| 354 |
|
|
$(CPPFLAGS)
|
| 355 |
|
|
|
| 356 |
|
|
# Arguments only for the assembler.
|
| 357 |
|
|
APP_ASFLAGS := $(APP_ASM_INC_DIRS) \
|
| 358 |
|
|
$(ALT_ASFLAGS) \
|
| 359 |
|
|
$(APP_ASFLAGS_USER) \
|
| 360 |
|
|
$(ASFLAGS)
|
| 361 |
|
|
|
| 362 |
|
|
# Arguments only for the linker.
|
| 363 |
|
|
APP_LDFLAGS := $(APP_LDFLAGS_USER)
|
| 364 |
|
|
|
| 365 |
|
|
ifneq ($(LINKER_SCRIPT),)
|
| 366 |
|
|
APP_LDFLAGS += -T'$(LINKER_SCRIPT)'
|
| 367 |
|
|
endif
|
| 368 |
|
|
|
| 369 |
|
|
ifneq ($(AVOID_NIOS2_GCC3_OPTIONS),)
|
| 370 |
|
|
|
| 371 |
|
|
# Avoid Nios II GCC 3.x options.
|
| 372 |
|
|
ifneq ($(CRT0),)
|
| 373 |
|
|
APP_LDFLAGS += $(CRT0)
|
| 374 |
|
|
endif
|
| 375 |
|
|
|
| 376 |
|
|
# The equivalent of the -msys-lib option is provided
|
| 377 |
|
|
# by the GROUP() command in the linker script.
|
| 378 |
|
|
# Note this means the SYS_LIB variable is now ignored.
|
| 379 |
|
|
|
| 380 |
|
|
else # !AVOID_NIOS2_GCC3_OPTIONS
|
| 381 |
|
|
|
| 382 |
|
|
# Use Nios II GCC 3.x options.
|
| 383 |
|
|
ifneq ($(CRT0),)
|
| 384 |
|
|
APP_LDFLAGS += -msys-crt0='$(CRT0)'
|
| 385 |
|
|
endif
|
| 386 |
|
|
ifneq ($(SYS_LIB),)
|
| 387 |
|
|
APP_LDFLAGS += -msys-lib=$(SYS_LIB)
|
| 388 |
|
|
endif
|
| 389 |
|
|
|
| 390 |
|
|
endif # !AVOID_NIOS2_GCC3_OPTIONS
|
| 391 |
|
|
|
| 392 |
|
|
APP_LDFLAGS += \
|
| 393 |
|
|
$(APP_LIB_DIRS) \
|
| 394 |
|
|
$(ALT_LDFLAGS) \
|
| 395 |
|
|
$(LDFLAGS)
|
| 396 |
|
|
|
| 397 |
|
|
LINKER_MAP_NAME := $(APP_NAME).map
|
| 398 |
|
|
ifeq ($(CREATE_LINKER_MAP), 1)
|
| 399 |
|
|
APP_LDFLAGS += -Wl,-Map=$(LINKER_MAP_NAME)
|
| 400 |
|
|
endif
|
| 401 |
|
|
|
| 402 |
|
|
# QUARTUS_PROJECT_DIR and SOPC_NAME need to be defined if you want the
|
| 403 |
|
|
# mem_init_install target of the mem_init.mk (located in the associated BSP)
|
| 404 |
|
|
# to know how to copy memory initialization files (e.g. .dat, .hex) into
|
| 405 |
|
|
# directories required for Quartus compilation or RTL simulation.
|
| 406 |
|
|
|
| 407 |
|
|
# Defining QUARTUS_PROJECT_DIR causes mem_init_install to copy memory
|
| 408 |
|
|
# initialization files into your Quartus project directory. This is required
|
| 409 |
|
|
# to provide the initial memory contents of FPGA memories that can be
|
| 410 |
|
|
# initialized by the programming file (.sof) or Hardcopy ROMs. It is also used
|
| 411 |
|
|
# for VHDL simulation of on-chip memories.
|
| 412 |
|
|
|
| 413 |
|
|
# Defining SOPC_NAME causes the mem_init_install target to copy memory
|
| 414 |
|
|
# initialization files into your RTL simulation directory. This is required
|
| 415 |
|
|
# to provide the initial memory contents of all memories that can be
|
| 416 |
|
|
# initialized by RTL simulation. This variable should be set to the same name
|
| 417 |
|
|
# as your SOPC Builder system name. For example, if you have a system called
|
| 418 |
|
|
# "foo.sopc", this variable should be set to "foo".
|
| 419 |
|
|
|
| 420 |
|
|
# If SOPC_NAME is not set and QUARTUS_PROJECT_DIR is set, then derive SOPC_NAME.
|
| 421 |
|
|
ifeq ($(SOPC_NAME),)
|
| 422 |
|
|
ifneq ($(QUARTUS_PROJECT_DIR),)
|
| 423 |
|
|
SOPC_NAME := $(basename $(notdir $(wildcard $(QUARTUS_PROJECT_DIR)/*.sopcinfo)))
|
| 424 |
|
|
endif
|
| 425 |
|
|
endif
|
| 426 |
|
|
|
| 427 |
|
|
# Defining JDI_FILE is required to specify the JTAG Debug Information File
|
| 428 |
|
|
# path. This file is generated by Quartus, and is needed along with the
|
| 429 |
|
|
# .sopcinfo file to resolve processor instance ID's from names in a multi-CPU
|
| 430 |
|
|
# systems. For multi-CPU systems, the processor instance ID is used to select
|
| 431 |
|
|
# from multiple CPU's during ELF download.
|
| 432 |
|
|
|
| 433 |
|
|
# Both JDI_FILE and SOPCINFO_FILE are provided by the BSP if they found during
|
| 434 |
|
|
# BSP creation. If JDI_FILE is not set and QUARTUS_PROJECT_DIR is set, then
|
| 435 |
|
|
# derive JDI_FILE. We do not attempt to derive SOPCINFO_FILE since there may be
|
| 436 |
|
|
# multiple .sopcinfo files in a Quartus project.
|
| 437 |
|
|
ifeq ($(JDI_FILE),)
|
| 438 |
|
|
ifneq ($(QUARTUS_PROJECT_DIR),)
|
| 439 |
|
|
JDI_FILE := $(wildcard $(QUARTUS_PROJECT_DIR)/*.jdi)
|
| 440 |
|
|
endif
|
| 441 |
|
|
endif
|
| 442 |
|
|
|
| 443 |
|
|
# Path to root runtime directory used for hdl simulation
|
| 444 |
|
|
RUNTIME_ROOT_DIR := $(CONFIG_OBJ_DIR)/runtime
|
| 445 |
|
|
|
| 446 |
|
|
|
| 447 |
|
|
|
| 448 |
|
|
#------------------------------------------------------------------------------
|
| 449 |
|
|
# MAKEFILE INCLUDES DEPENDENT ON GENERATED CONTENT
|
| 450 |
|
|
#------------------------------------------------------------------------------
|
| 451 |
|
|
# mem_init.mk is a generated makefile fragment. This file defines all targets
|
| 452 |
|
|
# used to generate HDL initialization simulation files and pre-initialized
|
| 453 |
|
|
# onchip memory files.
|
| 454 |
|
|
MEM_INIT_FILE := $(BSP_ROOT_DIR)/mem_init.mk
|
| 455 |
|
|
include $(MEM_INIT_FILE)
|
| 456 |
|
|
|
| 457 |
|
|
# Create list of object files to be built using the list of source files.
|
| 458 |
|
|
# The source file hierarchy is preserved in the object tree.
|
| 459 |
|
|
# The supported file extensions are:
|
| 460 |
|
|
#
|
| 461 |
|
|
# .c - for C files
|
| 462 |
|
|
# .cxx .cc .cpp - for C++ files
|
| 463 |
|
|
# .S .s - for assembler files
|
| 464 |
|
|
#
|
| 465 |
|
|
# Handle source files specified by --src-dir & --src-rdir differently, to
|
| 466 |
|
|
# save some processing time in calling the adjust-path macro.
|
| 467 |
|
|
|
| 468 |
|
|
OBJ_LIST_C := $(patsubst %.c,%.o,$(filter %.c,$(C_SRCS)))
|
| 469 |
|
|
OBJ_LIST_CPP := $(patsubst %.cpp,%.o,$(filter %.cpp,$(CXX_SRCS)))
|
| 470 |
|
|
OBJ_LIST_CXX := $(patsubst %.cxx,%.o,$(filter %.cxx,$(CXX_SRCS)))
|
| 471 |
|
|
OBJ_LIST_CC := $(patsubst %.cc,%.o,$(filter %.cc,$(CXX_SRCS)))
|
| 472 |
|
|
OBJ_LIST_S := $(patsubst %.S,%.o,$(filter %.S,$(ASM_SRCS)))
|
| 473 |
|
|
OBJ_LIST_SS := $(patsubst %.s,%.o,$(filter %.s,$(ASM_SRCS)))
|
| 474 |
|
|
|
| 475 |
|
|
OBJ_LIST := $(sort $(OBJ_LIST_C) $(OBJ_LIST_CPP) $(OBJ_LIST_CXX) \
|
| 476 |
|
|
$(OBJ_LIST_CC) $(OBJ_LIST_S) $(OBJ_LIST_SS))
|
| 477 |
|
|
|
| 478 |
|
|
SDIR_OBJ_LIST_C := $(patsubst %.c,%.o,$(filter %.c,$(SDIR_C_SRCS)))
|
| 479 |
|
|
SDIR_OBJ_LIST_CPP := $(patsubst %.cpp,%.o,$(filter %.cpp,$(SDIR_CXX_SRCS)))
|
| 480 |
|
|
SDIR_OBJ_LIST_CXX := $(patsubst %.cxx,%.o,$(filter %.cxx,$(SDIR_CXX_SRCS)))
|
| 481 |
|
|
SDIR_OBJ_LIST_CC := $(patsubst %.cc,%.o,$(filter %.cc,$(SDIR_CXX_SRCS)))
|
| 482 |
|
|
SDIR_OBJ_LIST_S := $(patsubst %.S,%.o,$(filter %.S,$(SDIR_ASM_SRCS)))
|
| 483 |
|
|
SDIR_OBJ_LIST_SS := $(patsubst %.s,%.o,$(filter %.s,$(SDIR_ASM_SRCS)))
|
| 484 |
|
|
|
| 485 |
|
|
SDIR_OBJ_LIST := $(sort $(SDIR_OBJ_LIST_C) $(SDIR_OBJ_LIST_CPP) \
|
| 486 |
|
|
$(SDIR_OBJ_LIST_CXX) $(SDIR_OBJ_LIST_CC) $(SDIR_OBJ_LIST_S) \
|
| 487 |
|
|
$(SDIR_OBJ_LIST_SS))
|
| 488 |
|
|
|
| 489 |
|
|
# Relative-pathed objects that being with "../" are handled differently.
|
| 490 |
|
|
#
|
| 491 |
|
|
# Regular objects are created as
|
| 492 |
|
|
# $(CONFIG_OBJ_DIR)//.o
|
| 493 |
|
|
# where the path structure is maintained under the obj directory. This
|
| 494 |
|
|
# applies for both absolute and relative paths; in the absolute path
|
| 495 |
|
|
# case this means the entire source path will be recreated under the obj
|
| 496 |
|
|
# directory. This is done to allow two source files with the same name
|
| 497 |
|
|
# to be included as part of the project.
|
| 498 |
|
|
#
|
| 499 |
|
|
# Note: On Cygwin, the path recreated under the obj directory will be
|
| 500 |
|
|
# the cygpath -u output path.
|
| 501 |
|
|
#
|
| 502 |
|
|
# Relative-path objects that begin with "../" cause problems under this
|
| 503 |
|
|
# scheme, as $(CONFIG_OBJ_DIR)/..// can potentially put the object
|
| 504 |
|
|
# files anywhere in the system, creating clutter and polluting the source tree.
|
| 505 |
|
|
# As such, their paths are flattened - the object file created will be
|
| 506 |
|
|
# $(CONFIG_OBJ_DIR)/.o. Due to this, two files specified with
|
| 507 |
|
|
# "../" in the beginning cannot have the same name in the project. VPATH
|
| 508 |
|
|
# will be set for these sources to allow make to relocate the source file
|
| 509 |
|
|
# via %.o rules.
|
| 510 |
|
|
#
|
| 511 |
|
|
# The following lines separate the object list into the flatten and regular
|
| 512 |
|
|
# lists, and then handles them as appropriate.
|
| 513 |
|
|
|
| 514 |
|
|
FLATTEN_OBJ_LIST := $(filter ../%,$(OBJ_LIST))
|
| 515 |
|
|
FLATTEN_APP_OBJS := $(addprefix $(CONFIG_OBJ_DIR)/,$(notdir $(FLATTEN_OBJ_LIST)))
|
| 516 |
|
|
|
| 517 |
|
|
REGULAR_OBJ_LIST := $(filter-out $(FLATTEN_OBJ_LIST),$(OBJ_LIST))
|
| 518 |
|
|
REGULAR_OBJ_LIST_C := $(filter $(OBJ_LIST_C),$(REGULAR_OBJ_LIST))
|
| 519 |
|
|
REGULAR_OBJ_LIST_CPP := $(filter $(OBJ_LIST_CPP),$(REGULAR_OBJ_LIST))
|
| 520 |
|
|
REGULAR_OBJ_LIST_CXX := $(filter $(OBJ_LIST_CXX),$(REGULAR_OBJ_LIST))
|
| 521 |
|
|
REGULAR_OBJ_LIST_CC := $(filter $(OBJ_LIST_CC),$(REGULAR_OBJ_LIST))
|
| 522 |
|
|
REGULAR_OBJ_LIST_S := $(filter $(OBJ_LIST_S),$(REGULAR_OBJ_LIST))
|
| 523 |
|
|
REGULAR_OBJ_LIST_SS := $(filter $(OBJ_LIST_SS),$(REGULAR_OBJ_LIST))
|
| 524 |
|
|
|
| 525 |
|
|
FLATTEN_SDIR_OBJ_LIST := $(filter ../%,$(SDIR_OBJ_LIST))
|
| 526 |
|
|
FLATTEN_SDIR_APP_OBJS := $(addprefix $(CONFIG_OBJ_DIR)/,$(notdir $(FLATTEN_SDIR_OBJ_LIST)))
|
| 527 |
|
|
|
| 528 |
|
|
REGULAR_SDIR_OBJ_LIST := $(filter-out $(FLATTEN_SDIR_OBJ_LIST),$(SDIR_OBJ_LIST))
|
| 529 |
|
|
REGULAR_SDIR_OBJ_LIST_C := $(filter $(SDIR_OBJ_LIST_C),$(REGULAR_SDIR_OBJ_LIST))
|
| 530 |
|
|
REGULAR_SDIR_OBJ_LIST_CPP := $(filter $(SDIR_OBJ_LIST_CPP),$(REGULAR_SDIR_OBJ_LIST))
|
| 531 |
|
|
REGULAR_SDIR_OBJ_LIST_CXX := $(filter $(SDIR_OBJ_LIST_CXX),$(REGULAR_SDIR_OBJ_LIST))
|
| 532 |
|
|
REGULAR_SDIR_OBJ_LIST_CC := $(filter $(SDIR_OBJ_LIST_CC),$(REGULAR_SDIR_OBJ_LIST))
|
| 533 |
|
|
REGULAR_SDIR_OBJ_LIST_S := $(filter $(SDIR_OBJ_LIST_S),$(REGULAR_SDIR_OBJ_LIST))
|
| 534 |
|
|
REGULAR_SDIR_OBJ_LIST_SS := $(filter $(SDIR_OBJ_LIST_SS),$(REGULAR_SDIR_OBJ_LIST))
|
| 535 |
|
|
|
| 536 |
|
|
VPATH := $(sort $(dir $(FLATTEN_OBJ_LIST)) $(dir $(FLATTEN_SDIR_OBJ_LIST)))
|
| 537 |
|
|
|
| 538 |
|
|
APP_OBJS_C := $(addprefix $(CONFIG_OBJ_DIR)/,\
|
| 539 |
|
|
$(REGULAR_SDIR_OBJ_LIST_C) \
|
| 540 |
|
|
$(foreach s,$(REGULAR_OBJ_LIST_C),$(call adjust-path,$s)))
|
| 541 |
|
|
|
| 542 |
|
|
APP_OBJS_CPP := $(addprefix $(CONFIG_OBJ_DIR)/,\
|
| 543 |
|
|
$(REGULAR_SDIR_OBJ_LIST_CPP) \
|
| 544 |
|
|
$(foreach s,$(REGULAR_OBJ_LIST_CPP),$(call adjust-path,$s)))
|
| 545 |
|
|
|
| 546 |
|
|
APP_OBJS_CXX := $(addprefix $(CONFIG_OBJ_DIR)/,\
|
| 547 |
|
|
$(REGULAR_SDIR_OBJ_LIST_CXX) \
|
| 548 |
|
|
$(foreach s,$(REGULAR_OBJ_LIST_CXX),$(call adjust-path,$s)))
|
| 549 |
|
|
|
| 550 |
|
|
APP_OBJS_CC := $(addprefix $(CONFIG_OBJ_DIR)/,\
|
| 551 |
|
|
$(REGULAR_SDIR_OBJ_LIST_CC) \
|
| 552 |
|
|
$(foreach s,$(REGULAR_OBJ_LIST_CC),$(call adjust-path,$s)))
|
| 553 |
|
|
|
| 554 |
|
|
APP_OBJS_S := $(addprefix $(CONFIG_OBJ_DIR)/,\
|
| 555 |
|
|
$(REGULAR_SDIR_OBJ_LIST_S) \
|
| 556 |
|
|
$(foreach s,$(REGULAR_OBJ_LIST_S),$(call adjust-path,$s)))
|
| 557 |
|
|
|
| 558 |
|
|
APP_OBJS_SS := $(addprefix $(CONFIG_OBJ_DIR)/,\
|
| 559 |
|
|
$(REGULAR_SDIR_OBJ_LIST_SS) \
|
| 560 |
|
|
$(foreach s,$(REGULAR_OBJ_LIST_SS),$(call adjust-path,$s)))
|
| 561 |
|
|
|
| 562 |
|
|
APP_OBJS := $(APP_OBJS_C) $(APP_OBJS_CPP) $(APP_OBJS_CXX) $(APP_OBJS_CC) \
|
| 563 |
|
|
$(APP_OBJS_S) $(APP_OBJS_SS) \
|
| 564 |
|
|
$(FLATTEN_APP_OBJS) $(FLATTEN_SDIR_APP_OBJS)
|
| 565 |
|
|
|
| 566 |
|
|
# Add any extra user-provided object files.
|
| 567 |
|
|
APP_OBJS += $(OBJS)
|
| 568 |
|
|
|
| 569 |
|
|
# Create list of dependancy files for each object file.
|
| 570 |
|
|
APP_DEPS := $(APP_OBJS:.o=.d)
|
| 571 |
|
|
|
| 572 |
|
|
# Patch the Elf file with system specific information
|
| 573 |
|
|
|
| 574 |
|
|
# Patch the Elf with the name of the sopc system
|
| 575 |
|
|
ifneq ($(SOPC_NAME),)
|
| 576 |
|
|
ELF_PATCH_FLAG += --sopc_system_name $(SOPC_NAME)
|
| 577 |
|
|
endif
|
| 578 |
|
|
|
| 579 |
|
|
# Patch the Elf with the absolute path to the Quartus Project Directory
|
| 580 |
|
|
ifneq ($(QUARTUS_PROJECT_DIR),)
|
| 581 |
|
|
ABS_QUARTUS_PROJECT_DIR := $(call adjust-path-mixed,$(shell cd "$(QUARTUS_PROJECT_DIR)"; pwd))
|
| 582 |
|
|
ELF_PATCH_FLAG += --quartus_project_dir "$(ABS_QUARTUS_PROJECT_DIR)"
|
| 583 |
|
|
endif
|
| 584 |
|
|
|
| 585 |
|
|
# Patch the Elf and download args with the JDI_FILE if specified
|
| 586 |
|
|
ifneq ($(wildcard $(JDI_FILE)),)
|
| 587 |
|
|
ELF_PATCH_FLAG += --jdi $(JDI_FILE)
|
| 588 |
|
|
DOWNLOAD_JDI_FLAG := --jdi $(JDI_FILE)
|
| 589 |
|
|
endif
|
| 590 |
|
|
|
| 591 |
|
|
# Patch the Elf with the SOPCINFO_FILE if specified
|
| 592 |
|
|
ifneq ($(wildcard $(SOPCINFO_FILE)),)
|
| 593 |
|
|
ELF_PATCH_FLAG += --sopcinfo $(SOPCINFO_FILE)
|
| 594 |
|
|
endif
|
| 595 |
|
|
|
| 596 |
|
|
# Use the DOWNLOAD_CABLE variable to specify which JTAG cable to use.
|
| 597 |
|
|
# This is not needed if you only have one cable.
|
| 598 |
|
|
ifneq ($(DOWNLOAD_CABLE),)
|
| 599 |
|
|
DOWNLOAD_CABLE_FLAG := --cable '$(DOWNLOAD_CABLE)'
|
| 600 |
|
|
endif
|
| 601 |
|
|
|
| 602 |
|
|
|
| 603 |
|
|
#------------------------------------------------------------------------------
|
| 604 |
|
|
# BUILD PRE/POST PROCESS
|
| 605 |
|
|
#------------------------------------------------------------------------------
|
| 606 |
|
|
build_pre_process :
|
| 607 |
|
|
$(BUILD_PRE_PROCESS)
|
| 608 |
|
|
|
| 609 |
|
|
build_post_process :
|
| 610 |
|
|
$(BUILD_POST_PROCESS)
|
| 611 |
|
|
|
| 612 |
|
|
.PHONY: build_pre_process build_post_process
|
| 613 |
|
|
|
| 614 |
|
|
|
| 615 |
|
|
#------------------------------------------------------------------------------
|
| 616 |
|
|
# TOOLS
|
| 617 |
|
|
#------------------------------------------------------------------------------
|
| 618 |
|
|
|
| 619 |
|
|
#
|
| 620 |
|
|
# Set tool default variables if not already defined.
|
| 621 |
|
|
# If these are defined, they would typically be defined in an
|
| 622 |
|
|
# included makefile fragment.
|
| 623 |
|
|
#
|
| 624 |
|
|
ifeq ($(DEFAULT_CROSS_COMPILE),)
|
| 625 |
|
|
DEFAULT_CROSS_COMPILE := nios2-elf-
|
| 626 |
|
|
endif
|
| 627 |
|
|
|
| 628 |
|
|
ifeq ($(DEFAULT_STACKREPORT),)
|
| 629 |
|
|
DEFAULT_STACKREPORT := nios2-stackreport
|
| 630 |
|
|
endif
|
| 631 |
|
|
|
| 632 |
|
|
ifeq ($(DEFAULT_DOWNLOAD),)
|
| 633 |
|
|
DEFAULT_DOWNLOAD := nios2-download
|
| 634 |
|
|
endif
|
| 635 |
|
|
|
| 636 |
|
|
ifeq ($(DEFAULT_FLASHPROG),)
|
| 637 |
|
|
DEFAULT_FLASHPROG := nios2-flash-programmer
|
| 638 |
|
|
endif
|
| 639 |
|
|
|
| 640 |
|
|
ifeq ($(DEFAULT_ELFPATCH),)
|
| 641 |
|
|
DEFAULT_ELFPATCH := nios2-elf-insert
|
| 642 |
|
|
endif
|
| 643 |
|
|
|
| 644 |
|
|
ifeq ($(DEFAULT_RM),)
|
| 645 |
|
|
DEFAULT_RM := rm -f
|
| 646 |
|
|
endif
|
| 647 |
|
|
|
| 648 |
|
|
ifeq ($(DEFAULT_CP),)
|
| 649 |
|
|
DEFAULT_CP := cp -f
|
| 650 |
|
|
endif
|
| 651 |
|
|
|
| 652 |
|
|
ifeq ($(DEFAULT_MKDIR),)
|
| 653 |
|
|
DEFAULT_MKDIR := mkdir -p
|
| 654 |
|
|
endif
|
| 655 |
|
|
|
| 656 |
|
|
#
|
| 657 |
|
|
# Set tool variables to defaults if not already defined.
|
| 658 |
|
|
# If these are defined, they would typically be defined by a
|
| 659 |
|
|
# setting in the generated portion of this makefile.
|
| 660 |
|
|
#
|
| 661 |
|
|
ifeq ($(CROSS_COMPILE),)
|
| 662 |
|
|
CROSS_COMPILE := $(DEFAULT_CROSS_COMPILE)
|
| 663 |
|
|
endif
|
| 664 |
|
|
|
| 665 |
|
|
ifeq ($(origin CC),default)
|
| 666 |
|
|
CC := $(CROSS_COMPILE)gcc -xc
|
| 667 |
|
|
endif
|
| 668 |
|
|
|
| 669 |
|
|
ifeq ($(origin CXX),default)
|
| 670 |
|
|
CXX := $(CROSS_COMPILE)gcc -xc++
|
| 671 |
|
|
endif
|
| 672 |
|
|
|
| 673 |
|
|
ifeq ($(origin AS),default)
|
| 674 |
|
|
AS := $(CROSS_COMPILE)gcc
|
| 675 |
|
|
endif
|
| 676 |
|
|
|
| 677 |
|
|
ifeq ($(origin AR),default)
|
| 678 |
|
|
AR := $(CROSS_COMPILE)ar
|
| 679 |
|
|
endif
|
| 680 |
|
|
|
| 681 |
|
|
ifeq ($(origin LD),default)
|
| 682 |
|
|
LD := $(CROSS_COMPILE)g++
|
| 683 |
|
|
endif
|
| 684 |
|
|
|
| 685 |
|
|
ifeq ($(origin RM),default)
|
| 686 |
|
|
RM := $(DEFAULT_RM)
|
| 687 |
|
|
endif
|
| 688 |
|
|
|
| 689 |
|
|
ifeq ($(NM),)
|
| 690 |
|
|
NM := $(CROSS_COMPILE)nm
|
| 691 |
|
|
endif
|
| 692 |
|
|
|
| 693 |
|
|
ifeq ($(CP),)
|
| 694 |
|
|
CP := $(DEFAULT_CP)
|
| 695 |
|
|
endif
|
| 696 |
|
|
|
| 697 |
|
|
ifeq ($(OBJDUMP),)
|
| 698 |
|
|
OBJDUMP := $(CROSS_COMPILE)objdump
|
| 699 |
|
|
endif
|
| 700 |
|
|
|
| 701 |
|
|
ifeq ($(OBJCOPY),)
|
| 702 |
|
|
OBJCOPY := $(CROSS_COMPILE)objcopy
|
| 703 |
|
|
endif
|
| 704 |
|
|
|
| 705 |
|
|
ifeq ($(STACKREPORT),)
|
| 706 |
|
|
STACKREPORT := $(DEFAULT_STACKREPORT) --prefix $(CROSS_COMPILE)
|
| 707 |
|
|
else
|
| 708 |
|
|
DISABLE_STACKREPORT := 1
|
| 709 |
|
|
endif
|
| 710 |
|
|
|
| 711 |
|
|
ifeq ($(DOWNLOAD),)
|
| 712 |
|
|
DOWNLOAD := $(DEFAULT_DOWNLOAD)
|
| 713 |
|
|
endif
|
| 714 |
|
|
|
| 715 |
|
|
ifeq ($(FLASHPROG),)
|
| 716 |
|
|
FLASHPROG := $(DEFAULT_FLASHPROG)
|
| 717 |
|
|
endif
|
| 718 |
|
|
|
| 719 |
|
|
ifeq ($(ELFPATCH),)
|
| 720 |
|
|
ELFPATCH := $(DEFAULT_ELFPATCH)
|
| 721 |
|
|
endif
|
| 722 |
|
|
|
| 723 |
|
|
ifeq ($(MKDIR),)
|
| 724 |
|
|
MKDIR := $(DEFAULT_MKDIR)
|
| 725 |
|
|
endif
|
| 726 |
|
|
|
| 727 |
|
|
#------------------------------------------------------------------------------
|
| 728 |
|
|
# PATTERN RULES TO BUILD OBJECTS
|
| 729 |
|
|
#------------------------------------------------------------------------------
|
| 730 |
|
|
|
| 731 |
|
|
define compile.c
|
| 732 |
|
|
@$(ECHO) Info: Compiling $< to $@
|
| 733 |
|
|
@$(MKDIR) $(@D)
|
| 734 |
|
|
$(CC) -MP -MMD -c $(APP_CPPFLAGS) $(APP_CFLAGS) -o $@ $<
|
| 735 |
|
|
$(CC_POST_PROCESS)
|
| 736 |
|
|
endef
|
| 737 |
|
|
|
| 738 |
|
|
define compile.cpp
|
| 739 |
|
|
@$(ECHO) Info: Compiling $< to $@
|
| 740 |
|
|
@$(MKDIR) $(@D)
|
| 741 |
|
|
$(CXX) -MP -MMD -c $(APP_CPPFLAGS) $(APP_CXXFLAGS) $(APP_CFLAGS) -o $@ $<
|
| 742 |
|
|
$(CXX_POST_PROCESS)
|
| 743 |
|
|
endef
|
| 744 |
|
|
|
| 745 |
|
|
# If assembling with the compiler, ensure "-Wa," is prepended to all APP_ASFLAGS
|
| 746 |
|
|
ifeq ($(AS),$(patsubst %as,%,$(AS)))
|
| 747 |
|
|
COMMA := ,
|
| 748 |
|
|
APP_ASFLAGS := $(filter-out $(APP_CFLAGS),$(addprefix -Wa$(COMMA),$(patsubst -Wa$(COMMA)%,%,$(APP_ASFLAGS))))
|
| 749 |
|
|
endif
|
| 750 |
|
|
|
| 751 |
|
|
define compile.s
|
| 752 |
|
|
@$(ECHO) Info: Assembling $< to $@
|
| 753 |
|
|
@$(MKDIR) $(@D)
|
| 754 |
|
|
$(AS) -MP -MMD -c $(APP_CPPFLAGS) $(APP_CFLAGS) $(APP_ASFLAGS) -o $@ $<
|
| 755 |
|
|
$(AS_POST_PROCESS)
|
| 756 |
|
|
endef
|
| 757 |
|
|
|
| 758 |
|
|
ifeq ($(MAKE_VERSION),3.81)
|
| 759 |
|
|
.SECONDEXPANSION:
|
| 760 |
|
|
|
| 761 |
|
|
$(APP_OBJS_C): $(CONFIG_OBJ_DIR)/%.o: $$(call adjust-path-mixed,%.c)
|
| 762 |
|
|
$(compile.c)
|
| 763 |
|
|
|
| 764 |
|
|
$(APP_OBJS_CPP): $(CONFIG_OBJ_DIR)/%.o: $$(call adjust-path-mixed,%.cpp)
|
| 765 |
|
|
$(compile.cpp)
|
| 766 |
|
|
|
| 767 |
|
|
$(APP_OBJS_CC): $(CONFIG_OBJ_DIR)/%.o: $$(call adjust-path-mixed,%.cc)
|
| 768 |
|
|
$(compile.cpp)
|
| 769 |
|
|
|
| 770 |
|
|
$(APP_OBJS_CXX): $(CONFIG_OBJ_DIR)/%.o: $$(call adjust-path-mixed,%.cxx)
|
| 771 |
|
|
$(compile.cpp)
|
| 772 |
|
|
|
| 773 |
|
|
$(APP_OBJS_S): $(CONFIG_OBJ_DIR)/%.o: $$(call adjust-path-mixed,%.S)
|
| 774 |
|
|
$(compile.s)
|
| 775 |
|
|
|
| 776 |
|
|
$(APP_OBJS_SS): $(CONFIG_OBJ_DIR)/%.o: $$(call adjust-path-mixed,%.s)
|
| 777 |
|
|
$(compile.s)
|
| 778 |
|
|
|
| 779 |
|
|
endif # MAKE_VERSION != 3.81
|
| 780 |
|
|
|
| 781 |
|
|
$(CONFIG_OBJ_DIR)/%.o: %.c
|
| 782 |
|
|
$(compile.c)
|
| 783 |
|
|
|
| 784 |
|
|
$(CONFIG_OBJ_DIR)/%.o: %.cpp
|
| 785 |
|
|
$(compile.cpp)
|
| 786 |
|
|
|
| 787 |
|
|
$(CONFIG_OBJ_DIR)/%.o: %.cc
|
| 788 |
|
|
$(compile.cpp)
|
| 789 |
|
|
|
| 790 |
|
|
$(CONFIG_OBJ_DIR)/%.o: %.cxx
|
| 791 |
|
|
$(compile.cpp)
|
| 792 |
|
|
|
| 793 |
|
|
$(CONFIG_OBJ_DIR)/%.o: %.S
|
| 794 |
|
|
$(compile.s)
|
| 795 |
|
|
|
| 796 |
|
|
$(CONFIG_OBJ_DIR)/%.o: %.s
|
| 797 |
|
|
$(compile.s)
|
| 798 |
|
|
|
| 799 |
|
|
|
| 800 |
|
|
#------------------------------------------------------------------------------
|
| 801 |
|
|
# PATTERN RULES TO INTERMEDIATE FILES
|
| 802 |
|
|
#------------------------------------------------------------------------------
|
| 803 |
|
|
|
| 804 |
|
|
$(CONFIG_OBJ_DIR)/%.s: %.c
|
| 805 |
|
|
@$(ECHO) Info: Compiling $< to $@
|
| 806 |
|
|
@$(MKDIR) $(@D)
|
| 807 |
|
|
$(CC) -S $(APP_CPPFLAGS) $(APP_CFLAGS) -o $@ $<
|
| 808 |
|
|
|
| 809 |
|
|
$(CONFIG_OBJ_DIR)/%.s: %.cpp
|
| 810 |
|
|
@$(ECHO) Info: Compiling $< to $@
|
| 811 |
|
|
@$(MKDIR) $(@D)
|
| 812 |
|
|
$(CXX) -S $(APP_CPPFLAGS) $(APP_CXXFLAGS) $(APP_CFLAGS) -o $@ $<
|
| 813 |
|
|
|
| 814 |
|
|
$(CONFIG_OBJ_DIR)/%.s: %.cc
|
| 815 |
|
|
@$(ECHO) Info: Compiling $< to $@
|
| 816 |
|
|
@$(MKDIR) $(@D)
|
| 817 |
|
|
$(CXX) -S $(APP_CPPFLAGS) $(APP_CXXFLAGS) $(APP_CFLAGS) -o $@ $<
|
| 818 |
|
|
|
| 819 |
|
|
$(CONFIG_OBJ_DIR)/%.s: %.cxx
|
| 820 |
|
|
@$(ECHO) Info: Compiling $< to $@
|
| 821 |
|
|
@$(MKDIR) $(@D)
|
| 822 |
|
|
$(CXX) -S $(APP_CPPFLAGS) $(APP_CXXFLAGS) $(APP_CFLAGS) -o $@ $<
|
| 823 |
|
|
|
| 824 |
|
|
$(CONFIG_OBJ_DIR)/%.i: %.c
|
| 825 |
|
|
@$(ECHO) Info: Compiling $< to $@
|
| 826 |
|
|
@$(MKDIR) $(@D)
|
| 827 |
|
|
$(CC) -E $(APP_CPPFLAGS) $(APP_CFLAGS) -o $@ $<
|
| 828 |
|
|
|
| 829 |
|
|
$(CONFIG_OBJ_DIR)/%.i: %.cpp
|
| 830 |
|
|
@$(ECHO) Info: Compiling $< to $@
|
| 831 |
|
|
@$(MKDIR) $(@D)
|
| 832 |
|
|
$(CXX) -E $(APP_CPPFLAGS) $(APP_CXXFLAGS) $(APP_CFLAGS) -o $@ $<
|
| 833 |
|
|
|
| 834 |
|
|
$(CONFIG_OBJ_DIR)/%.i: %.cc
|
| 835 |
|
|
@$(ECHO) Info: Compiling $< to $@
|
| 836 |
|
|
@$(MKDIR) $(@D)
|
| 837 |
|
|
$(CXX) -E $(APP_CPPFLAGS) $(APP_CXXFLAGS) $(APP_CFLAGS) -o $@ $<
|
| 838 |
|
|
|
| 839 |
|
|
$(CONFIG_OBJ_DIR)/%.i: %.cxx
|
| 840 |
|
|
@$(ECHO) Info: Compiling $< to $@
|
| 841 |
|
|
@$(MKDIR) $(@D)
|
| 842 |
|
|
$(CXX) -E $(APP_CPPFLAGS) $(APP_CXXFLAGS) $(APP_CFLAGS) -o $@ $<
|
| 843 |
|
|
|
| 844 |
|
|
|
| 845 |
|
|
#------------------------------------------------------------------------------
|
| 846 |
|
|
# TARGET RULES
|
| 847 |
|
|
#------------------------------------------------------------------------------
|
| 848 |
|
|
|
| 849 |
|
|
.PHONY : help
|
| 850 |
|
|
help :
|
| 851 |
|
|
@$(ECHO) "Summary of Makefile targets"
|
| 852 |
|
|
@$(ECHO) " Build targets:"
|
| 853 |
|
|
@$(ECHO) " all (default) - Application and all libraries (including BSP)"
|
| 854 |
|
|
@$(ECHO) " bsp - Just the BSP"
|
| 855 |
|
|
@$(ECHO) " libs - All libraries (including BSP)"
|
| 856 |
|
|
@$(ECHO) " flash - All flash files"
|
| 857 |
|
|
@$(ECHO) " mem_init_generate - All memory initialization files"
|
| 858 |
|
|
ifeq ($(QSYS),1)
|
| 859 |
|
|
@$(ECHO) " mem_init_install - This target is deprecated for QSys Systems"
|
| 860 |
|
|
@$(ECHO) " --> Use the mem_init_generate target and then"
|
| 861 |
|
|
@$(ECHO) " add the generated meminit.qip file to your"
|
| 862 |
|
|
@$(ECHO) " Quartus II Project."
|
| 863 |
|
|
else # if QSYS != 1
|
| 864 |
|
|
@$(ECHO) " mem_init_install - Copy memory initialization files to Quartus II project"
|
| 865 |
|
|
endif # QSYS == 1
|
| 866 |
|
|
@$(ECHO)
|
| 867 |
|
|
@$(ECHO) " Clean targets:"
|
| 868 |
|
|
@$(ECHO) " clean_all - Application and all libraries (including BSP)"
|
| 869 |
|
|
@$(ECHO) " clean - Just the application"
|
| 870 |
|
|
@$(ECHO) " clean_bsp - Just the BSP"
|
| 871 |
|
|
@$(ECHO) " clean_libs - All libraries (including BSP)"
|
| 872 |
|
|
@$(ECHO)
|
| 873 |
|
|
@$(ECHO) " Run targets:"
|
| 874 |
|
|
@$(ECHO) " download-elf - Download and run your elf executable"
|
| 875 |
|
|
@$(ECHO) " program-flash - Program flash contents to the board"
|
| 876 |
|
|
|
| 877 |
|
|
# Handy rule to skip making libraries and just make application.
|
| 878 |
|
|
.PHONY : app
|
| 879 |
|
|
app : $(ELF)
|
| 880 |
|
|
|
| 881 |
|
|
ifeq ($(CREATE_OBJDUMP), 1)
|
| 882 |
|
|
app : $(OBJDUMP_NAME)
|
| 883 |
|
|
endif
|
| 884 |
|
|
|
| 885 |
|
|
ifeq ($(CREATE_ELF_DERIVED_FILES),1)
|
| 886 |
|
|
app : elf_derived_files
|
| 887 |
|
|
endif
|
| 888 |
|
|
|
| 889 |
|
|
.PHONY: elf_derived_files
|
| 890 |
|
|
elf_derived_files: default_mem_init
|
| 891 |
|
|
|
| 892 |
|
|
# Handy rule for making just the BSP.
|
| 893 |
|
|
.PHONY : bsp
|
| 894 |
|
|
bsp :
|
| 895 |
|
|
@$(ECHO) Info: Building $(BSP_ROOT_DIR)
|
| 896 |
|
|
@$(MAKE) --no-print-directory -C $(BSP_ROOT_DIR)
|
| 897 |
|
|
|
| 898 |
|
|
|
| 899 |
|
|
# Make sure all makeable libraries (including the BSP) are up-to-date.
|
| 900 |
|
|
LIB_TARGETS := $(patsubst %,%-recurs-make-lib,$(MAKEABLE_LIBRARY_ROOT_DIRS))
|
| 901 |
|
|
|
| 902 |
|
|
.PHONY : libs
|
| 903 |
|
|
libs : $(LIB_TARGETS)
|
| 904 |
|
|
|
| 905 |
|
|
ifneq ($(strip $(LIB_TARGETS)),)
|
| 906 |
|
|
$(LIB_TARGETS): %-recurs-make-lib:
|
| 907 |
|
|
@$(ECHO) Info: Building $*
|
| 908 |
|
|
$(MAKE) --no-print-directory -C $*
|
| 909 |
|
|
endif
|
| 910 |
|
|
|
| 911 |
|
|
ifneq ($(strip $(APP_LDDEPS)),)
|
| 912 |
|
|
$(APP_LDDEPS): libs
|
| 913 |
|
|
@true
|
| 914 |
|
|
endif
|
| 915 |
|
|
|
| 916 |
|
|
# Rules to force your project to rebuild or relink
|
| 917 |
|
|
# .force_relink file will cause any application that depends on this project to relink
|
| 918 |
|
|
# .force_rebuild file will cause this project to rebuild object files
|
| 919 |
|
|
# .force_rebuild_all file will cause this project and any project that depends on this project to rebuild object files
|
| 920 |
|
|
|
| 921 |
|
|
FORCE_RELINK_DEP := .force_relink
|
| 922 |
|
|
FORCE_REBUILD_DEP := .force_rebuild
|
| 923 |
|
|
FORCE_REBUILD_ALL_DEP := .force_rebuild_all
|
| 924 |
|
|
FORCE_REBUILD_DEP_LIST := $(CONFIG_OBJ_DIR)/$(FORCE_RELINK_DEP) $(CONFIG_OBJ_DIR)/$(FORCE_REBUILD_DEP) $(FORCE_REBUILD_ALL_DEP)
|
| 925 |
|
|
|
| 926 |
|
|
$(FORCE_REBUILD_DEP_LIST):
|
| 927 |
|
|
|
| 928 |
|
|
$(APP_OBJS): $(wildcard $(CONFIG_OBJ_DIR)/$(FORCE_REBUILD_DEP)) $(wildcard $(addsuffix /$(FORCE_REBUILD_ALL_DEP), . $(ALT_LIBRARY_DIRS)))
|
| 929 |
|
|
|
| 930 |
|
|
$(ELF): $(wildcard $(addsuffix /$(FORCE_RELINK_DEP), $(CONFIG_OBJ_DIR) $(ALT_LIBRARY_DIRS)))
|
| 931 |
|
|
|
| 932 |
|
|
|
| 933 |
|
|
# Clean just the application.
|
| 934 |
|
|
.PHONY : clean
|
| 935 |
|
|
ifeq ($(CREATE_ELF_DERIVED_FILES),1)
|
| 936 |
|
|
clean : clean_elf_derived_files
|
| 937 |
|
|
endif
|
| 938 |
|
|
|
| 939 |
|
|
clean :
|
| 940 |
|
|
@$(RM) -r $(ELF) $(OBJDUMP_NAME) $(LINKER_MAP_NAME) $(OBJ_ROOT_DIR) $(RUNTIME_ROOT_DIR) $(FORCE_REBUILD_DEP_LIST)
|
| 941 |
|
|
@$(ECHO) [$(APP_NAME) clean complete]
|
| 942 |
|
|
|
| 943 |
|
|
# Clean just the BSP.
|
| 944 |
|
|
.PHONY : clean_bsp
|
| 945 |
|
|
clean_bsp :
|
| 946 |
|
|
@$(ECHO) Info: Cleaning $(BSP_ROOT_DIR)
|
| 947 |
|
|
@$(MAKE) --no-print-directory -C $(BSP_ROOT_DIR) clean
|
| 948 |
|
|
|
| 949 |
|
|
# Clean all makeable libraries including the BSP.
|
| 950 |
|
|
LIB_CLEAN_TARGETS := $(patsubst %,%-recurs-make-clean-lib,$(MAKEABLE_LIBRARY_ROOT_DIRS))
|
| 951 |
|
|
|
| 952 |
|
|
.PHONY : clean_libs
|
| 953 |
|
|
clean_libs : $(LIB_CLEAN_TARGETS)
|
| 954 |
|
|
|
| 955 |
|
|
ifneq ($(strip $(LIB_CLEAN_TARGETS)),)
|
| 956 |
|
|
$(LIB_CLEAN_TARGETS): %-recurs-make-clean-lib:
|
| 957 |
|
|
@$(ECHO) Info: Cleaning $*
|
| 958 |
|
|
$(MAKE) --no-print-directory -C $* clean
|
| 959 |
|
|
endif
|
| 960 |
|
|
|
| 961 |
|
|
.PHONY: clean_elf_derived_files
|
| 962 |
|
|
clean_elf_derived_files: mem_init_clean
|
| 963 |
|
|
|
| 964 |
|
|
# Clean application and all makeable libraries including the BSP.
|
| 965 |
|
|
.PHONY : clean_all
|
| 966 |
|
|
clean_all : clean mem_init_clean clean_libs
|
| 967 |
|
|
|
| 968 |
|
|
# Include the dependency files unless the make goal is performing a clean
|
| 969 |
|
|
# of the application.
|
| 970 |
|
|
ifneq ($(firstword $(MAKECMDGOALS)),clean)
|
| 971 |
|
|
ifneq ($(firstword $(MAKECMDGOALS)),clean_all)
|
| 972 |
|
|
-include $(APP_DEPS)
|
| 973 |
|
|
endif
|
| 974 |
|
|
endif
|
| 975 |
|
|
|
| 976 |
|
|
.PHONY : download-elf
|
| 977 |
|
|
download-elf : $(ELF)
|
| 978 |
|
|
@if [ "$(DOWNLOAD)" = "none" ]; \
|
| 979 |
|
|
then \
|
| 980 |
|
|
$(ECHO) Downloading $(ELF) not supported; \
|
| 981 |
|
|
else \
|
| 982 |
|
|
$(ECHO) Info: Downloading $(ELF); \
|
| 983 |
|
|
$(DOWNLOAD) --go --cpu_name=$(CPU_NAME) $(DOWNLOAD_CABLE_FLAG) $(SOPC_SYSID_FLAG) $(DOWNLOAD_JDI_FLAG) $(WRITE_GMON_OPTION) $(ELF); \
|
| 984 |
|
|
fi
|
| 985 |
|
|
|
| 986 |
|
|
# Delete the target of a rule if it has changed and its commands exit
|
| 987 |
|
|
# with a nonzero exit status.
|
| 988 |
|
|
.DELETE_ON_ERROR:
|
| 989 |
|
|
|
| 990 |
|
|
# Rules for flash programming commands
|
| 991 |
|
|
PROGRAM_FLASH_SUFFIX := -program
|
| 992 |
|
|
PROGRAM_FLASH_TARGET := $(addsuffix $(PROGRAM_FLASH_SUFFIX), $(FLASH_FILES))
|
| 993 |
|
|
|
| 994 |
|
|
.PHONY : program-flash
|
| 995 |
|
|
program-flash : $(PROGRAM_FLASH_TARGET)
|
| 996 |
|
|
|
| 997 |
|
|
.PHONY : $(PROGRAM_FLASH_TARGET)
|
| 998 |
|
|
$(PROGRAM_FLASH_TARGET) : flash
|
| 999 |
|
|
@if [ "$(FLASHPROG)" = "none" ]; \
|
| 1000 |
|
|
then \
|
| 1001 |
|
|
$(ECHO) Programming flash not supported; \
|
| 1002 |
|
|
else \
|
| 1003 |
|
|
$(ECHO) Info: Programming $(basename $@).flash; \
|
| 1004 |
|
|
if [ -z "$($(basename $@)_EPCS_FLAGS)" ]; \
|
| 1005 |
|
|
then \
|
| 1006 |
|
|
$(ECHO) $(FLASHPROG) $(SOPC_SYSID_FLAG) --base=$($(basename $@)_START) $(basename $@).flash; \
|
| 1007 |
|
|
$(FLASHPROG) $(DOWNLOAD_CABLE_FLAG) $(SOPC_SYSID_FLAG) --base=$($(basename $@)_START) $(basename $@).flash; \
|
| 1008 |
|
|
else \
|
| 1009 |
|
|
$(ECHO) $(FLASHPROG) $(SOPC_SYSID_FLAG) --epcs --base=$($(basename $@)_START) $(basename $@).flash; \
|
| 1010 |
|
|
$(FLASHPROG) $(DOWNLOAD_CABLE_FLAG) $(SOPC_SYSID_FLAG) --epcs --base=$($(basename $@)_START) $(basename $@).flash; \
|
| 1011 |
|
|
fi \
|
| 1012 |
|
|
fi
|
| 1013 |
|
|
|
| 1014 |
|
|
|
| 1015 |
|
|
# Rules for simulating with an HDL Simulator [QSYS only]
|
| 1016 |
|
|
ifeq ($(QSYS),1)
|
| 1017 |
|
|
IP_MAKE_SIMSCRIPT := ip-make-simscript
|
| 1018 |
|
|
|
| 1019 |
|
|
ifeq ($(VSIM),)
|
| 1020 |
|
|
VSIM_EXE := "$(if $(VSIM_DIR),$(VSIM_DIR)/,)vsim"
|
| 1021 |
|
|
ifeq ($(ENABLE_VSIM_GUI),1)
|
| 1022 |
|
|
VSIM := $(VSIM_EXE) -gui
|
| 1023 |
|
|
else
|
| 1024 |
|
|
VSIM := $(VSIM_EXE) -c
|
| 1025 |
|
|
endif # ENABLE_VSIM_GUI == 1
|
| 1026 |
|
|
endif # VSIM not set
|
| 1027 |
|
|
|
| 1028 |
|
|
ifeq ($(SPD),)
|
| 1029 |
|
|
ifneq ($(ABS_QUARTUS_PROJECT_DIR),)
|
| 1030 |
|
|
ifneq ($(SOPC_NAME),)
|
| 1031 |
|
|
SPD := $(ABS_QUARTUS_PROJECT_DIR)/$(SOPC_NAME)_tb.spd
|
| 1032 |
|
|
endif # SOPC_NAME set
|
| 1033 |
|
|
endif # ABS_QUARTUS_PROJECT_DIR set
|
| 1034 |
|
|
endif # SPD == empty string
|
| 1035 |
|
|
|
| 1036 |
|
|
ifeq ($(MSIM_SCRIPT),)
|
| 1037 |
|
|
SIM_SCRIPT_DIR := $(RUNTIME_ROOT_DIR)/sim
|
| 1038 |
|
|
MSIM_SCRIPT := $(SIM_SCRIPT_DIR)/mentor/msim_setup.tcl
|
| 1039 |
|
|
endif # MSIM_SCRIPT == empty string
|
| 1040 |
|
|
|
| 1041 |
|
|
ifeq ($(MAKE_VERSION),3.81)
|
| 1042 |
|
|
ABS_MEM_INIT_DESCRIPTOR_FILE := $(abspath $(MEM_INIT_DESCRIPTOR_FILE))
|
| 1043 |
|
|
else
|
| 1044 |
|
|
ABS_MEM_INIT_DESCRIPTOR_FILE := $(call adjust-path-mixed,$(shell pwd))/$(MEM_INIT_DESCRIPTOR_FILE)
|
| 1045 |
|
|
endif
|
| 1046 |
|
|
|
| 1047 |
|
|
$(MSIM_SCRIPT): $(SPD) $(MEM_INIT_DESCRIPTOR_FILE)
|
| 1048 |
|
|
ifeq ($(SPD),)
|
| 1049 |
|
|
$(error No SPD file specified. Ensure QUARTUS_PROJECT_DIR variable is set)
|
| 1050 |
|
|
endif
|
| 1051 |
|
|
@$(MKDIR) $(SIM_SCRIPT_DIR)
|
| 1052 |
|
|
$(IP_MAKE_SIMSCRIPT) --spd=$(SPD) --spd=$(MEM_INIT_DESCRIPTOR_FILE) --output-directory=$(SIM_SCRIPT_DIR)
|
| 1053 |
|
|
|
| 1054 |
|
|
VSIM_COMMAND = \
|
| 1055 |
|
|
cd $(dir $(MSIM_SCRIPT)) && \
|
| 1056 |
|
|
$(VSIM) -do "do $(notdir $(MSIM_SCRIPT)); ld; $(if $(VSIM_RUN_TIME),run ${VSIM_RUN_TIME};quit;)"
|
| 1057 |
|
|
|
| 1058 |
|
|
.PHONY: sim
|
| 1059 |
|
|
sim: $(MSIM_SCRIPT) mem_init_generate
|
| 1060 |
|
|
ifeq ($(MSIM_SCRIPT),)
|
| 1061 |
|
|
$(error MSIM_SCRIPT not set)
|
| 1062 |
|
|
endif
|
| 1063 |
|
|
$(VSIM_COMMAND)
|
| 1064 |
|
|
|
| 1065 |
|
|
endif # QSYS == 1
|
| 1066 |
|
|
|
| 1067 |
|
|
|
| 1068 |
|
|
#------------------------------------------------------------------------------
|
| 1069 |
|
|
# ELF TARGET RULE
|
| 1070 |
|
|
#------------------------------------------------------------------------------
|
| 1071 |
|
|
# Rule for constructing the executable elf file.
|
| 1072 |
|
|
$(ELF) : $(APP_OBJS) $(LINKER_SCRIPT) $(APP_LDDEPS)
|
| 1073 |
|
|
@$(ECHO) Info: Linking $@
|
| 1074 |
|
|
$(LD) $(APP_LDFLAGS) $(APP_CFLAGS) -o $@ $(filter-out $(CRT0),$(APP_OBJS)) $(APP_LIBS) $(APP_BSP_DEP_LIBS)
|
| 1075 |
|
|
ifneq ($(DISABLE_ELFPATCH),1)
|
| 1076 |
|
|
$(ELFPATCH) $@ $(ELF_PATCH_FLAG)
|
| 1077 |
|
|
endif
|
| 1078 |
|
|
ifneq ($(DISABLE_STACKREPORT),1)
|
| 1079 |
|
|
@bash -c "$(STACKREPORT) $@"
|
| 1080 |
|
|
endif
|
| 1081 |
|
|
|
| 1082 |
|
|
$(OBJDUMP_NAME) : $(ELF)
|
| 1083 |
|
|
@$(ECHO) Info: Creating $@
|
| 1084 |
|
|
$(OBJDUMP) $(OBJDUMP_FLAGS) $< >$@
|
| 1085 |
|
|
|
| 1086 |
|
|
# Rule for printing the name of the elf file
|
| 1087 |
|
|
.PHONY: print-elf-name
|
| 1088 |
|
|
print-elf-name:
|
| 1089 |
|
|
@$(ECHO) $(ELF)
|
| 1090 |
|
|
|
| 1091 |
|
|
|