blob: 1b71215029eccf27f57db3fa31f27a65b80ff504 [file] [log] [blame]
Ken Liubc88eb42020-04-25 19:32:25 +08001###################################
2Trusted Firmware-M Source Structure
3###################################
4
5:Organization: Arm Limited
6:Contact: tf-m@lists.trustedfirmware.org
7
8.. note::
Minos Galanakise4094012020-06-12 14:25:34 +01009 Refernce the document :doc:`Glossary </docs/reference/glossary>` for terms and
Ken Liubc88eb42020-04-25 19:32:25 +080010 abbreviations.
11
12************
13Introduction
14************
Ken Liu8e41e3e2020-06-02 10:57:53 +080015TF-M is designed to provide a user-friendly source structure to ease
Ken Liubc88eb42020-04-25 19:32:25 +080016integration and service development. This document introduces the source
17structure and its design intention of TF-M.
18
19.. note::
20 - This document goes ahead of the implementation so the existing source
Ken Liu8e41e3e2020-06-02 10:57:53 +080021 structure may be different from the description listed here. It is
22 recommended to refer to this document for ongoing code structure changes.
23 - By getting feedback from the practical implementation, this document is
24 updated continuously before it is detailed enough to be a user guide.
Ken Liubc88eb42020-04-25 19:32:25 +080025
26****************
27Source Structure
28****************
29The description of the source structure is broken down into subsections, each
30subsection introduces one detailed folder.
31
32Root Direcotry
33==============
Ken Liu8e41e3e2020-06-02 10:57:53 +080034This table describes the structure under the root directory with part of
35possible folders. Note that the ``Detailed`` field indicates if the folder is
36described in details here in this document:
Ken Liubc88eb42020-04-25 19:32:25 +080037
38============= ==================================== ====================
39Folder name Purpose Detailed
40============= ==================================== ====================
Ken Liu8e41e3e2020-06-02 10:57:53 +080041bl2 The 2nd stage bootloader. No.
42cmake Cmake files. No.
43configs Configuration system files. No.
44docs The documentations. No.
45lib The 3rd party library. No.
Ken Liubc88eb42020-04-25 19:32:25 +080046**platform** Platform intermedia files. See `'platform'`_.
47**secure_fw** The secure firmware. See `'secure_fw'`_.
Ken Liu8e41e3e2020-06-02 10:57:53 +080048test Tests. No.
49tools Tools in scripts for building. No.
Ken Liubc88eb42020-04-25 19:32:25 +080050============= ==================================== ====================
51
Ken Liubc88eb42020-04-25 19:32:25 +080052'platform'
53==========
54The platform sources contain necessary platform sources or intermedia files
55pointing to the sources out of TF-M folder.
56
57========================= =============================================
58Folder name Purpose
59========================= =============================================
60common/\* Common HAL implementation.
Ken Liu8e41e3e2020-06-02 10:57:53 +080061include/\* Platform public headers.
62<vendor> Vendor specific folders.
Ken Liubc88eb42020-04-25 19:32:25 +080063========================= =============================================
64
65.. note::
66 The ``common`` folder contains the example implementation of the ``HAL`` API
67 bases on common ``system`` (CMSIS e.g.). The platform could reference to
68 sources in the ``common`` folder directly if applicable or apply a
69 customized HAL implementation.
70 A ``system`` can have a standalone folder under ``common``, depends on how
71 'common' this system is. Each ``platform vendor`` is assigned with one
72 folder for usage. As the content of the ``vendor`` folder comes by the
73 contribution of vendors, the ``vendor`` manages the structure inside it.
74
75'secure_fw'
76===========
77This folder contains components needed by secure firmware, and the exported
78interfaces for application, service development and HAL integration:
79
Ken Liu8e41e3e2020-06-02 10:57:53 +080080================= ===================================== ======================
81Folder name Purpose Detailed
82================= ===================================== ======================
83**include** Public headers of 'secure_fw'. See `'include'`_
84**partitions** Default services and supportings. See `'partitions'`_
85**spm** PSA-FF-M SPM implementation. [1] See `'spm'`_
86================= ===================================== ======================
Ken Liubc88eb42020-04-25 19:32:25 +080087
88.. note::
Ken Liu8e41e3e2020-06-02 10:57:53 +080089 1. A PSA-FF-M complied SPM implementation.
Ken Liubc88eb42020-04-25 19:32:25 +080090
Ken Liu8e41e3e2020-06-02 10:57:53 +080091 The headers referenced by other modules are public headers and put under the
92 'include' folder of the current module. Do not put headers not referenced by
93 other modules in this 'include' folder.
Ken Liubc88eb42020-04-25 19:32:25 +080094
95'include'
96---------
97This folder holds headers for client, services and platform integration usage.
98
Ken Liu8e41e3e2020-06-02 10:57:53 +080099=========================== ===================================================
Ken Liubc88eb42020-04-25 19:32:25 +0800100Folder name Purpose
Ken Liu8e41e3e2020-06-02 10:57:53 +0800101=========================== ===================================================
102psa/\* PSA FF Client API.
103=========================== ===================================================
Ken Liubc88eb42020-04-25 19:32:25 +0800104
105.. note::
106 TFM applies an explicit including policy. Each module's headers are put into
Ken Liu8e41e3e2020-06-02 10:57:53 +0800107 a specific folder which follows the pattern '\*/inc', this folder needs to be
108 added into the project's searching path if this project needs to include
109 headers in this folder. The 'inc' in a path indicates the end of
110 including-path. If there are subfolders under folder 'inc', apply a
111 hierarchy including.
Ken Liubc88eb42020-04-25 19:32:25 +0800112
113'partitions'
114------------
115This folder contains default services implemented as partitions and necessary
116partition runtime utilities provided by TF-M.
117
118================================= =============================================
119Folder name Purpose
120================================= =============================================
121lib/sprt/\* The SPRTL sources and intermedia files. [1]
Ken Liu8e41e3e2020-06-02 10:57:53 +0800122lib/sprt/shared\* Sources can be shared by out of SPRTL. [2]
Ken Liubc88eb42020-04-25 19:32:25 +0800123<partition_x>/\* Files for 'partition_x'.
Ken Liu8e41e3e2020-06-02 10:57:53 +0800124<partition_x>/include/\* RoT Service API headers of 'partition_x'. [3]
Ken Liubc88eb42020-04-25 19:32:25 +0800125<partition_y>/\* Files for 'partition_y'.
Ken Liu8e41e3e2020-06-02 10:57:53 +0800126<partition_y>/include/\* RoT Service API headers of 'partition_y'. [3]
Ken Liubc88eb42020-04-25 19:32:25 +0800127================================= =============================================
128
129.. note::
130 1. The SPRTL sources and intermediate files. SPRTL contains sources from
131 other folders, such as necessary RoT Service API implementation from
132 'partitions' folder.
Ken Liu8e41e3e2020-06-02 10:57:53 +0800133 2. The sources here can be referenced by the building system out of SPRTL.
134 Generally, they are runtime and PSA APIs.
135 3. Here takes 'partition_x' and 'partition_y' as an example, and showcases
136 a detailed structure of them. The `<interface>` contains the RoT Service
137 API for client calls. The folder name of this client-orient folder is
138 decided by the service developer.
Ken Liubc88eb42020-04-25 19:32:25 +0800139
Ken Liu8e41e3e2020-06-02 10:57:53 +0800140'spm'
141-----
142The SPM is the core component to provide a mechanism for providing secure
143services.
Ken Liubc88eb42020-04-25 19:32:25 +0800144
Ken Liu8e41e3e2020-06-02 10:57:53 +0800145=================================== ===========================================
146Folder name Purpose
147=================================== ===========================================
148include/\* SPM public headers.
149common/\* SPM common logic complies PSA-FF-M.
150psa_cmsis/\* CMSIS implementation for PSA-FF-M SPM. [1]
151func_cmsis/\* The library model implementation. [2]
152\* Implementation sources.
153=================================== ===========================================
Ken Liubc88eb42020-04-25 19:32:25 +0800154
155.. note::
Ken Liu8e41e3e2020-06-02 10:57:53 +0800156 1. CMSIS is the first implementation system.
157 2. This folder contains a function call based secure firmware implementation.
158 This model is the prototype model which would be updated after the PSA
159 model. Create a standalone folder to hold it.
Ken Liubc88eb42020-04-25 19:32:25 +0800160
161--------------
162
163*Copyright (c) 2020, Arm Limited. All rights reserved.*