Commit Graph

1342 Commits (master)

Author SHA1 Message Date
Chun-Chieh Li d5130d33d7 TFM: Add missing IPC file for PSA Firmware Update
On a target that doesn't support Firmware Update, compilation still works, and any attempt to call the Firmware Update API returns a runtime error which is good enough.
2021-07-23 09:26:17 +08:00
Lingkai Dong 351680fb18 Rework post-build to support multiple executables
When building greentea tests, each test is an executable with its
own output binary path. This is also the case when a user project
produces multiple executables. But the current implementation of
post-build operations always assumes there's only one executable,
at the root of the build directory.

The post-build command depends on Mbed target, and it always takes
the the executable we build as an input file. To achieve this, we
let each Mbed target (that has a post-build command) define a function

    function(mbed_post_build_function target)

which takes a CMake executable target as an argument from which it can
get its binary path using generator expressions. It generates and adds
to the passed executable target a post-build custom command.

Notes:
* The function name needs to be exact, because CMake only supports
literal function calls - CMake can't dereference a function name from
a variable. To avoid multiple definitions of this function, each Mbed
target needs to guard it with a macro to check if the user is
building this Mbed target.
* `mbed_post_build_function()` is a function, but it is usually
defined by another macro rather than a parent function, because
nesting functions would make many variables inaccessible inside the
innermost `mbed_post_build_function()`.
* There's no more need to force regenerate images. Previously, post-
build commands were custom *targets* which always got to run, so we
force regenerated images on every build to avoid patching an image
that's already been patched once on previous build. Now post-build
commands are custom *commands* of the same executable target, and they
are only run if the executable target itself is rebuilt.
2021-07-22 17:31:22 +01:00
Jerome Coutant e61aff6564 mbed_retarget: enable IAR build 2021-07-19 15:05:37 +02:00
mbedmain d147abc3e5 Update Mbed version block 2021-07-14 11:11:35 +01:00
Robert Walton 55f77ea77f CMake: unit-tests: Remove --coverage option from mbed-stubs-platform
We set the --coverage flag globally in UNITTESTS/CMakeLists.txt. We
shouldn't need to also set it on mbed-stubs-platform, so remove it.
2021-07-06 13:50:46 +01:00
Robert Walton 021baa68e7 CMake: unit-tests: Split platform headers out of mbed-stubs-headers
We have a central collection of "stub headers", which makes reasoning
about dependencies rather difficult, as it forces every stub library to
depend on all available stub headers. The standard approach would be for
each stub library to expose its public headers, and its dependents to
explicitly specify a dependency on the stub library containing the
headers it needs. This is a more modular design than creating a
header-only monolith library. Move the platform stub headers from this
central library into the mbed-stubs-platform library to increase
modularity.

mbed-stubs-connectivity now depends on the mbed-stubs-platform because
it requires some headers which were moved to mbed-stubs-platform.
2021-07-06 13:50:46 +01:00
Robert Walton b73b38a01f CMake: unit-tests: Make platform stub only depend on headers it uses
Previously the platform stub library depended on `mbed-headers`, which
is a collection of all available headers in mbed-os. To make it easier
to separate the library, only depend on the headers we're actually using.
2021-07-06 13:50:46 +01:00
Robert Walton e2704749f1 CMake: unit-tests: Move mbed-headers-platform to platform directory
Move the header-only mbed-headers-platform library the unit test stubs
depend on into the platform component directory. This makes the platform
stubs more self contained and improves composition of the library.
2021-07-06 13:50:46 +01:00
Robert Walton 40435fd9b3 CMake: Move platform stubs to the mbed-os/platform directory
Move the platform stub library into the platform component directory.
This change is so we can avoid duplicating the mbed-os source tree in a
central UNITTESTS folder.
2021-07-06 13:50:42 +01:00
Robert Walton 3abc7886a9 CMake: unit-tests: CircularBuffer: Remove trailing whitespace 2021-07-06 13:48:59 +01:00
Jaeden Amero 75808eaaf2
Merge pull request #14783 from rwalton-arm/dont_capture_stdout
tfm-post-build: Don't capture subprocess stdout
2021-07-06 12:57:45 +01:00
Chun-Chieh Li 51f74bcda3 PSA: Fix compile error with NV seed
This compile error can reproduce when both PSA V7M and MBEDTLS_ENTROPY_NV_SEED are both enabled.
2021-07-01 17:44:33 +08:00
Jaeden Amero b5c2f7079e
Merge pull request #14718 from Meano/develop
Feature: Make changes for Cortex-A5 support
2021-07-01 10:23:41 +01:00
Martin Kojtal aa0aa3dc65
Merge pull request #14816 from artokin/nanostack_release_14_0_0_master
Nanostack release v14.0.0
2021-07-01 10:52:18 +02:00
Robert Walton 6d78f93b9e tfm-post-build: Don't capture subprocess stdout
subprocess.PIPE is used to enable the parent process to communicate with
the subprocess via pipes, which mean all stdout and stderr messages are
captured and returned as part of Popen.communicate's result tuple.

