AN 1011: TinyML Applications in Altera FPGAs Using LiteRT for Microcontrollers

ID 848984
Date 4/07/2025
Public
Document Table of Contents

3.2.3. Creating an Application Project File

Application Project (APP) stores the software TinyML application for Nios® V/g processor system.

Follow these steps to create an application project file:

  1. In <Working directory>/software/app folder, copy the following LiteRT for Microcontrollers libraries from tflite_app.
    1. signal
    2. tensorflow
    3. third_party
  2. Create a new folder in app called image_classification (or any preferred name).
  3. Navigate into the image_classification folder, create two folders named image and model, and upload the main.cc binary (Refer to the examples in Appendix).
  4. In image folder, store the MNIST C array samples.
  5. In model folder, store the model_data.cc, model_data.h and model_settings.h source codes.
  6. Launch the Nios® V Command Shell.
    $ niosv-shell
  7. Execute the command below to generate an application CMakeLists.txt.
    $ niosv-app --bsp-dir=software/bsp --app-dir=software/app \
    --srcs-recursive=software/app/image_classification,\
    software/app/signal,\
    software/app/tensorflow \
    --incs=software/app,\
    software/app/image_classification/model,\
    software/app/image_classification/image,\
    software/app/tensorflow,\
    software/app/third_party/flatbuffers/include,\
    software/app/third_party/gemmlowp,\
    software/app/third_party/kissfft,\
    software/app/third_party/ruy
    
Figure 16. Content of app Folder with Generated CMakeLists File