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 18 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
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 @@ -426,6 +426,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
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'],
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 @@ -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
Loading
Loading