USB Mass Storage sample not building with LittleFS on SDK 2.9 (nrf52840)

I'm trying to get the USB Mass Storage sample working on the nRF52840 using SDK 2.9. I followed the official guide here:
https://docs.nordicsemi.com/bundle/ncs-latest/page/zephyr/samples/subsys/usb/mass/README.html

My goal is to use LittleFS as the storage backend for the USB Mass Storage device. However, when I try to build the sample using the following command:

west build -b nrf52840dk/nrf52840 samples/subsys/usb/mass -- -DCONFIG_APP_MSC_STORAGE_FLASH_LITTLEFS=y

I get a build error. I also tried with SDK 2.7 just in case, but I ran into the same issue.


I came across a similar question on the forums:
https://devzone.nordicsemi.com/f/nordic-q-a/117539/fs_sample-doesn-t-work-in-my-nrf52840-dk
But in that case, the suggested workaround was to use RAM instead of flash for storage, which doesn't quite fit my use case.

Am I missing something in the configuration? Is LittleFS currently supported as a backend for the USB MSC sample on nRF52840?

Thanks in advance

Parents
  • The specific error is:

     
    C:/ncs/v2.9.0-nRF54H20-1-rc2/zephyr/drivers/disk/flashdisk.c:533:1: error: return type defaults to 'int' [-Werror=implicit-int]
    533 | PM_FOREACH_AFFILIATED_TO_disk(DEFINE_FLASHDISKS_CACHE)
    | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    C:/ncs/v2.9.0-nRF54H20-1-rc2/zephyr/drivers/disk/flashdisk.c: In function 'PM_FOREACH_AFFILIATED_TO_disk':
    C:/ncs/v2.9.0-nRF54H20-1-rc2/zephyr/drivers/disk/flashdisk.c:572:30: error: storage class specified for parameter 'flash_disks'
    572 | static struct flashdisk_data flash_disks[] = {
    | ^~~~~~~~~~~
    C:/ncs/v2.9.0-nRF54H20-1-rc2/zephyr/drivers/disk/flashdisk.c:572:15: error: parameter 'flash_disks' is initialized
    572 | static struct flashdisk_data flash_disks[] = {
    | ^~~~~~~~~~~~~~
    C:/ncs/v2.9.0-nRF54H20-1-rc2/zephyr/drivers/disk/flashdisk.c:573:39: error: 'DEFINE_FLASHDISKS_DEVICE' undeclared (first use in this function)
    573 | PM_FOREACH_AFFILIATED_TO_disk(DEFINE_FLASHDISKS_DEVICE)
    | ^~~~~~~~~~~~~~~~~~~~~~~~

    ....

Reply
  • The specific error is:

     
    C:/ncs/v2.9.0-nRF54H20-1-rc2/zephyr/drivers/disk/flashdisk.c:533:1: error: return type defaults to 'int' [-Werror=implicit-int]
    533 | PM_FOREACH_AFFILIATED_TO_disk(DEFINE_FLASHDISKS_CACHE)
    | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    C:/ncs/v2.9.0-nRF54H20-1-rc2/zephyr/drivers/disk/flashdisk.c: In function 'PM_FOREACH_AFFILIATED_TO_disk':
    C:/ncs/v2.9.0-nRF54H20-1-rc2/zephyr/drivers/disk/flashdisk.c:572:30: error: storage class specified for parameter 'flash_disks'
    572 | static struct flashdisk_data flash_disks[] = {
    | ^~~~~~~~~~~
    C:/ncs/v2.9.0-nRF54H20-1-rc2/zephyr/drivers/disk/flashdisk.c:572:15: error: parameter 'flash_disks' is initialized
    572 | static struct flashdisk_data flash_disks[] = {
    | ^~~~~~~~~~~~~~
    C:/ncs/v2.9.0-nRF54H20-1-rc2/zephyr/drivers/disk/flashdisk.c:573:39: error: 'DEFINE_FLASHDISKS_DEVICE' undeclared (first use in this function)
    573 | PM_FOREACH_AFFILIATED_TO_disk(DEFINE_FLASHDISKS_DEVICE)
    | ^~~~~~~~~~~~~~~~~~~~~~~~

    ....

Children
Related