Skip to content

Commit 2b0faf0

Browse files
authored
Merge pull request #250 from joltwallet/v6-support
Add v6 support.
2 parents 8274371 + 7363799 commit 2b0faf0

11 files changed

Lines changed: 126 additions & 21 deletions

File tree

.github/workflows/pr.yml

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
strategy:
1717
fail-fast: false
1818
matrix:
19-
idf_ver: ["release-v5.0", "release-v5.1", "release-v5.2", "release-v5.3", "release-v5.4"] # re-add "latest" once we support v6.0
19+
idf_ver: ["release-v5.0", "release-v5.1", "release-v5.2", "release-v5.3", "release-v5.4", "release-v6.0", "latest"]
2020
idf_target: ["esp32"]
2121
include:
2222
- idf_ver: "release-v5.2"
@@ -25,6 +25,10 @@ jobs:
2525
idf_target: esp32c3
2626
- idf_ver: "release-v5.2"
2727
idf_target: esp32s3
28+
- idf_ver: "latest"
29+
idf_target: esp32c6
30+
- idf_ver: "latest"
31+
idf_target: esp32p4
2832
runs-on: ubuntu-latest
2933
steps:
3034
- uses: actions/checkout@v4
@@ -48,8 +52,20 @@ jobs:
4852
path: "example/"
4953
command: apt-get update && apt-get install -y python3-venv && idf.py --version && idf.py build
5054

51-
- name: esp-idf build tests
55+
# ESP-IDF v5.x: Use legacy unit-test-app
56+
- name: esp-idf build tests (v5.x)
57+
if: ${{ !contains(matrix.idf_ver, 'v6.') && matrix.idf_ver != 'latest' }}
5258
uses: espressif/esp-idf-ci-action@main
5359
with:
5460
esp_idf_version: ${{ matrix.idf_ver }}
5561
command: '/bin/bash -c " ln -s /app /opt/esp/idf/tools/unit-test-app/components/littlefs; cd /opt/esp/idf/tools/unit-test-app; idf.py -T littlefs build"'
62+
63+
# ESP-IDF v6.0+: Use new test_apps structure
64+
- name: esp-idf build tests (v6.0+)
65+
if: ${{ contains(matrix.idf_ver, 'v6.') || matrix.idf_ver == 'latest' }}
66+
uses: espressif/esp-idf-ci-action@main
67+
with:
68+
esp_idf_version: ${{ matrix.idf_ver }}
69+
target: ${{ matrix.idf_target }}
70+
path: "test_apps/"
71+
command: idf.py build

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,10 @@ example/sdkconfig
77
example/sdkconfig.old
88
example/dependencies.lock
99

10+
test_apps/build/
11+
test_apps/sdkconfig
12+
test_apps/sdkconfig.old
13+
test_apps/dependencies.lock
14+
1015
*.DS_Store
1116
*/.cache

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
cmake_minimum_required(VERSION 3.10)
1+
cmake_minimum_required(VERSION 3.16)
22

