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 48 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
48 commits
Select commit Hold shift + click to select a range
e0b32c0
AP_HAL_ChibiOS: add support for littlefs
andyp1per Jun 12, 2023
0cbef44
AP_HAL_ChibiOS: don't backup storage with littlefs
andyp1per Nov 29, 2024
64e3274
AP_HAL: add littlefs build option
andyp1per Jun 12, 2023
c4efc19
modules: add littlefs v2.9.3
andyp1per Jun 12, 2023
08839af
waf: build in littlefs support
andyp1per Jun 12, 2023
8f32f4d
wscript: build in littlefs
andyp1per Jun 12, 2023
8cabaaa
Replay: account for littlefs when building
andyp1per Jun 12, 2023
7f38c32
AP_Bootloader: correct use usage
andyp1per Nov 25, 2024
69bb09c
AP_Periph: correct use usage
andyp1per Nov 25, 2024
38584b4
AP_Logger: sync littlefs writes on block boundaries
andyp1per Nov 29, 2024
38f888c
AP_HAL_ChibiOS: littlefs for MambaH743v4
andyp1per Jul 26, 2023
1546113
AP_HAL_ChibiOS: littlefs for MatekH7A3
andyp1per Nov 29, 2024
a351b26
AP_HAL_ChibiOS: use littlefs on KakuteH7Mini-Nand
andyp1per Nov 30, 2024
21fce94
AP_Scripting: allow scripting on 2Mb boards with littlefs
andyp1per Nov 30, 2024
99118a7
AP_Filesystem: add littlefs based filesystem support
andyp1per Jun 12, 2023
461ee8b
AP_Filesystem: reduce metadata_max on W25N flash
andyp1per Dec 7, 2024
01bab5d
AP_Logger: add flash speed test
andyp1per Dec 7, 2024
798e367
AP_Logger: add performance debug to W25NXX logger
andyp1per Dec 7, 2024
28a8058
AP_Filesystem: add littlefs singleton for sync block use
andyp1per Dec 11, 2024
6cd776c
AP_Logger: user sync_block from littlefs to decide when to sync when …
andyp1per Dec 11, 2024
f9f6da9
AP_HAL_ChibiOS: terrain turned on on 2Mb boards with littlefs
andyp1per Dec 11, 2024
fb57b4a
AP_HAL_ChibiOS: turn off storage backup on anything other than FATFS
andyp1per Dec 11, 2024
2925b72
AP_HAL_ChibiOS: littlefs support for Aocoda-RC-H743Dual
andyp1per Dec 11, 2024
bd646d8
AP_HAL_ChibiOS: littlefs support for JHEMCU-H743HD
andyp1per Dec 11, 2024
b922b47
AP_HAL_ChibiOS: littlefs support for KakuteH7v2
andyp1per Dec 12, 2024
62f6811
modules: update littlefs build to v2.9.3-ardupilot
andyp1per Dec 12, 2024
256dad3
AP_Filesystem: provide SITL implementation for littlefs
andyp1per Dec 12, 2024
8dd52d7
AP_Logger: support SITL implementation of littlefs
andyp1per Dec 12, 2024
a266e7f
waf: build littlefs filebd
andyp1per Dec 12, 2024
2dcb5bb
AP_Logger: nuance minspace for W25NXX and W25QXX
andyp1per Dec 13, 2024
5473016
waf: optionally add littlefs to sitl build options
andyp1per Dec 13, 2024
71e9e18
wscript: add littlefs build option for sitl
andyp1per Dec 13, 2024
af135a0
modules: update littlefs to version that skips validation
andyp1per Dec 18, 2024
5f810ad
AP_Filesystem: support mutiple reads/writes in littlefs
andyp1per Dec 18, 2024
6b31187
AP_Logger: avoid disk_free() checks on littlefs
andyp1per Dec 18, 2024
3f45c3a
AP_HAL: provide console logger that can be called from C.
andyp1per Dec 18, 2024
d1f9c69
AP_Filesystem: allow for logical blocks bigger than physical blocks i…
andyp1per Dec 20, 2024
7a20a86
AP_Filesystem: optimize configured defaults on littlefs and address r…
andyp1per Dec 31, 2024
a2e456d
AP_HAL_ChibiOS: introduce new DATAFLASH directive and use it
andyp1per Dec 31, 2024
52b8d16
AP_HAL: tidy meanings of FATFS, POSIX_IO and friends
andyp1per Dec 31, 2024
aa291a8
wscript: address review comments
andyp1per Dec 31, 2024
2ca59ad
AP_HAL_ChibiOS: add HAL_OS_POSIX_IO to defaults
andyp1per Jan 1, 2025
a1d172f
AP_Scripting: scripting directory configuration for posix IO
andyp1per Jan 2, 2025
0b47084
AP_HAL_ChibiOS: ensure explicitly configured DATAFLASH is prioritized
andyp1per Jan 2, 2025
549dc53
AP_Filesystem: add comment about littlefs inlining
andyp1per Jan 2, 2025
0f74e13
AP_Filesystem: support lseek() in littlefs in a way that enables terr…
andyp1per Jan 2, 2025
589ac73
modules: update littlefs to 2.10.1
andyp1per Jan 4, 2025
cf761f7
AP_Scripting: ensure SITL uses ./scripts
andyp1per Jan 5, 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