aboutsummaryrefslogtreecommitdiff
path: root/platform/ext/readme.md
blob: 5558e416ed0bbc5c71729b0e3ed101fb31616ea5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
# Details for the platform/ext folder

This folder has code that has been imported from other projects. This means the
files in this folder and subfolders have Apache 2.0 license which
is different to BSD 3.0 license applied to the parent TF-M project.


`NOTE` This folder is strictly Apache 2.0 with the exception of cmake files.
Maintainers should be consulted if this needs to be revisited.

## Sub-folders

### cmsis

This folder contains core and compiler specific header files imported from the
CMSIS_5 project.

### common

This folder contains stdout redirection to UART, a temporary memory mapped
flash implementation for the bootloader and tfm_mbedtls_config.h for all
the targets.

### drivers

This folder contains the headers with CMSIS compliant driver definitions that
that TF-M project expects a target to provide.

#### target_cfg.h

This file is expected to define the following macros respectively.

 - `TFM_DRIVER_STDIO`
   This macro should expand to a structure of type `ARM_DRIVER_USART`.
   TFM redirects its standard input and output to this instance of USART.
 - `NS_DRIVER_STDIO`
   This macro should expand to a structure of type `ARM_DRIVER_USART`.
   Non-Secure application redirects its standard input and output to this
   instance of USART.

### target

This folder contains the files for individual target.

#### Flash layout header file

Target must provide a header file, called flash_layout.h, which defines the
information explained in the follow subsections. The defines must be named
as they are in the subsections.

##### BL2 bootloader

The BL2 bootloader requires the following definitions:

 - `FLASH_BASE_ADDRESS`
   Defines the first valid address in the flash.
 - `FLASH_AREA_BL2_OFFSET`
   Defines the offset from the flash base address
   where the BL2 - MCUBOOT area starts.
 - `FLASH_AREA_BL2_SIZE`
   Defines the size of the BL2 area.
 - `FLASH_AREA_IMAGE_0_OFFSET`
   Defines the offset from the flash base address
   where the image 0 area starts, which hosts the
   active firmware image.
 - `FLASH_AREA_IMAGE_0_SIZE`
   Defines the size of the image 0 area.
 - `FLASH_AREA_IMAGE_1_OFFSET`
   Defines the offset from the flash base address
   where the image 1 area starts, which is a placeholder
   for new firmware images.
 - `FLASH_AREA_IMAGE_1_SIZE`
   Defines the size of the image 1 area.
 - `FLASH_AREA_IMAGE_SCRATCH_OFFSET`
   Defines the offset from the flash base address
   where the scratch area starts, which is used during
   image swapping.
 - `FLASH_AREA_IMAGE_SCRATCH_SIZE`
   Defines the size of the scratch area. The minimal size
   must be as the biggest sector size in the flash.
 - `FLASH_DEV_NAME`
   Specifies the flash device used by BL2.

##### Assemble tool

The assemble.py tools is used to concatenate secure and non-secure
binary to a single binary blob. It requires the following definitions:

 - `SECURE_IMAGE_OFFSET`
   Defines the offset from the single binary blob base address,
   where the secure image starts.
 - `SECURE_IMAGE_MAX_SIZE`
   Defines the maximum size of the secure image area.
 - `NON_SECURE_IMAGE_OFFSET`
   Defines the offset from the single binary blob base address,
   where the non-secure image starts.
 - `NON_SECURE_IMAGE_MAX_SIZE`
   Defines the maximum size of the non-secure image area.

##### Secure Storage (SST) Service definitions

The SST service requires the following definitions:

 - `SST_FLASH_AREA_ADDR`
   Defines the flash area address where the secure
   store area starts.
 - `SST_SECTOR_SIZE`
   Defines the size of the flash sectors.
 - `SST_NBR_OF_SECTORS`
   Defines the number of sectors available for
   the secure area.
 - `SST_FLASH_DEV_NAME`
   Specifies the flash device used by SST to store the data.
 - `SST_FLASH_PROGRAM_UNIT`
   Defines the smallest flash programmable unit in bytes.
 - `SST_MAX_ASSET_SIZE`
   Defines the maximum asset size to be stored in the SST area.
 - `SST_NUM_ASSETS`
   Defines the maximum number of assets to be stored in the SST area.

**Note**: The sectors must be consecutive.

## Expose target support for HW components

Services may require HW components to be supported by the target
to enable some features (e.g. SST service with rollback protection, etc).
The following definitions need to be set in the <TARGET_NAME>.cmake file if the
target has the following HW components:

 - `TARGET_NV_COUNTERS_ENABLE`
   Specifies that the target has non-volatile (NV) counters.

--------------

*Copyright (c) 2017-2019, Arm Limited. All rights reserved.*