This is an automated email from the ASF dual-hosted git repository.

xiaoxiang781216 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git

commit 844652a7a139d8c73ccf39db74f2227652bf2223
Author: Felipe Moura <[email protected]>
AuthorDate: Sun Jul 19 23:09:26 2026 -0300

    stm32f746g-disco: Add LittleFS support for N25Q QSPI flash
    
    Add a LittleFS mount option for the on-board N25Q QSPI flash,
    mirroring the existing NXFFS/LittleFS toggle already used by the
    sibling stm32_w25q.c driver. Needed because NXFFS does not support
    rename(), which the companion Dropbear config depends on.
    
    Signed-off-by: Felipe Moura <[email protected]>
---
 .../arm/stm32f7/stm32f746g-disco/src/stm32_n25q.c  | 29 +++++++++++++++++++++-
 1 file changed, 28 insertions(+), 1 deletion(-)

diff --git a/boards/arm/stm32f7/stm32f746g-disco/src/stm32_n25q.c 
b/boards/arm/stm32f7/stm32f746g-disco/src/stm32_n25q.c
index 3249fb4ac01..8b9fef97de2 100644
--- a/boards/arm/stm32f7/stm32f746g-disco/src/stm32_n25q.c
+++ b/boards/arm/stm32f7/stm32f746g-disco/src/stm32_n25q.c
@@ -56,7 +56,9 @@
 
 #include "stm32_qspi.h"
 
-#define HAVE_N25QXXX_NXFFS
+#if defined(CONFIG_FS_NXFFS) && !defined(CONFIG_FS_LITTLEFS)
+#  define HAVE_N25QXXX_NXFFS
+#endif
 
 /****************************************************************************
  * Public Functions
@@ -115,5 +117,30 @@ int stm32_n25qxxx_setup(void)
 
 #endif
 
+#if !defined(CONFIG_FS_NXFFS) && defined(CONFIG_FS_LITTLEFS)
+  /* Register the MTD driver so that it can be accessed from the
+   * VFS.
+   */
+
+  ret = register_mtddriver("/dev/n25q", mtd_dev, 0755, NULL);
+  if (ret < 0)
+    {
+      syslog(LOG_ERR, "ERROR: Failed to register MTD driver: %d\n",
+             ret);
+      return ret;
+    }
+
+  /* Mount the LittleFS file system */
+
+  ret = nx_mount("/dev/n25q", "/data", "littlefs", 0, "autoformat");
+  if (ret < 0)
+    {
+      syslog(LOG_ERR,
+             "ERROR: Failed to mount LittleFS at /data: %d\n",
+             ret);
+      return ret;
+    }
+#endif
+
   return 0;
 }

Reply via email to