Commit Graph

270 Commits (7794d901f2be0737c02fa30fdae0b9ddf59dadf3)

Author SHA1 Message Date
David Saada 50836e76a1 Improve the efficiency of BufferedBlockDevice 2018-11-15 11:52:22 +02:00
Martin Kojtal a4500e86f5 blockdevice test: fix coding style 2018-11-15 07:20:09 +00:00
Martin Kojtal 20646d3da1 littlefs: fix coding style 2018-11-08 08:54:43 +00:00
Martin Kojtal e54ce88bca storage: fix astyle coding style 2018-11-07 08:56:35 +00:00
Martin Kojtal 73cc54e5f7
Merge pull request #8524 from korjaa/more_blockdevice_tests
Add more generic BlockDevice tests.
2018-11-05 17:15:59 +01:00
Cruz Monrreal 0e6eac5faa
Merge pull request #8491 from lrusinowicz/new-target-future_sequana
New target future sequana
2018-11-03 07:05:58 -05:00
Leszek Rusinowicz 9b1db83eaa Added required changes outside of TARGET_Cypress tree:
1. In drivers/Timer.cpp make sure that hardware timer is initialized outside of critical section.
   This is because on PSoC 6 hardware resources are shared between both cores
   and we have to make sure that the other core is not already using a particular resource.
   This mechanism is based on interprocessor communication taht cannot be handled iside of
   critical section.
2. Added support for post-binary hook function for PSoC 6 targets, so the hex image for M0+ CPU core
   can be merged with M4 core image for the final image.
3. Added possibility to use hook function from exportes, so the M0+ hex image could be included
   in the generated project.
4. Included hex images in the build dependency list, so the update of image is catched by the
   build process.
2018-11-01 20:19:21 +01:00
Jaakko Korhonen c3e0e3e75d Add generic BlockDevice test for get_erase_value(). 2018-11-01 14:51:07 +02:00
Jaakko Korhonen ebef79a05c Add generic BlockDevice test for contiguous erase/write/read. 2018-11-01 14:51:07 +02:00
Kevin Bracey fc32d954ac FATFileSystem: fix format specifiers 2018-10-31 14:49:22 +02:00
Cruz Monrreal fba0669194
Merge pull request #8563 from marcuschangarm/default_qspif
Add QSPIF block device to default system storage
2018-10-30 22:32:01 -05:00
Marcus Chang 063a7842ba Add QSPIF block device to default system storage 2018-10-26 13:00:38 -07:00
Martin Kojtal fc741f03a1
Merge pull request #8346 from OpenNuvoton/nuvoton_fix_mbr
storage: fix valid partion check with windows formatted sd card
2018-10-26 09:37:28 +01:00
Amir Cohen 54d2f66aec Fix no block device handling 2018-10-23 16:41:54 +03:00
Amir Cohen 7962e0c525 Fix build issues 2018-10-23 10:54:58 +03:00
Amanda Butler 8bca678ed8 Copy edit README.md
Copy edit file, mostly for active voice.
2018-10-23 10:54:58 +03:00
Amir Cohen 71431437fd Fix typos 2018-10-23 10:54:58 +03:00
Amir Cohen 5a2e7e3367 Fix minor issues 2018-10-23 10:54:58 +03:00
Amir Cohen 1b45d00bde features/storage/TESTS/blockdevice/general_block_device/README.md 2018-10-23 10:54:58 +03:00
Amir Cohen 7d7a553836 Add general block device tests 2018-10-23 10:54:58 +03:00
Deepika 9db31d299b Resolve build issues in test
mbed.h was added in test, via greentea and utest header files. 'mbed.h' is removed
from header files and required header file and namespace is added to CPP/C files
2018-10-16 11:50:16 -05:00
Cruz Monrreal a6651b868b
Merge pull request #8317 from yossi2le/add-flashiap-bd-as-default
Add FlashIAP block device as default block device for WISE 1570
2018-10-15 10:22:34 -05:00
Anna Bridge 8dcc949c63
Merge pull request #8002 from deepikabhavnani/storage_remove_mbed_h
Storage: Add required header file and namespace element instead add all
2018-10-12 11:06:35 +01:00
Cruz Monrreal 0aed6bb43f
Merge pull request #8256 from yossi2le/fix_warnings_in_blockdevices
Fix warnings in block devices
2018-10-11 10:10:55 -05:00
Yossi Levy b84f377b73 Removing nvstore. adding back the option for configuration as in the external repo 2018-10-10 17:15:46 +03:00
Oren Cohen 9e337bb600 Restore disk_get_sector_size() to return WORD 2018-10-10 14:57:44 +03:00
Oren Cohen 37b5442656 Fix overflow in disk_get_sector_size() 2018-10-10 14:57:42 +03:00
Yossi Levy 473f8d3f94 Fixing the order of component if more than one is included for a target.
Revert deprecation of FlashIAPBlockDevice 2 argument constructor has this was a breaking change. This follows a similar change in the external flashiap-driver repo.
2018-10-10 12:32:08 +03:00
ccli8 8ef23ff54d Fix mis-recognize that Windows-formatted SD card has valid partitions
For Windows-formatted SD card, it is not partitioned (no MBR), but its PBR has the
same boot signature (0xaa55) as MBR. We would easily mis-recognize this SD card has valid
partitions if we only check partition type. We add check by only accepting 0x00 (inactive)
/0x80 (active) for valid partition status.
2018-10-09 11:06:49 +08:00
Deepika 8642ece022 Storage: Add required header file and namespace element instead add all 2018-10-08 07:32:04 -05:00
Martin Kojtal f42aab7715
Merge pull request #8121 from deepikabhavnani/thread_safety_info
Add thread safety info to FatFs/LittleFs
2018-10-05 16:56:55 +02:00
Nir Sonnenschein f1587b50d7
Merge pull request #8262 from juhoeskeli/mbrblockdevice_align
Align MBRBlockDevice writes to underlying BlockDevice write size
2018-09-28 13:23:55 +03:00
Cruz Monrreal 6b85ec7c57
Merge pull request #7953 from davidsaada/david_is_valid_erase_fix
Fix is_valid_erase function to use get_erase_size with address
2018-09-27 10:20:56 -05:00
Juho Eskeli d32b454c5b Align writes to blockdevice write size in MBRBlockDevice 2018-09-26 22:43:27 +03:00
Martin Kojtal 37654e546a
Merge pull request #7696 from aashishc1988/wizwiki_iar_error
skip the flashsim test if not enough memory cannot be allocated for it.
2018-09-26 15:08:23 +02:00
Yossi Levy dd065e3be1 Fix warnings in block devices 2018-09-26 14:35:48 +03:00
David Saada 999042dda3 Handle NVStore tests in a low memory environment 2018-09-20 11:53:51 +03:00
Aashish chaddha 887aafe321 skip the flashsim test if enough memory cannot be allocated for it. 2018-09-18 11:38:39 -05:00
deepikabhavnani 1cb87d3235 Added thread safety info to FatFs/LittleFs 2018-09-13 11:32:36 -05:00
Cruz Monrreal 6c30b2f48d
Merge pull request #7924 from kjbracey-arm/filebase_default
Add special handling for "/default" filesystem
2018-09-05 19:40:29 -05:00
Kevin Bracey c0dbc49aa0 Make "/default" an alias - add real names too
Make the built-in FileSystem::get_default_instance() implementation
instantiate storage as "flash" or "sd", with "default" as an alias.

