Skip to content

Commit 0f65576

Browse files
author
Amanda Butler
authored
Edit spm.md
Make initial edits to file, mostly for active voice, branding and grammar.
1 parent 460e631 commit 0f65576

File tree

1 file changed

+58
-60
lines changed

1 file changed

+58
-60
lines changed

docs/porting/psa/spm.md

Lines changed: 58 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,14 @@
1-
<h2 id="blockdevice-port">PSA SPM</h2>
1+
<h2 id="spm-port">PSA SPM</h2>
22

3-
SPM (Secure Partition Manager) is a part of the PSA Firmware Framework that is responsible for isolating software in Partitions, managing the execution of software within Partitions, and providing IPC between Partitions.
3+
Secure Partition Manager (SPM) is a part of the PSA Firmware Framework that is responsible for isolating software in partitions, managing the execution of software within partitions and providing interprocessor communication (IPC) between partitions.
44

5-
For more information about SPM, refer to [TODO: WHEN READY, SPM OVERVIEW PAGE LINK]
5+
For more information about SPM, please refer to [the SPM overview page](/docs/development/apis/mbed-psa.html).
66

77
**This page gives guidelines for silicon partners wishing to have Secure Partition Manager capabilities**
88

9+
### Memory layout
910

10-
## Memory layout
11-
12-
Typically PSA platforms will share same RAM and flash between secure and non secure cores.
13-
In order to provide PSA isolation level 1 or higher we need to partition both RAM and flash
14-
in a way described by following drawing:
11+
Typically, PSA platforms share the same RAM and flash between secure and nonsecure cores. To provide PSA isolation level 1 or higher, you need to partition both RAM and flash in a way the following image describes:
1512

1613
```text
1714
RAM
@@ -27,11 +24,12 @@ in a way described by following drawing:
2724
+-----------------------+----------------------------------------------------+
2825
2926
```
30-
In order to achieve RAM and Flash partitioning start and size values must be added to target a configuration in `targets.json`.
31-
The process of defining can be described in the following steps:
32-
1. secure target must inherit from `SPE_Target` meta-target
33-
2. non-secure target must inherit from `NSPE_Target`
34-
3. both targets must override default configuration by specifying flash RAM and shared RAM regions.
27+
28+
To achieve RAM and flash partitioning, you must add start and size values to a target configuration in `targets.json`. You can do this with the following steps:
29+
30+
1. Secure target must inherit from `SPE_Target` meta-target.
31+
2. Nonsecure target must inherit from `NSPE_Target`.
32+
3. Both targets must override the default configuration by specifying flash RAM and shared RAM regions.
3533

3634
```json
3735
"FUTURE_SEQUANA_M0_PSA": {
@@ -75,15 +73,16 @@ The process of defining can be described in the following steps:
7573
}
7674
```
7775

78-
> Note: shared memory region is required only for multi core architectures.
76+
<span class="notes">**Note:** Only multicore architectures require a shared memory region.</span>
77+
78+
### Linker scripts
79+
80+
Linker scripts must include `MBED_ROM_START`, `MBED_ROM_SIZE`, `MBED_RAM_START` and `MBED_RAM_START` macros for defining memory regions. You can define a shared memory region by reserving RAM space for shared memory use. The shared memory location is target specific and depends on the memory protection scheme applied.
7981

80-
## Linker Scripts
82+
Typically, shared memory is located before or after nonsecure RAM, for saving MPU regions. The shared memory region is nonsecure memory that both cores use.
8183

82-
Linker scripts mast include `MBED_ROM_START`, `MBED_ROM_SIZE`, `MBED_RAM_START` and `MBED_RAM_START` macros for defining memory regions.
83-
Shared memory region is defined by reserving RAM space for shared memory usage. Shared memory location is target specific and depends on the memory protection scheme applied.
84-
Typically shared memory will be located before/after non-secure RAM, for saving MPU regions. Shared memory region is considered non-secure memory used by both cores.
84+
#### Linker script example GCC_ARM
8585

