• 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# Declare support for std headers that the QC SDK contains so that libs like
58# pigweed don't try to redefine functionality.
59TARGET_CFLAGS += -D__cpp_lib_byte=201603L
60TARGET_CFLAGS += -D__cpp_lib_integer_sequence=201304L
61TARGET_CFLAGS += -D__cpp_lib_is_null_pointer=201309L
62TARGET_CFLAGS += -D__cpp_lib_logical_traits=201510L
63TARGET_CFLAGS += -D__cpp_lib_nonmember_container_access=201411L
64TARGET_CFLAGS += -D__cpp_lib_transformation_trait_aliases=201304L
65
66# Hexagon Shared Object Linker Flags ###########################################
67
68TARGET_SO_LDFLAGS += --gc-sections
69TARGET_SO_LDFLAGS += -shared
70TARGET_SO_LDFLAGS += -call_shared
71TARGET_SO_LDFLAGS += -Bsymbolic
72TARGET_SO_LDFLAGS += --wrap=malloc
73TARGET_SO_LDFLAGS += --wrap=calloc
74TARGET_SO_LDFLAGS += --wrap=free
75TARGET_SO_LDFLAGS += --wrap=realloc
76TARGET_SO_LDFLAGS += --wrap=memalign
77TARGET_SO_LDFLAGS += --wrap=__stack_chk_fail
78TARGET_SO_LDFLAGS += --no-threads
79
80HEXAGON_LIB_PATH = $(HEXAGON_TOOLS_PREFIX)/Tools/target/hexagon/lib
81TARGET_SO_EARLY_LIBS += $(HEXAGON_LIB_PATH)/$(HEXAGON_ARCH)/G0/pic/initS.o
82TARGET_SO_LATE_LIBS += $(HEXAGON_LIB_PATH)/$(HEXAGON_ARCH)/G0/pic/finiS.o
83
84# Supported Hexagon Architectures ##############################################
85
86HEXAGON_SUPPORTED_ARCHS = v55 v60 v62 v65 v66
87
88# Environment Checks ###########################################################
89
90# Ensure that an architecture is chosen.
91ifeq ($(filter $(HEXAGON_ARCH), $(HEXAGON_SUPPORTED_ARCHS)),)
92$(error "The HEXAGON_ARCH variable must be set to a supported architecture \
93         ($(HEXAGON_SUPPORTED_ARCHS))")
94endif
95
96# Target Architecture ##########################################################
97
98# Set the Hexagon architecture.
99TARGET_CFLAGS += -m$(strip $(HEXAGON_ARCH))
100
101# Optimization Level ###########################################################
102
103TARGET_CFLAGS += -O$(OPT_LEVEL)
104
105# TODO: Consider disabling this when compiling for >-O0.
106TARGET_CFLAGS += -D_DEBUG
107
108# Variant Specific Sources #####################################################
109
110TARGET_VARIANT_SRCS += $(HEXAGON_SRCS)
111