Embedded C++ Example#
Introduction#
On an embedded Linux distribution such as Yocto, applications need to be cross-compiled on a host and copied to the target system.
Before starting with this example, please follow driver/runtime install Method 3 and Hardware Setup.
Note
The default settings in CMakeLists.txt is for ARM v8 platforms. Please modify it according to your build target.
Edit example_c/CMakeLists.txt according to your embedded system (ARM v7, ARM v8 or x86-64):
set(CMAKE_C_COMPILER aarch64-linux-gnu-gcc) # modify this according to your build target (local build or cross-compile)
set(CMAKE_CXX_COMPILER aarch64-linux-gnu-g++) # modify this according to your build target (local build or cross-compile)
link_directories(${PROJECT_SOURCE_DIR}/../udriver/arm_64) # modify this according to your build target
Compile the sample code:
cd example_c
mkdir build
cd build && cmake ..
make
Copy the generated
output
folder (including cross-compiled executable files and DFP) from your build host to your embedded system. The generated output folder structure will be like:
output
├── bin
│ ├── pipeline_inference_rgb888
│ └── simple_inference_rgb888
│
└── model
└── ssd_mobilenet_v1_10_cascadex4_rgb888.dfp
Finally, on the embedded system, run the sample application to benchmark the performance of our compiled ssd-mobilenet v1 model with the MXA:
cd output/bin
./pipeline_inference_rgb888