TDBStore used to rely on Flash devices erase value.
This logic has been removed, and TDBStore can do the entire erase
logic itself, in case the given BlockDevice does not offer erase().
This relies on BlockDevice to properly return -1 in BlockDevice::get_erase_value().
Previous logic caused garbage collection to kick in, if the init() was
called on empty storage. This has effect of erasing areas twice, if both
areas were empty.
Re-write logic so that we erase areas only on garbage_collect() or reset().
The init() logic already chooses the active area, so no need to touch,
until keys are modified.
Removed also the is_erase_unit_erased() as this is working only on
FLASH devices, and TDBStore should be refactored to work on all storages.
Change the "reserved data" logic so that every time we erase and area,
the content of reserved data is then immediately copied to newly erased
area. This keeps two copies of the data.
When data is requested, return only if checksum is matching.
When data is written, only allow if BOTH checksums are incorrect, meaning
that areas are either corrupted or erased.
Only exception is TDBStore::reset() which erases all keys and reserved data.
Removed all logic that tried to detect, if reserved are was erased or
corrupted. Rely entirely on checksum.
Add moduletest for reserved data.
When using MbedCRC, init value must be non-reversed, regardless of
`reflect_data` or `reflect_out` settings. This means we need to reflect
the intermediate output before passing using it as the next init value.
(In GCC this ends up putting in two `RBIT` instructions back-to-back,
because it's implemented as assembler, so it doesn't know how to
optimise. In ARMC6, `__RBIT` is implemented as an intrinsic, so adding
this reflection cancels the existing reflection and makes the code
smaller).
* Make mbed_error use bitwise MbedCRC call rather than local
implementation.
* Remove use of POLY_32BIT_REV_ANSI from LittleFS.
* Move some MbedCRC instances closer to use - construction cost is
trivial, and visibility aids compiler optimisation.
Previously Greentea tests was not initialising its storage
before asking for bd->get_program_size(), causing FlashBlockDevice to
return zero. This caused both TDBStorage's to use zero for both
parameter to SlicingBlockDevice(bd, 0, 0), effetivaly both then
used same addresses for slice. This caused SecureStore tests
to fail, because writes to internal RBP storage overwrote keys
from external storage.
Fine-tune TDBStore sizes, so that all tests can fit into storage.
At least with LPC55S69's default TDBStore configuration it's
impossible to run storage Greentea tests without exhausting the
memory reserved for storing keys.
Fixes an issue where number of keys were removed based on number of
threads which didn't have anything to do with the test case.
Fixes an issue where number of keys were assumed to be constant
but variable number was used for configuration.
In case our are contains data from previous reset() or reset_area(),
we might end up in the situation where free space contains valid
key headers, but we have not erased that area yet. This can cause
failures if the deinit() and init() because new scan of that area
would continue as long as keys are found. This causes keys on the
not-yet-erased area to be included in the new instance of TDBStore.
To prevent this failure, check after each key-write that our free
space does not contain valid key headers. Also make sure that we
erase one program unit sector over the master record. If we erased
just the master record,first key might is still there, causing next
init() to find it. Extend erase area by one program unit, so that
build_ram_table() won't find any keys.
With tickless mechanism hsem can be used for quite a long time
(time to set up PLL clock).
Also, if hsem is held to long, then this is not the current core which is faulty,
but probably the other (the one which hold the HSEM)
Added support to Wi-SUN tasklet for following mbed-mesh-api .json configuration options:
wisun-uc-channel-function
wisun-bc-channel-function
wisun-uc-fixed-channel
wisun-bc-fixed-channel
wisun-bc-interval
wisun-bc-dwell-interval
wisun-uc-dwell-interval
This allows e.g. enabling single channel configuration for testing.
This pull request does not change existing functionality since when
defaults from mbed-mesh-api .json are used, no new or changed
ws_management_* interface calls are made.
Remove lwIP reliant networking and BLE tests for baremetal
Mbed OS 5 ported lwIP in its OS mode and uses threads. Networking
that rely on lwIP needs to be removed so it can be compiled with the
baremetal profile.
The BLE cordio Greentea tests are also disabled given that the feature
is not supported without an RTOS.
MBED_DEPRECATE macros is added to string-based APIs.
New, non-string-based APIs are added in their place.
Wiced binaries rebuilt
Any existing stubs or mocks are adjusted to compile and run with the newly added non-string based functions.
Previously it was 2 pages - 1kB - which isn't sufficient to store
Reserved Area and Master Record. Reserved are requires one page and Master
Record takes two pages. With 512B page size and having two areas, active and
inactive, the minimum size requirement becomes 2 areas * 3 pages = 3kB. That
isn't enough to store any keys though.
Cypress Target update to support WiFi Manufacturing Test
Adding IOCTLS in WhdSTAInterface for MFG Test.
Fix WHD EMAC interface to release buffer when emac is not powered up or callback
is not registered.
As per 3GPP TS 24.301:
If the UE supports NB-S1 mode, Non-IP PDN type, or N1 mode,
then the UE shall support the extended protocol configuration options IE.
...
If the UE supports the extended protocol configuration options IE,
then the UE shall set the ePCO bit to extended protocol configuration options supported
in the UE network capability IE of the ATTACH REQUEST message.
* Make mbed_error use bitwise MbedCRC call rather than local
implementation.
* Remove use of POLY_32BIT_REV_ANSI from LittleFS.
* Move some MbedCRC instances closer to use - construction cost is
trivial, and visibility aids compiler optimisation.
The addition of trace logging during greentea tests pushes the multithreaded
read-write test beyond the limits of the stack it allocates for its threads.
The increase of 128 bytes was chosen by experimentation.
-Added the mbedtls,crypto,psa,filesystem,fat,littlefs in baremetal.json to resolve compiler issue
-Disable metrics that are not available for bare metal
-Moved the baremetal.json inside TESTS/configs directory
-Added the baremetal.json on Tests directory to enable bare-metal
-Conditional enable of greentea metrics
Note:
Run green tea with bare metal
mbed test -m target -t GCC_ARM -n tests-mbed_platform-transaction --app-config TESTS/baremetal.json
_inc_set_handle is new'd in SecureStore::init(), then its members are
referenced in various functions without being explicitly initialized
first. These pre-existing values can confuse the SecureStore's internal
state and cause various undesired behavior.
DeviceKey was using mbedtls_ssl_safer_memcmp() to compare result against
buffer of equal length, but zero content. This comparison makes no sense
as the entropy function is already returning proper error, if it fails.
* Change MBED_ASSERTS() to return valid error code, so that
checks are not bypassed on release builds.
* Fix starting address calculations so that "addr" parameter is always
relative to SlicingDevice and "_start" is only added when calls to
underlying storage block is made.
* Bypass BlockDevice:is_valid_*() to underlying block device.
Slicingblockdevice was just verifying addresses independently, without
verifying those from underlying block storage.
* Refactor some headers to use relative path from Mbed OS root.
* Refactor some data types to compile on 64bit machines.
* Refactor some debug traces to use mbed_trace.
Describe the return values with as much detail as possible, to let user only check the relevant return codes, instead of all nsapi_error_t. Refer to underlying APIs wherever possible.
Protocols like mdns requires IPv6 link local address to be advertised in its
records (AAAA record). LWIP::Interface::bringup() API is creating IPv6 link
local address;But as of now there is no API exposed by mbed-os to get the
IPv6 link local address.
This new API is required to deliver mDNS library support on mbed-os for Cypress
platforms. Unit tested it by invoking get_ipv6_link_local_address with a simple
application.
- Enable FLASHIAP for all H7 boards
- Use "TDB_INTERNAL" for all H7 boards
- Define specific internal_base_address only for DISCO_H747I_CM7
(default address is the end of FLASH which is correct for other H7 boards)
- Correct GetSectorBase function with Dual Bank information
- A shared mutex is added for synchronization
- ScopedMutexLock is used to to protect
- SoftAP: start, stop
- STA: scan, join, disconnect
- Fix switching issue between SoftAP and STA mode for primary interface
- Avoid reinit primary interface by getting mapping the current interface to the other one which is already on
- In concurrent mode, STA is the default if it is up, otherwise SoftAP is default.
- For non-concurrent mode, the most recent started interface is set as default.
- Add WhdAccessPoint to include additional WHD scan info
- To save memory, only move assignment is supported for WhdAccessPoint
- Add scan_whd to scan for WhdAccessPoint
- Set set_blocking(false) to unsupported by return NSAPI_ERROR_UNSUPPORTED
Originally, when DEVICE_TRNG is defined, MBEDTLS_ENTROPY_HARDWARE_ALT will also be defined
accordingly to provide entropy source. This is fine for targets supporting TRNG. However, for
targets without TRNG, it is also possible to provide non-TRNG entropy source solution via the
define MBEDTLS_ENTROPY_HARDWARE_ALT. Related discussion can be found at:
https://github.com/ARMmbed/mbed-os/issues/11680
Add 2 targets for DISCO_H747I dualcore:
* DISCO_H747I -> for CM7 core
* DISCO_H747I_CM4 -> for CM4 core
Current restrictions:
* TICKLESS deactivated
* DeepSleep not supported (DeepSleep wrapped to sleep)
Warning: use of the same IP (example I2C1) by both core at the same time is not prevented,
but is strongly not recommended.
Some Hardware Semaphore are use for common IP, to manage concurrent access by both cores: Flash, GPIO, RCC.
Warning: Drag and drop of binary to DISCO_H747I will flash CM7.
In order to flash CM4, one can use STM32 CubeProgrammer tool.
Problem Statement:
During multicast join sequence, InternetSocket::join_multicast_group() calls InternetSocket::modify_multicast_group(). modify_multicast_group() sets up the multicast group address (i.e., mreq.imr_multiaddr) to be joined and the interface address (i.e., mreq.imr_interface) to be used for the multicast join request. The interface address is initialized with the default value, which sets the version of interface address to NSAPI_UNSPEC. This results in LWIP::setsockopt() API to attempt IPv6 multicast join on the IPv4 interface address, hence IPv6 multicast join always fails with the protocol error.
Fix:
Initialize interface address version based on the multicast address version in LWIP::setsockopt(), before attempting multicast join operation.
AT_CellularContext::do_connect() is a virtual API and therefore can be overwritten in
inherited class. The problem was that it sets AT_CellularContext::_is_connected flag but
earlier it was set as private member making it impossible to set in overwritten do_connect()
method.
This commit fixes the problem by changing _is_connected as protected enabling its use
in inherited class.
As of 722628be02, the "remainder" configuration
also uses the default location near the end of flash. Which makes the two tests
nearly identical with the exception that the "last two sectors" test correctly
handles parts with a low (possibly 1:1) erase size to program size ratio.
Therefore, change the "remainder" test to instead be a "default" test that uses
the tdb_internal_address/size values, so that it
a.) tests something meaningfully different and
b.) tests using the custom TDB address/size values if they are provided.
c.) functions correctly on devices where the default sector-based size computation
does not work (e.g. because of the low erase size to program size ratio)
and therefore a custom location and size has been specified.
The is_conf_tdb_internal variable is unused and therefore removed.
This is related to https://github.com/ARMmbed/mbed-os/issues/11256
When TARGET_PSA is enabled on Cortex-A boards, the SECURE
is redeclared. So to minimize the impact we can redeclare this in
val.h which is used only by Mbed. And `security_t` itself is used in
mbed-os\components\TARGET_PSA\TESTS, but the SECURE string is not used.
Renamed to `caller_security_t` which aligns with
https://github.com/ARM-software/psa-arch-tests
The QSPI spec allows alt to be any size that is a multiple of the
number of data lines. For example, Micron's N25Q128A uses only a
single alt cycle for all read modes (1, 2, or 4 bits depending on
how many data lines are in use).
We get this compiler warning;
Compile [ 7.9%]: AT_CellularDevice.cpp
[Warning] AT_CellularDevice.cpp@206,18: variable 'err' set but not used [-Wunused-but-set-variable]
Due to the fact, that the code that would actually use this variable
is behind trace flags. Based on review feedback from Antti Kauppila and
Kimmo Väisänen, adding same flagging also for that.
- Reason being - the operation needs to be within the locks.
Return value was ignored, and TDBStore:init() ended up in a
MBED_ERROR() phase after that.
TDBStore API was limited to allow returning of only two separate
errors, which may end up hiding the actual return value. Change
the documentation slightly to allow returning of original error
code from the underlying block device.
Fixes#11591
_ongoing_tx_msg was incorrectly initialized before _mlme_confirmation.
Fixes following build warning:
[Warning] LoRaMac.h@691,26: 'LoRaMac::_ongoing_tx_msg' will be initialized after [-Wreorder]
[Warning] LoRaMac.h@689,28: 'loramac_mlme_confirm_t LoRaMac::_mlme_confirmation' [-Wreorder]
[Warning] LoRaMac.cpp@68,1: when initialized here [-Wreorder]