Move rtos stubs headers to the mbed-os/rtos/tests/UNITTESTS/double
directory and update CMake to create a mbed-stubs-rtos-headers
library for rtos stub headers
Previously the events unit tests 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 using.
Previously the drivers 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 using.
Move the header-only mbed-headers-drivers library the unit test stubs
depend on into the drivers component directory. This makes the drivers
stubs more self-contained and improves the composition of the library.
Previously the drivers unit tests 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 using.
The default get_ip_address implementation was not working for
BG9x. Furthermore the cellular connect routine tries to get the
address multiple times, which added around 2 seconds of
unnecessary delay to the connection. This commit adds the correct
implementation using the AT+QIACT? command.
We potentially save flash space by not enabling Mbed TLS self-tests
by default. A new test config file, TESTS/configs/mbedtls.json, is
provided to enable self tests. This newly created JSON file also
enables timing in Mbed TLS so timing gets tested.
This allows us to verify the support for Mbed TLS timing on Mbed OS.
Note: The macros MBEDTLS_TIMING_C and MBEDTLS_TIMING_ALT are not
enabled by default and need to be additionally enabled to run this
test.
Do not compile the Mbed implementation of Mbed TLS unless
MBEDTLS_TIMING_ALT is defined. This prevents a macro check error on
devices that do not have LPTICKER or USTICKER when Mbed TLS timing
is not enabled.
When MBEDTLS_TIMING_C and MBEDTLS_TIMING_ALT are enabled,
the Arm Compiler generates errors like the following (one for
each missing symbol):
Error: L6218E: Undefined symbol mbedtls_timing_get_delay
Reason:
The function `mbedtls_timing_self_test()` in the Mbed TLS default
`timing.c` always gets compiled, if MBEDTLS_SELF_TEST is defined.
And MBEDTLS_SELF_TEST is always defined, as we have a Greentea test
to run some of the Mbed TLS self tests. (In the future we should try
not to enable MBEDTLS_SELF_TEST except for tests, but it requires
a rework in our test flow.)
`mbedtls_timing_self_test()` tests (calls) the full API declared in
`timing.h`, and the ARM Compiler requires all symbols referenced by
all functions to be defined, even those not used by the final
application. This is unlike GCC_ARM which resolves what are required.
Solution:
To fix the "undefined symbol" errors, we add an implementation of
`mbedtls_timing_get_timer()` based on Mbed OS `LowPowerTimer` or
`Timer` (depending on which one is available), and copy Mbed TLS's
default `mbedtls_timing_set_delay()` and `mbedtls_timing_get_delay()`
which are built on top of `mbedtls_timing_get_timer()`. This will also
benefit user applications that need to enable timing in Mbed TLS.
Previously we used `gettimeofday()` for Mbed TLS timing, but its
implementation provided by Mbed OS is only precise to seconds. The
microsecond component of the output `struct timeval` is always set
to zero. But Mbed TLS requires millisecond precision.
To provide required timing precision, switch to use `LowPowerTicker`
or (microsecond) `Ticker`. `LowPowerTicker` is preferred as it saves
power and Mbed TLS does not require microsecond precision.
Adding mbed-os subdirectories that are not required for a specific project to .mbedignore is a good way to reduce compilation time. Sometimes it happens that tests depend on ignored files, which causes the test-build to fail even though the corresponding feature/component
is not configured. The reason is that the conditional that skips the test is placed after the includes.
Block-Wise request (block1) error handling improvements:
* Removed SN_COAP_BLOCKWISE_MAX_TIME_DATA_STORED usage. Block-Wise requests will now follow normal retranmission rules.
* Process block1 responses only once. If response is coming in wrong order just ignore it wait next response to happen.