Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for scripting in flash using littlefs #28724

Open
wants to merge 55 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
55 commits
Select commit Hold shift + click to select a range
974ad97
AP_HAL_ChibiOS: add support for littlefs
andyp1per Jun 12, 2023
906f8fb
AP_HAL_ChibiOS: don't backup storage with littlefs
andyp1per Nov 29, 2024
b3ce93b
AP_HAL: add littlefs build option
andyp1per Jun 12, 2023
425b6e2
modules: add littlefs v2.9.3
andyp1per Jun 12, 2023
f24f0bd
waf: build in littlefs support
andyp1per Jun 12, 2023
0260bc1
wscript: build in littlefs
andyp1per Jun 12, 2023
ccefd66
Replay: account for littlefs when building
andyp1per Jun 12, 2023
ca9d307
AP_Bootloader: correct use usage
andyp1per Nov 25, 2024
632c321
AP_Periph: correct use usage
andyp1per Nov 25, 2024
5ee59ed
AP_Logger: sync littlefs writes on block boundaries
andyp1per Nov 29, 2024
ce6714f
AP_HAL_ChibiOS: littlefs for MambaH743v4
andyp1per Jul 26, 2023
041250d
AP_HAL_ChibiOS: littlefs for MatekH7A3
andyp1per Nov 29, 2024
29ed298
AP_HAL_ChibiOS: use littlefs on KakuteH7Mini-Nand
andyp1per Nov 30, 2024
e81bd6d
AP_Scripting: allow scripting on 2Mb boards with littlefs
andyp1per Nov 30, 2024
be5fc47
AP_Filesystem: add littlefs based filesystem support
andyp1per Jun 12, 2023
900fb65
AP_Filesystem: reduce metadata_max on W25N flash
andyp1per Dec 7, 2024
9e864a3
AP_Logger: add flash speed test
andyp1per Dec 7, 2024
5d09c55
AP_Logger: add performance debug to W25NXX logger
andyp1per Dec 7, 2024
3aff7c5
AP_Filesystem: add littlefs singleton for sync block use
andyp1per Dec 11, 2024
0c54c8d
AP_Logger: user sync_block from littlefs to decide when to sync when …
andyp1per Dec 11, 2024
72c866b
AP_HAL_ChibiOS: terrain turned on on 2Mb boards with littlefs
andyp1per Dec 11, 2024
736ddd4
AP_HAL_ChibiOS: turn off storage backup on anything other than FATFS
andyp1per Dec 11, 2024
56de3bf
AP_HAL_ChibiOS: littlefs support for Aocoda-RC-H743Dual
andyp1per Dec 11, 2024
7ab29ee
AP_HAL_ChibiOS: littlefs support for JHEMCU-H743HD
andyp1per Dec 11, 2024
ab60ddc
AP_HAL_ChibiOS: littlefs support for KakuteH7v2
andyp1per Dec 12, 2024
50bcb3b
modules: update littlefs build to v2.9.3-ardupilot
andyp1per Dec 12, 2024
4d0209e
AP_Filesystem: provide SITL implementation for littlefs
andyp1per Dec 12, 2024
871fbca
AP_Logger: support SITL implementation of littlefs
andyp1per Dec 12, 2024
902e94d
waf: build littlefs filebd
andyp1per Dec 12, 2024
111529e
AP_Logger: nuance minspace for W25NXX and W25QXX
andyp1per Dec 13, 2024
ba8a580
waf: optionally add littlefs to sitl build options
andyp1per Dec 13, 2024
96fe86f
wscript: add littlefs build option for sitl
andyp1per Dec 13, 2024
23b9442
modules: update littlefs to version that skips validation
andyp1per Dec 18, 2024
cfe1c54
AP_Filesystem: support mutiple reads/writes in littlefs
andyp1per Dec 18, 2024
645f29b
AP_Logger: avoid disk_free() checks on littlefs
andyp1per Dec 18, 2024
a39ad06
AP_HAL: provide console logger that can be called from C.
andyp1per Dec 18, 2024
1200af5
AP_Filesystem: allow for logical blocks bigger than physical blocks i…
andyp1per Dec 20, 2024
cf3efe8
AP_Filesystem: optimize configured defaults on littlefs and address r…
andyp1per Dec 31, 2024
4b00241
AP_HAL_ChibiOS: introduce new DATAFLASH directive and use it
andyp1per Dec 31, 2024
00d0d7f
AP_HAL: tidy meanings of FATFS, POSIX_IO and friends
andyp1per Dec 31, 2024
998d18d
wscript: address review comments
andyp1per Dec 31, 2024
5368eb8
AP_HAL_ChibiOS: add HAL_OS_POSIX_IO to defaults
andyp1per Jan 1, 2025
902cc1a
AP_Scripting: scripting directory configuration for posix IO
andyp1per Jan 2, 2025
f28ac3d
AP_HAL_ChibiOS: ensure explicitly configured DATAFLASH is prioritized
andyp1per Jan 2, 2025
8b39c40
AP_Filesystem: add comment about littlefs inlining
andyp1per Jan 2, 2025
8947735
AP_Filesystem: support lseek() in littlefs in a way that enables terr…
andyp1per Jan 2, 2025
c141ddb
modules: update littlefs to 2.10.1
andyp1per Jan 4, 2025
cc679cc
AP_Scripting: ensure SITL uses ./scripts
andyp1per Jan 5, 2025
9c87ceb
AP_Filesystem: rename file and directory structures in littlefs
andyp1per Jan 6, 2025
4168839
AP_Filesystem: code in littlefs glue should be C++ rather than C
andyp1per Jan 9, 2025
e014cc7
AP_HAL_ChibiOS: correct inclusion of fat malloc
andyp1per Jan 9, 2025
ec090c9
AP_Filesystem: small littlefs cleanups
andyp1per Jan 9, 2025
2a94fb4
AP_Filesystem: lock littlefs between opendir and closedir
tpwrules Jan 9, 2025
faa26f2
AP_HAL_ChibiOS: only create storage backups on fatfs
andyp1per Jan 11, 2025
15ad577
AP_Filesystem: check for strdup failure on littlefs
andyp1per Jan 11, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -42,3 +42,6 @@
[submodule "modules/lwip"]
path = modules/lwip
url = https://github.com/ArduPilot/lwip.git
[submodule "modules/littlefs"]
path = modules/littlefs
url = https://github.com/ArduPilot/littlefs.git
andyp1per marked this conversation as resolved.
Show resolved Hide resolved
4 changes: 2 additions & 2 deletions Tools/AP_Bootloader/wscript
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ def build(bld):