33
file(GLOB SOURCES src/littlefs/*.c)
44
list(APPEND SOURCES src/esp_littlefs.c src/littlefs_esp_part.c src/lfs_config.c)

README.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -226,6 +226,8 @@ LittleFS (cache=4096): 27,709 us
226226

227227
# Running Unit Tests
228228

229+
## ESP-IDF v5.x
230+
229231
To flash the unit-tester app and the unit-tests, clone or symbolicly link this
230232
component to `$IDF_PATH/tools/unit-test-app/components/littlefs`. Make sure the
231233
folder name is `littlefs`, not `esp_littlefs`. Then, run the following:
@@ -257,6 +259,19 @@ The unit tester can then be flashed via the command:
257259
idf.py -T littlefs -p YOUR_PORT_HERE encrypted-flash monitor
258260
```
259261

262+
## ESP-IDF v6.0+
263+
264+
ESP-IDF v6.0 removed the legacy `unit-test-app`. Instead, use the standalone test app in `test_apps/`:
265+
266+
```
267+
cd test_apps
268+
idf.py set-target esp32 # Or your target
269+
idf.py build
270+
idf.py -p YOUR_PORT_HERE flash monitor
271+
```
272+
273+
Once running, press Enter to see the test menu. You can run all tests by typing `*` or run specific tests by name or number.
274+
260275
# Breaking Changes
261276

262277
* July 22, 2020 - Changed attribute type for file timestamp from `0` to `0x74` ('t' ascii value).

src/esp_littlefs.c

Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
#include "freertos/semphr.h"
1818
#include "freertos/task.h"
1919
#include "littlefs_api.h"
20+
#include <dirent.h>
2021
#include <sys/dirent.h>
2122
#include <sys/errno.h>
2223
#include <sys/fcntl.h>
@@ -36,24 +37,7 @@
3637
#endif
3738

3839
#include "spi_flash_mmap.h"
39-
40-
#if CONFIG_IDF_TARGET_ESP32
41-
#include "esp32/rom/spi_flash.h"
42-
#elif CONFIG_IDF_TARGET_ESP32S2
43-
#include "esp32s2/rom/spi_flash.h"
44-
#elif CONFIG_IDF_TARGET_ESP32S3
45-
#include "esp32s3/rom/spi_flash.h"
46-
#elif CONFIG_IDF_TARGET_ESP32C3
47-
#include "esp32c3/rom/spi_flash.h"
48-
#elif CONFIG_IDF_TARGET_ESP32H2
49-
#include "esp32h2/rom/spi_flash.h"
50-
#elif CONFIG_IDF_TARGET_ESP8684
51-
#include "esp8684/rom/spi_flash.h"
52-
#elif __has_include("esp32/rom/spi_flash.h")
53-
#include "esp32/rom/spi_flash.h" //IDF 4
54-
#else
55-
#include "rom/spi_flash.h" //IDF 3
56-
#endif
40+
#include "esp_rom_spiflash.h"
5741

5842
#define CONFIG_LITTLEFS_BLOCK_SIZE 4096 /* ESP32 can only operate at 4kb */
5943

test_apps/CMakeLists.txt

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# This is the project CMakeLists.txt file for the test subproject
2+
cmake_minimum_required(VERSION 3.16)
3+
4+
set(COMPONENTS main)
5+
6+
# Include test_utils from ESP-IDF tools
7+
list(APPEND EXTRA_COMPONENT_DIRS "$ENV{IDF_PATH}/tools/test_apps/components")
8+
9+
include($ENV{IDF_PATH}/tools/cmake/project.cmake)
10+
project(test_littlefs)

test_apps/main/CMakeLists.txt

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
set(TEST_DIR "${CMAKE_CURRENT_LIST_DIR}/../../test")
2+
3+
idf_component_register(
4+
SRCS
5+
"test_main.c"
6+
"${TEST_DIR}/test_littlefs.c"
7+
"${TEST_DIR}/test_littlefs_common.c"
8+
"${TEST_DIR}/test_dir.c"
9+
"${TEST_DIR}/test_benchmark.c"
10+
"${TEST_DIR}/test_littlefs_static_partition.c"
11+
INCLUDE_DIRS "${TEST_DIR}"
12+
PRIV_REQUIRES
13+
esp_littlefs
14+
unity
15+
test_utils
16+
vfs
17+
spi_flash
18+
spiffs
19+
fatfs
20+
wear_levelling
21+
esp_timer
22+
esp_partition
23+
WHOLE_ARCHIVE
24+
)
25+
26+
# Embed the test filesystem binary
27+
target_add_binary_data(${COMPONENT_LIB} "${TEST_DIR}/testfs.bin" BINARY)

test_apps/main/idf_component.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
dependencies:
2+
idf: ">=5.0"
3+
esp_littlefs:
4+
path: "../../"

test_apps/main/test_main.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
/*
2+
* Entry point for the littlefs test application (ESP-IDF v6.0+)
3+
*/
4+
5+
#include "unity.h"
6+
7+
void app_main(void)
8+
{
9+
printf("Running littlefs tests\n");
10+
unity_run_menu();
11+
}

test_apps/partitions.csv

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# Partition table for littlefs unit tests
2+
# Name, Type, SubType, Offset, Size, Flags
3+
nvs, data, nvs, 0x9000, 0x4000
4+
phy_init, data, phy, 0xd000, 0x1000
5+
factory, app, factory, 0x10000, 1M
6+
# Partitions for filesystem tests and benchmarks
7+
fat_store, data, fat, , 528K
8+
spiffs_store, data, spiffs, , 512K
9+
flash_test, data, spiffs, , 512K
10+
named_part, data, 0x83, , 64K

0 commit comments

Comments
 (0)