JetsonHacks

Developing on NVIDIA® Jetson™ for AI on the Edge

One Jetson Orin to Be Them All!

The NVIDIA Jetson Orin Developer Kit can now emulate all of the Jetson Orin modules. This currently includes the Jetson AGX Orin, Orin NX and the new Orin Nano modules. Looky here:

Note: that there is an excellent article on the NVIDIA Developer blog about this very subject: Develop for All Six NVIDIA Jetson Orin Modules with the Power of One Developer Kit. Think about this article as supplemental.

Introduction

Emulators are a very interesting corner of Computer Science. People have different ideas about the emulation experience. There are very strict emulators. These emulators mimic the device they are trying to copy exactly. All of the same architectural features, instruction sets, and even errata and flaws are reproduced. The idea is that one should not be able to tell that the difference between the emulator and the real thing. Note that this usually requires special hardware to replicate the experience.

This tends to be where the serious developers live. This is the result of the amount of knowledge that one has to have to replicate what is typically legacy hardware or software stacks.

Other emulators are far more generous in their criteria. You’ll see this in applications such as game emulators. The game is emulated, but is able to run at much higher clock speeds, graphic resolutions, and so on.

There are different types of emulators. Hardware, software, in circuit (ICE). Each play their own role in the development cycle. But here’s the deal. Emulators are pretenders. They are acting as a device, but they are not the device itself. Many people have been bitten relying only on emulation for verifying their application or product. Emulators will bite you, given the chance.

With that said, emulators are great tools for getting started with new designs, initial testing of designs on a variety of hardware configurations, and legacy testing. It will get you most of the way there, but there’s always a little bit of danger too. That’s what makes it fun!

Jetson Orin Developer Kit

The Orin Dev Kit has some advantages when it comes to emulating other Orin modules. First, the architecture is the same. A lot of the emulation is done by changing hardware settings. Set the clock speeds for the CPU and GPU, limit the amount of memory, and assign the number of CPU and GPU cores for a given model.

There are a couple of hardware features that may need to be disabled. For example, the Jetson Orin Nano module does not have hardware video encoding or a Programmable Vision Accelerator (PVA). I am guessing that the device tree is modified on the dev kit to exclude their availability.

Because the Jetson Orins are similar in their over all design, you should expect excellent fidelity in the emulation. However, you should still do final verification testing on a real device for critical applications. You are working on critical applications, aren’t you?

Setting up Emulation

Preparing a Jetson AGX Orin Developer Kit for emulation is a three step process:

  • Download to the Host the Jetson Driver Package and sample rootfs for the AGX Orin
    • Another name for the Driver Package is the Board Support Package (BSP)
    • Extract the downloaded files and prepare the package that will be flashed to the Jetson
  • Flash the Orin Developer Kit
    • Select which Orin module you want to emulate
    • Set the Orin Dev Kit into Force Recovery Mode
  • Setup Jetson
    • After flashing, go through the initial Linux for Tegra configuration
    • Download and install JetPack to the Jetson

Preparing the Host

The official NVIDIA document for flashing a Jetson is here: To Flash the Jetson Developer Kit Operating Software . On a host x86 computer running Ubuntu 18.04 or 20.04, download both the Driver Package (BSP) and Sample Root Filesystem. To emulate the Orin Nano, you will also need the orin-nano-overlay. These are available by following this link to the appropriate download page. For this article we are using Jetson Linux 35.1.

A couple of comments about the procedure. I usually download the BSP and sample rootfs to a new folder. This is where the image to flash the Jetson will be built, so you should have plenty of room available before starting. After you complete the download, you need to set some OS environment variables. One way to do this, as shown in the video, is to set the environment variables:

  • L4T_RELEASE_PACKAGE
  • SAMPLE_FS_PACKAGE
  • BOARD

in the file ~/.bashrc In the video we use gedit to place the variables at the end of the file. These settings should reflect where you download the files. Here’s a sample where the files are in the JetPack5.0.2 folder in the home directory:

L4T_RELEASE_PACKAGE=~/JetPack5.0.2/Jetson_Linux_R35.1.0_aarch64.tbz2
SAMPLE_FS_PACKAGE=~/JetPack5.0.2/Tegra_Linux_Sample-Root-Filesystem_R35.1.0_aarch64.tbz2
BOARD=jetson-agx-orin-devkit

Save the file, and then source it. You can source it from your open Terminal by:

$ source ~/.bashrc

or open a new Terminal. Then:

