zephyr/samples/modules/tflite-micro/tflm_ethosu
Sudan Landge 767e03f082 samples: tflite-micro: Use FVP for test validation
What is changed?
 - Replaced printk with printf in the sample

Why do we need this change?
 - Running the sample with fvp just prints the below output and not
   the complete logs that we expect:
    `sender 0: Sending inference`
   We get the expected output with CONFIG_LOG_IMMEDIATE=y but,
   its not ideal. printf works without the config and plus it
   looks a better fit in the current sample than printk.

This change is validate using `mps3/corstone300/fvp`.

Signed-off-by: Sudan Landge <sudan.landge@arm.com>
2025-01-07 10:10:05 +01:00
..
src samples: tflite-micro: Use FVP for test validation 2025-01-07 10:10:05 +01:00
CMakeLists.txt
Kconfig
linker.ld
prj.conf
README.rst samples: tflite-micro: Use FVP for test validation 2025-01-07 10:10:05 +01:00
sample.yaml samples: tflite-micro: Use FVP for test validation 2025-01-07 10:10:05 +01:00

.. zephyr:code-sample:: tflite-ethosu
   :name: TensorFlow Lite for Microcontrollers on Arm Ethos-U

   Run an inference using an optimized TFLite model on Arm Ethos-U NPU.

Overview
********

A sample application that demonstrates how to run an inference using the TFLM
framework and the Arm Ethos-U NPU.

The sample application runs a model that has been downloaded from the
`Arm model zoo <https://github.com/ARM-software/ML-zoo>`_. This model has then
been optimized using the
`Vela compiler <https://git.mlplatform.org/ml/ethos-u/ethos-u-vela.git>`_.

Vela takes a tflite file as input and produces another tflite file as output,
where the operators supported by Ethos-U have been replaced by an Ethos-U custom
operator. In an ideal case the complete network would be replaced by a single
Ethos-U custom operator.

Building and running
********************

Add the tflite-micro module to your West manifest and pull it:

.. code-block:: console

    west config manifest.project-filter -- +tflite-micro
    west update

This application can be built and run on any Arm Ethos-U capable platform, for
example Corstone(TM)-300. A reference implementation of Corstone-300 can be
downloaded either as a FPGA bitfile for the
`MPS3 FPGA prototyping board <https://developer.arm.com/tools-and-software/development-boards/fpga-prototyping-boards/mps3>`_,
or as a
`Fixed Virtual Platform <https://developer.arm.com/tools-and-software/open-source-software/arm-platforms-software/arm-ecosystem-fvps>`_
that can be emulated on a host machine.

Assuming that the Corstone-300 FVP has been downloaded, installed and added to
the ``PATH`` variable, then building and testing can be done with following
commands.

.. code-block:: bash

    $ west build -b mps3/corstone300/fvp zephyr/samples/modules/tflite-micro/tflm_ethosu
    $ FVP_Corstone_SSE-300_Ethos-U55 build/zephyr/zephyr.elf