86-
### Linker Script example GCC_ARM
8786
```
8887
#if !defined(MBED_ROM_START)
8988
#define MBED_ROM_START 0x10000000
@@ -111,7 +110,8 @@ MEMORY
111110
}
112111
...
113112
```
114-
### Linker Script example ARM
113+
114+
#### Linker Script example ARM
115115

116116
```
117117
#if !defined(MBED_ROM_START)
@@ -149,7 +149,8 @@ LR_IROM1 MBED_ROM_START MBED_ROM_SIZE {
149149
}
150150
}
151151
```
152-
### Linker Script example IAR
152+
153+
#### Linker script example IAR
153154

154155
```
155156
if (!isdefinedsymbol(MBED_ROM_START)) {
@@ -178,62 +179,60 @@ define symbol __ICFEDIT_region_IROM1_end__ = (MBED_ROM_START + MBED_ROM_SIZE);
178179
...
179180
```
180181

181-
## Mailbox
182+
### Mailbox
182183

183-
Mailbox is the SPM mechanism in charge of Inter Processor Communication, and is **relevant for multi-core systems only**.
184+
Mailbox is the SPM mechanism in charge of IPC, and is **relevant for multicore systems only**.
184185

185186
#### Concepts
186-
The mailbox mechanism is based on message queues and dispatcher threads.
187-
Each core has a single dispatcher thread, and a single message queue.
188-
The dispatcher thread waits on a mailbox event. Once this event occurs, the dispatcher thread reads and runs "tasks" accumulated on its local message queue.
187+
188+
The mailbox mechanism is based on message queues and dispatcher threads. Each core has a single dispatcher thread and a single message queue. The dispatcher thread waits on a mailbox event. Once this event occurs, the dispatcher thread reads and runs "tasks" accumulated on its local message queue.
189189

190190
#### Requirements
191-
The SPM mailbox mechanism requires that the platform should have the following capabilities:
192-
* Inter Processor Communication capabilities - The ability to notify the peer processor about an event (usually implemented with interrupts)
193-
* Ability to set a RAM section which is shared between the cores
191+
192+
The SPM mailbox mechanism requires the platform to have the following capabilities:
193+
194+
- IPC capabilities - The ability to notify the peer processor about an event (usually implemented with interrupts).
195+
- Ability to set a RAM section shared between the cores.
194196

