M2354: Fix some TF-M minor issues (#376)

* M2354: Update TF-M import document

For Nuvoton M2354, this updates document to be consistent with
TF-M import.

* M2354: Pre-create cmake target mbed-m2354-tfm for custom_targets

For M2354 custom target, there is dilemma on cmake target mbed-m2354-tfm:
1. mbed-m2354-tfm is created in mbed-os M2354 cmake listfile, but may be used
   in custom_targets M2354 cmake listfile in advance.
2. Build system requires add_subdirectory(custom_targets) be placed in front of
   add_subdirectory(mbed-os).

To overcome above, mbed-m2354-tfm is pre-created on request and as singleton,
E.g.:
if(NOT TARGET mbed-m2354-tfm)
    add_library(mbed-m2354-tfm INTERFACE)
endif()
pull/15530/head
ccli8 2024-10-25 00:04:33 +08:00 committed by GitHub
parent 2692df35db
commit af80d119c1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 16 additions and 5 deletions

View File

@ -1,7 +1,9 @@
# Copyright (c) 2020-2021 ARM Limited. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
add_library(mbed-m2354-tfm INTERFACE)
if(NOT TARGET mbed-m2354-tfm)
add_library(mbed-m2354-tfm INTERFACE)
endif()
if("NU_M2354" IN_LIST MBED_TARGET_LABELS)
add_subdirectory(TARGET_NU_M2354)

View File

@ -100,6 +100,12 @@ $ cmake -S . \
-G"Unix Makefiles"
```
**NOTE**: To build for NuMaker-IoT-M2354 board, add below lines to above:
```
-DNU_TGT_NUMAKER_M2354=OFF \
-DNU_TGT_NUMAKER_IOT_M2354=ON \
```
Then:
```

View File

@ -1,11 +1,14 @@
# Nuvoton M2354 RSA keypair
A default RSA key pair is given to the Nuvoton M2354 target.
Two default RSA key pairs are given to the Nuvoton M2354 target.
Public key was pre-compiled to `targets/TARGET_NUVOTON/TARGET_M2354/TARGET_TFM/TARGET_NU_M2354/COMPONENT_TFM_S_FW/bl2.bin` and private key is in `nuvoton_m2354-root-rsa-3072.pem` for Secure image and `nuvoton_m2354-root-rsa-3072_1.pem` for Non-Secure image.
Public keys were pre-compiled to `bl2.bin` and private keys are in
`nuvoton_m2354-root-rsa-3072.pem` and `nuvoton_m2354-root-rsa-3072_1.pem`
for Secure image and Non-Secure image separately.
DO NOT use them in production code, they are exclusively for testing!
Private key must be stored in a safe place outside of the repository.
Private keys must be stored in a safe place outside of the repository.
`tools/psa/tfm/bin_utils/imgtool.py` can be used to generate new key pairs.
[Image tool](https://github.com/mcu-tools/mcuboot/blob/main/docs/imgtool.md)
can be used to generate new key pairs.