blob: 7b02ba0697b538bc205a67dcfa37ed9d85c1d396 [file] [log] [blame]
Anton Komlev36882782024-04-10 21:00:30 +01001########################
2TF-M Example Application
3########################
4
5This **tf-m-example-ns-app** directory provides a bare metal example NS application, demonstrating how to use the
6artifacts exported by TF-M build.
7
8The application outputs "Hello TF-M world" and uses a PSA service function to demonstrate
9that a NS application can be successfully run.
10
11*****************
12The Build Process
13*****************
14
151. Clone the TF-M repository at anywhere, assume the root directory is ``<TF-M Source Dir>``
16
172. Build the TF-M with the following command:
18
19.. code-block:: bash
20
21 cmake -S <TF-M Source Dir> -B build/spe -DTFM_PLATFORM=arm/mps2/an521 -DTFM_PROFILE=profile_small
22 cmake --build build/spe -- install
23
243. The files necessary to build TF-M will appear in ``build/spe/api_ns``.
25 The most important elements are:
26
27 - Bootloader: ``/bin/bl2.*``
28 - Secure (S) side binary image: ``/bin/tfm_s.*``
29 - PSA API for Non-Secure application ``/interface/*``
30
314. Build this example TF-M application:
32
33.. code-block:: bash
34
35 cmake -S <path_to_this_example> -B build/nspe -DCONFIG_SPE_PATH=<absolute_path_to>/build/spe/api_ns
36 cmake --build build/nspe
37
385. In output you will get:
39
40 - Non-secure (NS) application in ``build/nspe/bin/tfm_ns.*``
41 - Combined S + NS bianry ``build/nspe/bin/tfm_s_ns.bin``
42 - Combined S + NS and signed bianry ``build/nspe/bin/tfm_s_ns.bin``
43
44*******************
45Run the Application
46*******************
47The application binary shall be loaded and launched on address ``0x10080000``.
48The application can be run using the SSE-200 fast-model using FVP_MPS2_AEMv8M provided by Arm
49Development Studio.
50Add ``bl2.axf`` and ``tfm_s_ns_signed.bin`` to the symbol files in the Debug Configuration menu.
51The following output you shall find in a serial terminal:
52
53.. code-block:: console
54
55 Non-Secure system starting...
56 Hello TF-M world
57 PSA Framework Version = 1.1
58 Testing psa get random number...
59 1: psa_generate_random() = 254
60 2: psa_generate_random() = 214
61 3: psa_generate_random() = 129
62 4: psa_generate_random() = 226
63 5: psa_generate_random() = 102
64 End of TF-M example App
65
66*Copyright (c) 2023, Arm Limited. All rights reserved.*