Commit graph

28 commits

Author SHA1 Message Date
Andrzej Puzdrowski b7f1289847 subsys: fs: Add Flash Circular Buffer
Zephyr already supports NFFS as a storage layer, but it might
be a little bit too heavyweight for certain applications in
memory-restricted ICs.

This module is response for need of Lightweight flash storage
capability. FCB is ported form MyNewt as native zephyr module.

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2018-01-15 15:46:37 -05:00
Jan Van Winkel 36e2efaf91 fs: nffs: Corrected types in OS specific functions
Corrected types in OS specific functions to be inline with NFFS
declarations.

Fixes #5467

Signed-off-by: Jan Van Winkel <jan.van_winkel@dxplore.eu>
2018-01-02 13:34:02 -05:00
Michael Hope 9dd4399edd fs: only select the disk subsystem if the filesystem needs it.
Of the filesystems under subsys/fs/, only the ELM FAT filesystem needs
the disk layer as others (like NFFS) talk directly to the flash API.

This removes the need to define CONFIG_DISK_ERASE_BLOCK_SIZE and
similar which are used by the disk subsystem but not by NFFS.

Signed-off-by: Michael Hope <mlhx@google.com>
2017-12-14 16:49:18 -06:00
Anas Nashif 429c2a4d9d kconfig: fix help syntax and add spaces
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-12-13 17:43:28 -06:00
Sebastian Bøe 0829ddfe9a kbuild: Removed KBuild
Signed-off-by: Sebastian Boe <sebastian.boe@nordicsemi.no>
2017-11-08 20:00:22 -05:00
Sebastian Bøe 12f8f76165 Introduce cmake-based rewrite of KBuild
Introducing CMake is an important step in a larger effort to make
Zephyr easy to use for application developers working on different
platforms with different development environment needs.

Simplified, this change retains Kconfig as-is, and replaces all
Makefiles with CMakeLists.txt. The DSL-like Make language that KBuild
offers is replaced by a set of CMake extentions. These extentions have
either provided simple one-to-one translations of KBuild features or
introduced new concepts that replace KBuild concepts.

This is a breaking change for existing test infrastructure and build
scripts that are maintained out-of-tree. But for FW itself, no porting
should be necessary.

For users that just want to continue their work with minimal
disruption the following should suffice:

Install CMake 3.8.2+

Port any out-of-tree Makefiles to CMake.

Learn the absolute minimum about the new command line interface:

$ cd samples/hello_world
$ mkdir build && cd build
$ cmake -DBOARD=nrf52_pca10040 ..

$ cd build
$ make

PR: zephyrproject-rtos#4692
docs: http://docs.zephyrproject.org/getting_started/getting_started.html

Signed-off-by: Sebastian Boe <sebastian.boe@nordicsemi.no>
2017-11-08 20:00:22 -05:00
David B. Kinder ee71332b99 doc: fix doc misspellings
Found some spelling issues missed during regular PR review

Signed-off-by: David B. Kinder <david.b.kinder@intel.com>
2017-10-17 14:31:52 -04:00
Anas Nashif c6a8014e1c subsys: fs: consolidate elm FAT kconfig options
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-10-03 08:43:50 -04:00
Anas Nashif 3580ba539e subsys: fs: consolidate nffs kconfig options
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-10-03 08:43:50 -04:00
Anas Nashif 6192555b35 kconfig: cleanup file system kconfig
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-10-03 08:43:50 -04:00
Andrzej Kaczmarek 12e2dfd90a fs: shell: Add more shell functions
Add following commands to fs shell:
- rf <filename>
- read <filename> [<offset> [<length>]]
- write <filename> [-o <offset>] <byte1> [<byte2> ... [<byteN>]]
- trunc <filename> [<length>]

For writes without offset specified, new data is appended to file.
For truncaces without length specified, 0 is default value.