In our case, we want to display the error messages on the console, so we
don't need to capture the output from stdout.

Example of a typical error message before this change:
```
Traceback (most recent call last):
  File "platform/FEATURE_EXPERIMENTAL_API/FEATURE_PSA/TARGET_TFM/TARGET_TFM_LATEST/scripts/generate_mbed_image.py", line 197, in <module>
    sign_and_merge_tfm_bin(args.tfm_target, args.target_path, args.non_secure_bin, args.secure_bin)
  File "platform/FEATURE_EXPERIMENTAL_API/FEATURE_PSA/TARGET_TFM/TARGET_TFM_LATEST/scripts/generate_mbed_image.py", line 81, in sign_and_merge_tfm_bin
    " secure binary, Error code: " + str(retcode))
Exception: Unable to sign musca_b1 secure binary, Error code: 1
```

Example of the error message after this change:
```
Traceback (most recent call last):
  File "/mbed-os/tools/psa/tfm/bin_utils/wrapper.py", line 13, in <module>
    import click
ModuleNotFoundError: No module named 'click'
Traceback (most recent call last):
  File "platform/FEATURE_EXPERIMENTAL_API/FEATURE_PSA/TARGET_TFM/TARGET_TFM_LATEST/scripts/generate_mbed_image.py", line 194, in <module>
    sign_and_merge_tfm_bin(args.tfm_target, args.target_path, args.non_secure_bin, args.secure_bin)
  File "platform/FEATURE_EXPERIMENTAL_API/FEATURE_PSA/TARGET_TFM/TARGET_TFM_LATEST/scripts/generate_mbed_image.py", line 80, in sign_and_merge_tfm_bin
    raise Exception("Unable to sign " + target_name +
Exception: Unable to sign musca_b1 secure binary, Error code: 1
```

