Commit Graph

1342 Commits (master)

Author SHA1 Message Date
Chun-Chieh Li 7c43c6d906 TFM: Fix undeclared function tfm_ns_interface_init
ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
2024-03-19 10:20:37 +08:00
alrvid 56ca532ef1
Moved a { to the same line as if
Moved a { to the same line as if
2023-06-15 15:38:55 +02:00
alrvid 7e206a90db
Handle negative values passed to close()
Calling close() with negative numbers causes out-of-bounds indexing of the filehandles array. For example, this can happen if open() returns an error and the value is later passed to close().
2023-06-14 23:29:38 +02:00
Saheer Babu 17dc3dc2e6 Update Mbed version block 2023-02-23 15:00:40 +00:00
mbedmain 54e8693ef4 Update Mbed version block 2022-06-14 15:24:16 +01:00
Casper Meijn 904f867bdc semihosting: Fix typo in semihost_rename
Fix typo in semihost_rename. Now it actually sends the `new_name` as well as the `old_name`.
2022-04-26 07:24:27 +02:00
Chun-Chieh Li 9e49cabb2c Fix strrchr() not declared for IAR
For IAR, strrchr() is used in MBED_FILENAME macro definition. Declare it via string.h to fix compile error when MBED_FILENAME is expanded.
2022-02-07 16:04:23 +08:00
Henrik Persson 6ff504ceb4 Use MBED_FILENAME instead of __FILE__ in MBED_ASSERT
To actually get the filename in the error reporting struct instead of
the start of the path, let's use the MBED_FILENAME macro that MBED_ERROR
et al uses.
2022-02-01 09:25:33 +01:00
Ladislas de Toldi 568ffbf22a
Allow unit tests to be compiled with -fno-exception 2022-01-28 11:11:08 +01:00
Marc Emmers 0fb88f8521 Deprecate instead of remove index_type 2021-11-30 10:56:05 +01:00
Marc Emmers ed3ad1ca9f mstd::span rename index_type to size_type according to spec 2021-11-30 10:56:05 +01:00
mbedmain 2eb06e7620 Update Mbed version block 2021-11-22 16:23:38 +00:00
Martin Kojtal d4c6b37cad
Merge pull request #14610 from jeromecoutant/DEV_SLEEP_TRACE
Power management stat : add verbosity level for MBED_SLEEP_TRACING_ENABLED
2021-11-08 15:11:18 +00:00
jeromecoutant 658e9ae972 Power management stat : add verbosity level for MBED_SLEEP_TRACING_ENABLED
Full verbosity is adding a console line for each lock/unlock API call

- stats can be enabled with json config
- default configuration is full verbosity and add a console line for each lock/unlock command
- for STM32 targets, verbosity is reduced by default
2021-11-08 09:46:06 +01:00
sytse 43f0c14c9a Code style violation corrected 2021-10-29 13:45:32 +02:00
sytse b99584d16d Fixed floating point formatting
When decimal_prec is 0 and the value is negative and needs rounding subtract 1, instead of adding 1
When decimal_prec > 0 round before printing the integer part, instead of after
2021-10-29 13:40:29 +02:00
Sytse Reitsma 1c6fb3b4c5 Added unit test for floating point formatting
And added a bonus test for string padding
2021-10-29 13:32:46 +02:00
mbedmain 810adf9aa8 Update Mbed version block 2021-09-16 12:15:02 +01:00
Robert Walton 98e3730bf2 PSA: Reinstate deprecated macro
PSA_ALG_AEAD_WITH_TAG_LENGTH has been replaced with
PSA_ALG_AEAD_WITH_SHORTENED_TAG upstream. We could just update
psa_util.h to use the new macro, but we still have some targets that
only support older versions of PSA, so we reinstate the removed macro.
2021-09-14 17:32:42 +01:00
Lingkai Dong c7df1221cc 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-09-14 17:32:42 +01:00
Jaeden Amero 78b17b6717 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-09-14 17:32:42 +01:00
Robert Walton 56ffd54dd4 tfm: Move tfm_ns_interface.c
tfm_ns_interface.c is intended to be overriden by clients to support
different targets. We copy this file from upstream into the mbed-os
platform library. We also have a specific "strong" overridden version
for the NU_M2354 target, which is located in its target library.
Previously the implementations in the platform library were decorated
with __attribute__(weak), and we provided a strong definition for the
NU_M2354 target. This worked fine because of weak linking, the linker
will pick the first "strong" definition and use that, avoiding any ODR
violations. However, upstream have removed __attribute__(weak) from the
function definitions, which caused multiply defined symbol errors when
trying to build the NU_M2354 target.

To work around the above issue, we remove the common definition in the
platform library; instead we copy the file to the Musca B1 and Musca S1
target libaries. This means the appropriate tfm_ns_interface.c is only
included in the build when compiling for the specific target which uses
it.
2021-09-14 17:32:42 +01:00
Robert Walton c48361b841 "Update directory platform/FEATURE_EXPERIMENTAL_API/FEATURE_PSA/TARGET_TFM/TARGET_TFM_LATEST" 2021-09-14 17:32:42 +01:00
Jaeden Amero eff8fda16c
Merge pull request #15067 from ARMmbed/fix_flash_overflow_callback_big_test
Greentea: Fix flash overflown issue in callback_big test
2021-09-14 17:04:13 +01:00
Rajkumar Kanagaraj 77960d351b Greentea: Fix flash overflown issue in callback_big test
The "Callback_big" greentea test has six test cases that require
a minimum above 36kb ROM to build all test cases. LPC1114 target
has only 32KB ROM memory, so the limit 6th test case to include
or exclude based on the target minimum ROM size.

Note:
In LPC1114 target, callback_big test has ROM overflow build issue
for both Mbed CLI1 and CLI2.
2021-09-14 15:28:06 +01:00
Rajkumar Kanagaraj ad18cc88a6 CMake: Fix platform wait_ns greentea test Cmake
Mbed CLI 2 generates TARGET_ARM_FM macro as a string in mbed_config.cmake
under the MBED_TARGET_DEFINITIONS list. Fix the "if defined" check for
TARGET_ARM_FM by searching for the TARGET_ARM_FM string in the
MBED_TARGET_DEFINITIONS list. This allows us to skip or include the test from CMake.
2021-09-13 14:30:23 +01:00
Martin Kojtal c14396a5b6
Merge pull request #15045 from LDong-Arm/malloc_newlib_nano
Workaround for a bug in malloc() from newlib-nano 4.1.0 (in GCC 10.3)
2021-09-03 15:03:31 +01:00
Lingkai Dong 8d32b668ec Workaround for a bug in malloc() from newlib-nano 4.1.0
The commit 84d0689 "Nano-malloc: Fix for unwanted external heap
fragmentation" from newlib 4.1.0 introduced several optimizations,
one of which is as follows:

When the last chunk in the free list is smaller than requested,
nano_malloc() calls sbrk(0) to see if the heap's current head is
adjacent to this chunk, and if so it asks sbrk() to allocate the
difference in bytes only and expands the current chunk.

This doesn't work if the heap consists of non-contiguous regions.
sbrk(0) returns the the current region's head if the region has any
remaining capacity. But if this capacity is not enough for the second
(non-trivial) call to sbrk() described above, allocation will happen
from the next region if available. Expanding the current chunk won't
work and will result in a segmentation fault.

So this optimization needs to be reverted in order to bring back
compatibility with non-contiguous heaps. Before the next version
of newlib becomes available and gets updated in the GCC Arm Embedded
Toolchain, we work around this issue by including the fix in Mbed OS.
The linker prioritizes malloc() from the project to the one from the
toolchain.
2021-09-01 17:21:32 +01:00
Martin Kojtal 50c135292c
Merge pull request #15019 from ARMmbed/refactor_platform_greentea_cmake
Refactor platform greentea cmake
2021-09-01 15:24:49 +01:00
Martin Kojtal 513f581bce
Merge pull request #15012 from felser/MTS_DRAGONFLY_L496VG
Add platform MTS_DRAGONFLY_L496VG
2021-08-24 09:50:58 +01:00
Rajkumar Kanagaraj 6cc3d6dd17 Update platform CMake to include greentea test dir 2021-08-23 21:41:17 +01:00
Rajkumar Kanagaraj 16c9058fd1 CMake: greentea: Add skip reason to platform test 2021-08-23 21:40:50 +01:00
Rajkumar Kanagaraj 40253b2a54 CMake: Refactor platform greentea test CMake
Initially, every library greentea test has its project() creation in
their CMake. As running greentea using CTest move all greentea test
suite under one global project mbed-os and MBED_CONFIG_PATH set at
the root mbed os CMake under the condition BUILD_GREENTEA_TESTS
check so refactored platform greentea CMake accordingly.
2021-08-23 21:39:19 +01:00
Leon 4b27aef0ae Add platform MTS_DRAGONFLY_L496VG 2021-08-18 12:03:48 -05:00
mbedmain 3377f083b3 Update Mbed version block 2021-08-18 12:44:48 +01:00
Martin Kojtal 2ceb3bfd6a
Merge pull request #14935 from jeromecoutant/PR_IAR
mbed_retarget: enable IAR build
2021-08-17 10:25:03 +01:00
Lingkai Dong 6776069a18 CMake: greentea: Port PSA Attestation test to CTest
The PSA Attestation test suite requires full RTOS. There is no need
to explicitly check PSA support, because when we build all greentea
tests from the top of Mbed OS, PSA tests only get included if PSA is
enabled.
2021-08-11 11:43:17 +01:00
Robert Walton 7842320ab7 CMake: Add option to enable greentea tests
Add an option to enable the greentea tests independently from the unit
tests.

We can't just use the typical BUILD_TESTING option to enable greentea
tests. BUILD_TESTING enables unit tests and fetches googletest, which
are compiled for the host. Greentea tests are cross compiled and require
a toolchain file. For this reason we add a new option just to enable
greentea tests, preventing build failures triggered by the unit tests
and googletest.
2021-08-10 16:35:11 +01:00
Lingkai Dong dca2aa79a0 Unit tests: Remove redundant CMake target mbed-headers-base
Individual libraries' `target_h` stub headers have now all been moved
from `mbed-headers-base` to `mbed-headers-<library>`.

Note: Even though headers previously in `target_h` are technically
stubs/fakes too, they are used by not only unit tests but also regular
libraries when compiled for unit tests, because no target-specific HAL
implementation exists in this case. In order for regular library
sources to pick up `target_h` headers, those headers must

* have the same names as regular headers
* appear first in include paths

This is why those headers are part of `mbed-headers-<library>` and not
`mbed-stubs-<library>`. Before this refactoring, `mbed-headers-base`
was the first in unit tests' include paths.
2021-08-02 17:42:43 +01:00
Lingkai Dong c775e30b2d Unit tests: Move randLIB.h
The stub header randLIB.h overrides the header of the same name in
platform/randlib/ which is an external repository vendored into
the mbed-os codebase. As the repository is synchronized regularly,
it is better not to put overrides there, so we put the randLIB.h
stub into the regular platform doubles directory.
2021-08-02 17:42:43 +01:00
Lingkai Dong 4011e2ef85 Unit tests: Move platform target_h stubs
Stubs previously in UNITTESTS/target_h/ have the same names as
regular Mbed OS headers, intending to override the latter directly.
We move platform target_h stubs into
platform/tests/UNITTESTS/doubles/platform/.

Note: nvic_wrapper.h is normally implemented and used by Mbed targets
as needed. But as unit tests do not have a real target, we treat it
as a stub for the platform.
2021-08-02 17:42:42 +01:00
Lingkai Dong 7e3565b5f5 Unit tests: Move cmsis target_h stubs
This creates a new mbed-headers-cmsis which is always and only used
by mbed-headers-platform, so we add the former to the laters' linked
targets.
2021-08-02 17:42:42 +01:00
Jaeden Amero 744814f0a0
Merge pull request #14900 from 0xc0170/feature_CMSIS_5_13b9f72f2
Update CMSIS to 5.8.0
2021-07-30 09:43:11 +01:00
Martin Kojtal 38ca4bdce4 semihosting: add compat header where is required
ARMCC provides __semihost via compat header. As CMSIS 5.8.0 removed this compat header,
we need to explicitly include it to fix definition missing error.
2021-07-29 14:31:38 +01:00
Martin Kojtal 8bdec2b4db retarget: move compat header for ARMClang prior any cmsis headers
Reference: CMSIS 5.8.0 known issues and https://github.com/ARM-software/CMSIS_5/issues/1211

This fixes the error about redefinition of enable/disable irq. we need compat header because of
semihosting (not yet provided in CMSIS).
2021-07-29 14:31:33 +01:00
Robert Walton a09d08917b CMake: unittests: Show all tests in CTest report
Previously a test executable was recognised as a single test by CTest.
However, test executables usually contain multiple test cases, the
results of the test cases should be individually reported. With our
previous setup we could miss test case failures that didn't cause the
executable to return an error code.

This commit uses gtest_discover_test to discover all test cases in a
test executable. This enables CTest to match test passes and failures
from the googletest binary output.
2021-07-27 21:09:39 +01:00
Jaeden Amero 862a9420fe
Merge pull request #14948 from Patater/lorawan-timer-unittest-fake-fix
Fix lorawantimer unit test
2021-07-27 14:02:47 +01:00
Jaeden Amero 51b81e0629 test: Make MBED_ASSERT failures fail
Make MBED_ASSERT failures fail the unit test case. Without this, we
might not notice the assertion failure as it wouldn't be bubbled up to
googletest.
2021-07-27 10:28:12 +01:00
Jaeden Amero f0d7e24066 test: CircularBuffer: Don't push zero elements
The CircularBuffer doesn't allow pushing zero elements; you must push at
least one. Update the CircularBuffer unit test to avoid invalid use of
the CircularBuffer.
2021-07-27 10:28:12 +01:00
Martin Kojtal efaf159ca4
Merge pull request #14945 from OpenNuvoton/nuvoton_tfm_missing_update
TFM: Add missing IPC file for PSA Firmware Update
2021-07-23 14:33:06 +02:00