1# 2# Build targets for a Hexagon-based processor 3# 4 5# Hexagon Environment Checks ################################################### 6 7# Ensure that the user has specified a path to the Hexagon toolchain that they 8# wish to use. 9ifeq ($(HEXAGON_TOOLS_PREFIX),) 10$(error "You must supply a HEXAGON_TOOLS_PREFIX environment variable \ 11 containing a path to the hexagon toolchain. Example: \ 12 export HEXAGON_TOOLS_PREFIX=$$HOME/Qualcomm/HEXAGON_Tools/8.0.07") 13endif 14 15ifeq ($(IS_NANOAPP_BUILD),) 16ifeq ($(SLPI_PREFIX),) 17$(error "You must supply an SLPI_PREFIX environment variable \ 18 containing a path to the SLPI source tree. Example: \ 19 export SLPI_PREFIX=$$HOME/slpi_proc") 20endif 21endif 22 23# Hexagon Tools ################################################################ 24 25TARGET_AR = $(HEXAGON_TOOLS_PREFIX)/Tools/bin/hexagon-ar 26TARGET_CC = $(HEXAGON_TOOLS_PREFIX)/Tools/bin/hexagon-clang 27TARGET_LD = $(HEXAGON_TOOLS_PREFIX)/Tools/bin/hexagon-link 28 29# Hexagon Compiler Flags ####################################################### 30 31# Add Hexagon compiler flags 32TARGET_CFLAGS += $(HEXAGON_CFLAGS) 33 34# Enable position independence. 35TARGET_CFLAGS += -fpic 36 37# Disable splitting double registers. 38TARGET_CFLAGS += -mllvm -disable-hsdr 39 40# Enable default visibility for FastRPC entry points. 41TARGET_CFLAGS += -D'__QAIC_SKEL_EXPORT=__attribute__((visibility("default")))' 42 43# This code is loaded into a dynamic module. Define this symbol in the event 44# that any Qualcomm code needs it. 45TARGET_CFLAGS += -D__V_DYNAMIC__ 46 47# This flag is used by some QC-supplied code to differentiate things intended to 48# run on Hexagon vs. other architectures 49TARGET_CFLAGS += -DQDSP6 50 51# Hexagon Shared Object Linker Flags ########################################### 52 53TARGET_SO_LDFLAGS += --gc-sections 54TARGET_SO_LDFLAGS += -shared 55TARGET_SO_LDFLAGS += -call_shared 56TARGET_SO_LDFLAGS += -Bsymbolic 57TARGET_SO_LDFLAGS += --wrap=malloc 58TARGET_SO_LDFLAGS += --wrap=calloc 59TARGET_SO_LDFLAGS += --wrap=free 60TARGET_SO_LDFLAGS += --wrap=realloc 61TARGET_SO_LDFLAGS += --wrap=memalign 62TARGET_SO_LDFLAGS += --wrap=__stack_chk_fail 63 64HEXAGON_LIB_PATH = $(HEXAGON_TOOLS_PREFIX)/Tools/target/hexagon/lib 65TARGET_SO_EARLY_LIBS += $(HEXAGON_LIB_PATH)/$(HEXAGON_ARCH)/G0/pic/initS.o 66TARGET_SO_LATE_LIBS += $(HEXAGON_LIB_PATH)/$(HEXAGON_ARCH)/G0/pic/finiS.o 67 68# Supported Hexagon Architectures ############################################## 69 70HEXAGON_SUPPORTED_ARCHS = v60 v62 71 72# Environment Checks ########################################################### 73 74# Ensure that an architecture is chosen. 75ifeq ($(filter $(HEXAGON_ARCH), $(HEXAGON_SUPPORTED_ARCHS)),) 76$(error "The HEXAGON_ARCH variable must be set to a supported architecture \ 77 ($(HEXAGON_SUPPORTED_ARCHS))") 78endif 79 80# Target Architecture ########################################################## 81 82# Set the Hexagon architecture. 83TARGET_CFLAGS += -m$(strip $(HEXAGON_ARCH)) 84 85# Optimization Level ########################################################### 86 87TARGET_CFLAGS += -O$(OPT_LEVEL) 88 89# TODO: Consider disabling this when compiling for >-O0. 90TARGET_CFLAGS += -D_DEBUG 91 92# Variant Specific Sources ##################################################### 93 94TARGET_VARIANT_SRCS += $(HEXAGON_SRCS) 95