This is a significant improvement as now you can see what the reason for
the failure was.
2021-06-29 15:37:44 +01:00
Jaeden Amero 472c688a83
Merge pull request #14828 from hazzlim/add-cmake-supports-psa-tests
CMake: Add CMake to mbed-psa greentea tests
2021-06-29 15:17:01 +01:00
Hari Limaye f69a37518f CMake: Add support for PSA compliance_its tests
PSA compliance_its tests can now be built with CMake.
2021-06-29 13:33:51 +01:00
Hari Limaye 13ea9f36c1 CMake: Add support for compliance_attestation test
Greentea test for PSA compliance_attestation can now build with CMake.
2021-06-29 13:33:51 +01:00
Hari Limaye 62f110c89b CMake: Add mbed-psa-tal (Test Abstraction Layers)
Move /val and /pal directories into /test_abstraction_layers directory
and combine into one CMake target, mbed-psa-tal. Moved into seperate
directory in order to have own CMakeLists.txt, rather than adding to
/TARGET_MBED_PSA_SRV CMake file.
2021-06-29 13:33:51 +01:00
Hari Limaye 26290addbe CMake: Add support for PSA entropy_inject test
The greentea test for PSA entropy_inject can now be built with CMake.
Note: requires MBEDTLS_ENTROPY_NV_SEED enabled, so not tested on target.
2021-06-29 13:33:51 +01:00
Hari Limaye 24a3daba48 CMake: Add support for PSA its_ps test
The greentea test for mbed-psa its_ps can now be built with CMake.
2021-06-29 13:33:51 +01:00
Hari Limaye 9dc39a8352 CMake: Add support for PSA crypto_init test
The greentea test for mbed-psa crypto_init can now be built with CMake.
2021-06-29 13:33:51 +01:00
Hari Limaye 4bed069d21 CMake: Add support for PSA attestation test
The greentea test for mbed-psa attestation can now be built with CMake.
2021-06-29 13:33:50 +01:00
Hari Limaye f95052cf6f CMake: Require TEST_SOURCES in greentea CMake file
Assumption that greentea test file is always named main.cpp is
incorrect. Updated mbed_greentea_add_test() macro to make TEST_SOURCES
parameter compulsory, which is used to specify greentea test
file(s). This allows tests to use C, or have a different name.
Therefore also updated all pre-existing greentea test CMake files to
explicity add main.cpp to TEST_SOURCES.
2021-06-29 13:33:42 +01:00
Arto Kinnunen 6249aad249 Update copyright (#15)
-Change company name from Arm Limited to Pelion
-Update years
2021-06-28 09:38:11 +03:00
Arto Kinnunen 3a3c728784 Update license text in test files. (#14) 2021-06-28 09:38:11 +03:00
Antti Kauppila 2874fa67c4 Move ns_trace.h to mbed-trace folder 2021-06-28 09:38:11 +03:00
Tero Jääskö 6effd3d3ad tr_array: fix use after free error after mbed_trace_free() is called
If one called mbed_trace_free() but continued using the trace (which
is a supported use case), the already freed tmp_data buffer was used
by tr_array().

This was spotted by Valgrind on some unit tests which do enable the
trace only temporarily for some of the tests.

Error being fixed in this PR:
--8<--8<--8<---
==5865== Invalid write of size 1
==5865==    at 0x2639BB: mbed_trace_array (mbed_trace.c:569)
<...>
==5865==  Address 0x5dc79d0 is 0 bytes inside a block of size 128 free'd
==5865==    at 0x4C32D3B: free (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==5865==    by 0x262723: mbed_trace_free (mbed_trace.c:192)
<...>
==5865==  Block was alloc'd at
==5865==    at 0x4C31B0F: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==5865==    by 0x262548: mbed_trace_init (mbed_trace.c:162)
<...>
2021-06-28 09:38:10 +03:00
Tymoteusz Bloch f1663e794a Disable override errno erro value
Disable setting own values of flags for fcntl() function if they are defined
2021-06-25 17:12:55 +02:00
Meano ff2188150a Make changes for Cortex-A5 support 2021-06-23 13:36:55 +08:00
Meano 6feca90589 Unify the __CORTEX_A macro in the files containing cmsis.h 2021-06-23 13:36:52 +08:00
mbedmain cecc47b4a5 Update Mbed version block 2021-06-18 11:54:51 +01:00
Martin Kojtal c358ab2946
Merge pull request #14749 from tymoteuszblochmobica/fcntl
Fcntl  setting improvement,
2021-06-17 15:37:55 +02:00
Robert Walton a0befae2d4 CMake: Only build unit tests if Mbed OS is the current project
Typically when adding a unit test directory to a CMake project a check
will be used to ensure the subdirectory is added only if the following
are true:

* The BUILD_TESTING option is set to ON.
* The current CMake project is the top-level project.

The reason being, if a downstream project includes our project they
generally don't want to build our unit tests.

In mbed-os, we do correctly specify the above condition before adding
the central UNITTEST subdirectory, which fetches googletest and adds the
"stub" libraries the unit tests depend on. However, we only check if
CMAKE_CROSSCOMPILING is OFF (or undefined) before actually adding the
unit tests. This mismatched logic would lead to unexpected build
failures in various scenarios. One likely case could be: a downstream
project including mbed-os happens to set CMAKE_CROSSCOMPILING to
OFF/undefined for any reason (possibly to build its own unit tests).
mbed-os would go ahead and attempt to build its tests without fetching
googletest or adding the required stub targets.

To fix the issue replace the check for CMAKE_CROSSCOMPILING in the unit
tests with the same BUILD_TESTING idiom we use for adding the central
UNITTESTS subdirectory.
2021-06-10 23:34:14 +01:00
Robert Walton c761049903 CMake: unit-tests: Remove trailing whitespace 2021-06-10 23:24:43 +01:00
Tymoteusz Bloch bdb0a22dec Fcntl setting Non Blocking operations improvement 2021-06-09 15:36:24 +02:00
Tymoteusz Bloch 3a05db8d98 Namespace scope mbed:: added for CriticalSectionLock used in Atomic templates 2021-06-08 22:55:43 +02:00
Martin Kojtal 543bcb5192
Merge pull request #14441 from OpenNuvoton/nuvoton_m2354_tfm
M2354: Support Nuvoton's new target
2021-06-01 11:25:59 +02:00
Martin Kojtal a2d62f9597
Merge pull request #14652 from Patater/upgrade-mbedtls-2.25.0
tls: Upgrade to Mbed TLS v2.25.0
2021-05-31 11:36:26 +02:00
Martin Kojtal 8c2db151e6
Merge pull request #14547 from ARMmbed/remove_unittest_cmake_script
CMake: Remove all unittest.cmake script from test suite
2021-05-31 11:34:26 +02:00
Rajkumar Kanagaraj 50fc85dc44 CMake: Remove all unittest.cmake script from test suite
- Remove redundant cmake script as already added the CMake configuration file
- Remove redundant empty_baseline as it is no longer needed with the help of CMake configuration file
2021-05-26 07:09:14 -07:00
Chun-Chieh Li fd8ac31537 M2354: Support TF-M
1.  Configure non-secure target name to NU_M2354 (targets/targets.json). No NU_M2354_NS alias
2.  Following template target, enable image signing and concatenating in post-build process
    (1) Add post-build script (tools/targets).
    (2) Enable TF-M custom build by centralize relevant stuff imported from TF-M (COMPONENT_TFM_S_FW).
3.  Add M2354Code.merge_secure into whitelist of uvision6 (tools/export/uvision/__init__.py).
4.  Add M2354 CMSIS pack database (tools/arm_pack_manager/index.json).
5.  Configure stdio baudrate to 115200 to match TF-M port (platform/mbed_lib.json).
6.  Define CMSIS_NVIC_VIRTUAL to override NVIC_SystemReset with TF-M version (cmsis_nvic_virtual.h).
7.  Override tfm_ns_interface_xxx(...) to enable NS secure call:
    (1) At pre-rtos stage
    (2) In SVC context
8. Implement secure function call with tfm_platform_ioctl(...).
9. Combine stddriver_secure.h/c and hal_secure.h/c into platform_extra_secure.h/c.
10. Fix peripheral base to non-secure (PeripheralNames.h) (TrustZone-unaware since Mbed OS 6.0).
11. Fix NU_PORT_BASE/NU_GET_GPIO_PIN_DATA/NU_SET_GPIO_PIN_DATA to non-secure (PinNamesCommon.h) (TrustZone-unaware since Mbed OS 6.0).
12. NSC convention for StdDriver sys/clk (both TF-M and Mbed must follow)
    (1) SYS_ResetModule
        Usage: Replaced with SYS_ResetModule_S on Mbed OS
        Action: Make it inaccessible from Mbed (neither source nor NSC). Provide SYS_ResetModule_S on Mbed via platform ioctl instead.
    (2) CLK_GetXxx
        Usage: Called in bpwm/i2s/qspi/sc/sdh and system_M2354 on Mbed OS
        Action: Make them inaccessible from Mbed (neither source nor NSC). Re-provide them on Mbed via platform ioctl instead.
13. Remove DISABLE/ENABLE macro definitions in BSP to avoid name conflict with other modules
14. Change to TMR4/5 from TMR2/3 for implementing us_ticker/lp_ticker because TMR2 is used for TF-M NSPE test
15. Support cmake

NOTE: Export(uvision6) doesn't support TF-M target. To enable it for partial compile on Keil, force below function to return true.
      is_target_supported(tools/export/uvision/__init__.py)
2021-05-26 09:35:02 +08:00
Werner Lewis 046fa78319 Update GCC except.S to support ARMC6
ARM Compiler 6 supports GNU-style assembly with armclang. Instead of
relying on armasm with the legacy syntax, GCC except.S is updated so
that it can be used with ARM as well as GCC_ARM toolchains. CMake is
updated to use this version.
2021-05-24 13:54:57 +01:00
Anna Bridge 4e586a93d3
Merge pull request #14426 from ARMmbed/feature_unittest_refactor
CMake: Refactor UNITTESTS CMake
2021-05-24 13:04:22 +01:00
Lingkai Dong c780165686 psa: Remove outdated macro checks in tests
The macros `TARGET_PSA` and `COMPONENT_PSA_SRV_IPC` no longer exist.
The former is replaced by `COMPONENT_PSA` which is also a directory
where the tests are located, so its check can be assumed true.
The latter is not applicable to Mbed OS PSA and can be assumed false.

Note: The entropy_inject test is skipped by default unless a user
manually configures the required `MBEDTLS_ENTROPY_NV_SEED`.
2021-05-19 11:00:26 +01:00
Lingkai Dong 63531ecf45 psa: Fix test detection for Mbed CLI 1
A Greentea test is detectable by Mbed CLI 1 only if it's two-levels
deep inside a `TESTS` directory, e.g. `TESTS/foo/bar/main.cpp`. But
several Mbed OS PSA tests are only one-level deep. This commit fixes
the issue by adding an extra level of directory.
2021-05-19 11:00:20 +01:00
Lingkai Dong d1655ea772 psa: Add missing inclusion of crypto_types.h
val_client_defs.h includes crypto_values.h, but the latter requires
type definitions from crypto_types.h.
2021-05-19 11:00:06 +01:00
mbedmain 14e5d307bb Update Mbed version block 2021-05-17 12:12:30 +01:00
Lingkai Dong aa0c917140 psa: Add PSA_ALG_ECB_NO_PADDING to TF-M v1.0
TF-M v1.0 implements an older version of PSA and does not have the macro
`PSA_ALG_ECB_NO_PADDING` required by
`mbedtls_psa_translate_cipher_mode()` in Mbed TLS v2.25.0. Copy this
macro from Mbed TLS to fix the issue.
2021-05-14 17:31:31 +01:00
Lingkai Dong e5230c9c07 psa: Include mbedtls_svc_key_id.h for TF-M
We have added definitions that are needed by Mbed TLS's PSK key exchange
but missing from TF-M's PSA to `mbedtls_svc_key_id.h`. To pick up those
definitions, TF-M's `psa/crypto_values.h' needs to include
`mbedtls_svc_key_id.h`.
2021-05-14 17:31:23 +01:00
Lingkai Dong fa5df141d6 psa: Add mbedtls_svc_key_id.h
In order for Mbed TLS to use the PSA Crypto API, definitions of
`MBEDTLS_SVC_KEY_ID_INIT`, `mbedtls_svc_key_id_t` and
`mbedtls_svc_key_id_is_null()` need to be present but are not provided
by the PSA headers from TF-M.

To solve this issue, this commit copies those definitions from Mbed
TLS's original `psa/crypto_types.h` and `psa/crypto_values.h` into a
separate `mbedtls_svc_key_id.h` for TF-M PSA.
2021-05-14 17:31:07 +01:00
Jaeden Amero 9360e0fe82 tls: Upgrade to Mbed TLS v2.25.0 2021-05-12 15:49:36 +01:00
Martin Kojtal a4c63e6fdb
Merge pull request #14576 from marcuschangarm/trace_debug_color
Trace: Change tr_debug color from gray to bright blue
2021-05-12 10:48:44 +02:00
Rajkumar Kanagaraj 5ad51790a7 CMake: Refactor platform unittest CMake
- Add CMake configuration file test suites
2021-05-11 02:29:56 -07:00
Rajkumar Kanagaraj ba04c1cf76 CMake: Add add_subdirectory of unittests
- add every libraries unittest directory into respective CMake
  which allows to include unittest source into build based on
  MBED_BUILD_UNITTESTS flag
2021-05-11 02:29:56 -07:00
Martin Kojtal 3bd40d3161
Merge pull request #14624 from 0xc0170/fix-14432
error: use __INITIAL_SP from cmsis instead of RTX one
2021-05-11 10:51:32 +02:00
Martin Kojtal 3003a171b2 fixup! error: use __INITIAL_SP from cmsis instead of RTX one 2021-05-10 16:09:18 +01:00
Martin Kojtal e18d280ede
Merge pull request #14588 from Patater/mbed-libs-for-m55
Add v8.1-M architecture awareness
2021-05-10 15:13:33 +02:00
Marcus Chang 6e4c02ac6f Trace: Change tr_debug color from gray to bright blue
The gray-on-black color code used for debug level print-out in
mbed_trace is hard to read. Bright-blue-on-black increases the
brightness of the text without over shadowing the info level
default (white-on-black), thus making it easier to read while
maintaining the original intention.

For original color set MBED_TRACE_COLOR_THEME to 1.
2021-05-05 12:34:48 -07:00
Martin Kojtal f6176432d2 error: use __INITIAL_SP from cmsis instead of RTX one
We used to require INITIAL_SP as rtx target headers define it. This should not be required, as
cmsis already defines symbol  __INITIAL_SP for all toolchains.

Fixes #14432
2021-05-05 13:15:10 +01:00
Martin Kojtal 9f35f294fe
Merge pull request #14582 from LDong-Arm/TF-Mv1.3.0_update
Update TF-M to v1.3.0
2021-04-30 12:13:56 +01:00
Jaeden Amero 032fe4a6f7 tfm: Add mbedtls_ecc_group_to_psa.h to crypto_extra.h
Include mbedtls_ecc_group_to_psa.h from crypto_extra.h so that clients
of PSA within Mbed OS do not need to behave differently depending on
which PSA implementation they are using.

This solution is not ideal as it makes it more difficult to update the
TF-M-provided psa/crypto_extra.h. We'll have to see what other options
we have for including additional headers based on the Mbed OS
configuration.
2021-04-30 11:28:20 +01:00
Jaeden Amero 07d8aefe51 mbedtls: Add mbedtls_ecc_group_to_psa()
We'd like to enable Mbed TLS's PK module in using TF-M's PSA
implementation, even if it doesn't expose the same set of PSA extensions
as Mbed TLS's PSA implementation. To do this, we add
mbedtls_ecc_group_to_psa() in its own header available when using the
latest TF-M.

Add mbedtls_ecc_group_to_psa(), one of Mbed TLS's PSA compatibility
helpers, for internal use by the Mbed TLS PK module. Without this
conversion function, the Mbed TLS PK module is unable to use any PSA
implementation other than one which provides a compatible set of PSA
extensions.
2021-04-30 09:04:08 +01:00
Lingkai Dong b8969e0072 Updated directory platform/FEATURE_EXPERIMENTAL_API/FEATURE_PSA/TARGET_TFM/TARGET_TFM_LATEST 2021-04-29 11:09:20 +01:00
Lingkai Dong 23824b44b5 Updated directory platform/FEATURE_EXPERIMENTAL_API/FEATURE_PSA/TARGET_TFM/TARGET_TFM_LATEST 2021-04-29 11:09:14 +01:00
Martin Kojtal 331473a706
Merge pull request #14589 from plan-do-break-fix/Typo-corrections
fix(docs): corrects various typos in project documentation
2021-04-28 13:36:37 +01:00
Martin Kojtal a32a45c02d
Merge pull request #14540 from mjbogusz/fix-clang-timeval
Improve condition for declaring `struct timeval`
2021-04-28 12:33:13 +01:00
plan-do-break-fix 915b45af23 fix(docs): corrects various typos in project documentation 2021-04-23 23:31:11 -05:00
Jaeden Amero 5d20374bc3 Add v8.1-M architecture awareness
Add v8.1-M architecture awareness to Mbed CRC, HAL, and Mbed Atomic.

Fixes #14433
2021-04-23 15:01:16 +01:00
Maciej Bogusz f1d8378218 Improve condition for declaring struct timeval 2021-04-22 13:20:22 +02:00
mbedmain 9738b27c7d Update Mbed version block 2021-04-16 10:54:26 +01:00
Martin Kojtal 1fd4cfd798
Merge pull request #14516 from 0xc0170/fix-cmake-project-name
CMake: remove MBED_PATH and use <PROJECT-NAME>_SOURCE_DIR/MODULE_PATH instead
2021-04-15 14:00:21 +02:00
Martin Kojtal 121c8286da CMake: set CMAKE_MODULE_PATH in the Mbed OS CMakelists.txt
Update CMAKE_MODULE_PATH at once place.

Note, we update also CMAKE_MODULE_PATH in app.cmake. This is temporary until we get a proper way to include
Mbed Os (removing app.cmake need to be included by an application).
2021-04-14 13:09:28 +01:00
Martin Kojtal b6a90c4ae1 CMake: fix for CMAKE_CURRENT_LIST_DIR in functions
CMAKE_CURRENT_LIST_DIR behaves differently in functions. We store it in the CMakeLists itself, so anyone
calling a function would get the actual list dir where the scripts are.

To illustrate: if I call a function from src/CMakelists.txt, function located in src/scripts, `CMAKE_CURRENT_LIST_DIR` in the function would point
to the src/ folder but not to src/scripts.
2021-04-14 13:09:27 +01:00
Martin Kojtal afd938491a CMake platform: remove MBED_PATH, use standard variables
As we still use target labels, TFM is not visible to CMake. Protect include of their scripts with the same mechanism.
2021-04-14 13:09:26 +01:00
Lingkai Dong bd92ca06fa ARM_MUSCA_B1: default baud rate to 115200
The TF-M secure binary has a fixed baud rate of 115200. Having a
different baud rate on the non-secure side results in broken serial
outputs.
2021-04-06 18:11:46 +01:00
Anna Bridge d20384aaf9
Merge pull request #14456 from ladislas/ladislas/feature/fix-mbed_atomic-mac-m1
Fix define MBED_EXCLUSIVE_ACCESS for Apple M1 (__aarch64__) computers
2021-03-26 14:57:10 +00:00
Ladislas de Toldi f80ed5ef3e
Fix define MBED_EXCLUSIVE_ACCESS for Apple M1 (ARM64) computers
The new Apple M1 Mac computers are ARM based. When compiling and running
unit tests on an M1 Mac, the architecture is defined as __arm__

An extra check for __aarch64__ is needed to set MBED_EXCLUSIVE_ACCESS to 0U for the M1
Mac

If not, compilation fails with "Unknown ARM architecture for exclusive access" error
2021-03-23 11:42:02 +01:00
Lingkai Dong e6fd25df83 Enforce full-qualified path for `os_wrapper/*.h`
Some host operating systems are case-insensitive and cannot
distinguish (for example) `semaphore.h` in `os_wrapper` from
`Semaphore.h` from Mbed OS `rtos`. This causes the wrong header to be
included.

By adding `os_wrapper/.mbedignore`, we guarantee that

    #include "Semaphore.h"

always points to `rtos/Semaphore.h`, while the fully-qualified include

    #include "os_wrapper/semaphore.h"

continues to work because its parent directory is still in the include
path.
2021-03-22 16:41:52 +00:00
Martin Kojtal 96e19afdd1
Merge pull request #14396 from LDong-Arm/tfm_os_wrapper
TF-M: Switch to vanilla TF-M's OS wrapper
2021-03-22 12:06:04 +01:00
Lingkai Dong a6081e5681 Update VERSION.txt for imported TF-M files 2021-03-22 10:01:46 +00:00
George Psimenos d239ef98cd Rename USBTX/RX to CONSOLE_TX/RX 2021-03-18 17:01:54 +00:00
jeromecoutant 9d453cce68 [STD-PIN] ARDUINO_UNO pins
- hal/include/hal/ArduinoUnoAliases.h creation
- doc update
2021-03-18 17:01:50 +00:00
jeromecoutant a4350f72bd [STD-PIN] BUTTON and LED define
hal/tests/TESTS/mbed_hal/gpio/main.cpp is replaced by
hal/tests/TESTS/pin_names/generic/main.cpp now
2021-03-18 17:01:50 +00:00
jeromecoutant a6c213bb10 [STD-PIN] Replace STDIO_UART_TX by USBTX 2021-03-18 17:01:50 +00:00
Lingkai Dong eeae3d73dd Import OS wrapper from the vanilla TF-M
Previous, we patched TF-M to replace its OS wrapper with CMSIS RTOS
to resolve manage management issue when integrated with Mbed OS. But
as of TF-M v1.2, the OS wrapper has been reworked in the vanilla TF-M,
and now it makes identical calls to its underlying CMSIS RTOS as our
patches do. So, we remove our patches and use vanilla TF-M's OS
wrapper instead to avoid extra maintenance overhead.

This commit re-imports TF-M files associated with the OS wrapper.
2021-03-17 09:41:56 +00:00
mbedmain c73413893f Update Mbed version block 2021-03-15 12:45:41 +00:00
Martin Kojtal 8947e3cbeb
Merge pull request #14403 from saheerb/CY8CKIT064B0S2_4343W-115200
update baud rate of CY8CKIT064B0S2_4343W to 115200
2021-03-12 13:28:21 +00:00
Lingkai Dong 4450464fc8 Add integer overflow check to the malloc wrappers
Add a check that the combined size of the buffer to allocate and
alloc_info_t does not exceed the maximum integer value representable
by size_t.
2021-03-10 09:47:15 +00:00
Saheer Babu aba132e84c update baud rate of CY8CKIT064B0S2_4343W to 115200 2021-03-09 22:48:50 +00:00
Lingkai Dong 31cc82dabb "Updated secure binaries for [(ARM_MUSCA_S1, ARMCLANG)]"
This brings in the platform init fix:

    https://github.com/ARMmbed/trusted-firmware-m/pull/15
2021-03-09 10:22:58 +00:00
Lingkai Dong f225791fee CMake: Support signing and merging TF-M binaries
This commit adds post binary hook support for TF-M targets.

To apply this hook to a TF-M target, do the following in the target's
`CMakeLists.txt`:
* include `mbed_set_post_build_tfm.cmake`
* call `mbed_post_build_tfm_sign_image()`, passing
  - Mbed OS target name
  - TF-M target name
  - path containing the target's bootloader, layout files and signing
    keys
  - path to the secure binary
  - path to the non-secure binary (i.e. the "raw" Mbed application)
2021-03-05 16:16:26 +00:00
Martin Kojtal 8a1ce92317
Merge pull request #14368 from LDong-Arm/minimal_printf_cmake_fix
Fix CMake include path for the minimal-printf test
2021-03-05 14:22:09 +00:00
Lingkai Dong 074b0ba00c Fix CMake include path for the minimal-printf test 2021-03-02 17:27:50 +00:00
Lingkai Dong 62c8379d8d TARGET_TFM_V1_0: compatibility with Mbed TLS 2.24.0
Mbed TLS 2.24.0 requires a few new macros and an inline function in
the PSA Crypto header. This PR adds them to make sure the TF-M v1.0
target (specifically CYTFM_064B0S2_4343W) continues to compile with
the new Mbed TLS.

Note: Support for older versions of TF-M than v1.2 will be dropped,
so existing TF-M targets should migrate to TF-M v1.2 as soon as
possible.
2021-02-25 15:40:57 +00:00
Lingkai Dong 2807a01fd3 "Updated directory platform/FEATURE_EXPERIMENTAL_API/FEATURE_PSA/TARGET_TFM/TARGET_TFM_LATEST " 2021-02-25 14:02:57 +00:00
Lingkai Dong eb0ac59494 Deprecation warnings for key enrollment algorithm
Setting/getting key enrollment algorithm is not recommended and not
part of the vanilla PSA or TF-M. For now keep the API just for
backward compatibility with existing projects, and this commit
adds deprecation warnings.
2021-02-25 14:02:57 +00:00
Lingkai Dong 12b2c89962 PSA/TF-M: support key enrollment algorithm
Add `psa_set_key_enrollment_algorithm()` and
`psa_get_key_enrollment_algorithm()` for TF-M targets.

Note: This is deprecated and for backward compatibility only.
Setting an enrollment algorithm is not recommended, because
using the same key with different algorithms can allow some
attacks based on arithmetic relations between different
computations made with the same key, or can escalate harmless
side channels into exploitable ones. Use this function only
if it is necessary to support a protocol for which it has been
verified that the usage of the key with multiple algorithms
is safe.
2021-02-25 14:02:57 +00:00
Vikas Katariya ab09a6934b Add mbedtls_ecc_group_to_psa() to PSA in TF-M 1.2
The PSA headers imported from TF-M does not contain a declaration of
mbedtls_ecc_group_to_psa(), which is expected by pk.c from Mbed TLS.
This leads to an "undefined symbol" error when using the ARM toolchain
to compile an application for a TF-M target.
2021-02-25 14:02:56 +00:00
Vikas Katariya 260a33574b core: Upgrade TFM v1.2 related files
These files have been imported/copied from:
* ARMmbed/trusted-firmware-m
* ARMmbed/tf-m-tests

These are generic files, which are required for TF-M v1.2 integration
with Mbed OS for PSA_V8M and PSA_DUAL_CORE targets.
2021-02-25 14:02:56 +00:00