Commit graph

31 commits

Author SHA1 Message Date
Ivan Grokhotkov 24c4bc9cc4 fatfs: fix duplicate unit test name 2017-06-23 14:59:21 +08:00
Ivan Grokhotkov e918ee20da Merge branch 'bugfix/vfs_fixes' into 'master'
VFS fixes

See merge request !901
2017-06-23 11:33:27 +08:00
Ivan Grokhotkov 45037efc45 Merge branch 'bugfix/vfs_write_return_type' into 'master'
Change esp_vfs_t.write return value to ssize_t

See merge request !897
2017-06-22 11:48:34 +08:00
Ivan Grokhotkov 2ccfe3da96 vfs: fix opendir of a filesystem root directory
Previously opendir("/data") would fail if filesystem with "data" prefix
was registered in VFS, while opendir("/data/") would succeed.
This change fixes handling for the former case and adds relevant tests.
2017-06-21 01:21:14 +08:00
Deomid Ryabkov b8782bdd90 Change esp_vfs_t.write return value to ssize_t
write() should return ssize_t, not size_t.
2017-06-09 21:24:00 +01:00
Ivan Grokhotkov 06accaf851 add C++ include guards to header files which are missing them
Fixes https://github.com/espressif/esp-idf/issues/628
2017-05-31 17:20:17 +08:00
Ivan Grokhotkov 53d5c5f668 vfs, fatfs: fix support for two FATFS instances (SD and flash)
- fix null pointer dereference in VFS when VFS implementations are added
  and removed in different order

- vfs_fat_sdmmc, vfs_fat_spiflash: pass correct drive to mkfs
  (previously it would always do mkfs in the first drive)

- add test case
2017-05-05 15:21:38 +08:00
Ivan Grokhotkov 5ac28e843d fatfs: clean up diskio code
- clean up diskio_spiflash, fix the max number of volumes supported
- move SDMMC code into a separate file
2017-05-05 15:21:38 +08:00
Ivan Grokhotkov 4e3ea66ec4 fatfs: run same fatfs tests for WL and SDMMC
This change moves actual test code into test_fatfs_common.c and
refactors setup/teardown code to be contained within separate functions.
For each SDMMC FATFS test, identical test is added which can run with
WL partition in flash.
2017-05-05 15:21:38 +08:00
Ivan Grokhotkov d18157e108 vfs_fat: allocate FIL structures on the heap in vfs_fat_link
vfs_fat_link opened two files to perform copy operation. File structures
were allocated on the stack. When _MAX_SS setting was increased in
ffconf.h due to wear levelling feature, the size of these structures
increased to ~4k each (~8k total). This exceeds stack size allocated for
tasks in most typical cases.

This change makes file structures dynamically allocated.
2017-05-05 15:21:37 +08:00
Ivan Grokhotkov 1a73b41b10 vfs_fat: fix prepend_drive_to_path
Originally, prepend_drive_to_path was designed to be a macro, and it
modified local path variables to point to a temporary buffers.
When it was converted into a function, modification to path variables
were no longer visible outside of this function.

In addition to that, prepend_drive_to_path allocated 2k bytes on the
stack for temporary path buffers. This is replaced with path buffers
allocated as part of vfs_fat context object. Locking is added around
parts of code which use these temporary buffers.

Additionally, _lock member of vfs_fat_ctx_t was placed after the
variable-sized files array, which caused the first entry in the
array to be never used. This change fixes the order of members
and adds comments.
2017-05-05 15:21:37 +08:00
Nineis K b65779eefe Fix vfs_fat_spiflash failed to mount / f_mkfs() 2017-05-04 17:31:14 +08:00
Ivan Grokhotkov b540322dc1 Merge branch 'feature/wear_levelling' into 'master'
wear levelling

This MR adds wear levelling component. It presents an interface similar to the interface of spi_flash and esp_partition. Inside, it stores data inside a partition to in a way that reduces worst case number of erase cycles for any given sector.

Also included are APIs similar to the ones provided for SDMMC to mount FAT filesystem on top of the wear levelling partition. A simple example shows how this API can be used.

Ref TW10338.

See merge request !567
2017-04-25 19:46:11 +08:00
Ivan Grokhotkov 8f02730e1f fat/sdmmc: unmount FATFS object on error
Failure to call f_mount(NULL,...) makes FATFS attempt to clean up the old
FS object upon next mount. If previous mount operation has failed, some
parts of FS object may not be fully initialized, which will cause errors
(such as attempting to delete a mutex which wasn’t allocated).
2017-04-19 15:03:30 +08:00
Ivan Grokhotkov 52b51df859 add wear_levelling component and example 2017-04-17 11:01:17 +08:00
Dmitry Yakovlev aeabbd305c fatfs: add support for small disc sizes (less then 16 MB) 2017-04-17 11:01:17 +08:00
Ivan Grokhotkov 7388efa953 fatfs: add support for variable sector size 2017-04-17 11:01:17 +08:00
Angus Gratton 5f549aab2e fatfs: Support for Long Filenames 2017-03-08 09:54:40 +11:00
Ivan Grokhotkov 4ecd26ce77 Merge branch 'feature/fatfs_dynamic_pdrv' into 'master'
FATFS enable support for multiple drives

Current implementation has drive numbers and paths hardcoded to support
only one FATFS drive. Arduino has it's own SPI driver to allow
compatibility and flexibility. With the MR it is possible to have up to
```_VOLUMES``` drives connected (SPI, SDMMC and others) at the same
time and accessed through VFS

See merge request !478
2017-03-03 11:40:37 +08:00
Ivan Grokhotkov c17e05040a vfs_fat_sdmmc: if card init fails, fail cleanly
This fixes the issue with sdmmc_host not returned to clean state after
a failed attempt to mount the card, with no SD card in the slot.
2017-02-24 21:04:22 +08:00
Angus Gratton 9cea5ea075 fatfs: Add unit test for overwrite/append fix 2017-02-15 18:04:28 +11:00
nineisk 57af0d70d3 Fix fopen() in “a” (append) mode
fopen() does not work when file is opened in “a” (append) mode
2017-02-14 16:15:08 +11:00
me-no-dev 0eeda99a8c pick better name for unregister function and update docs 2017-02-02 12:24:38 +02:00
me-no-dev 972c6f0cae implement review recomendations 2017-02-01 17:55:25 +02:00
me-no-dev a57b6326e3 Fix ``if`` breaking the path 2017-01-31 17:43:22 +02:00
me-no-dev 84590ec0a4 FATFS enable support for multiple drives
Current implementation has drive numbers and paths hardcoded to support
only one FATFS drive. Arduino has it's own SPI driver to allow
compatibility and flexibility. With the MR it is possible to have up to
```_VOLUMES``` drives connected (SPI, SDMMC and others) at the same
time and accessed through VFS
2017-01-31 17:23:25 +02:00
antti f8b5c29346 esp32: add [ignore] tag to some unit test cases for CI
Add ignore tag on unit test cases that are not supported in CI yet
2017-01-18 17:08:20 +08:00
Ivan Grokhotkov 44ce833d76 fatfs: add vfs support 2017-01-09 05:54:04 +08:00
Ivan Grokhotkov d418776982 fatfs: rename DIR to FF_DIR to avoid conflict with dirent.h 2017-01-09 04:51:24 +08:00
Ivan Grokhotkov 9398d1b1cc fatfs: add pluggable diskio layer, sdmmc implementation 2017-01-09 04:51:24 +08:00
Ivan Grokhotkov 1440c866fc fatfs: import version 0.12b 2017-01-09 04:51:24 +08:00