Skip to content

Commit

Permalink
AP_Filesystem: add littlefs based filesystem support
Browse files Browse the repository at this point in the history
use correct read status for nor flash
implement format on littlefs
optimize device calls in littlefs flash usage
check for fileops allowed in littlefs
littlefs optimization and support for mtime
  • Loading branch information
andyp1per committed Dec 7, 2024
1 parent 6ba34d1 commit 92f9c58
Show file tree
Hide file tree
Showing 6 changed files with 1,263 additions and 1 deletion.
9 changes: 9 additions & 0 deletions libraries/AP_Filesystem/AP_Filesystem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ static AP_Filesystem_ESP32 fs_local;
#elif AP_FILESYSTEM_POSIX_ENABLED
#include "AP_Filesystem_posix.h"
static AP_Filesystem_Posix fs_local;
#elif AP_FILESYSTEM_LITTLEFS_ENABLED
#include "AP_Filesystem_FlashMemory_LittleFS.h"
static AP_Filesystem_FlashMemory_LittleFS fs_local;
#else
static AP_Filesystem_Backend fs_local;
int errno;
Expand Down Expand Up @@ -310,6 +313,12 @@ void AP_Filesystem::unmount(void)
return LOCAL_BACKEND.fs.unmount();
}

// if non-zero size at which syncs should be peformed, only used by flash fs
uint32_t AP_Filesystem::get_sync_size(void) const
{
return LOCAL_BACKEND.fs.get_sync_size();
}

/*
Load a file's contents into memory. Returned object must be `delete`d to free
the data. The data is guaranteed to be null-terminated such that it can be
Expand Down
3 changes: 3 additions & 0 deletions libraries/AP_Filesystem/AP_Filesystem.h
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,9 @@ class AP_Filesystem {
// format filesystem. This is async, monitor get_format_status for progress
bool format(void);

// if non-zero size at which syncs should be peformed, only used by flash fs
uint32_t get_sync_size() const;

// retrieve status of format process:
AP_Filesystem_Backend::FormatStatus get_format_status() const;

Expand Down
Loading

0 comments on commit 92f9c58

Please sign in to comment.