This will aid interworking between simple and advanced filesystem code
on various platforms. The expectation is that the names "sd" or "flash"
will be always available if the device is available and configured,
regardless of what "default" represents.
2018-09-05 14:18:29 +03:00
Kevin Bracey fd4b3879be Change default filesystem name to /default
"/fs" is a tautology - not a good name for the default filing system, as
whereever we use it, we know we're specifying a filing system. Rename to
"/default".
2018-09-05 14:18:28 +03:00
David Saada ff7858a306 Fix is_valid_erase function to use get_erase_size with address 2018-09-03 16:15:54 +03:00
Deepika 683034db8a Use the same API name to add mbed CRC: lfs_crc 2018-09-02 15:25:41 -05:00
Deepika 4d7fdfc2a9 Use MbedCRC for LittleFS (0xEDB88320)
CRC used in LittleFS is Reversed ANSI, hence new polynomial added.
Reversed polynomials perform shift in reverse direction of standard
polynomial, and we do not have option to notify reverse shift to hardware.
Hence this option is available in software only.
2018-09-02 15:25:40 -05:00
Yossi Levy c1eb141def Changing general_filesystem test to be more efficient. now format is done once at the beginning and once at the end while every test clean its resource before the next test. Testing time on SD should be drop form 10 minutes plus to less than 1 minute 2018-08-31 18:33:08 +03:00
Yossi Levy ed8e170d15 Moving SD, SPIF and FLASHIAP into mbedos and refactoring features storage directory structure. 2018-08-29 12:01:11 +03:00
Oren Cohen 787317b7eb Remove uVisor from mbed-os 2018-08-22 16:36:59 +03:00
Brendan McDonnell c4f10aafee typos 2018-02-20 20:11:19 -05:00
Jimmy Brisson 922bf1b619 Update mbed OS to handle ARMC6 requirements 2017-09-11 13:20:32 -05:00
Deepika 6c1ad4a4e4 Use correct IAR toolchain macro 2017-09-06 09:51:16 -05:00
Deepika 818f82c5bd Typecasting to int to resolve warning:#68-D: integer conversion resulted in a change of sign 2017-06-15 11:50:52 -05:00
Russ Butler 0de35e2a21 Fix config store deprecation warnings
Silence deprecation warnings in the config store C and C++ files. This
removes warnings that not relevant to applications. Note - using
these deprecated functions still gives an error outside of these files.
2017-06-05 18:06:10 -05:00
Russ Butler 58041a215d Deprecate config store and related libraries
Deprecate configuration-store, flash-journal and
storage-volume-manager for the 5.5 release. Also disable the
storage tests.
2017-05-31 12:08:11 -05:00
Simon D Hughes a09ad071e6 Corrections of debug trace statements which prevent compilation when CFSTORE_DEBUG is defined. 2016-12-05 15:29:22 +00:00
Simon Hughes 46411f7f73 CFSTORE issue 3327: fix to build CFSTORE SRAM mode (disabling flash storage). 2016-11-28 16:09:00 +00:00
Mahadevan Mahesh ac9668a498 Update tests to fix build failures. Also make the code similar to other tests
Signed-off-by: Mahadevan Mahesh <Mahesh.Mahadevan@nxp.com>
2016-11-02 11:45:14 -05:00
Marcus Chang 8876b7ef38 Removed static declaration for the StorageVolumeManager in the CFStore because this componenent is shared across all users of the flash. Added define guards to the CFStore location and size so that these can be changed from the settings file. 2016-10-27 10:26:28 +01:00
Russ Butler 3601b5ebb3 CFSTORE - Fix test failures due to fragmentation
In the config store create test in test case #5 the amount of available
memory is determined by fully allocating the heap. This is done
multiple times to determine if there is a memory leak. This causes
problems when even slight fragmentation occurs in the heap, since
the size that can be allocated is decreased slightly, which the test
flags as a memory leak.

