From 94e55817d2e5ba1b5f2e7dc47b4bcbbf99fd0a03 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adam=20M=C3=BAdry?= Date: Tue, 5 Nov 2024 17:57:15 +0100 Subject: [PATCH] fix(littlefs): Allow LittleFS image generation on Windows + version bump Closes https://github.com/espressif/esp-idf/issues/12900 --- examples/storage/littlefs/main/CMakeLists.txt | 6 +----- examples/storage/littlefs/main/esp_littlefs_example.c | 8 ++++---- examples/storage/littlefs/main/idf_component.yml | 2 +- examples/storage/perf_benchmark/main/idf_component.yml | 2 +- 4 files changed, 7 insertions(+), 11 deletions(-) diff --git a/examples/storage/littlefs/main/CMakeLists.txt b/examples/storage/littlefs/main/CMakeLists.txt index 83567668b9ec..14c7cab10118 100644 --- a/examples/storage/littlefs/main/CMakeLists.txt +++ b/examples/storage/littlefs/main/CMakeLists.txt @@ -4,8 +4,4 @@ idf_component_register(SRCS "esp_littlefs_example.c" # Note: you must have a partition named the first argument (here it's "littlefs") # in your partition table csv file. -if(NOT CMAKE_HOST_SYSTEM_NAME STREQUAL "Windows") - littlefs_create_partition_image(storage ../flash_data FLASH_IN_PROJECT) -else() - fail_at_build_time(littlefs "Windows does not support LittleFS partition generation") -endif() +littlefs_create_partition_image(storage ../flash_data FLASH_IN_PROJECT) diff --git a/examples/storage/littlefs/main/esp_littlefs_example.c b/examples/storage/littlefs/main/esp_littlefs_example.c index 53ee5f58e751..eb4b23e65f39 100644 --- a/examples/storage/littlefs/main/esp_littlefs_example.c +++ b/examples/storage/littlefs/main/esp_littlefs_example.c @@ -1,6 +1,6 @@ /* * SPDX-FileCopyrightText: 2023 Brian Pugh - * SPDX-FileCopyrightText: 2023 Espressif Systems (Shanghai) CO LTD + * SPDX-FileCopyrightText: 2023-2024 Espressif Systems (Shanghai) CO LTD * * SPDX-License-Identifier: Unlicense OR CC0-1.0 */ @@ -85,11 +85,11 @@ void app_main(void) return; } - char line[128]; + char line[128] = {0}; fgets(line, sizeof(line), f); fclose(f); // strip newline - char*pos = strchr(line, '\n'); + char* pos = strpbrk(line, "\r\n"); if (pos) { *pos = '\0'; } @@ -104,7 +104,7 @@ void app_main(void) fgets(line, sizeof(line), f); fclose(f); // strip newline - pos = strchr(line, '\n'); + pos = strpbrk(line, "\r\n"); if (pos) { *pos = '\0'; } diff --git a/examples/storage/littlefs/main/idf_component.yml b/examples/storage/littlefs/main/idf_component.yml index 0056553732a3..e4d970c702b0 100644 --- a/examples/storage/littlefs/main/idf_component.yml +++ b/examples/storage/littlefs/main/idf_component.yml @@ -1,3 +1,3 @@ ## IDF Component Manager Manifest File dependencies: - joltwallet/littlefs: "~=1.14.4" + joltwallet/littlefs: "~=1.14.8" diff --git a/examples/storage/perf_benchmark/main/idf_component.yml b/examples/storage/perf_benchmark/main/idf_component.yml index c5c86b6035c7..e4d970c702b0 100644 --- a/examples/storage/perf_benchmark/main/idf_component.yml +++ b/examples/storage/perf_benchmark/main/idf_component.yml @@ -1,3 +1,3 @@ ## IDF Component Manager Manifest File dependencies: - joltwallet/littlefs: "^1.14.1" + joltwallet/littlefs: "~=1.14.8"