Commit Graph

336 Commits (ad80ed17fc86e03c6ac65b14c0083c0c8ced51a5)

Author SHA1 Message Date
ccli8 41d95ef2fb [M2351] Support TFM level 1 2020-01-06 15:55:00 +08:00
Anna Bridge 309183420b
Merge pull request #12111 from rajkan01/feature_feof_disable
Microlib: Disable feof function usage in general filesystem test
2019-12-17 16:36:54 +00:00
Przemyslaw Stekiel 25f354fe1f storage: fix static pin-map for ARMC5 2019-12-16 15:38:07 +01:00
Rajkumar Kanagaraj 95f56bac30 Microlib: Disable feof function usage in tests
feof function is not supported in Microlib library. so disabling all the feof function usage in the green tea test.
2019-12-16 04:34:20 -08:00
Martin Kojtal f2a1804d51
Merge pull request #12058 from mprse/static_pinmap_for_cloud_client
Add static pin-map support: SDBlockDevice, kvstore, system storage (reduce ROM used by Mbed Cloud Client example)
2019-12-10 14:19:18 +01:00
Przemyslaw Stekiel ee5953ad74 Add static pinmap support: SDBlockDevice, kvstore, system storage
This is done in order to enable static pin-map for Mbed Cloud Client Example. This should give extra ROM savings, ~1KB.
2019-12-10 12:26:23 +01:00
Seppo Takalo 1f99703806 Fix TDBStore sizes for tests
Tests must require at least 2 erase sectors per TDBStore,
so that the garbage collection may work.
2019-12-09 11:18:29 +02:00
Martin Kojtal 412a9317de
Merge pull request #12017 from VeijoPesonen/remove_nvstore
NVStore: already deprecated implementation removed
2019-12-05 09:10:30 +01:00
Seppo Takalo 21acb66c1c TDBStore: remove unused variables 2019-12-04 16:21:55 +02:00
Seppo Takalo 7902100238 SecureStore: Get rid of casting by using opaque pointers. 2019-12-04 16:21:55 +02:00
Seppo Takalo 23b2b8c4f3 SecureStore: Deinitialize also member TDBStorages on deinit() 2019-12-04 14:55:45 +02:00
Seppo Takalo 650b93b66c SecureStore: Validate internal RBP data first
Previous logic was allowing external storage to be tampered by setting
write-protected keys, so values could not be updated, but it was still
used by get().
2019-12-04 14:55:45 +02:00
Seppo Takalo bde9753696 SecureStore: Don't use flags of corrupted data. Allow removing. 2019-12-04 14:55:45 +02:00
Seppo Takalo 56d67360ef SecureStore: Validate internal header size before using its values. 2019-12-04 14:55:45 +02:00
Martin Kojtal 7a085b472b
Merge pull request #11987 from ARMmbed/feature_tdbstore_refactoring
TDBStore refactoring
2019-12-04 13:51:50 +01:00
Veijo Pesonen 060a1c6df7 NVStore: deprecated implementation removed 2019-12-03 15:36:31 +02:00
Seppo Takalo ce7b196b26 TDBStore: Don't copy more data than what we can hold 2019-12-03 15:20:10 +02:00
Seppo Takalo fe3c3550f9 TDBStore: Move Assert to init(), so Block parameter are initialised correctly 2019-12-03 15:20:10 +02:00
Seppo Takalo adf409f7f7 Do not require Flash device for TDBStore
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().
2019-12-03 15:20:10 +02:00
Seppo Takalo 3dc6c4879f TDBStore: erase one program unit more, when cleaning an area 2019-12-03 15:20:10 +02:00
Seppo Takalo 93d7422f75 TDBStore: Do no garbage_collect() on init()
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.
2019-12-03 15:20:10 +02:00
Seppo Takalo 36523282fa TDBStore: Keep copy of reserved data on both areas.
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.
2019-12-03 15:20:10 +02:00
Seppo Takalo 0fe159f6c4 Greentea: Fix slice-calculation from kvstore test phase 2 2019-12-03 14:51:37 +02:00
Seppo Takalo 2ddd4069b6 Remove flaky error_inject_test 2019-12-03 14:38:40 +02:00
Seppo Takalo b9eaac4da0 Fix Greentea handler typecasting. 2019-12-03 14:38:40 +02:00
Seppo Takalo 3eb8d6eb1d BufferedBlockDevice: Sync all the buffers on deinit()
Make sure that all data has been written on the underlying
storage when we do deinit().
2019-12-03 14:38:40 +02:00
Seppo Takalo 8ab3984d33 Don't allow over-read on BufferedBlockDevice 2019-12-03 14:38:40 +02:00
Seppo Takalo 191d3444bb HeapBlockDevice: Don't assert on const functions 2019-12-03 14:38:40 +02:00
Seppo Takalo 6105634bb0 Remove unceressary NULL check from BufferedBlockDevice::size() 2019-12-03 14:38:40 +02:00
Seppo Takalo bcaf37dcfa SlicingBlockDevice should assert, if size does not look valid 2019-12-03 14:38:40 +02:00
Seppo Takalo 92a60c3d80 Extend SlicingBlockDevice test coverage 2019-12-03 14:38:40 +02:00
Seppo Takalo 12dea71f40 Greenteatests: Validate KVStore content when WRITE_ONCE flag is set. 2019-12-03 14:38:40 +02:00
Kevin Bracey cf13cd48bc LittleFS test: silence sign mismatch warning 2019-12-02 14:45:37 +02:00
Kevin Bracey 7a219260c1 LittleFS: correct CRC calculation
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).
2019-12-02 14:45:37 +02:00
Kevin Bracey c67816b5ff Adjust code for MbedCRC changes
* 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.
2019-12-02 14:45:37 +02:00
Seppo Takalo 7f7b191077 IOTSTOR-951: Unlock the master mutex even after garbage_collect() 2019-11-28 14:33:07 +02:00
Seppo Takalo b82e106a43 Astyle fixes 2019-11-28 10:59:48 +02:00
Seppo Takalo abbb2485d2 Greentea: Fix storage sizes for SecureStore tests.
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.
2019-11-28 10:47:47 +02:00
Veijo Pesonen 065ff2645e Fixes features-storage-tests-kvstore-static_tests test case bugs
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.
2019-11-28 10:37:11 +02:00
Seppo Takalo 8f77de6453 TDBStore safety check: Erase if there is valid keys on the free space.
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.
2019-11-28 10:37:07 +02:00
Martin Kojtal 5f7ecea00b
Revert "MbedCRC and CRC HAL revisions" 2019-11-26 13:45:37 +00:00
Martin Kojtal eb60e67d92
Merge pull request #11913 from VeijoPesonen/tdbstore_min_size
LPC55S69_NS default TDBStore size increased to 32kB
2019-11-22 14:47:56 +01:00
Martin Kojtal 04ed9c5c8c
Merge pull request #11851 from amq/patch-2
Enable FAT ChaN lib configuration with mbed_lib.json
2019-11-22 13:38:56 +01:00
Veijo Pesonen 8a0af607f3 LPC55S69_NS: Sets default TDBStore size to 32kB
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.
2019-11-21 11:28:59 +02:00
Veijo Pesonen 458f5f43f3 TDBStore: Adds sanity check for storage size when compiled with debug profile 2019-11-21 11:28:59 +02:00
Seppo Takalo af0708ca48 IOTSTOR-978: Skip a unstable testcase until fixed 2019-11-15 10:38:32 +02:00
Martin Kojtal fd22997b60
Merge pull request #11559 from kjbracey-arm/crc
MbedCRC and CRC HAL revisions
2019-11-13 18:24:04 +01:00
amq 5ec0a911fa
Change "MBED_CONF_FAT" to MBED_CONF_FAT_CHAN" 2019-11-13 16:08:08 +01:00
amq 1b55cbe92d
Change library name from "fat" to "fat_chan" 2019-11-13 15:51:55 +01:00
Kevin Bracey 8811972201 Adjust code for MbedCRC changes
* 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.
2019-11-13 14:31:49 +02:00