Skip to content

Commit ea9484f

Browse files
committed
Add docs for NSC APIs and update H5 option bytes
1 parent 1813463 commit ea9484f

File tree

3 files changed

+42
-4
lines changed

3 files changed

+42
-4
lines changed

docs/API.md

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,3 +66,35 @@ the two images again.
6666
For more information about the update process, see [Firmware Update](firmware_update.md)
6767

6868
For the image format, see [Firmware Image](firmware_image.md)
69+
70+
## NSC API
71+
72+
If you're running wolfBoot on an ARM TrustZone-enabled device (see for example
73+
[STM32-TZ](STM32-TZ.md)) you may wish to run your application in non-secure
74+
mode, while keeping the UPDATE and SWAP partitions in the secure domain. In
75+
order to accomplish this, any operation by the application that requires access
76+
to those partitions needs to be performed via wolfBoot code running in the
77+
secure domain. For this purpose, wolfBoot provides Non-Secure Callable (NSC)
78+
APIs that allow code running in the non-secure domain to call into the secure
79+
domain managed by wolfBoot.
80+
81+
These APIs are listed below.
82+
83+
- `void wolfBoot_nsc_success(void)`: wrapper for `wolfBoot_success()`
84+
- `void wolfBoot_nsc_update_trigger(void)`: wrapper for
85+
`wolfBoot_update_trigger()`
86+
- `uint32_t wolfBoot_nsc_get_image_version(uint8_t part)`: wrapper for
87+
`wolfBoot_get_image_version()`
88+
- `uint32_t wolfBoot_nsc_current_firmware_version(void)`: wrapper for
89+
`wolfBoot_current_firmware_version()`
90+
- `uint32_t wolfBoot_nsc_update_firmware_version(void)`: wrapper for
91+
`wolfBoot_update_firmware_version()`
92+
- `int wolfBoot_nsc_get_partition_state(uint8_t part, uint8_t *st)`: wrapper
93+
for `wolfBoot_get_partition_state()`
94+
- `int wolfBoot_nsc_erase_update(uint32_t address, uint32_t len)`: allows the
95+
application to erase the update partition in secure mode. The `address`
96+
parameter is an offset from the beginning of the partition.
97+
- `int wolfBoot_nsc_write_update(uint32_t address, const uint8_t *buf, uint32_t
98+
len)`: allows the application to write to the update partition in secure
99+
mode. The `address` parameter is an offset from the beginning of the
100+
partition.

docs/STM32-TZ.md

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,12 @@ image header size must be supplied as an environment variable. For example:
5555
IMAGE_HEADER_SIZE=1024 ./tools/keytools/sign --sha256 --ecc256 myapp.bin wolfboot_signing_private_key.der 1
5656
```
5757

58+
### NSC API
59+
60+
wolfBoot provides a few Non-Secure Callable functions to allow a non-secure
61+
application to perform certain operations that must be run from the secure
62+
domain. For more information, see [API](docs/API.md#nsc-api).
63+
5864
### Example using STM32L552
5965

6066
- Copy the example configuration for STM32-L5 with support for wolfCrypt in
@@ -210,8 +216,8 @@ OPTION BYTES BANK: 4
210216
211217
Bank2 - Flash watermark area definition:
212218
213-
SECWM2_STRT : 0x2F (0x0815e000)
214-
SECWM2_END : 0x0 (0x08100000)
219+
SECWM2_STRT : 0x0 (0x08100000)
220+
SECWM2_END : 0x7F (0x081fe0000)
215221
216222
Write sector group protection 2:
217223

docs/Targets.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -915,7 +915,7 @@ The example configuration for this scenario is available in [/config/examples/st
915915
`STM32_Programmer_CLI -c port=swd -ob TZEN=0xB4`
916916

917917
- set the option bytes to enable flash secure protection of first 384KB and remainder as non-secure:
918-
`STM32_Programmer_CLI -c port=swd -ob SECWM1_STRT=0x0 SECWM1_END=0x2F SECWM2_STRT=0x2F SECWM2_END=0x0`
918+
`STM32_Programmer_CLI -c port=swd -ob SECWM1_STRT=0x0 SECWM1_END=0x2F SECWM2_STRT=0x0 SECWM2_END=0x7F`
919919

920920
- flash the wolfboot image to the secure partition:
921921
`STM32_Programmer_CLI -c port=swd -d wolfboot.bin 0x0C000000`
@@ -934,7 +934,7 @@ echo -n "pBOOT" > trigger_magic.bin
934934
update.bin \
935935
0x0 test-app/image_v2_signed.bin \
936936
0x9FFFB trigger_magic.bin
937-
STM32_Programmer_CLI -c port=swd -d update.bin 0x08100000
937+
STM32_Programmer_CLI -c port=swd -d update.bin 0x0C100000
938938
```
939939

940940

0 commit comments

Comments
 (0)