Linux 环境下部署Hexagon SDK 开发环境

https://developer.qualcomm.com/software/hexagon-dsp-sdk/tools  链接下下载qualcomm_hexagon_sdk_3_4_3_linux.zip 对应855 平台DSP版本。

在linux 系统上创建解压安装bin文件。会自动创建Qualcomm/Hexagon_SDK 目录。echo "export SDK_ROOT=/home/s00429677/Qualcomm">>~/.bashrc 将SDK_ROOT 目录添加到环境变量中,

此版本的 linux平台编译器请选在g++ 4.8版本, android 平台ndk编译工具选择 android-ndk-r14b, 过新的版本会导致用例的编译失败。 ndk 编译工具存放目录是 Qualcomm/Hexagon_SDK/3.4.3/tools/android-ndk-r14b。

为了方便, 可以将halide的example 拷贝到一个独立的路径下面,具体的编译方法在文档Hexagon_Document_Bundle.pdf中有介绍。  80-pd002-1_b_halide_for_hvx_user_guide.pdf 中也有对应的 介绍。大家可以自己搜索下载。

 

2.1 Download the Hexagon SDK
Install the following:
■ Hexagon LLVM toolset
■ Halide toolset
■ Hexagon SDK
1. Go to https://developer.qualcomm.com/software/hexagon-dsp-sdk/tools.
2. Locate and download version 3.3.0 for Linux under the Hexagon Series 600 Software heading.
3. Untar the installer.
4. Run the extracted installer to install the Hexagon SDK and Tools selecting Installation of
Hexagon SDK and designating /location/of/SDK/Hexagon_SDK/3.3.0 as the filepath.
2.2 Install prerequisite packages
For the camera_pipe use case, Halide on Linux requires the following libraries to be installed on the
host:
■ sudo apt-get install libjpeg-dev
■ sudo apr-get install libpng12-dev
■ sudo apt-get install zlib1g-dev
2.3 Set up the environment
Set environment variables to point to the SDK installation locations:
export SDK_ROOT=/location/of/SDK
export HEXAGON_SDK_ROOT=$SDK_ROOT/Hexagon_SDK/
export HL_HEXAGON_TOOLS=$HEXAGON_SDK_ROOT/tools/HEXAGON_Tools//
Tools
export HALIDE_ROOT=/location/of/HALIDE_Tools//Halide
HL_HEXAGON_TOOLS should point to the Tools directory of the Hexagon LLVM toolset.

 

2.4 Build and run a Halide for HVX example
Build and run an example on the simulator
Halide supports running Hexagon code on the simulator from the Hexagon tools.
Build and run the dilate-3x3 example on the simulator:
cd $HALIDE_ROOT/Examples/dilate3x3
./test-dilate3x3
Build and run an example on a Snapdragon device
Halide uses a small runtime library that must be present on the device.
adb shell mkdir -p /system/lib/rfsa/adsp
adb push $HL_HEXAGON_TOOLS/Halide/lib/arm-32-android/
libhalide_hexagon_host.so /system/lib/
adb push $HL_HEXAGON_TOOLS/Halide/lib/arm-64-android/
libhalide_hexagon_host.so /system/lib64/
adb push $HL_HEXAGON_TOOLS/Halide/lib/v60/libhalide_hexagon_remote_skel.so /
system/lib/rfsa/adsp/
The libhalide_hexagon_remote_skel.so library must be signed or the device must be signed
as a debug device to run Hexagon code.See Hexagon_SDK/3.0/docs/Tools_Signing.html for more
information about signing Hexagon binaries.
To build a Halide example – the sobel filter – for execution on a Snapdragon device:
1. Create a standalone toolchain from the Android NDK with the make-standalonetoolchain.
sh script.
export ANDROID_NDK_HOME=$HEXAGON_SDK_ROOT/tools/android-ndk-r14b/
export ANDROID_ARM64_TOOLCHAIN=$ANDROID_NDK_HOME/install/android-21/archarm64
$ANDROID_NDK_HOME/build/tools/make--standalone--toolchain.sh --arch=arm64
…. --platform=android-21 --install-dir=$ANDROID_ARM64_TOOLCHAIN
2. Run the example script provided.
cd $HALIDE_ROOT/Halide/Examples/sobel
./test-sobel
To build a Halide example on Windows in the Examples directory:
setup-env.cmd
cd %HALIDE_ROOT%\Examples\sobel test-sobel.cmd
Halide for HVX User Guide Getting started with Halide for HVX
3.1 Halide for HVX Runtime Model
The Halide sources are compiled by the user to generate a binary, which is executed at runtime.
Halide for HVX supports two runtime targets:
■ Snapdragon devices
■ Hexagon simulator
Programmers can generate two variants of Halide binaries:
■ Offload mode – The generated Halide binary is launched from a host processor.
□ On Snapdragon devices, the host process is the ARM applications processor. This runtime
model is also called the Device-offload mode.
□ On the hexagon simulator runtime target, the host processor is the x86 processor. This
runtime model is called the Simulator-offload mode.
■ Standalone mode – The generated Halide binary is a standalone HVX object file. This file can be
used to integrate Halide programs into an existing vision pipeline.
□ On Snapdragon devices, the generated object file can be launched on the HVX processor.
This runtime model is called the Device-standalone model.
□ On the Hexagon simulator runtime target, the generated object file can be used to simulate an
end-to-end vision algorithm running on the Hexagon DSP. This runtime model is aclled the
Simulator-standalone model.
3.2 Author and build your first Halide program
To start authoring code with Halide, modify an existing example for the Hexagon simulator runtime
target (Simulator-standalone mode). For instance, use an editor to open the following file:
$HALIDE_ROOT/Examples/gaussian5x5/gaussian5x5.cpp
The examples are intended as templates to be modified as needed.
To build and run the Halide program on the simulator, invoke test-gaussian5x5 on Linux or testgaussian5x5.
cmd on Windows. The compilation model in Halide for HVX builds a Halide executable in
two steps:
1. The native, x86 compiler is invoked on the Halide sources to build an x86 executable. This is
called the generator.
2. The generator is executed to produce a HVX binary.
80-

 

你可能感兴趣的:(Linux 环境下部署Hexagon SDK 开发环境)