Skip to content

M2351: Support TFM level 1 #10959

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 12 commits into from
Jan 8, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ static const osMutexAttr_t ns_lock_attrib = {
/**
* \brief NS world, NS lock based dispatcher
*/
__attribute__((weak))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should use MBED_WEAK instead.

/** MBED_WEAK
 *  Mark a function as being weak.
 *
 *  @note
 *  Functions should only be marked as weak in the source file. The header file
 *  should contain a regular function declaration to insure the function is emitted.
 *  A function marked weak will not be emitted if an alternative non-weak
 *  implementation is defined.
 *
 *  @note
 *  Weak functions are not friendly to making code re-usable, as they can only
 *  be overridden once (and if they are multiply overridden the linker will emit
 *  no warning). You should not normally use weak symbols as part of the API to
 *  re-usable modules.
 *
 *  @code
 *  #include "mbed_toolchain.h"
 *
 *  MBED_WEAK void foo() {
 *      // a weak implementation of foo that can be overriden by a definition
 *      // without  __weak
 *  }
 *  @endcode
 */
#ifndef MBED_WEAK
#if defined(__ICCARM__)
#define MBED_WEAK __weak
#elif defined(__MINGW32__)
#define MBED_WEAK
#else
#define MBED_WEAK __attribute__((weak))
#endif
#endif
  • platform/mbed_toolchain.h

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The change to this file is temporary for my porting. Its final modification should come from TF-M repo (see #10959 (comment)).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@VeijoPesonen I still use __attribute__((weak)) because all toolchains support it. This is also what https://review.trustedfirmware.org/c/trusted-firmware-m/+/1460 is adopting.

uint32_t tfm_ns_lock_dispatch(veneer_fn fn,
uint32_t arg0, uint32_t arg1,
uint32_t arg2, uint32_t arg3)
Expand Down Expand Up @@ -70,6 +71,7 @@ uint32_t tfm_ns_lock_dispatch(veneer_fn fn,
/**
* \brief NS world, Init NS lock
*/
__attribute__((weak))
enum tfm_status_e tfm_ns_lock_init()
{
if (ns_lock.init == false) {
Expand Down
4 changes: 4 additions & 0 deletions features/storage/kvstore/conf/tdb_internal/mbed_lib.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@
"internal_size": "0x200000",
"internal_base_address": "0x00200000"
},
"NU_PFM_M2351_S": {
"internal_size": "0x8000",
"internal_base_address": "(PSA_SECURE_ROM_START + PSA_SECURE_ROM_SIZE - 0x1000 - MBED_CONF_STORAGE_TDB_INTERNAL_INTERNAL_SIZE)"
},
"MCU_PSOC6": {
"internal_size": "0x10000"
}
Expand Down
3 changes: 3 additions & 0 deletions platform/mbed_lib.json
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,9 @@
"crash-capture-enabled": true,
"fatal-error-auto-reboot-enabled": true
},
"NU_PFM_M2351": {
"stdio-baud-rate": 115200
},
"NRF52840_DK": {
"crash-capture-enabled": true,
"fatal-error-auto-reboot-enabled": true
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
Permissive Binary License

Version 1.0, September 2015

Redistribution. Redistribution and use in binary form, without
modification, are permitted provided that the following conditions are
met:

1) Redistributions must reproduce the above copyright notice and the
following disclaimer in the documentation and/or other materials
provided with the distribution.

2) Unless to the extent explicitly permitted by law, no reverse
engineering, decompilation, or disassembly of this software is
permitted.

3) Redistribution as part of a software development kit must include the
accompanying file named "DEPENDENCIES" and any dependencies listed in
that file.

4) Neither the name of the copyright holder nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.

Limited patent license. The copyright holders (and contributors) grant a
worldwide, non-exclusive, no-charge, royalty-free patent license to
make, have made, use, offer to sell, sell, import, and otherwise
transfer this software, where such license applies only to those patent
claims licensable by the copyright holders (and contributors) that are
necessarily infringed by this software. This patent license shall not
apply to any combinations that include this software. No hardware is
licensed hereunder.

If you institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the software
itself infringes your patent(s), then your rights granted under this
license shall terminate as of the date such litigation is filed.

DISCLAIMER. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
CONTRIBUTORS "AS IS." ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT
NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# M2351 pre-built secure images for PSA

This directory tree contains secure images released under Permissive Binary License.

Built using Arm Compiler - version 6.10 or afterwards

These images were compiled by the following command:

```sh
python ./tools/psa/release.py -m NU_PFM_M2351_S -t ARMC6
```
Binary file not shown.
Loading