• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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# Define CUST_H to allow including the customer header file.
32TARGET_CFLAGS += -DCUST_H='"custaaaaaaaaq.h"'
33
34# Add Hexagon compiler flags
35TARGET_CFLAGS += $(HEXAGON_CFLAGS)
36
37# Enable position independence.
38TARGET_CFLAGS += -fpic
39
40# Disable splitting double registers.
41TARGET_CFLAGS += -mllvm -disable-hsdr
42
43# Don't use small data section.
44TARGET_CFLAGS += -G0
45
46# Enable default visibility for FastRPC entry points.
47TARGET_CFLAGS += -D'__QAIC_SKEL_EXPORT=__attribute__((visibility("default")))'
48
49# This code is loaded into a dynamic module. Define this symbol in the event
50# that any Qualcomm code needs it.
51TARGET_CFLAGS += -D__V_DYNAMIC__
52
53# This flag is used by some QC-supplied code to differentiate things intended to
54# run on Hexagon vs. other architectures
55TARGET_CFLAGS += -DQDSP6
56
57# Hexagon Shared Object Linker Flags ###########################################
58
59TARGET_SO_LDFLAGS += --gc-sections
60TARGET_SO_LDFLAGS += -shared
61TARGET_SO_LDFLAGS += -call_shared
62TARGET_SO_LDFLAGS += -Bsymbolic
63TARGET_SO_LDFLAGS += --wrap=malloc
64TARGET_SO_LDFLAGS += --wrap=calloc
65TARGET_SO_LDFLAGS += --wrap=free
66TARGET_SO_LDFLAGS += --wrap=realloc
67TARGET_SO_LDFLAGS += --wrap=memalign
68TARGET_SO_LDFLAGS += --wrap=__stack_chk_fail
69TARGET_SO_LDFLAGS += --no-threads
70
71HEXAGON_LIB_PATH = $(HEXAGON_TOOLS_PREFIX)/Tools/target/hexagon/lib
72TARGET_SO_EARLY_LIBS += $(HEXAGON_LIB_PATH)/$(HEXAGON_ARCH)/G0/pic/initS.o
73TARGET_SO_LATE_LIBS += $(HEXAGON_LIB_PATH)/$(HEXAGON_ARCH)/G0/pic/finiS.o
74
75# Supported Hexagon Architectures ##############################################
76
77HEXAGON_SUPPORTED_ARCHS = v55 v60 v62 v65 v66
78
79# Environment Checks ###########################################################
80
81# Ensure that an architecture is chosen.
82ifeq ($(filter $(HEXAGON_ARCH), $(HEXAGON_SUPPORTED_ARCHS)),)
83$(error "The HEXAGON_ARCH variable must be set to a supported architecture \
84         ($(HEXAGON_SUPPORTED_ARCHS))")
85endif
86
87# Target Architecture ##########################################################
88
89# Set the Hexagon architecture.
90TARGET_CFLAGS += -m$(strip $(HEXAGON_ARCH))
91
92# Optimization Level ###########################################################
93
94TARGET_CFLAGS += -O$(OPT_LEVEL)
95
96# TODO: Consider disabling this when compiling for >-O0.
97TARGET_CFLAGS += -D_DEBUG
98
99# Variant Specific Sources #####################################################
100
101TARGET_VARIANT_SRCS += $(HEXAGON_SRCS)
102