$ tar xf ${L4T_RELEASE_PACKAGE}
$ cd Linux_for_Tegra/rootfs/
$ sudo tar xpf ${SAMPLE_FS_PACKAGE}
$ cd ..
$ sudo ./apply_binaries.sh

The command for untarring the SAMPLE_FS_PACKAGE is a little different than in the documentation, because we use the full path the package when we set the environment variable.

If you are using the Orin Nano overlay, then expand it.

$ cd [top level, the folder containing Linux_for_Tegra]
$ sudo tar xpf Orin_Nano_Overlay_35.1.tbz2

The Orin Nano overlay will be installed in the Linux_for_Tegra folder.

Flashing Procedure

WARNING: The AGX Orin is going to be wiped by the next procedure. Make sure to save any data you need before flashing!

Connect the Dev Kit to the Host with a USB cable. Connect the Jetson using the USB-C port located next to the 40 pin GPIO header. Plug the other end into the Host. Set the Jetson Dev Kit into Force Recovery Mode:

  1. Ensure that the developer kit is powered off.
  2. Press and hold down the Force Recovery button.
  3. Press, then release the Power button.
  4. Release the Force Recovery button.

Next, on the Host, check to see if the Jetson is visible:

$ lsusb

One of the entries should be the Jetson. It will be marked as the manufacturer of NVidia Corp. and corresponding ID similar to 0955:7023. If you don’t see the Jetson here, it will not be available to flash.

As of this writing, there are seven different configurations that the Jetson AGX Orin Developer Kit can emulate. Here are the flash commands for each:

Jetson Orin module to be emulatedFlashing command
Jetson AGX Orin 64GBsudo ./flash.sh jetson-agx-orin-devkit mmcblk0p1
Jetson AGX Orin 64GBsudo ./flash.sh jetson-agx-orin-devkit-maxn mmcblk0p1
Jetson AGX Orin 32GBsudo ./flash.sh jetson-agx-orin-devkit-as-jao-32gb mmcblk0p
Jetson Orin NX 16GBsudo ./flash.sh jetson-agx-orin-devkit-as-nx-16gb mmcblk0p1
Jetson Orin NX 8GBsudo ./flash.sh jetson-agx-orin-devkit-as-nx-8gb mmcblk0p1
Jetson Orin Nano 8GB*sudo ./flash.sh jetson-agx-orin-devkit-as-nano8gb mmcblk0p1
Jetson Orin Nano 4GBsudo ./flash.sh jetson-agx-orin-devkit-as-nano4gb mmcblk0p1

These cover the Developer Kit, the 32GB AGX Orin, the 16 and 8GB Orin NX and the 8 and 4GB Orin Nano modules. Select the appropriate entry you want to configure the Jetson to be. For example to flash the Developer Kit to emulate an Orin Nano 8GB module:

$ sudo ./flash.sh jetson-agx-orin-devkit-as-nano8gb mmcblk0p1

Setup Jetson

After flashing, the Jetson will reboot. Switch to the Jetson, and go through the familiar configuration dialogs. Then you are ready to install JetPack:

sudo apt update
sudo apt install nvidia-jetpack

You are then up and running in your new disguise!

Benchmark

As you know, I’m not big on benchmarks. Here’s a reproduction of the results from the NVIDIA Developer Blog and how to run the VPI example:

$ sudo jetson_clocks
$ sudo apt install cmake
$ cd /opt/nvidia/vpi2/samples/05-benchmark
$ sudo cmake .
$ sudo make
$ sudo ./vpi_sample_05_benchmark <cpu/cuda/pva>

Here’s the table of results:

Algorithm: 5X5
Gaussian Filter Input Image Size: 1920 X 1080
Input Format: U16
Emulated as Jetson AGX Orin 64GBEmulated as Jetson Orin NX 16GBEmulated as Jetson Orin Nano 8GB
Running on CPU0.3310.4920.838
Running on GPU0.0650.1430.210
Running on PVA1.1691.888

These numbers are representative of what I saw during filming.

Notes

  • The entire process from downloading the BSP to testing the Jetson took me about 1 hour.
  • The speed of the host computer and internet connection will greatly affect the flashing process
  • After the initial flash, it took around 45 minutes to switch the Dev Kit to another configuration.
Facebook
Twitter
LinkedIn
Reddit
Email
Print

Leave a Reply

Your email address will not be published. Required fields are marked *

Disclaimer

Some links here are affiliate links. If you purchase through these links I will receive a small commission at no additional cost to you. As an Amazon Associate, I earn from qualifying purchases.

Books, Ideas & Other Curiosities