This patch makes memory leak detection more robust by using metrics
provided by mbed_stats_heap_get. These metrics are an exact
measurement of memory allocated is not changed by fragmentation.
This allows the memory leak test to report correct values regardless of
fragmentation.
2016-10-17 21:08:57 -05:00
Russ Butler 9f0e756e28 CFSTORE - Delete handle even if key ref non zero
When closing a file handle remove the handle from the handle list
regardless of what the reference count of the key it is pointing to is.
This prevents config store from keeping a handle to file handles that
have gone out of scope.
2016-10-16 20:47:43 -05:00
Russ Butler c908666d63 CFSTORE - fix handling of realloc fail on delete
The function cfstore_delete_ex is written under the assumption that
CFSTORE_REALLOC will never fail if the size is decreasing. Regardless
of the status of CFSTORE_REALLOC the entry is removed from the config
store and zeroed. This works correctly if CFSTORE_REALLOC correctly
updates area_0_tail, but can lead to crashes in the case area_0_tail is
left unchanged. The crash is because when iterating over the config
store data, cfstore_get_next_hkvt is unable to determine the end of
valid data.

This patch fixes this problem by handling the realloc failure case by
updating area_0_tail even if CFSTORE_REALLOC returns NULL. This
patch also adds an assert to check for out of bound entries in when
calling cfstore_get_next_hkvt. This allows an assert to be triggered
if this bug is re-introduced, rather than a crash.
2016-10-16 20:47:42 -05:00
Russ Butler de8ce0e43e CFSTORE - Fix crashed due to uninit data
When the config store is powered down area_0_head is freed, but
area_0_len is not set to 0. This causes when cfstore_realloc_ex is
called, since on the first allocation it appears that the config store
size is decreasing, and therefore the data is not initialized.

Since the data is uninitiated various fields such as the reference
can have invalid values. On GCC_ARM built with heap stats enabled
this manifests as a crash due to an invalid reference count.

This patch fixes this problem by setting area_0_len to 0 when the data
is freed.
2016-10-16 20:47:40 -05:00
Simon Hughes 5e22db842f This commit includes the following CFSTORE/Flash-Journal/Storage updates and fixes:
- flash-journal basicAPI fix for ARM toolchain
- Updated storage-abstraction with version 0.4.7
  (commit c7c4a8c52298bbc006a6f53a059fb2599cad73cc).
