Do we have any example for use flash as usb mass storage on Zephyr?

Hi there,

SO , In Zephyr Kconfig, dependencies override your direct config choice.
So even if you manually write CONFIG_DISK_DRIVER_FLASH=y, it gets turned off (n) if its dependency like DT_HAS_ZEPHYR_FLASH_DISK_ENABLED is n.

This is why he sees the warning — not an error, but a heads-up that the config request was ignored.

The unmet dependency is:

DT_HAS_ZEPHYR_FLASH_DISK_ENABLED (=n)

This means that the device tree does not define a “flash-disk” node (usually under /flash, or some partition label).

What’s Missing / Likely Cause:

  • The user did not enable or define a proper flash partition (storage node) in their Device Tree overlay (DTS).
  • They may also have missed enabling:
CONFIG_FLASH=y
CONFIG_FLASH_MAP=y
CONFIG_FLASH_PAGE_LAYOUT=y
  • Without the correct partition label (like "storage") or disk definition, Zephyr’s auto-detection fails to turn on DT_HAS_ZEPHYR_FLASH_DISK_ENABLED.

Example of a Correct Setup:

Device Tree fragment (often in boards/*.overlay):

/ {
    storage_partition: partition@00030000 {
        label = "storage";
        reg = <0x00030000 0x00010000>;  // Start address and size
    };
};

and the supporting prj…

prj.conf example:

CONFIG_FLASH=y
CONFIG_FLASH_MAP=y
CONFIG_FLASH_PAGE_LAYOUT=y
CONFIG_DISK_DRIVER_FLASH=y
CONFIG_FILE_SYSTEM=y
CONFIG_FAT_FILESYSTEM_ELM=y

bottom line… You need to make sure your Device Tree defines a flash partition (label “storage”) and enable the following configs:

CONFIG_FLASH=y
CONFIG_FLASH_MAP=y
CONFIG_FLASH_PAGE_LAYOUT=y
CONFIG_DISK_DRIVER_FLASH=y

Use menuconfig or guiconfig to confirm these.
Also make sure your DTS overlay includes a properly defined storage partition.

HTH
GL :slight_smile: PJ :v:

Listen to your compiler…LOL :+1: