buildzephyr-rtosusb-mass-storage

How to resolve build failure of Zephyr USB Mass Storage Sample


I have an nrd52840DK and I am trying to build and run the Zephyr USB Mass Storage sample and ultimately add USB Mass Storage to my application. The issue I am facing is that the build fails with the following error:

error: #error No supported disk driver enabled

Further examination of the build log shows the following:

CMake Warning at C:/ncs/v3.1.1/zephyr/CMakeLists.txt:1027 (message):
  No SOURCES given to Zephyr library: drivers__disk

  Excluding target from build.

The following are the contents of the 'prj.conf' file:

CONFIG_STDOUT_CONSOLE=y

#USB related configs
CONFIG_USB_DEVICE_STACK=y
CONFIG_USB_DEVICE_PRODUCT="Zephyr MSC sample"
CONFIG_USB_DEVICE_PID=0x0008
CONFIG_LOG=y
CONFIG_USB_DRIVER_LOG_LEVEL_ERR=y
CONFIG_USB_MASS_STORAGE=y
CONFIG_USB_DEVICE_LOG_LEVEL_ERR=y
CONFIG_USB_MASS_STORAGE_LOG_LEVEL_ERR=y
CONFIG_USB_DEVICE_INITIALIZE_AT_BOOT=n

CONFIG_MAIN_STACK_SIZE=1536

I have selected 'Use RAM disk and FAT file system' in Kconfig.

In the project folder I see a README.rst and it contains some settings for the various mass storage options, including the following for RAM disk with FAT file system:

.. zephyr-app-commands::
   :zephyr-app: samples/subsys/usb/mass
   :board: reel_board
   :gen-args: -DEXTRA_DTC_OVERLAY_FILE="ramdisk.overlay" -DCONFIG_APP_MSC_STORAGE_RAM=y
   :goals: build
   :compact:

I assume this should be placed into the 'sample.yaml' file, however I do not understand where to place it.

How/where do I place the above settings? Is this all I am missing?


Solution

  • I have fixed the build issues I was facing.

    Since I am using the Nordic NCS VSCode extension, I discovered that I was able to add the required overlay using the "Edit Configuration" feature of the extension. I was able to add ramdisk.overlay to the build.

    In addition, I had to enable the experimental USB stack option "CONFIG_USB_DEVICE_STACK_NEXT", this enabled the MSC class driver.

    Hopefully Nordic will update the version of Zephyr it distributes to include the release version of the USB Next Stack.