- https://github.com/ARMmbed/storage-volume-manager at version v0.2.10.
- https://github.com/ARMmbed/mtd-k64f v0.4.2 version of flash.c (imported as storage_driver.c).
- update to CFSTORE to use the storage-volume-manager API to initialize volume manager and
  add a volume for CFSTORE to use.
- https://github.com/ARMmbed/flash-journal at version v0.5.3
  (commit 4c58165e2fa02c6ed2b9d166a9c96967e81f458f) including readFrom() support.
- Taking flash-journal-strategy-sequential v0.6.7 strategy.c
  (commit b11a718761aa9f33679956968a21aaef9179bde1).
- GCC_ARM, ARM and IAR compiler warning fixes for new versions of flash-journal code.
- Fix storage-volume-manager test cases for concurrent access from 2 volumes to use
  addresses within the 512-1024kB address range, which is within the cfstore added volume.
- Fix cfstore/storage-volume-manager IAR warnings when building with verbose flag.
2016-09-13 18:16:56 +01:00
Sam Grove 5b90bf7b1d Merge pull request #2624 from simonqhughes/master
CFSTORE Bugfix for realloc() moving KV area and cfstore_file_t data structures not being updated correctly
2016-09-10 07:26:41 -05:00
Simon Hughes b2f561a917 Restoring swap code to cfstore_test_delete_all() after being previously removed to work around CFSTORE issue 17/23 (realloc()). 2016-09-05 14:16:40 +01:00
Simon Hughes d9ad7bbb99 This commit contains CFSTORE fixes for the following related issues:
- issue 17: Heap corruption.
- issue 23: Handles invalidated when realloc called.
- issue 24: cfstore_find returns error when "previous" parameter is NULL.
- issue 25: Memory leak when out of memory.

With respect to issues 17 and 23:
- A code defect existed for correctly updating cfstore_file_t data structures
  under the following conditions:
  -- the KV memory area contained some KV's.
  -- cfstore calls realloc() to increase the size of the KV area in
     memory because:
	  * A new KV was being added to the KV area, or
	  * the size of a pre-existing KV was being increased.
  -- The returned address from realloc() has changed from before the
     call (i.e. the location in memory of the KV area has changed)
	 e.g. the presence of heap memory objects directly above the KV memory
	 area in the memory address space causes realloc() to move the KV area
	 so the newly increased area can be accommodated at contiguous addresses.
  -- In this scenario, the cfstore_file_t (structures for open files) head pointers
     do not get correctly updated.
  -- The defect was fixed by correctly updating the cfstore_file_t:: head pointer.
  -- A new add_del test case was added to the scenario where a new KV is being added
     to the KV area.
  -- A new create test case was added to the scenario where the size of a
     pre-existing KV is being increased in size.

- A code defect for suppling a NULL handle as the previous argument to the Find() method
  (issue 24).
	-- Supply a null handle is valid, but it was being used to check for a valid hkey,
	   which was incorrect.
	-- A new test case was added to check the case of supplying a NULL previous argument
	   works correctly.

- A code defect for a memory leak under the following conditions (issue 25):
  -- When realloc() fails to perform a requested change to the size of the KV area, the
     error handling sometimes incorrectly sets cfstore_context_t::area_0_head to NULL.
	 Cfstore returns a suitable error to the client. If memory had previously been held
	 at area_0_head, realloc(area_0_head, size) returning NULL means the memory
	 at area_0_head is still retained.
  -- On receiving the error code, the client cleans up including a call to Uninitialize().
     This should free the retained but as area_0_head == NULL this is not possible. Hence
	 a memory leak occurred.
  -- This was fixed by not setting area_0_head = NULL on the realloc() failure.
  -- A create test case was modified to detect the leaking of memory in this way.
2016-09-05 12:45:43 +01:00
Marcus Chang 076515c15f Added define guards for SEQUENTIAL_FLASH_JOURNAL_MAX_LOGGED_BLOBS so that the value can be passed as an argument during compile time. 2016-08-25 14:16:59 +01:00
Russ Butler 81859050c3 Fix cfstore_test_delete_all by removing swap
Remove the handle swap in cfstore_test_delete_all. This prevents a
deleted handle from being used.
2016-08-22 18:32:59 -05:00
Russ Butler 1799ace8ba Fix intermittent config store tests failures
Make the journal object in cfstore_test_startup static since the call
to FlashJournal_initialize keep a copy of this for future use. This fixes
an intermittent crash start started showing up when optimizations
were set to "-os".
2016-07-26 23:07:26 -05:00
Simon Hughes c2d849133f Adding mbed-os/features/storage to mbed/features/storage/FEATURE_STORAGE (before deleting mbed-os/features/storage). 2016-07-26 23:07:24 -05:00