195197
#### Porting
196-
These are the guidelines which should be followed by silicon partners with multi-core systems:
197-
- For each core, initialize, configure and enable the a mailbox event (usually an interrupt) at SystemInit()
198-
- For each core, implement the mailbox event handler (usually interrupt handler):
199-
- This handler must call an ARM callback function. This is explained in more details in the [HAL Functions section](#hal-functions)
200-
- It is the silicon partner's responsibility to clear the mailbox event. This can be done in the event handler.
201-
- For each core, implement the HAL function which notifies the peer processor about a mailbox event occurrence. This is a part of the HAL, and explained in more details in the [HAL Functions section](#hal-functions)
202198

199+
These are the guidelines you should follow if you have multicore systems:
200+
201+
- For each core, initialize, configure and enable the a mailbox event (usually an interrupt) at `SystemInit()`.
202+
- For each core, implement the mailbox event handler (usually interrupt handler):
203+
- This handler must call an Arm callback function. The [HAL functions section](#hal-functions) explains this in more detail.
204+
- It is your responsibility to clear the mailbox event. You can do this in the event handler.
205+
- For each core, implement the HAL function that notifies the peer processor about a mailbox event occurrence. This is a part of the HAL, and the section below explains this in more detail.
203206

204-
## HAL Functions
207+
### HAL functions
205208

206209
Target specific code of silicon partners who wish to have SPM capabilities must:
207-
- Implement a list of functions which are being called by SPM code
208-
- Call other functions supplied by ARM
209210

210-
The HAL can be logically divided into 2 different fields:
211+
- Implement a list of functions which are being called by SPM code.
212+
- Call other functions supplied by ARM.
211213

212-
#### Mailbox
213-
This part of HAL allows the silicon partner to implement a thin layer of the mailbox mechanism which is specific to their platform.
214-
It must be implemented only by silicon partners with multi-core systems.
214+
The HAL can be logically divided into two different fields:
215215

216-
#### Secure Processing Environment
217-
This part of HAL allows the silicon partner to apply their specific memory protection scheme.
216+
#### Mailbox
218217

219-
A list of these functions can be found here [TODO: WHEN READY, ADD LINK TO DOXYGEN FILES OF HAL FUNCTIONS]
218+
This part of HAL allows you to implement a thin layer of the mailbox mechanism that is specific to your platform. You must only implement it if you have multicore systems.
220219

220+
#### Secure Processing Environment
221221

222-
## Memory Protection
222+
This part of HAL allows you to apply your specific memory protection scheme. You can find a list of [these functions]([TODO: WHEN READY, ADD LINK TO DOXYGEN FILES OF HAL FUNCTIONS]).
223223

224-
As explained in the [HAL Functions section](#hal-functions), target specific code must implement the function *spm_hal_memory_protection_init()* called on SPM initialization.
225-
This function should apply memory protection schemes to ensure secure memory can only be accessed from secure-state.
224+
### Memory protection
226225

227-
The implementation of this function, must be aligned with the SPM general guidelines as described in the table below.
226+
Target-specific code must implement the function *spm_hal_memory_protection_init()* called in SPM initialization. This function should apply memory protection schemes to ensure secure memory can only be accessed from secure-state.
228227

229-
This table describes the allowed operations (Read / Write / Execute) on the Secure and Non-Secure RAM and FLASH by each core:
228+
The implementation of this function must be aligned with the SPM general guidelines, as the table below describes. This table describes the allowed operations (Read, Write and Execute) on the secure and nonsecure RAM and FLASH by each core:
230229

231-
- X means No Access
232-
- V means Must Be Able to Access
233-
- ? means it is up to the target
234-
- X? means it is up to the target, preferably No Access
230+
- X means No access.
231+
- V means Must be able to access.
232+
- ? means it is up to the target.
233+
- X? means it is up to the target, preferably No access.
235234

236-
Processor Access |Secure RAM |Secure FLASH|Non Secure RAM |Non Secure FLASH
235+
Processor access |Secure RAM |Secure FLASH|Nonsecure RAM |Nonsecure FLASH
237236
--------------------|------------------|------------|-------------------|----------------
238237
`Non Secure Read` | X | X | V | V
239238
`Non Secure Write` | X | X | V | ?
@@ -242,15 +241,14 @@ Processor Access |Secure RAM |Secure FLASH|Non Secure RAM |Non Sec
242241
`Secure Write` | V | V | V | ?
243242
`Secure Execute` | X? | V | X | ?
244243

244+
### Testing
245245

246-
## Testing
246+
Arm provides a list of tests to make sure the HAL functions are implemented according to requirements, and the porting is done correctly.
247247

248-
ARM provides a list of tests to make sure the HAL functions are implemented according to requirements, and the porting is done correctly.
248+
After finalizing the porting, execute the following tests:
249249

250-
After finalizing the porting, the following tests should be executed:
251250
- [TODO: WHEN READY, ADD TEST NAME]
252251
- [TODO: WHEN READY, ADD TEST NAME]
253252
- ...
254253

255-
It is recommended to leave the memory protection part [*spm_hal_memory_protection_init()* implementation] to the end of the porting.
256-
First implement and test other HAL functions, and after these tests pass, implement *spm_hal_memory_protection_init()* and run the entire test suite again, including the memory protection related tests.
254+
We recommended you leave the memory protection part (*spm_hal_memory_protection_init()* implementation) to the end of the porting. First, implement and test other HAL functions. After these tests pass, implement *spm_hal_memory_protection_init()*, and run the entire test suite again, including the memory protection related tests.

0 commit comments

Comments
 (0)