I recently started working with Qualcomm’s Snapdragon Flight kit. The platform looks pretty interesting, but instructions for getting started are scattered around various locations. I’ve been compiling the disparate instructions and will be sharing simplified guides for anyone else who’s annoyed by the unorganized documentation.
First things first: let’s walk through the development environment setup.
Setting Up a Linux Snapdragon Development Environment
The instructions below cover the setup process for Snapdragon Flight development using Ubuntu 14.04. I have not tested these instructions on other distributions, though I do not expect the steps to change.
Download SDK Packages
Install the following packages via apt-get
(or another package manager):
sudo apt-get install git build-essential cmake default-jre
Then download these two SDK packages:
- Hexagon SDK: download v3.0 to work with the current GitHub Project
- You will need to create an account with Qualcomm if you don’t already have one
- qrlSDK: download
Flight_3.1.3_qrlSDK.tgz
to work with the current GitHub Project- You will need to create an account with Intrynsic if you don’t already have one
Toolchain Setup
There is a handy cross_toolchain
GitHub project which simplifies the installation process for us.
First, clone the repository:
git clone git@github.com:ATLFlight/cross_toolchain.git
Unzip the Hexagon SDK v3.0 package and place the qualcomm_hexagon_sdk_lnx_3_0_eval.bin
file in the cross_toolchain/downloads
folder.
Move the qrlSDK Flight_3.1.3_qrlSDK.tgz
file into the cross_toolchain/downloads
folder as well. Unzipping is not required for this file.
Then run the installer:
./installsdk.sh --APQ8074 --arm-gcc --qrlSDK
This will install the following items:
- Hexagon SDK to
${HOME}/Qualcomm/Hexagon_SDK/3.0
- Hexagon Tools to
${HOME}/Qualcomm/Hexagon_Tools/7.2.12/Tools
- ARMv7hf cross compiler:
${HEXAGON_SDK_ROOT}/gcc-linaro-4.9-2014.11-x86_64_arm-linux-gnueabihf_linux
- qrlSDK to
${HOME}/Qualcomm/qrlinux_sysroot/merged-rootfs
If you re-run the installsdk.sh
script, it will only install missing pieces and display environment variables to set. You can also remove packages by omitting options in subsequent runs (like --arm-gcc
or --qrlSDK
).
You can also create a zipfile of the SDK for archiving and distribution:
/installsdk.sh --APQ8074 --zip --arm-gcc --qrlSDK
A Minimal SDK Installation Profile
If you want to remove all non-essential files (e.g. for setting up a continuous integration server), you can run the following command:
./installsdk.sh --APQ8074 --trim --arm-gcc --qrlSDK
You can create a zipfile of the trimmed SDK for archiving and distribution:
/installsdk.sh --APQ8074 --trim --zip --arm-gcc --qrlSDK
Environment Setup
You’ll need to add the following definitions to your .bashrc
or .bash_profile
files in order for the SDK to work correctly:
export HEXAGON_SDK_ROOT=/home/parallels/Qualcomm/Hexagon_SDK/3.0
export HEXAGON_TOOLS_ROOT=/home/parallels/Qualcomm/HEXAGON_Tools/7.2.12/Tools
export HEXAGON_ARM_SYSROOT=/home/parallels/Qualcomm/qrlinux_sysroot
export ARM_CROSS_GCC_ROOT=/home/parallels/Qualcomm/ARM_Tools/gcc-4.9-2014.11
I also recommend adding the following directory to your PATH
so you don’t have to remember where mini-dm
is found:
${HEXAGON_SDK_ROOT}/tools/debug/mini-dm/Linux_Debug/
Example for adding it to the PATH
inside your .bashrc
file:
export PATH=$PATH:${HEXAGON_SDK_ROOT}/tools/debug/mini-dm/Linux_Debug
Android SDK Setup
The Snapdragon Flight development environment uses adb
to interact with the device.
You will need to download the Android SDK tools from Google.
To install the SDK, unzip the SDK tools and run the following command:
tools/android update sdk --no-ui
You’ll want to add the Android tools to your PATH
:
/home/parallels/android-sdk-linux/platform-tools (in my case)
With the path changes we had above, your export PATH
line should look similar to this:
export PATH=$PATH:${HEXAGON_SDK_ROOT}/tools/debug/mini-dm/Linux_Debug:/home/parallels/android-sdk-linux/platform-tools
Talking to the Snapdragon Flight
Once the Android SDK is installed, connect to the Snapdragon Flight’s mini-USB connector. When you run the adb devices
command, you should see a device listed:
adb devices
List of devices attached
158e2b08 device
You can then connect to the device using adb shell
. You should see a prompt for the root
user:
adb shell
root@linaro-developer:/#
Testing the Environment: Let’s Build an Example!
Now that we’ve set up our environment, let’s build the Snapdragon Flight HelloWorld project. This demo project builds for both the application processor and the Hexagon DSP, so we can confirm quickly whether our toolchain setup was successful.
First, clone the HelloWorld project:
git clone git@github.com:ATLFlight/HelloWorld.git
We’ll build with the QURT_BUNDLE
option, which will produce both the AP and DSP applications.
cd HelloWorld/bundle
make
Once the build has completed, we can send the test app to the device. With the Snapdragon Flight connected over USB, simply run the following command from the bundle/
folder:
make load-bundle
We can connect to the device using the adb shell
command. Change to the home directory:
cd /home/linaro
And you should see a helloworld
application listed.
When you run the helloworld
application, you should see a print statement:
./helloworld
Asking DSP to say hello
We’ll need to open another shell to verify the output on the DSP. If you added the mini-dm
directory to your PATH
, simply invoke mini-dm
to open up a DSP debug log instance. If you did not add it to your PATH
, invoke the following command:
${HEXAGON_SDK_ROOT}/tools/debug/mini-dm/Linux_Debug/mini-dm
Now that you have a DSP log window up, run the helloworld
application again. You should now see a new entry in the DSP log window, similar to this line:
DMSS is connected. Running mini-dm...
[08500/00] 01:31.986 HAP:38:Hello World 0037 helloworld_dsp.c
Our SDK works, and we’ve successfully loaded a demo application that runs on the AP and DSP!
Useful Links
These have been the most useful resources that I have found so far:
- Snapdragon Flight Platform Documentation (GitHub)
- Qualcomm Snapdragon Flight Forum
- Snapdragon Flight Debug Connector Pinout and Hardware User Guide