From 908bac55f352f89b80fc94f5cd85d983dcb03aa0 Mon Sep 17 00:00:00 2001 From: Tiago Medicci Serrano Date: Tue, 12 Dec 2023 09:56:28 -0300 Subject: [PATCH] esp32<|s2|s3>_board_spiflash: Fix error message about SmartFS init The SmartFS partition needs to be formatted before being mounted. Otherwise, it would throw an error message. The error message now contains a suggestion to format the partition when such an error is detected. --- boards/xtensa/esp32/common/src/esp32_board_spiflash.c | 6 ++++++ boards/xtensa/esp32s2/common/src/esp32s2_board_spiflash.c | 6 ++++++ boards/xtensa/esp32s3/common/src/esp32s3_board_spiflash.c | 6 ++++++ 3 files changed, 18 insertions(+) diff --git a/boards/xtensa/esp32/common/src/esp32_board_spiflash.c b/boards/xtensa/esp32/common/src/esp32_board_spiflash.c index 026733b4449..67c82595be1 100644 --- a/boards/xtensa/esp32/common/src/esp32_board_spiflash.c +++ b/boards/xtensa/esp32/common/src/esp32_board_spiflash.c @@ -204,6 +204,12 @@ static int setup_smartfs(int smartn, struct mtd_dev_s *mtd, if (ret < 0) { ferr("ERROR: Failed to mount the FS volume: %d\n", ret); + if (ret == -ENODEV) + { + fwarn("Smartfs seems unformatted. " + "Did you run 'mksmartfs /dev/smart%d'?\n", smartn); + } + return ret; } } diff --git a/boards/xtensa/esp32s2/common/src/esp32s2_board_spiflash.c b/boards/xtensa/esp32s2/common/src/esp32s2_board_spiflash.c index 64131350fb1..e3dc6f172ee 100644 --- a/boards/xtensa/esp32s2/common/src/esp32s2_board_spiflash.c +++ b/boards/xtensa/esp32s2/common/src/esp32s2_board_spiflash.c @@ -115,6 +115,12 @@ static int setup_smartfs(int smartn, struct mtd_dev_s *mtd, if (ret < 0) { ferr("ERROR: Failed to mount the FS volume: %d\n", ret); + if (ret == -ENODEV) + { + fwarn("Smartfs seems unformatted. " + "Did you run 'mksmartfs /dev/smart%d'?\n", smartn); + } + return ret; } } diff --git a/boards/xtensa/esp32s3/common/src/esp32s3_board_spiflash.c b/boards/xtensa/esp32s3/common/src/esp32s3_board_spiflash.c index 56340aadc05..5a024c87b17 100644 --- a/boards/xtensa/esp32s3/common/src/esp32s3_board_spiflash.c +++ b/boards/xtensa/esp32s3/common/src/esp32s3_board_spiflash.c @@ -106,6 +106,12 @@ static int setup_smartfs(int smartn, struct mtd_dev_s *mtd, if (ret < 0) { ferr("ERROR: Failed to mount the FS volume: %d\n", ret); + if (ret == -ENODEV) + { + fwarn("Smartfs seems unformatted. " + "Did you run 'mksmartfs /dev/smart%d'?\n", smartn); + } + return ret; } }