Commit graph

9 commits

Author SHA1 Message Date
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
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
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
Ivan Grokhotkov 44ce833d76 fatfs: add vfs support 2017-01-09 05:54:04 +08:00