Developer Guide Release

Programming the Sensor Processing Engine (SPE)
Building the SPE Binaries
Code Organization
The distribution includes a reference implementation of early boot Sensor Processing Engine (SPE) software based on FreeRTOS.
The current SPE firmware runs from 128 KB of internal tightly coupled memory (TCM). The TCM retains its contents across the SC7/SC8 low power states.
Building the SPE Binaries
Use the following procedure to build and flash the SPE binaries.
Before you build the SPE binaries you must install Foundation. If Foundation is not yet installed, do one of the following:
Use SDK Manager to install Foundation and Linux. For more information, see “SDK Manager” in Linux SDK 5.1 Development Guide.
Manually install Foundation.
To build SPE binaries
1. Untar the freertos.tgz package in the foundation source folder:
cd <top>/drive-t186ref-foundation_src
tar -xvf freertos.tgz
cd ..
2. From the root SDK installation folder, set the following environment variables:
export TOP=$(pwd)
export TOOLCHAIN_PREFIX=arm-none-eabi-
export CROSS_COMPILE=$TOP/toolchains/gcc-arm-none-eabi-4_8-2014q3/bin/arm-none-eabi-
export TEGRA_TOP=$(pwd)/drive-t186ref-foundation/firmwares/src/spe-fw
export FREERTOS_DIR=$TOP/drive-t186ref-foundation_src/freertos/FreeRTOSV8.1.2/FreeRTOS/Source
export FREERTOS_COMMON_DIR=$TEGRA_TOP/freertos-common
3. Build the SPE firmware binary:
cd <top>/drive-t186ref-foundation/firmwares/src/spe-fw/spe/bringup
The SPE binary is created in the folder <top>/drive-t186ref-foundation/firmwares/src/spe-fw/spe/bringup/OUT/spe.bin.
4. Copy the generated SPE binary to firmware:
cp <top>/drive-t186ref-foundation/firmwares/src/spe-fw/spe/bringup/OUT/t19x/spe.bin <top>/drive-t186ref-foundation/firmware/t194/spe/spe.bin
5. Set enable_can_boot in the MB1 BCT configuration file at <top>/drive-t186ref-foundation/platform-support/bct/t194/misc to 1 to enable SPE firmware to be loaded during boot.
6. Flash the target with the following commands:
cd <top>/drive-t186ref-foundation_src
./tools/hosts/flashtools/bootburn/bootburn.sh -b <platform>
Where <platform> is e3550b01-t194a for Xavier A (x1) and e3550b01-t194b for Xavier B (x2).
Alternatively, you may use the ‑L option to set enable_can_boot, however, the ‑L option also enabled warmboot binary. Step 5 is not needed if the ‑L option is used.
./tools/hosts/flashtools/bootburn/bootburn.sh -b <platform> -L
Where <platform> is e3550b01-t194a for Xavier A (x1) and e3550b01-t194b for Xavier B (x2).
See Flashing the Board for details.
Code Organization
The source code for the reference implementation of early boot SPE firmware is available from the Foundation SDK:
FreeRTOS v8.1.2, from http://www.freertos.org, from:
Common driver code from:
Initialization and power state management code from:
You can debug SPE through debug prints enabled through either a UARTG or JTAG connection to ARM® DS‑5 Debugger.
To connect to SPE from the debugger
1. Download DS‑5 Developer Studio from https://developer.arm.com. Basic installation instructions are available on the site; search for “ds-5 getting started.”
2. Connect DS‑5 Debugger to the host PC and confirm the connection though rviconfigip.
3. Connect the JTAG connector of DS‑5 Debugger to the target and power the target on. Run dbghwconfig and click the Auto Configure button to scan the target. Export the configuration and choose the board name “T194” and the manufacturer “nVIDIA.”
4. Execute the Configuration Database Importer utility, cdbimporter:
./bin/cdbimporter -c /usr/local/DS-5_v5.24.1/sw/debugger/configdb -t /home/user/ds5configdb/ /home/user/.DbgHwConfig/PlatformFiles/nVIDIA_T194.rvc
5. Start DS‑5 Debugger.
In the debugger
1. On the Window menu, click Preferences.
2. Expand the DS‑5 category and select Configuration Database. Click the Add button to pop up the Add Configuration Database Location menu, and enter the full pathname of the configuration database.
3. Choose Rebuild database to load target definitions.
4. On the Run menu, click Debug Configurations. DS‑5 Studio opens the Debug Configurations dialog.
5. Double click DS‑5 Debugger to create a new configuration. Enter a name in the Name field at the top of the configuration pane and press Enter.
6. Click the Connection tab.
7. Under Select target, expand the option tree to nVIDIA > T194 > Bare Metal Debug, and choose Cortex-R5_1.
8. Under Connections, choose the appropriate USB/IP connection details for DS‑5.
9. Click the Debugger tab.
10. Under Run control, choose Connect only. Click the Execute debugger commands box and enter the command:
memory 0 0xffffffff rw nocache noverify
Click the Debug button to start debugging SPE, or the Close button to close the dialog.