Signed-off-by: Andrzej Kaczmarek <andrzej.kaczmarek@codecoup.pl>
2017-09-22 06:54:48 -04:00
Andrzej Kaczmarek 7feacf26c2 fs: shell: Extract common path handling code to helper
This patch moves code to create absolute path of file/directory to
separate helper since the same code is used in few places.

Signed-off-by: Andrzej Kaczmarek <andrzej.kaczmarek@codecoup.pl>
2017-09-22 06:54:48 -04:00
Andrzej Kaczmarek 81da3ca295 fs: nffs: Add NFFS filesystem support
This patch adds filesystem interface implementation for NFFS.
Default configuration for mem slabs sizes are the same as in Mynewt.

Origin: Original
Signed-off-by: Andrzej Kaczmarek <andrzej.kaczmarek@codecoup.pl>
2017-09-22 06:54:48 -04:00
Kumar Gala 6da829690f subsys: convert to using newly introduced integer sized types
Convert code to use u{8,16,32,64}_t and s{8,16,32,64}_t instead of C99
integer types.

Jira: ZEP-2051

Change-Id: Icbf9e542b23208890a3a32358447d44cdc274ef1
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2017-04-21 09:36:22 -05:00
Kumar Gala 789081673f Introduce new sized integer typedefs
This is a start to move away from the C99 {u}int{8,16,32,64}_t types to
Zephyr defined u{8,16,32,64}_t and s{8,16,32,64}_t.  This allows Zephyr
to define the sized types in a consistent manor across all the
architectures we support and not conflict with what various compilers
and libc might do with regards to the C99 types.

We introduce <zephyr/types.h> as part of this and have it include
<stdint.h> for now until we transition all the code away from the C99
types.

We go with u{8,16,32,64}_t and s{8,16,32,64}_t as there are some
existing variables defined u8 & u16 as well as to be consistent with
Zephyr naming conventions.

Jira: ZEP-2051

Change-Id: I451fed0623b029d65866622e478225dfab2c0ca8
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2017-04-20 16:07:08 +00:00
Kumar Gala 869a9fc050 fat: match type info expected by fat library for f_write
The fat library uses its own typedef for integer parms and expects a
UINT to be either 16 or 32-bits in length.  We potentially get into
trouble when we build with newlib if we use an uint32_t.  Lets just use
unsigned int which should cover all cases for us.

Change-Id: I3dbbf4871ab65dd12488d41cb06a06387c128339
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2017-01-30 12:01:50 +00:00
David B. Kinder ac74d8b652 license: Replace Apache boilerplate with SPDX tag
Replace the existing Apache 2.0 boilerplate header with an SPDX tag
throughout the zephyr code tree. This patch was generated via a
script run over the master branch.

Also updated doc/porting/application.rst that had a dependency on
line numbers in a literal include.

Manually updated subsys/logging/sys_log.c that had a malformed
header in the original file.  Also cleanup several cases that already
had a SPDX tag and we either got a duplicate or missed updating.

Jira: ZEP-1457

Change-Id: I6131a1d4ee0e58f5b938300c2d2fc77d2e69572c
Signed-off-by: David B. Kinder <david.b.kinder@intel.com>
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2017-01-19 03:50:58 +00:00
Anas Nashif 7e18ab70f9 filesystem: add mkdir shell command
Change-Id: I84d8acd46ba3406eb3f4a73beaa98b7c132bea7f
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-01-09 19:47:49 +00:00
Anas Nashif 6c1c4b7cd4 filesystem: fix dependency on shell
Change-Id: I7977753fa6897cbe480de83f6d49e3c7952144c0
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-01-09 15:07:51 +00:00
Jithu Joseph 89f4bf7c7e subsys: disk: Refactor disk_access stuff into a directory
Disk IO functions are used by both FS and USB Mass Storage.
This patch refactors those from FS directory to a separate one.
In addition existing, config options were modified to make
stuff meaningful.