bld.ap_stlib(
name= 'AP_Bootloader_libs',
use='dronecan',
use=['dronecan'],
dynamic_source='modules/DroneCAN/libcanard/dsdlc_generated/src/**.c',
ap_vehicle='AP_Bootloader',
ap_libraries= flashiface_lib + [
Expand All @@ -27,7 +27,7 @@ def build(bld):
# build external libcanard library
bld.stlib(source='../../modules/DroneCAN/libcanard/canard.c',
name='libcanard',
use='dronecan',
use=['dronecan'],
target='libcanard')

bld.ap_program(
Expand Down
4 changes: 2 additions & 2 deletions Tools/AP_Periph/wscript
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ def build(bld):
dynamic_source='modules/DroneCAN/libcanard/dsdlc_generated/src/**.c',
ap_vehicle='AP_Periph',
ap_libraries= libraries,
use='dronecan',
use=['dronecan'],
exclude_src=[
'libraries/AP_HAL_ChibiOS/Storage.cpp'
]
Expand All @@ -100,7 +100,7 @@ def build(bld):
# build external libcanard library
bld.stlib(source='../../modules/DroneCAN/libcanard/canard.c',
name='libcanard',
use='dronecan',
use=['dronecan'],
target='libcanard')

bld.ap_program(
Expand Down
2 changes: 1 addition & 1 deletion Tools/Replay/wscript
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ def configure(cfg):
cfg.env.HAL_GCS_ENABLED = 0

def build(bld):
if isinstance(bld.get_board(), boards.chibios) and bld.env['WITH_FATFS'] != '1':
if isinstance(bld.get_board(), boards.chibios) and bld.env['WITH_FATFS'] != '1' and bld.env['WITH_LITTLEFS'] != 1:
# we need a filesystem for replay
return

Expand Down
4 changes: 4 additions & 0 deletions Tools/ardupilotwaf/ardupilotwaf.py
Original file line number Diff line number Diff line change
Expand Up @@ -445,6 +445,10 @@ def ap_stlib(bld, **kw):
kw['target'] = kw['name']
kw['source'] = []

if 'use' not in kw:
kw['use'] = []
kw['use'].append('littlefs')

bld.stlib(**kw)

_created_program_dirs = set()
Expand Down
3 changes: 3 additions & 0 deletions Tools/ardupilotwaf/boards.py
Original file line number Diff line number Diff line change
Expand Up @@ -826,6 +826,9 @@ def configure_env(self, cfg, env):
cfg.fatal("Failed to find SFML Audio libraries")
env.CXXFLAGS += ['-DWITH_SITL_TONEALARM']

if cfg.options.sitl_littlefs:
env.CXXFLAGS += ['-DHAL_OS_LITTLEFS_IO=1']

if cfg.env.DEST_OS == 'cygwin':
env.LIB += [
'winmm',
Expand Down
25 changes: 25 additions & 0 deletions Tools/ardupilotwaf/littlefs.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# encoding: utf-8

"""
Adds support for building littlefs as part of a Waf build
"""

from waflib.Configure import conf

def configure(cfg):
cfg.env.append_value('GIT_SUBMODULES', 'littlefs')
cfg.env.prepend_value('INCLUDES', [
cfg.srcnode.abspath() + '/modules/littlefs/',
])


@conf
def littlefs(bld, **kw):
kw.update(
name='littlefs',
source=['modules/littlefs/lfs.c', 'modules/littlefs/lfs_util.c', 'modules/littlefs/bd/lfs_filebd.c'],
target='littlefs',
defines=['LFS_NO_DEBUG'],
cflags=['-Wno-format', '-Wno-format-extra-args', '-Wno-shadow', '-Wno-unused-function', '-Wno-missing-declarations']
)
return bld.stlib(**kw)
3 changes: 3 additions & 0 deletions libraries/AP_Filesystem/AP_Filesystem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ static AP_Filesystem_FATFS fs_local;
#elif AP_FILESYSTEM_ESP32_ENABLED
#include "AP_Filesystem_ESP32.h"
static AP_Filesystem_ESP32 fs_local;
#elif AP_FILESYSTEM_LITTLEFS_ENABLED
#include "AP_Filesystem_FlashMemory_LittleFS.h"
static AP_Filesystem_FlashMemory_LittleFS fs_local;
#elif AP_FILESYSTEM_POSIX_ENABLED
#include "AP_Filesystem_posix.h"
static AP_Filesystem_Posix fs_local;
Expand Down
6 changes: 6 additions & 0 deletions libraries/AP_Filesystem/AP_Filesystem.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@
#if AP_FILESYSTEM_FATFS_ENABLED
#include "AP_Filesystem_FATFS.h"
#endif
#if AP_FILESYSTEM_LITTLEFS_ENABLED
#include "AP_Filesystem_FlashMemory_LittleFS.h"
#endif

struct dirent {
char d_name[MAX_NAME_LEN]; /* filename */
Expand All @@ -56,6 +59,9 @@ struct dirent {

#if CONFIG_HAL_BOARD == HAL_BOARD_LINUX || CONFIG_HAL_BOARD == HAL_BOARD_SITL || CONFIG_HAL_BOARD == HAL_BOARD_QURT
#include "AP_Filesystem_posix.h"
#if AP_FILESYSTEM_LITTLEFS_ENABLED
#include "AP_Filesystem_FlashMemory_LittleFS.h"
#endif
#endif

#if CONFIG_HAL_BOARD == HAL_BOARD_ESP32
Expand Down
Loading
Loading