1.. _platform_folder:
2
3###############################
4Details for the platform folder
5###############################
6
7*********************
8Interfacing with TF-M
9*********************
10
11platform/ext/target/tfm_peripherals_def.h
12=========================================
13This file should enumerate the hardware peripherals that are available for TF-M
14on the platform. The name of the peripheral used by a service is set in its
15manifest file. The platform have to provide a macro for each of the provided
16peripherals, that is substituted to a pointer to type
17``struct platform_data_t``. The memory that the pointer points
18to is allocated by the platform code. The pointer gets stored in the partitions
19database in SPM, and it is provided to the SPM HAL functions.
20
21Peripherals currently used by the services in TF-M
22--------------------------------------------------
23- ``TFM_PERIPHERAL_UART1``-  UART1
24
25.. Note::
26
27    If a platform doesn't support a peripheral, that is used by a service, then
28    the service cannot be used on the given platform. Using a peripheral in
29    TF-M that is not supported by the platform results in compile error.
30
31platform/include/tfm_spm_hal.h
32==============================
33This file contains the declarations of functions that a platform implementation
34has to provide for TF-M's SPM. For details see the comments in the file.
35
36platform/include/tfm_platform_system.h
37======================================
38This file contains the declarations of functions that a platform implementation
39has to provide for TF-M's Platform Service. For details see
40``docs/user_guides/services/tfm_platform_integration_guide.rst``
41
42**************
43System Startup
44**************
45
46Before calling ``main()``, platform startup code should initialise all system
47clocks, perform runtime initialisation and other steps such as setting the
48vector table. Configuration of the following features is optional as TF-M
49architecture code will check and initialise them:
50
51  - The Security Extension.
52  - The Floating-point Extension.
53
54*****************************
55Debug authentication settings
56*****************************
57
58A platform may provide the option to configure debug authentication. TF-M core
59calls the HAL function ``enum tfm_hal_status_t tfm_hal_platform_init(void)``
60in which debug authentication is configured based on the following defines:
61
62  - `DAUTH_NONE`: Debugging the system is not enabled.
63  - `DAUTH_NS_ONLY`: Invasive and non invasive debugging of non-secure code is
64    enabled.
65  - `DAUTH_FULL`: Invasive and non-invasive debugging of non-secure and secure
66    code is enabled.
67  - `DAUTH_CHIP_DEFAULT`: The debug authentication options are used that are set
68    by the chip vendor.
69
70The desired debug authentication configuration can be selected by setting one of
71the options above to the cmake command with the
72`-DDEBUG_AUTHENTICATION="<define>"` option. The default value of
73`DEBUG_AUTHENTICATION` is `DAUTH_CHIP_DEFAULT`.
74
75.. Note::
76   ``enum tfm_hal_status_t tfm_hal_platform_init(void)`` is called during the
77   TF-M core initialisation phase, before initialising secure partition. This
78   means that BL2 runs with the chip default setting.
79
80***********
81Sub-folders
82***********
83
84include
85=======
86This folder contains the interfaces that TF-M expects every target to provide.
87The code in this folder is created as a part of the TF-M project therefore it
88adheres to the BSD 3.0 license.
89
90ext
91===
92This folder contains code that has been imported from other projects so it may
93have licenses other than the BSD 3.0 used by the TF-M project.
94
95Please see the :doc:`platform_ext_folder` for details.
96
97--------------
98
99*Copyright (c) 2017-2023, Arm Limited. All rights reserved.*
100