Hi Saurav, I suggest you to verifyr these errors first:
*Command: 1293 | BIOC_FLUSH: 1293* Error Upper! ioctl | -25 #define ENOTTY 25 /* Not a typewriter */ So, you can search where this ENOTTY is returned. Some to: nx_mount: ERROR: Bind method failed: -28 nsh: mount: mount failed: 28 #define ENOSPC 28 /* No space left on device */ BR, Alan On Sat, Feb 24, 2024 at 9:28 AM Saurav Pal <resyfer....@gmail.com> wrote: > Hi all, > > I've been trying to develop a device simulator for the NAND flash (in the > sim). > > A short note on what this does is create a virtual NAND flash (from RAM) > and provide a driver, as well as a wrapper around the upper half (which for > now, does nothing extra). This helps in creating records of > reads/writes/erases (in a separate file) for testing and statistics > purposes. > > Since littlefs is one of the supported filesystems on MTD devices, I tried > to use it to test mount but it tries to use an ioctl with BIOC_FLUSH in the > format process, which is not supported as far as code in > drivers/mtd/mtd_nand.c go. > > *Should that be something that the NAND driver should support?* > > Here are the logs of that process, the first ioctl is for MTDIOC_GEOMETRY > (which is supported), and second for BIOC_FLUSH (in *bold*): > > nuttx ➤ make && ./nuttx > LD: nuttx > login: admin > password: > User Logged-in! > nsh> ls /dev > /dev: > console > gpio0 > gpio1 > gpio2 > gpio3 > loop > null > oneshot > ram0 > ram1 > ram2 > zero > nsh> mtddev > Size: 2097152 B > > Pages: 4096 > Blocks: 33 > Writing...Done > Driver running > nsh> ls /dev > /dev: > console > gpio0 > gpio1 > gpio2 > gpio3 > loop > mtd > null > oneshot > ram0 > ram1 > ram2 > zero > nsh> mount -t littlefs -o forceformat /dev/mtd /hi > Upper! ioctl > Command: 1537 | BIOC_FLUSH: 1293 > Upper! bread > Page 128 > Lower! rawread : Page 128 > Lower! rawread : Page 129 > Lower! rawread : Page 130 > Lower! rawread : Page 131 > Upper! erase > Lower! eraseblock : Block 0 > Upper! bread > Page 0 > Lower! rawread : Page 0 > Lower! rawread : Page 1 > Lower! rawread : Page 2 > Lower! rawread : Page 3 > Upper! bread > Page 4 > Lower! rawread : Page 4 > Lower! rawread : Page 5 > Lower! rawread : Page 6 > Lower! rawread : Page 7 > Upper! bwrite > Lower! rawwrite : Page 0 > Lower! rawwrite : Page 1 > Lower! rawwrite : Page 2 > Lower! rawwrite : Page 3 > Upper! ioctl > *Command: 1293 | BIOC_FLUSH: 1293* > Error Upper! ioctl | -25 > Upper! bread > Page 0 > Lower! rawread : Page 0 > Lower! rawread : Page 1 > Lower! rawread : Page 2 > Lower! rawread : Page 3 > nx_mount: ERROR: Bind method failed: -28 > nsh: mount: mount failed: 28 > nsh> > > The logs with "Upper!" refer to the upper half of the driver being > executed, and same for the lower, and the pages are numbered from the start > of the device (ie. (block << LOG_N_BLOCKS_PER_PAGE) + page_in_block)). > > Regards, > SP >