Commit Graph

33935 Commits (refactor_hal_greentea_cmake)

Author SHA1 Message Date
Martin Kojtal 218e93c97f cmsis: fix license header in rtx_def
Upstream fix was merged https://github.com/ARM-software/CMSIS_5/pull/1238. Included here as it will be overwritten once again updated
2021-07-29 14:29:57 +01:00
harmut01 86c2d70a5b Greentea: Remove deprecated APIs and use chrono
References to time should do so using std::chrono. We reworked tests in
connectivity and drivers to use std::chrono and new APIs in order to
remove deprecation warnings resulting from deprecated API calls.
This required addition of  a macro for test assertions using std::chrono
values.

As host test "timing_drift_auto" expects time values represented as an
integral number of microseconds, we explicitly provide this in place
using "microseconds{TICKER_TIME}.count()" in the relevant ticker tests.
We recognise this is ugly, but thought it best to descriptively convert
from std::chrono to the host test's required representation.

Co-authored-by: Hari Limaye <hari.limaye@arm.com>
2021-07-29 14:06:27 +01:00
Martin Kojtal bad4aa61ca
Merge pull request #14575 from LDong-Arm/cmake_armclang_fix
CMake: Enable improved armclang support in CMake 3.21
2021-07-29 10:32:27 +01:00
Martin Kojtal b94fe130a3
Merge pull request #14288 from boraozgen/bg96-socket-send-segmentation
BG96: Add segmentation to TCP socket send
2021-07-29 10:31:23 +01:00
Charles d13aaf408c
Allow LoRaWAN STM32WL driver debug led to be inverted (#14910) 2021-07-29 10:29:53 +01:00
Jaeden Amero 3d362641fb
Merge pull request #14944 from rwalton-arm/fix_ctest_reporting
CMake: unittests: Show all tests in CTest report
2021-07-28 11:39:18 +01:00
Robert Walton 98e25f193e unittests: Test_LoRaWANStack.acquire_rx_metadata: Fix SEGFAULT
We failed to set `LoRaMac_stub::mlme_ind_ptr` to a valid pointer. When
we tried to dereference it in `LoRaWANStack::process_reception` we hit a
SEGFAULT.
2021-07-27 21:09:39 +01:00
Robert Walton 421adc9888 unittests: Fix Test_LoRaWANStack.acquire_tx_metadata
This test was relying on the state of `LoRaMac_stub::bool_true_counter`
to be set to 1 from a previous test. When the test was ran in isolation
the `LoRaWANStack::rx_timeout_interrupt_handler` callback would fail
because we weren't returning true from the stub implementation of
`LoRaMac::nwk_joined`. Due to this
`LoRaWANStack::post_process_tx_no_reception` was never called. This
caused the LoRaWANStack object to think the "tx_metadata" was "stale"
(i.e the data hadn't changed since any previous read). So, when we
attempted to call `LoRaWANStack::acquire_tx_metadata` it returned
`LORAWAN_STATUS_METADATA_NOT_AVAILABLE` as it thought we had no new
metadata to report, causing the test assertion to fail.
2021-07-27 21:09:39 +01:00
Robert Walton 9f3069f1e1 unittests: Test_LoRaMac.post_process_mcps_req: Fix segfault
We had commented out a line where we reset LoRaPHY_stub::uint16_value to
0. This was causing an invalid array access in
LoRaMac::handle_data_frame, when trying to extract the
_mps_indication.channel from list of channel_params_t returned by
lora_phy->get_phy_channels.
2021-07-27 21:09:39 +01:00
Robert Walton b0c0fc9f66 unittests: Reduce runtime of TDBStoreModuleTest.corrupted_set_deinit_init_get
Instead of performing 10,000 "set, deinit, get" operations, let's just
perform 100. This reduces test time from 4.8s to 0.02s.
2021-07-27 21:09:39 +01:00
Robert Walton 2e75d184b6 unittests: Remove ATHandler test interdependencies
Some tests in athandlertest.cpp relied on the state of stubs set in
previous tests. This caused test failures if the tests cases were ran in
isolation. Remove the interdependencies between tests by setting stub
values in the tests that rely on them.
2021-07-27 21:09:39 +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
Robert Walton 1e48a61d89 CMake: unittests: Remove trailing whitespace 2021-07-27 21:09:38 +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
Jaeden Amero 0a944f0ac4 test: lorawanstack: Use valid message type
We previously made up an invalid message type, which was roughly
`MCPS_MULTICAST | 0x40`. This causes an MBED_ASSERT failure in the
handle_rx function, as it uses an assert to validate the message type
passed to it (in convert_to_msg_flag()). Use the valid message type
MCPS_MULTICAST instead in the handle_rx unit test.
2021-07-27 10:28:12 +01:00
Robert Walton 07aefbc6bc unittests: Test_LoRaWANTimer.start: Fix test failure
We weren't initialising the mocks correctly, so an MBED_ASSERT failed in
`LoRaWANTimer::start` because the "timer_id" was not set.
2021-07-27 10:28:12 +01:00
Martin Kojtal b9043fb91c cmsis: importer sha removal
I had to resolve conflicts with these sha. CMSIS 5.8.0 includes fixes and makes these changes
irrelevant.
2021-07-27 10:06:40 +01:00
Bartek Szatkowski 4744fdb2f3 CMSIS/RTX: Allow overwriting mutex ops for ARMC
(cherry picked from commit 08ab8cc47d)
2021-07-27 10:06:39 +01:00
Deepika 06b815a9d2 CMSIS/RTX: Patch to conditionally compile
tz_context.c should be compiled only for secure world,
definition of API's in tz_context.h should be part of secure
binary/bootloader when building mbed-os as non-secure

(Cherry picked from d0a43b8af0)

(cherry picked from commit fb354752eb)
2021-07-27 10:06:38 +01:00
Bartek Szatkowski 8ade0d46ec CMSIS/RTX: Patch RTX4 to preserve osThreadDef compatibility
mbed OS used older RTX4 version and with osThreadDef accepting only 3
parameters, to preserve compatibility we hardcode the 'instances'
parameter to 1.

(cherry picked from commit 428acae1b2ac15c3ad523e8d40755a9301220822)
(cherry picked from commit 4360b7bbf8)
2021-07-27 10:06:37 +01:00
Martin Kojtal 7941286531 [CMSIS_5]: Updated to 13b9f72f2 2021-07-27 10:06:34 +01:00
Martin Kojtal 6827b4275b
Merge pull request #14397 from macronix/macronix_spi_NAND
add SPI NAND Block device driver
2021-07-26 15:24:47 +02:00
Martin Kojtal e2ec3cd720
Merge pull request #14831 from jeromecoutant/PR_DISCO_WB_LED
DISCO_WB5MMG: add RGB LED
2021-07-26 13:21:09 +02:00
Lingkai Dong 257a4e551c CMake: Do not set `CMAKE_AR`
The variable for archiver is automatically set by CMake. There is
no need to explicitly set it, unless a project really needs to
override the default archiver.
2021-07-23 15:56:58 +01:00
Lingkai Dong 782375c431 CMake: Enable improved armclang support in CMake 3.21
CMake versions 3.20 and below always add compiler and linker flags
based on `CMAKE_SYSTEM_PROCESSOR`, for example `--cpu=Cortex-M33`.
This sometimes overrides flags we set in tools/cmake/cores/*.cmake
and results in link failure or unbootable binaries. To workaround
this, we added more linker flags to "counter" what CMake automatically
adds.

From CMake 3.21 onwards, CMake by default does not add flags to
armclang anymore, and it fully relies on projects to set all flags.
In this case we do not need to set `CMAKE_SYSTEM_PROCESSOR` or use
workarounds anymore. We still turn on workarounds when an older
version of CMake (3.19 and 3.20) is used, but in the future we might
require users to have at least CMake 3.21.
2021-07-23 15:56:58 +01:00
Lingkai Dong 4b6f243963 CMake: Cortex-A: Use MBED_CPU_CORE to set -mcpu
As we're moving away from the use of CMAKE_SYSTEM_PROCESSOR, use
MBED_CPU_CORE instead. They differ in cases, but both GCC and Arm
toolchains support case-insensitive CPU names.
2021-07-23 15:56:58 +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
Martin Kojtal 379afe794f
Merge pull request #14953 from LDong-Arm/post_build_hook_rework
Rework post-build to support multiple executables
2021-07-23 13:29:45 +02:00
jeromecoutant 68529322dd DISCO_WB5MMG: add RGB LED 2021-07-23 12:34:49 +02:00
Jaeden Amero c8b889ea89
Merge pull request #14914 from nicole-osaz/my_mbed-os_branch
Deprecate the Greentea metrics API
2021-07-23 10:34:38 +01:00
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
Jaeden Amero 162ae220b1 equeue: Enable use of stub from C++
Add extern "C" to the equeue_stub declaration to avoid an error when a C
file implements the equeue_stub symbol (as we do in equeue_stub.c).

    Undefined symbols for architecture x86_64:
      "_equeue_stub", referenced from:
          Test_LoRaWANTimer_start_Test::TestBody() in Test_LoRaWANTimer.cpp.o
    ld: symbol(s) not found for architecture x86_64
    clang: error: linker command failed with exit code 1 (use -v to see invocation)
2021-07-22 18:03:47 +01:00
Lingkai Dong 23d659ef9e CMake: Add test for multiple-executable support
Add a test to build two executables in two directories under a single
project.
2021-07-22 17:31:45 +01:00
Lingkai Dong 91b8186615 Cypress: Improve `mbed_post_build_psoc6_merge_hex()`
The CMake macro `mbed_post_build_psoc6_merge_hex()` takes the name of
a Cypress target and an optional Cortex-M0 hex image as arguments. The
proper way to define and parse optional arguments of a function or
macro is `cmake_parse_arguments()`, which allows the caller to
indicate what they are passing rather than rely on an argument's
relative position within `${ARGN}` which is not rigorous.

Also, avoid duplicating the common part of the post build command
when the optional argument is passed/not passed.
2021-07-22 17:31:45 +01: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
Jaeden Amero 4480abeaf9 cmake: Avoid linking to gcov
Use the `--coverage` option instead of manually linking to gcov, as some
host platforms (like macOS, FreeBSD) don't have gcov by default and use
an llvm equivalent instead.
2021-07-22 15:41:49 +01:00
Jaeden Amero a1e61b61c2 equeue: Add missing header guards
The header equeue_stub.h was missing header guards to enforce single
inclusion. Add some header guards.
2021-07-22 15:41:06 +01:00
Jaeden Amero b17ffaa68a cmake: Remove trailing whitespace
Remove trailing whitespace from lorawantimer's CMakeLists.txt.
2021-07-22 15:41:06 +01:00
Martin Kojtal 0f5e062b69
Merge pull request #14939 from jeromecoutant/PR_PIN_ALIAS
Standard Pin Names validation script update
2021-07-22 15:04:00 +02:00
Jerome Coutant 97cd8e928d pinvalidate.py script: add deprecated ARDUINO test 2021-07-22 13:55:52 +02:00
Jerome Coutant 77e7720cb0 pinvalidate.py script: add SPI and I2C alias check
Goal is to follow
hal/include/hal/PinNameAliases.h
2021-07-22 13:55:52 +02:00
Jerome Coutant 616a84f370 pinvalidate.py script: remove spaces 2021-07-22 13:55:52 +02:00
Robert Walton fcd57b24d3 CMake: Move post build functions out of root CMakeLists.txt
The 'post build' functions are made visible by adding the mbed-os
subdirectory. This is not ideal as any components in mbed-os wishing to
call the functions must be added after the functions are defined. To
improve modularity move these functions to a separate CMake script.

We include the post build CMake script in app.cmake for now so we don't
break user's projects.
2021-07-22 11:50:43 +01:00
Jaeden Amero 662bd59973
Merge pull request #14940 from Patater/update-prettytable
python: Allow newer prettytable with newer python
2021-07-21 14:55:52 +01:00
Jaeden Amero 14d4ee3f3b python: Allow newer prettytable with newer python
This helps to allow installation of Mbed OS's Python requirements, when
CMake is used, into the same Python environment as mbed-os-tools. The
versions specified here are aligned with mbed-os-tools;
tools/cmake/requirements.txt depends on the same version of prettytable
as mbed-os-tools's requirements.txt.
2021-07-21 13:55:18 +01:00
Jaeden Amero 8ffab0ae5a python: Remove direct dependency on prettytable
Mbed CLI 1 parses the base requirements.txt and attempts to
automatically install missing python libraries for you. Unfortunately,
it's requirements parser is not as capable as the one shipping with pip.
In particular, we are unable to express different version of libraries
conditional on the version of Python being used.

    ---
    [mbed] ERROR: Unknown Error: Unsupported environment marker:  python_version < '3.6'

Remove the direct dependency on prettytable from requirements.txt, as
mbed-os-tools depends on prettytable and we can pick up the dependency
(as properly expressed conditionally on the Python version) from there,
without having to use the limited requirements parser in Mbed CLI 1.
2021-07-21 13:52:52 +01:00
Martin Kojtal e060c8c007
Merge pull request #14730 from Ekidna/fix/sx126x-select-pins
Add config macros for device-variant, freq-support and xtal config
2021-07-21 14:52:44 +02:00
Martin Kojtal 655d889e91
Merge pull request #14912 from ARMmbed/move_unittest_ble_headers_lib
Move ble stubs to FEATURE_BLE lib
2021-07-21 14:52:01 +02:00