Jira: ZEP-1276

Change-Id: Ia2a2e18f3dbbbdb964c3dc0427d8138ad86134cd
Signed-off-by: Jithu Joseph <jithu.joseph@intel.com>
2017-01-08 20:58:05 +00:00
Anas Nashif 7297f5db88 shell: move shell to its own subsystem
This moves the shell component into its own subsys and groups all
related files and options into a single place.

Additionally, one Kconfig option will now be required to enable the
shell:

 CONFIG_CONSOLE_SHELL=y

The header files was also moved to include/shell/shell.h and can be now
referenced with

 #include <shell/shell.h>

instead of

 #include <misc/shell.h>

Updated documentation as well.

Change-Id: Iffbba4acfa05408055e9fd28dffa213451351f94
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-12-25 19:35:11 +00:00
Flavio Santes 7fae8989f5 fs/disk: Improve code readability
This commit improves source code readability by breaking long
expressions found at some if statements.

Some minor style issues are also fixed by this patch.

Change-Id: I0c8e42eaf0fca3a98490c54a0ccb941766c50fa3
Signed-off-by: Flavio Santes <flavio.santes@intel.com>
2016-12-05 02:46:52 +00:00
Jithu Joseph 2fe288b4aa fs: expose generic ramdisk/flash disk access functions
This patch removes "FAT" from  files names, config names and
symbol names so as to avoid confusion, when other modules use
them in a more generic way.

Also flash_disk_access.c and ram_disk_access.c now exports generic
disk_access symbols as defined in include/disk_access.h rather
than FAT specific ones in fs/fat_diskio.h. Thus modules like
USB which need to use disk_access interface is not dependent
on symbols from ELMChan FAT module. Also fat_diskio.h
is removed.

Further the shim between ELM chan and Zephyr is modified as
per these changes.

Change-Id: Ifd80f14a629e467ee9c7a9aaff8a4896eed11982
Signed-off-by: Jithu Joseph <jithu.joseph@intel.com>
2016-11-09 02:45:45 +00:00
Johan Hedberg 61cfaa1be1 fs: Add simple shell support
Add a simple shell that allows exploring the contents of the file
system.

Jira: ZEP-1235

Change-Id: Iaa49f0be18980dd740e9552ddf4761196a818884
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-11-08 14:22:33 +00:00
Johan Hedberg c9dcbe66dd fs: Kconfig: Remove bogus default value
FS_FAT_FLASH_DISK_W25QXXDV is a boolean so "" makes no sense.

Change-Id: Ic43529928d80bcd76c2876219990bcec86657d3d
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-10-31 08:08:27 +02:00
Johan Hedberg 51390c39a2 fs: Kconfig: Clean up representation of mutually exclusive options
The flash and RAM disk options are mutually exclusive (evident e.g. in
both defining FS_VOLUME_SIZE and FS_BLOCK_SIZE variables), so they
should really be inside a choice-endchoice block. The duplicated
options can also taken care of with a single definition using
conditional default values.

Change-Id: I87733f0c342166a9e03aa0e1f34390d91107b137
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-10-31 08:08:27 +02:00
Johan Hedberg b108d02eba fs: Make API naming adhere to the appropriate namespace
The namespace allocated for the filesystem API is fs_* and FS_*. That
means all symbols and defines should adhere to it.

Jira: ZEP-1155

Change-Id: I422310448b7c7c347f621aea6d7b1d97ef25c94d
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-10-31 08:08:10 +02:00
Ramesh Thomas e354ad2a36 fs: Move file system code to subsys/
Subsystems code will reside in subsys/ folder. This patch creates the
folder and moves FS code there.

Jira: ZEP-1120
Change-Id: If3b1bcb996c5fbd4056cd5d1920d41d29810d6b2
Signed-off-by: Ramesh Thomas <ramesh.thomas@intel.com>
2016-10-30 13:23:58 +00:00