apache / nuttx

Apache NuttX is a mature, real-time embedded operating system (RTOS)
https://nuttx.apache.org/
Apache License 2.0
2.91k stars 1.18k forks source link

[BUG] Several file utilities only occasually work #13857

Open UAV-Pilot opened 1 month ago

UAV-Pilot commented 1 month ago

Description / Steps to reproduce the issue

On Pi Pico W board with Pi Pico SDK 2.0, setup a system with working flash SmartFS file system and USB console, e.g., ./tools/configure.sh -l raspberrypi-pico-w:nsh-flash reference raspberrypi-pico-w:usbnsh base configuration to add USB console or execute the following script:

#!/bin/bash

#kconfig-tweak --set-val CONFIG_BASE_DEFCONFIG "raspberrypi-pico-w:telnet-dirty"
kconfig-tweak --disable CONFIG_DEBUG_USB
kconfig-tweak --enable CONFIG_BOARDCTL_USBDEVCTRL
kconfig-tweak --disable CONFIG_DEV_CONSOLE
kconfig-tweak --enable CONFIG_SERIAL_REMOVABLE
kconfig-tweak --enable CONFIG_SERIAL_TXDMA
kconfig-tweak --enable CONFIG_SERIAL_RXDMA
kconfig-tweak --disable CONFIG_UART0_SERIAL_CONSOLE
kconfig-tweak --enable CONFIG_NO_SERIAL_CONSOLE
kconfig-tweak --enable CONFIG_USBDEV

# USB Device Controller Driver Options
kconfig-tweak --set-val CONFIG_USBDEV_EPBUFFER_ALIGNMENT 0
kconfig-tweak --enable CONFIG_USBDEV_SELFPOWERED
kconfig-tweak --set-val CONFIG_USBDEV_MAXPOWER 100
kconfig-tweak --set-val CONFIG_USBDEV_TRACE_INITIALIDSET 0

# USB Device Class Driver Options
kconfig-tweak --enable CONFIG_CDCACM
kconfig-tweak --enable CONFIG_CDCACM_CONSOLE
kconfig-tweak --enable CONFIG_CDCACM_HAVE_EPINTIN
kconfig-tweak --set-val CONFIG_CDCACM_EP0MAXPACKET 64
kconfig-tweak --set-val CONFIG_CDCACM_EPINTIN 1
kconfig-tweak --set-val CONFIG_CDCACM_EPINTIN_FSSIZE 64
kconfig-tweak --set-val CONFIG_CDCACM_EPBULKOUT 3
kconfig-tweak --set-val CONFIG_CDCACM_EPBULKOUT_FSSIZE 64
kconfig-tweak --set-val CONFIG_CDCACM_EPBULKIN 2
kconfig-tweak --set-val CONFIG_CDCACM_EPBULKIN_FSSIZE 64
kconfig-tweak --set-val CONFIG_CDCACM_NRDREQS 4
kconfig-tweak --set-val CONFIG_CDCACM_NWRREQS 4
kconfig-tweak --set-val CONFIG_CDCACM_BULKOUT_REQLEN 256
kconfig-tweak --set-val CONFIG_CDCACM_BULKIN_REQLEN 96
kconfig-tweak --set-val CONFIG_CDCACM_RXBUFSIZE 257
kconfig-tweak --set-val CONFIG_CDCACM_TXBUFSIZE 193
kconfig-tweak --set-val CONFIG_CDCACM_VENDORID 0x0525
kconfig-tweak --set-val CONFIG_CDCACM_PRODUCTID 0xa4a7
kconfig-tweak --set-val CONFIG_CDCACM_VENDORSTR "NuttX"
kconfig-tweak --set-val CONFIG_CDCACM_PRODUCTSTR "CDC/ACM Serial"

kconfig-tweak --enable CONFIG_NSH_USBCONSOLE
kconfig-tweak --set-val CONFIG_NSH_USBCONDEV "/dev/ttyACM0"
kconfig-tweak --set-val CONFIG_USBDEV_MINOR 0
kconfig-tweak --disable CONFIG_NSH_USBDEV_TRACE
kconfig-tweak --disable CONFIG_SYSTEM_CDCACM

The problem happens with df, free and also with ifconfig. The following is an example for df.

nsh> cd /flash
nsh> ls -l
/flash:
 -rwsrwsrwx          14 test
nsh> df .
  Block    Number
  Size     Blocks       Used   Available Moun         0          0           0 /proc

nsh> df .
  Block    Number
  Size     Blocks       Used   Available Moun         0          0           0 /proc

nsh> df .
  Block    Number
  Size     Blocks       Used   Available Mounnsh>
nsh> df .
  Block    Number
  Size     Blocks       Used   Available Mounnsh>
nsh> df .
  Block    Number
  Size     Blocks       Used   Available Mounted on
  1024       1468         12        1456 /flash
     0 nsh>
nsh> df .
  Block    Number
  Size     Blocks       Used   Available Mounnsh>
nsh> df .
  Block    Number
  Size     Blocks       Used   Available Mounnsh>
nsh> df .
  Block    Number
  Size     Blocks       Used   Available Moun         0          0           0 /proc

nsh> df .
  Block    Number
  Size     Blocks       Used   Available Mounnsh>
nsh> df .
  Block    Number
  Size     Blocks       Used   Available Mounnsh>
nsh> df .
  Block    Number
  Size     Blocks       Used   Available Mounted on
  1024       1468         12        1456 /flash
     0 nsh>
nsh> df .
  Block    Number
  Size     Blocks       Used   Available Mounted on
  1024       1468         12        1456 /flash
     0          0          0           0 /proc

nsh> df .
  Block    Number
  Size     Blocks       Used   Available Moun         0          0           0 /proc

nsh> df .
  Block    Number
  Size     Blocks       Used   Available Mounted on
  1024       1468         12        1456 /flash
     0 nsh>
nsh> df .
  Block    Number
  Size     Blocks       Used   Available Mounted on
  1024       1468         12        1456 /flash
     0 nsh>
nsh> df .
  Block    Number
  Size     Blocks       Used   Available Mounnsh>
nsh> df .
  Block    Number
  Size     Blocks       Used   Available Mounnsh>

On which OS does this issue occur?

[OS: Linux]

What is the version of your OS?

Windows 11 WSL2 Ubuntu 22.04.2

NuttX Version

NuttX 12.7.0-RC0 0976258-dirty Oct 4 2024 22:58:36 arm rasp

Issue Architecture

[Arch: arm]

Issue Area

[Area: File System]

Verification

xiaoxiang781216 commented 1 month ago

could you switch to littlefs and compare the result?

UAV-Pilot commented 1 month ago

Created a related bug: https://github.com/apache/nuttx/issues/13882 (Flash file system creation process does not take configured parameters on Pi Pico https://github.com/apache/nuttx/issues/13882), don't know how to create a working littlefs. Note that in menuconfig, selecting RP2040_FLASH_FILE_SYSTEM (Configure a read/write filesystem on unused flash memory) will automatically select SmartFS.