When sockets were opened, they were not set non-blocking, but only had
their timeout set to 1ms.
TCP sockets were set to non-blocking on connect or accept, but UDP
sockets were left blocking with 1ms timeout.
This led to unnecessary delays when checking for data from an empty UDP
socket.
Change sockets to be non-blocking on open instead of setting the
timeout. As TCP sockets were already non-blocking, the necessary event
handling is already in place, and no other changes are required.
The config.py script that adjusts config.h in Mbed TLS doesn't
handle having configurations being defined in it multiple times
very well. As Mbed OS needs to have certain configurations settings
based on what features are set, these code additions to config.h
are moved to being added after the rest of the configuration is
adjusted.
Targets that use Mbed for their PSA implementation
(TARGET_MBED_PSA_SRV), rather than TF-M, do not need any adapters to
connect TF-M and KVStore. Remove the unnecessary file its_tfm_impl.cpp.
Implemented
-info_get API for Wi-SUN router to get RPL information.
-info_get API for Wi-SUN BR to get RPL information.
-routing_table_get API for Wi-SUN BR.
Configure Mbed TLS to automatically enable PSA as needed. When Mbed OS
is configured to use PSA, configure Mbed TLS to use PSA. This prevents
leaking of the "how to make Mbed TLS use PSA" knowledge up into
targets.json, and thus makes porting simpler. There is now one place
where "how to make TLS use PSA" exists rather than repeated throughout
targets.json for each target that can't inherit from PSA_Target.
Mbed Crypto 3.0.1 ships with TF-M. To make Mbed TLS 2.22.0 compatible
with Mbed Crypto 3.0.1, changes are needed in psa_util.h (which
abstracts some portions of the PSA Crypto API for use with TLS) to deal
with new ECC curve define changes.
Signed-off-by: Jaeden Amero <jaeden.amero@arm.com>
Signed-off-by: Devaraj Ranganna <devaraj.ranganna@arm.com>
Add TF-M to Mbed OS, replacing the previous PSA implementation for
TF-M-capable targets. This commit adds files imported from TF-M, without
modification. The version of TF-M imported can be found in
`features/FEATURE_PSA/TARGET_TFM/VERSION.txt`.
These changes switch to TF-M as the sole PSA implementation for v8-M and
dual core targets, with TF-M running on the secure side and Mbed OS
running on the non-secure side. Single core v7-M targets will continue
to have PSA implemented via PSA emulation, implemented by Mbed OS.
Move or remove many PSA-implementing files, as PSA will be provided by
TF-M on non-single-v7-M targets. Delete any files that are not relevant
for PSA emulation mode.
- Remove imported TF-M SPM
- Remove Mbed SPM and tests
- Remove Mbed-implemented PSA services and tests
- Remove PSA_SRV_IMPL, PSA_SRV_IPC, PSA_SRV_EMUL and NSPE.
- Replace PSA_SRV_EMUL and PSA_SRV_IMPL with MBED_PSA_SRV
- Remove any files autogenerated by
"tools/psa/generate_partition_code.py", which no longer exists.
Add new feature `PSA` to support PSA in Mbed OS.
Move the Mbed OS implementation of PSA services for v7-M targets (which
employ PSA emulation, and don't yet use TF-M) to
features/FEATURE_PSA/TARGET_MBED_PSA_SRV. Update the `requires`
attribute in TESTS/configs/baremetal.json to avoid breaking baremetal
testing builds.
Update .astyleignore to match new directory structure
Update Mbed TLS importer to place files into FEATURE_PSA
Create the following generic PSA targets:
* `PSA_Target` (Root level PSA generic target)
* `PSA_V7_M` (Single v7-M PSA generic target)
* `PSA_DUAL_CORE` (Dual-core PSA generic target)
* `PSA_V8_M` (v8-M PSA generic target)
Flatten MUSCA_NS and private MUSCA targets into public MUSCA targets.
Move mcuboot.bin to flat location (removing prebuilt folder)
Signed-off-by: Devaraj Ranganna <devaraj.ranganna@arm.com>
Signed-off-by: Jaeden Amero <jaeden.amero@arm.com>
Having Freescale and NXP macro causes compile from both
TARGET_Freescale and TARGET_NXP HAL folders.
Signed-off-by: Mahesh Mahadevan <mahesh.mahadevan@nxp.com>
Fixes: #13109
Prior to this commit, target implementations of NanostackRfPhy
are not guarded by any mbed_lib.json - they are always visible
to the build even if the interface itself is not enabled
(e.g. when using the "requires" attribute of mbed_app.json).
It causes build errors.
To resolve this, this commit move target code into
nanostack-interface, similar to what we do with BLE targets.
The selection is now based on the lib json (which allows you to disable filesystem db or kvstore db) and the call to SecurityManager::init. It will always fall back on memory db if no other db is available.
This works similar to filesystem db but uses the KVStore which it assumes is initialised. This is checked by open_db. On initialisation it either reads the present db or writes a new db into all entries thus guaranteeing that after the initialisation we will not run out of space for the keys and no extra error handling is needed.
To start direct connectable advertising on the cordio stack, the programmer should call the function DmConnAccept instead of the function DmAdvStart .
This functions expect the target address and address type as parameter, which are passed to the controller when the programmer sets the advertising parameters and not known when advertising_enable is called.
Therefore, this information should be kept in memory when advertising parameters are set and retrieved when advertising is enable to choose the right call to start (or stop) advertising.
Timeout of direct advertising is also handled in an uncommon way, a connection timeout is received. Similarly, DmConnClose should be called to stop connectable direct advertising.
The state is kept in an array of direct_adv_cb_t. Each items contains a peer address, the peer address type, the connection handle and the advertising handle as well as a state which indicate if the advertising is running, pending or not used.
When advertising parameters are set, the state is updated to match the target address or disable direct advertising management for the advertising set being configured.
When advertising is enabled, the pal dispatch the operation to the right calls (DmAdvStart/DmConnAccept or DmAdvStop/DmConnClose).
When an advertising timeout happen or a connection is made, the pal cleans any direct advertising state of this advertising set
Nothing in the Bluetooth standard prevents update of advertising payload while advertising is active.
This limitation wasn't present in previous version of the stack and is not present for extended advertising.
TF-M provides its own PSA headers for TF-M targets. Single v7-M targets
need to get PSA crypto from Mbed Crypto.
Note that we don't yet move crypto_struct.h to its new location. This is
to avoid breaking v8-M targets for the time being. When TF-M provides
the PSA implementation on v8-M, we will add crypto_struct.h to the
correct place.
Likewise, none of the PSA-implementing source is moved out of
COMPONENT_PSA_SRV_IMPL yet, as still must not be built for PSA NS
targets. When PSA NS targets switch to using TF-M provided
implementations rather than MBED_PSA_SRV, we can take the source out of
COMPONENT_PSA_SRV_IMPL.
Signed-off-by: Jaeden Amero <jaeden.amero@arm.com>
The Mbed TLS import script is quite fragile, and depends on certain lines to be
present in the files it adjusts to be able to do the modifications it needs to
to allow Mbed TLS to build within Mbed OS.
Thsi commit changes the `adjust-config.sh` script to look for a the end of the
config.h file, defined as "#endif /* MBEDTLS_CONFIG_H */" rather than the
include line for "check_config.h".
That's because the inclusion of "check_config.h" is being removed upstream in
Mbed TLS to fix another issue.
In PR #8876 when we added Cordio support for nRF52* targets,
we attempted to use an RTOS idle hook to workaround sleep
latency issues. However, the condition to bypass sleeps
never gets satisfied, and BLE nRF52* targets have generally
worked fine over the past year.
This commit removes the hook to avoid dependency on RTOS,
enabling BLE on bare metal.
Note that documentation for random_max_start_delay config setting has
been changed to indicate that the setting is in seconds, and always has
been. No functional change.
Reverts commit 10481f2f7e partially.
Changes made to ExhaustibleBlockDevice hides simulated flash degradation
which is the assumed behavior. Converted back to original behavior.
Mbed Crypto has been remerged back into Mbed TLS. Update the
Mbed TLS importer script with the relevant parts of the
Mbed Crypto importer.
Signed-off-by: Darryl Green <darryl.green@arm.com>
Remove all PSA S-mode only code, as it is unused. Only PSA S targets
would use the code, and we've removed those targets in a previous
commit.
Ensure all tests for S-mode code we are deleting is also removed, even
if that code would run in NS-mode. Keep any tests that also test our PSA
emulation support (for single v7-M targets).
Signed-off-by: Jaeden Amero <jaeden.amero@arm.com>
Remove PSA v8-M S target binaries will be built outside of Mbed OS and
added in as binaries which NS targets consume. Mbed OS no longer
implements PSA for v8-M targets, so there is no reason for it to build
PSA S targets.
Signed-off-by: Jaeden Amero <jaeden.amero@arm.com>
BLOCK2 code-branch was missing handling for duplicate packets. As part of the fix, added also
a call to update the duplicate package data via a new function
sn_coap_protocol_update_duplicate_package_data_all.
The new implementation handles all CoAP messages, not just those with COAP_MSG_TYPE_ACKNOWLEDGEMENT.
Add also 4.13 (Request Entity Too Large) responses to duplicate info list.
Add client library configurations for DEFAULT_RESPONSE_TIMEOUT and SN_COAP_DUPLICATION_MAX_TIME_MSGS_STORED.
Increased the default timeouts of DEFAULT_RESPONSE_TIMEOUT and SN_COAP_DUPLICATION_MAX_TIME_MSGS_STORED to 300 seconds.
These two are critical parameters for low-bandwidth high-latency networks. The defaults should be more geared towards such networks that are likely to have issues with transmissions.
The increased defaults can increase the runtime HEAP usage when there is a lot of duplicates or retransmissions.
tests-filesystem-general_filesystem declares BlockDevice and FileSystem
pointers as globals. If these are initialized to their respective
default_instance values in the declaration, the LFS init happens during
OS startup when __libc_init_array() is invoked by mbed_toolchain_init().
If the filesystem blockdevice does not currently contain a valid filesystem
(e.g. the chip has just been erased), then LFS will flag this as corruption
and abort the mounting process.
This cleanup process can take long enough (and is running pre-main) that
greentea times out waiting for the device to respond to its sync packet,
and resets the device.
To resolve this, move the initialization into the first test case
(bd_init_fs_reformat) right before it initializes and formats the
blockdevice and filesystem.