Support different Hexagon tools versions, possibly independently of the Hexagon SDK.

PiperOrigin-RevId: 329021591
Change-Id: Ia9d9be685fb36ab1a7b96fb3b758edaf7b2e2fff
This commit is contained in:
Shlomi Regev 2020-08-28 15:35:37 -07:00 committed by TensorFlower Gardener
parent 1255008e06
commit 155412683d

View File

@ -1,10 +1,19 @@
# Settings for Hexagon toolchain.
# REQUIRED:
# - Hexagon SDK 3.5 Toolkit (for hexagon-clang++, hexagon-sim).
# - HEXAGON_SDK_PREFIX environment variable must be set to location of
# - Hexagon SDK 3.5 Toolkit (for qurt, posix libs).
# HEXAGON_SDK_ROOT environment variable must be set to location of
# Hexagon_SDK/<version>/ on your machine.
# - Hexagon Tools root (for hexagon-clang++, hexagon-sim).
# The tool folder may be a part of the Hexagon SDK
# (e.g. $(HEXAGON_SDK_ROOT)/tools/HEXAGON_Tools) or installed
# separately.
# HEXAGON_ROOT environment variable must be set to location of
# HEXAGON_Tools on your machine.
# - HEXAGON_TOOL_VER: The Hexagon tool version (installed under HEXAGON_ROOT).
# For example: 8.3.07
# - HEXAGON_CPU_VER: The CPU version to use, will cause a compiler exception
# without providing a version. Acceptable values: v55-v67
# without providing a version. Valid values may vary depending on tools
# version, but generally in the range: v55-v67
#
# Unlike other targets, there is not currently a way to automatically download
# the Hexagon SDK. For this reason, users are required to manually download
@ -12,8 +21,16 @@
ifeq ($(TARGET), hexagon)
TARGET_ARCH := hexagon
ifndef HEXAGON_SDK_PREFIX
$(error HEXAGON_SDK_PREFIX is undefined)
ifndef HEXAGON_SDK_ROOT
$(error HEXAGON_SDK_ROOT is undefined)
endif
ifndef HEXAGON_TOOL_VER
$(error HEXAGON_TOOL_VER is undefined)
endif
ifndef HEXAGON_ROOT
$(error HEXAGON_ROOT is undefined)
endif
ifndef HEXAGON_CPU_VER
@ -55,6 +72,7 @@ ifeq ($(TARGET), hexagon)
-mcpu=$(HEXAGON_CPU_VER) \
-m$(HEXAGON_CPU_VER)
export PATH := $(HEXAGON_ROOT)/$(HEXAGON_TOOL_VER)/Tools/bin:$(PATH)
TARGET_TOOLCHAIN_PREFIX := hexagon-
CXX_TOOL := clang++
CC_TOOL := clang
@ -63,11 +81,11 @@ ifeq ($(TARGET), hexagon)
CCFLAGS += $(PLATFORM_ARGS)
LDFLAGS += \
-Wl,--gc-sections -lhexagon \
$(HEXAGON_SDK_PREFIX)/tools/HEXAGON_Tools/8.3.07/Tools/target/hexagon/lib/v66/libstdc++.a
$(HEXAGON_ROOT)/$(HEXAGON_TOOL_VER)/Tools/target/hexagon/lib/v66/libstdc++.a
INCLUDES += \
-I$(HEXAGON_SDK_PREFIX)/libs/common/qurt/computev66/include/posix \
-I$(HEXAGON_SDK_PREFIX)/libs/common/qurt/computev66/include/qurt
-I$(HEXAGON_SDK_ROOT)/libs/common/qurt/computev66/include/posix \
-I$(HEXAGON_SDK_ROOT)/libs/common/qurt/computev66/include/qurt
TEST_SCRIPT := tensorflow/lite/micro/testing/test_hexagon_binary.sh
endif