aboutsummaryrefslogtreecommitdiff
path: root/applications/trustzone_inference/README.md
diff options
context:
space:
mode:
authorPer Åstrand <per.astrand@arm.com>2021-01-26 14:42:43 +0100
committerPer Åstrand <per.astrand@arm.com>2021-02-22 09:56:25 +0100
commit79929ff29ffe5d39b19f415fe584ee3eb3e2df97 (patch)
tree6b720eb530b36a2fab6bcdb81a2d00e049e5fdeb /applications/trustzone_inference/README.md
parent1a679c4116484c1e2912d948b0784ac5b55d1c52 (diff)
downloadethos-u-core-platform-79929ff29ffe5d39b19f415fe584ee3eb3e2df97.tar.gz
Add trustzone application example
Add example project that builds both secure and nonsecure world sides and the inference is done on the secure side. This commit includes the mpc driver as found in the upstream trustedfirmware git repository https://git.trustedfirmware.org/TF-M/trusted-firmware-m.git (8c0a234e453b51e6606d11599d0cb15097c3da48) The model,input and output used are described in the README.md in this directory. Change-Id: Ie54904a38d54df4de2d6936f066c388ea58e396b
Diffstat (limited to 'applications/trustzone_inference/README.md')
-rw-r--r--applications/trustzone_inference/README.md79
1 files changed, 79 insertions, 0 deletions
diff --git a/applications/trustzone_inference/README.md b/applications/trustzone_inference/README.md
new file mode 100644
index 0000000..32a7264
--- /dev/null
+++ b/applications/trustzone_inference/README.md
@@ -0,0 +1,79 @@
+# Arm Ethos-U TrustZone demonstration
+
+This application is provided as an example of how to use TrustZone to separate
+the inference from an application layer in secure and nonsecure world.
+This software is primarily intended for guidance, to demonstrate how the
+firmware can be partitioned.
+
+### Building
+
+Building with default settings requires CMake for the configuration and make for
+building. This will produce an elf file which can be run on the FVP.
+
+```
+$ cmake -B build targets/corstone-300
+$ make -C build trustzone
+```
+
+### ML Model and data
+The model in this example has been generated from
+```
+ image_classification/mobilenet_v2_1.0_224/tflite_uint8
+```
+Found in the ARM ML-zoo open source github repository:
+```
+https://github.com/ARM-software/ML-zoo.git
+```
+
+The model is converted using vela (v2.0.1)
+```
+vela --cascading=True --config vela.ini --system-config=Ethos_U55_High_End_Embedded --memory-mode=Shared_Sram --accelerator-config=ethos-u55-128 --block-config-limit=0 ML-zoo/models/image_classification/mobilenet_v2_1.0_224/tflite_uint8/mobilenet_v2_1.0_224_quantized_1_default_1.tflite
+```
+Where the vela.ini is fetched from the vela git repository:
+
+```
+wget https://review.mlplatform.org/plugins/gitiles/ml/ethos-u/ethos-u-vela/+/refs/heads/master/vela.ini
+```
+
+Then the compiled model representation has been converted to a header file using xxd.
+
+```
+xxd -i output/mobilenet_v2_1.0_224_quantized_1_default_1_vela.tflite > model.h
+```
+
+The input and expected output data has been taken from the ML-zoo and generated
+from the respective .npy files to header files with:
+```
+python3 -c 'import numpy;i=numpy.load("ML-zoo/models/image_classification/mobilenet_v2_1.0_224/tflite_uint8/testing_input/input/0.npy");i.tofile("input.bin");' && xxd -i input.bin > input.h
+```
+
+```
+python3 -c 'import numpy;i=numpy.load("ML-zoo/models/image_classification/mobilenet_v2_1.0_224/tflite_uint8/testing_output/output/0.npy");i.tofile("output.bin");' && xxd -i output.bin > output.h
+```
+
+The generated header files are then modified to adapt name and link attributes.
+
+### Testing
+
+Assuming that the Corstone-300 FVP has been downloaded, installed and placed in
+the PATH variable. Then the software binary can be tested like this.
+
+```
+$ ctest trustzone
+```
+
+Note!
+The expected output using the input data is not bitexact.
+
+# License
+
+The Arm Ethos-U Core Platform is provided under an Apache-2.0 license. Please
+see [LICENSE.txt](LICENSE.txt) for more information.
+
+# Contributions
+
+Please see [README](../../README.md)
+
+# Security
+
+Please see [Security](../../SECURITY.md).