This describes how to development C++ applications in the YZLITE using Microsoft Visual Studio Code.
Using this guide, you can build C++ applications for Windows/Linux or supported embedded platforms.
NOTES:
- All of the YZLITE C++ source code may be found at: yzlite repo/cpp
- Internally, VSCode uses CMake to build the applications
- Refer to the example applications or Python wrappers documentation for more details about what comes with the YZLITE
- Alternatively, applications may be built for Yizhu Technology 's embedded targets using Simplicity Studio
First, we need to install a few tools:
.. tab-set::
.. tab-item:: Windows
If you're on Windows, enable `long file paths`:
https://learn.microsoft.com/en-us/windows/win32/fileio/maximum-file-path-limitation?tabs=registry
Also install the Visual Studio C++ compiler (this is needed to build some of the 3rd party Python packages for Python 3.10):
https://visualstudio.microsoft.com/visual-cpp-build-tools/
Be sure to check the **Desktop Development with C++** workload in the installer GUI.
.. tab-item:: Linux
If you're on Linux, run the following command to install the necessary packages:
.. code-block:: shell
sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test
sudo add-apt-repository -y ppa:deadsnakes/ppa
sudo apt update
sudo apt-get -y install build-essential g++-9 cmake ninja-build gdb p7zip-full git-lfs python3-dev python3-venv libusb-1.0-0 libgl1
CMake is a build system utility used to build the C++ applications.
Install CMake and ensure it is available on the command PATH
More details here: https://cmake.org/install
7-Zip is a file archiver with a high compression ratio.
Several of the assets downloaded by the YZLITE are compressed in this format.
More details here: https://www.7-zip.org/download.html
Install Python 3.7, 3.8, 3.9 or 3.10 64-bit and ensure it is available on the command PATH
More details here: https://www.python.org/downloads
While not required, this is used to single-step debug an embedded development board.
If you're only build for Window/Linux then you can skip this step.
Download and install the J-Link Software Pack:
https://www.segger.com/downloads/jlink/#J-LinkSoftwareAndDocumentationPack
If using Windows, select the 64-bit installer:
https://www.segger.com/downloads/jlink/JLink_Windows_x86_64.exe
While not required, this is used to view the serial logs from an embedded development board. If you're only build for Window/Linux then you can skip this step.
The Serial Monitor VSCode extension is recommended:
- Works well
- Directly integrates with VSCode
- Developed by Microsoft
Another option for Windows is TeraTerm which is a free serial terminal.
If necessary, install Git:
https://git-scm.com/downloads
If you're using Windows, install the Microsoft Visual C++ Redistributable for Visual Studio 2015, 2017 and 2019 which is required by Tensorflow
Next, we need to install the YZLITE:
# Clone the YZLITE GIT repository
git clone https://github.com/ReRAM-Labs/yzlite.gitThen navigate to the YZLITE repository directory
cd yzlite.. tab-set::
.. tab-item:: Windows
.. code-block:: shell
python .\install_yzlite.py
.. tab-item:: Linux
.. code-block:: shell
python3 ./install_yzlite.py
Activate the YZLITE's Python virtual environment:
.. tab-set::
.. tab-item:: Windows
.. code-block:: shell
.\.venv\Scripts\activate.bat
.. tab-item:: Linux
.. code-block:: shell
source ./.venv/bin/activate
After activation, the yzlite command should be available on the command-line:
yzlite --helpWith the YZLITE installed, let's get Visual Studio Code setup.
Download and install Visual Studio Code
OR
Select the YZLITE virtual environment's Python interpreter.
It has the similar to:
<yzlite dir>\.venv\Scripts\python.exe <-- Windows
<yzlite dir>/.venv/bin/python3 <--- LinuxMany of the YZLITE applications support running on Windows/Linux or embedded targets.
The following describes how to build for Windows/Linux.
Optionally create the file: <yzlite repo root>/user_options.cmake
And add any build specific settings. Refer to the Build Options for more details on the available settings.
Based on your host OS, select one of the following CMake kits:
YZLITE-Windows-GCCYZLITE-Linux-GCC
Configure the CMake project (this may take awhile):
Select the CMake build type, the build target, then build the application.
In this example, we build the yzlite_hello_world application in release mode:
This shows how to:
- Build as release
- Run the
yzlite_hello_worldapplication:
Alternatively, you can build as debug and single-step debug the application.
This shows how to:
- Set a breakpoint
- Build as debug
- Debug the
yzlite_model_profilerapplication
The YZLITE also supports building and running/debugging applications on supported development boards.
A serial terminal is needed to view the logs generated by the development board.
The Serial Monitor VScode extension is recommended.
Another options for Windows is TeraTerm which is a free serial terminal.
First, connect your dev board via USB.
Then, open the serial terminal program and select the COM Port that has a description
similar to: J-Link CDC Uart and set the Speed (aka BAUD Rate) to 115200:
Create the file: <yzlite repo root>/user_options.cmake
And add the following to it:
yzlite_set(YZLITE_PLATFORM_NAME brd2601)
This creates a CMake variable and tells the build system to use the brd2601 platform.
Refer to Supported Hardware for more details.
NOTE: If this variable is not defined, then the host operating system (e.g. windows or linux) is automatically selected.
Refer to the Build Options for more details on the available settings.
Configure the CMake project (this may take awhile):
Select the CMake build type, the build target, then build the application.
In this example, we build the yzlite_hello_world application in release mode:
The hello_world YZLITE application has several "targets":
yzlite_hello_world- Build the applicationyzlite_hello_world_download- Build the application and download it to the development boardyzlite_hello_world_download_run- Build the application, download it to the development board, view the serial output of the appyzlite_hello_world_reset- Reset the development board
Other applications have similar targets, e.g.:
yzlite_model_profileryzlite_model_profiler_downloadyzlite_model_profiler_download_runyzlite_model_profiler_reset
NOTES:
- A supported development board must be connected via USB
- You must have Segger J-Link installed (see the Install Tools section) and also a serial terminal to view the logs generated by the development board.
This shows how to:
- Build as release
- Download to the embedded development board
- Run the
yzlite_hello_worldapplication
NOTES:
- A supported development board must be connected via USB
- You must have Segger J-Link installed (see the Install Tools section) and also a serial terminal to view the logs generated by the development board.
This shows how to:
- Build as debug
- Set a breakpoint
- Download to the embedded development board
- Debug the
yzlite_model_profilerapplication
Refer to the Examples documentation for more details about the applications that come with the YZLITE.
Refer to the Python wrappers documentation for more details about the wrappers that come with the YZLITE.













