Prerequisites for Generating Code for NVIDIA Boards
You must install required software and hardware to use NVIDIA® Jetson™ or NVIDIA DRIVE® boards with MATLAB®. To use the MATLAB Coder™ Support Package for NVIDIA Jetson and NVIDIA DRIVE Platforms, you must use a supported hardware board, install required software, and set up environment variables. To target GPU devices, you can also install GPU Coder™.
Target Requirements
The target NVIDIA board must be a supported board, and you must install NVIDIA software and other libraries on the board. The support package uses environment variables to locate the required software.
Target Hardware
The MATLAB Coder Support Package for NVIDIA Jetson and NVIDIA DRIVE Platforms supports these boards:
NVIDIA DRIVE PX 2
NVIDIA Clara AGX™
NVIDIA Jetson AGX Xavier™
NVIDIA Jetson AGX Orin™
NVIDIA Jetson Orin Nano
NVIDIA Jetson Orin NX (GPIO workflows are not supported)
NVIDIA Jetson Nano™
NVIDIA Jetson TX1
NVIDIA Jetson TX2
NVIDIA Jetson Xavier NX
The support package uses an SSH connection over TCP/IP to execute commands while building and running the generated code on the Jetson or DRIVE platforms. Connect the target platform to the same network as the host computer. Alternatively, use an Ethernet crossover cable to connect the board directly to the host computer.
Note
On the Windows® platform, open port 18735
in the
Windows Firewall settings. This port is required to establish a
connection to the MATLAB server running on the embedded platforms.
Required Target Software
Use the NVIDIA JetPack (NVIDIA) or the DriveOS SDK (NVIDIA) software to install the OS image, developer tools, and the libraries required for developing applications on the Jetson or DRIVE platforms. You can use the Component Manager in the JetPack or the Drive Platform software to select the components to install on the target hardware. For installation instructions, refer to the NVIDIA board documentation. Install these libraries on the Jetson or DRIVE board:
CUDA® toolkit
NVIDIA CUDA Deep Neural Network (cuDNN) library
NVIDIA TensorRT™ library
OpenCV library
GStreamer library version 1.0 or higher
The MATLAB Coder Support Package for NVIDIA Jetson and NVIDIA DRIVE Platforms supports these JetPack and DriveOS SDK versions.
Hardware Platform | Software Version |
---|---|
Jetson AGX Orin | JetPack 6.0
Note
|
Jetson Orin Nano | |
Jetson Orin NX | |
Jetson AGX Xavier | JetPack 5.1.1 |
Jetson Xavier NX | |
Clara AGX | Holoscan SDK
Note
|
Jetson Nano | JetPack 4.6.1 |
Jetson TX1 | |
Jetson TX2 | |
DRIVE | DRIVE OS 5.0.10.3-12606092 |
Optional Target Software
These features require additional software on the target:
To run webcam examples, install version 1.2 of the Simple DirectMedia Layer library, the V4L2 library, and the V4L2 utilities. You must also install the development packages for these libraries.
To deploy the Audio File Read Simulink® block, install the Sound eXchange (SoX) utility and its development and format libraries. To install these libraries on Jetson, use the
apt-get
command.sudo -S apt-get -y install sox libsox-fmt-all libsox-dev alsa-utils
To use Modbus® functions and blocks, install the
libmodbus
libraries from https://github.com/stephane/libmodbus. To install these libraries on Jetson, use these commands:git clone https://github.com/stephane/libmodbus cd libmodbus ./autogen.sh ./configure && sudo make install
To use MQTT Publish and MQTT Subscribe blocks, install the MQTT library from https://github.com/eclipse-paho/paho.mqtt.c. You must also install the
json-c
library.To install the MQTT library on Jetson, use these commands:
git clone https://github.com/eclipse/paho.mqtt.c.git cd paho.mqtt.c make sudo -S make install
To install the
json-c
library on Jetson, use theapt
command to install the library:sudo apt install libjson-c-dev
Environment Variables on the Target
The support package uses environment variables to locate the tools, compilers, and libraries required for code generation. Set the environment variables in the table.
Variable Name | Default Value | Description |
---|---|---|
PATH | /usr/local/cuda/bin | Path to the CUDA toolkit executable on the Jetson or DRIVE platform. |
LD_LIBRARY_PATH | /usr/local/cuda/lib64 | Path to the CUDA library folder on the Jetson or DRIVE platform. |
The required environment variables must be accessible from non-interactive SSH
logins. For example, you can use the export
command at the
beginning of the $HOME/.bashrc
shell configuration file to
add the environment variables.
Alternatively, you can set the system-wide environment variables in the
/etc/environment
file. You must have
sudo
privileges to edit this file.
Input Devices
To record video or audio, connect:
A camera connected to the USB or CSI port of the target hardware
A USB audio device
Development Host Requirements
The development host computer must have MATLAB and MATLAB Coder. For processor-in-the-loop (PIL) execution, you must also install a supported compiler on the host computer. Optionally, to target GPU devices or generate code for deep learning applications, install additional MathWorks® software.
Optional MathWorks Software
GPU Coder— Required for GPU targeting
Parallel Computing Toolbox™— Required for GPU targeting
Simulink— Required for generating code from Simulink models
Simulink Coder— Required for generating code from Simulink models
Deep Learning Toolbox™— Required for deep learning
MATLAB Coder Interface for Deep Learning and GPU Coder Interface for Deep Learning support packages— Required for deep learning
Embedded Coder®— Recommended
Computer Vision Toolbox™— Recommended
Image Processing Toolbox™— Recommended
To verify the GPU code generation environment on the Jetson or DRIVE, use the GPU
Environment Check (GPU Coder) app or the coder.checkGpuInstall
(GPU Coder) function.