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

Add Block Device Support #191

Draft
wants to merge 11 commits into
base: develop
Choose a base branch
from
2 changes: 2 additions & 0 deletions BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,8 @@ cc_binary(
"//errors",
"//lib/nlohmann_json:json",
"//picoboot_connection",
"//lib/littlefs",
"//lib/oofatfs:fatfs",
"@libusb",
"@pico-sdk//src/common/boot_picobin_headers",
"@pico-sdk//src/common/boot_picoboot_headers",
Expand Down
2 changes: 2 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,8 @@ else()
target_compile_definitions(picotool PRIVATE HAS_LIBUSB=1)
target_link_libraries(picotool
picoboot_connection_cxx
fatfs
littlefs
${LIBUSB_LIBRARIES})
endif()

Expand Down
3 changes: 3 additions & 0 deletions lib/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ endif()
set(JSON_BuildTests OFF CACHE INTERNAL "")
add_subdirectory(nlohmann_json EXCLUDE_FROM_ALL)

add_subdirectory(oofatfs EXCLUDE_FROM_ALL)
add_subdirectory(littlefs EXCLUDE_FROM_ALL)

add_subdirectory(whereami EXCLUDE_FROM_ALL)

if(EXISTS "${PICO_SDK_PATH}/lib/mbedtls/CMakeLists.txt")
Expand Down
14 changes: 14 additions & 0 deletions lib/littlefs/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package(default_visibility = ["//visibility:public"])

cc_library(
name = "littlefs",
srcs = [
"lfs.c",
"lfs_util.c",
],
hdrs = [
"lfs.h",
"lfs_util.h",
],
includes = ["."],
)
9 changes: 9 additions & 0 deletions lib/littlefs/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
add_library(littlefs INTERFACE)

target_sources(littlefs INTERFACE
${CMAKE_CURRENT_LIST_DIR}/lfs.c
${CMAKE_CURRENT_LIST_DIR}/lfs_util.c)

target_include_directories(littlefs INTERFACE ${CMAKE_CURRENT_LIST_DIR})

target_compile_definitions(littlefs INTERFACE LFS_NO_ERROR=1)
25 changes: 25 additions & 0 deletions lib/littlefs/LICENSE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
Copyright (c) 2022, The littlefs authors.
Copyright (c) 2017, Arm Limited. All rights reserved.

Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:

- Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
- Redistributions in binary form must reproduce the above copyright notice, this
list of conditions and the following disclaimer in the documentation and/or
other materials provided with the distribution.
- Neither the name of ARM nor the names of its contributors may be used to
endorse or promote products derived from this software without specific prior
written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
7 changes: 7 additions & 0 deletions lib/littlefs/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
littlefs library
================

The upstream source for the files in this directory is
https://github.com/littlefs-project/littlefs

The current files come from v2.8.2
Loading
Loading