USB mass storage for the NRF7002DK development board using on board chip

Hello everyone,

As the title suggests, we're trying to get the on board flash (mx25r64 as far as I can tell) of the nrf7002dk devboard working as a USB mass storage device (should be visible when connecting to Windows and MacOS).

Doing a bit of googling, I've found that a good starting point is the sample from:

/opt/nordic/ncs/v3.0.0/zephyr/samples/subsys/usb/mass/

I started from there and tried various bits and pieces from different posts in the Nordic DevZone to try and get it working. Sadly it doesn't wanna yield and the most common error is either the partition manager not recognising the label put in the overlay or something else related to the partition manager not accepting/ initialising the disk.

Latest build log:

root@Tudors-MacBook mass # west build -b nrf7002dk/nrf5340/cpuapp/ns --pristine
-- west build: making build dir /opt/nordic/ncs/v3.0.0/zephyr/samples/subsys/usb/mass/build pristine
-- west build: generating a build system
Loading Zephyr module(s) (Zephyr base): sysbuild_default
-- Found Python3: /opt/homebrew/opt/[email protected]/bin/python3.13 (found suitable version "3.13.3", minimum required is "3.10") found components: Interpreter
-- Cache files will be written to: /Users/tudor/Library/Caches/zephyr
-- Found west (found suitable version "1.3.0", minimum required is "0.14.0")
-- Board: nrf7002dk, qualifiers: nrf5340/cpuapp/ns
Parsing /opt/nordic/ncs/v3.0.0/zephyr/share/sysbuild/Kconfig
Loaded configuration '/opt/nordic/ncs/v3.0.0/zephyr/samples/subsys/usb/mass/build/_sysbuild/empty.conf'
Merged configuration '/opt/nordic/ncs/v3.0.0/zephyr/samples/subsys/usb/mass/sysbuild.conf'
Configuration saved to '/opt/nordic/ncs/v3.0.0/zephyr/samples/subsys/usb/mass/build/zephyr/.config'
Kconfig header saved to '/opt/nordic/ncs/v3.0.0/zephyr/samples/subsys/usb/mass/build/_sysbuild/autoconf.h'
--
   **************************
   * Running CMake for mass *
   **************************

Loading Zephyr default modules (Zephyr base).
-- Application: /opt/nordic/ncs/v3.0.0/zephyr/samples/subsys/usb/mass
-- CMake version: 4.0.2
-- Found Python3: /opt/homebrew/bin/python3 (found suitable version "3.13.3", minimum required is "3.10") found components: Interpreter
-- Cache files will be written to: /Users/tudor/Library/Caches/zephyr
-- Zephyr version: 4.0.99 (/opt/nordic/ncs/v3.0.0/zephyr)
-- Found west (found suitable version "1.3.0", minimum required is "0.14.0")
-- Board: nrf7002dk, qualifiers: nrf5340/cpuapp/ns
-- ZEPHYR_TOOLCHAIN_VARIANT not set, trying to locate Zephyr SDK
-- Found host-tools: zephyr 0.17.0 (/Users/tudor/zephyr-sdk-0.17.0)
-- Found toolchain: zephyr 0.17.0 (/Users/tudor/zephyr-sdk-0.17.0)
-- Could NOT find Dtc (missing: DTC) (Required is at least version "1.4.6")
Hint: The project() command has not yet been called.  It sets up system-specific search paths.
-- Found BOARD.dts: /opt/nordic/ncs/v3.0.0/zephyr/boards/nordic/nrf7002dk/nrf7002dk_nrf5340_cpuapp_ns.dts
-- Found devicetree overlay: /opt/nordic/ncs/v3.0.0/zephyr/samples/subsys/usb/mass/boards/nrf7002dk_nrf5340_cpuapp_ns.overlay
-- Generated zephyr.dts: /opt/nordic/ncs/v3.0.0/zephyr/samples/subsys/usb/mass/build/mass/zephyr/zephyr.dts
-- Generated pickled edt: /opt/nordic/ncs/v3.0.0/zephyr/samples/subsys/usb/mass/build/mass/zephyr/edt.pickle
-- Generated zephyr.dts: /opt/nordic/ncs/v3.0.0/zephyr/samples/subsys/usb/mass/build/mass/zephyr/zephyr.dts
-- Generated devicetree_generated.h: /opt/nordic/ncs/v3.0.0/zephyr/samples/subsys/usb/mass/build/mass/zephyr/include/generated/zephyr/devicetree_generated.h
-- Including generated dts.cmake file: /opt/nordic/ncs/v3.0.0/zephyr/samples/subsys/usb/mass/build/mass/zephyr/dts.cmake

warning: DISK_DRIVER_SDMMC (defined at
boards/shields/adafruit_2_8_tft_touch_v2/Kconfig.defconfig:37, drivers/disk/Kconfig.sdmmc:7) was
assigned the value 'y' but got the value 'n'. Check these unsatisfied dependencies: ((DISK_DRIVERS
&& (SHIELD_ADAFRUIT_2_8_TFT_TOUCH_V2 || SHIELD_ADAFRUIT_2_8_TFT_TOUCH_V2_NANO)) ||
((DT_HAS_ZEPHYR_SDMMC_DISK_ENABLED || DT_HAS_ST_STM32_SDMMC_ENABLED) && DISK_DRIVERS)) (=n). See
http://docs.zephyrproject.org/latest/kconfig.html#CONFIG_DISK_DRIVER_SDMMC and/or look up
DISK_DRIVER_SDMMC in the menuconfig/guiconfig interface. The Application Development Primer, Setting
Configuration Values, and Kconfig - Tips and Best Practices sections of the manual might be helpful
too.


warning: NORDIC_QSPI_NOR (defined at /opt/nordic/ncs/v3.0.0/nrf/Kconfig.nrf:95,
drivers/flash/Kconfig.nordic_qspi_nor:4) was assigned the value 'y' but got the value 'n'. See
http://docs.zephyrproject.org/latest/kconfig.html#CONFIG_NORDIC_QSPI_NOR and/or look up
NORDIC_QSPI_NOR in the menuconfig/guiconfig interface. The Application Development Primer, Setting
Configuration Values, and Kconfig - Tips and Best Practices sections of the manual might be helpful
too.


warning: SDMMC_STM32_HWFC (defined at drivers/disk/Kconfig.sdmmc:47) was assigned the value 'y' but
got the value 'n'. Check these unsatisfied dependencies: SDMMC_STM32 (=n), (SOC_SERIES_STM32H5X ||
SOC_SERIES_STM32H7X || SOC_SERIES_STM32F7X || SOC_SERIES_STM32L4X || SOC_SERIES_STM32L5X) (=n),
DISK_DRIVER_SDMMC (=n). See
http://docs.zephyrproject.org/latest/kconfig.html#CONFIG_SDMMC_STM32_HWFC and/or look up
SDMMC_STM32_HWFC in the menuconfig/guiconfig interface. The Application Development Primer, Setting
Configuration Values, and Kconfig - Tips and Best Practices sections of the manual might be helpful
too.

Parsing /opt/nordic/ncs/v3.0.0/zephyr/samples/subsys/usb/mass/Kconfig
Loaded configuration '/opt/nordic/ncs/v3.0.0/zephyr/boards/nordic/nrf7002dk/nrf7002dk_nrf5340_cpuapp_ns_defconfig'
Merged configuration '/opt/nordic/ncs/v3.0.0/zephyr/samples/subsys/usb/mass/prj.conf'
Merged configuration '/opt/nordic/ncs/v3.0.0/zephyr/samples/subsys/usb/mass/boards/nrf7002dk_nrf5340_cpuapp_ns.conf'
Merged configuration '/opt/nordic/ncs/v3.0.0/zephyr/samples/subsys/usb/mass/build/mass/zephyr/.config.sysbuild'
Configuration saved to '/opt/nordic/ncs/v3.0.0/zephyr/samples/subsys/usb/mass/build/mass/zephyr/.config'
Kconfig header saved to '/opt/nordic/ncs/v3.0.0/zephyr/samples/subsys/usb/mass/build/mass/zephyr/include/generated/zephyr/autoconf.h'
-- Found GnuLd: /Users/tudor/zephyr-sdk-0.17.0/arm-zephyr-eabi/arm-zephyr-eabi/bin/ld.bfd (found version "2.38")
-- The C compiler identification is GNU 12.2.0
-- The CXX compiler identification is GNU 12.2.0
-- The ASM compiler identification is GNU
-- Found assembler: /Users/tudor/zephyr-sdk-0.17.0/arm-zephyr-eabi/bin/arm-zephyr-eabi-gcc
CMake Warning at /opt/nordic/ncs/v3.0.0/zephyr/subsys/usb/device/CMakeLists.txt:22 (message):
  CONFIG_USB_DEVICE_VID has default value 0x2FE3.

  This value is only for testing and MUST be configured for USB products.


=========== Generating psa_crypto_config ===============
Backup: CONFIG_MBEDTLS_PSA_CRYPTO_SPM: False
Backup: CONFIG_MBEDTLS_PSA_CRYPTO_C: False
Backup: CONFIG_MBEDTLS_PSA_CRYPTO_KEY_ID_ENCODES_OWNER: False
Backup: CONFIG_MBEDTLS_PLATFORM_SETUP_TEARDOWN_ALT: False
Backup: CONFIG_MBEDTLS_THREADING: False
Backup: CONFIG_MBEDTLS_THREADING_ALT: False
=========== Checkpoint: backup ===============
Restore: CONFIG_MBEDTLS_PSA_CRYPTO_SPM: False
Restore: CONFIG_MBEDTLS_PSA_CRYPTO_C: False
Restore: CONFIG_MBEDTLS_PSA_CRYPTO_KEY_ID_ENCODES_OWNER: False
Restore: CONFIG_MBEDTLS_PLATFORM_SETUP_TEARDOWN_ALT: False
Restore: CONFIG_MBEDTLS_THREADING: False
Restore: CONFIG_MBEDTLS_THREADING_ALT: False
=========== End psa_crypto_config ===============
=========== Generating psa_crypto_library_config ===============
Backup: CONFIG_MBEDTLS_PSA_CRYPTO_C: False
Backup: CONFIG_MBEDTLS_PSA_CRYPTO_KEY_ID_ENCODES_OWNER: False
Backup: CONFIG_MBEDTLS_PSA_CRYPTO_SPM: False
Backup: CONFIG_MBEDTLS_USE_PSA_CRYPTO: True
Backup: CONFIG_MBEDTLS_PLATFORM_PRINTF_ALT: False
Backup: CONFIG_MBEDTLS_THREADING: False
Backup: CONFIG_MBEDTLS_THREADING_ALT: False
=========== Checkpoint: backup ===============
Restore: CONFIG_MBEDTLS_PSA_CRYPTO_C: False
Restore: CONFIG_MBEDTLS_PSA_CRYPTO_KEY_ID_ENCODES_OWNER: False
Restore: CONFIG_MBEDTLS_PSA_CRYPTO_SPM: False
Restore: CONFIG_MBEDTLS_USE_PSA_CRYPTO: True
Restore: CONFIG_MBEDTLS_PLATFORM_PRINTF_ALT: False
Restore: CONFIG_MBEDTLS_THREADING: False
Restore: CONFIG_MBEDTLS_THREADING_ALT: False
=========== End psa_crypto_library_config ===============
-- Using ccache: /opt/homebrew/bin/ccache
-- Configuring done (5.7s)
-- Generating done (0.4s)
-- Build files have been written to: /opt/nordic/ncs/v3.0.0/zephyr/samples/subsys/usb/mass/build/mass
-- Found partition manager static configuration : /opt/nordic/ncs/v3.0.0/zephyr/samples/subsys/usb/mass/pm_static.yml
-- Configuring done (9.1s)
-- Generating done (0.0s)
-- Build files have been written to: /opt/nordic/ncs/v3.0.0/zephyr/samples/subsys/usb/mass/build
-- west build: building application
[5/10] Performing build step for 'mass'
[1/278] Preparing syscall dependency handling

[6/278] Generating include/generated/zephyr/version.h
-- Zephyr version: 4.0.99 (/opt/nordic/ncs/v3.0.0/zephyr), build: v4.0.99-ncs1
[8/278] Generating ../../tfm/CMakeCache.txt
-- Found Git: /usr/bin/git (found version "2.39.5 (Apple Git-154)")
-- The C compiler identification is GNU 12.2.0
-- The CXX compiler identification is GNU 12.2.0
-- The ASM compiler identification is GNU
-- Found assembler: /Users/tudor/zephyr-sdk-0.17.0/arm-zephyr-eabi/bin/arm-zephyr-eabi-gcc
-- Found Python3: /opt/homebrew/bin/python3 (found version "3.13.3") found components: Interpreter
-- Found Python3: /opt/homebrew/bin/python3 (found suitable version "3.13.3", minimum required is "3.10") found components: Interpreter
-- Cache files will be written to: /Users/tudor/Library/Caches/zephyr
CMake Warning (dev) at /opt/nordic/ncs/v3.0.0/nrf/modules/trusted-firmware-m/tfm_boards/nrf5340_cpuapp/CMakeLists.txt:21 (install):
  Policy CMP0177 is not set: install() DESTINATION paths are normalized.  Run
  "cmake --help-policy CMP0177" for policy details.  Use the cmake_policy
  command to set the policy and suppress this warning.
This warning is for project developers.  Use -Wno-dev to suppress it.

-- Configuring done (0.9s)
-- Generating done (0.1s)
-- Build files have been written to: /opt/nordic/ncs/v3.0.0/zephyr/samples/subsys/usb/mass/build/mass/tfm
[17/278] Performing build step for 'tfm'
[135/139] Linking C executable bin/tfm_s.axf
Memory region         Used Size  Region Size  %age Used
           FLASH:       32100 B        32 KB     97.96%
             RAM:       10404 B        32 KB     31.75%
[139/139] Linking C static library secure_fw/libtfm_s_veneers.a
[19/278] Performing install step for 'tfm'
-- Install configuration: "MinSizeRel"
----- Installing platform NS -----
[89/278] Building C object CMakeFiles/app.dir/src/main.c.obj
In file included from /opt/nordic/ncs/v3.0.0/zephyr/samples/subsys/usb/mass/src/main.c:29:
/opt/nordic/ncs/v3.0.0/nrf/include/flash_map_pm.h:37:17: warning: 'littlefs_storage' defined but not used [-Wunused-variable]
   37 | #define storage littlefs_storage
      |                 ^~~~~~~~~~~~~~~~
/opt/nordic/ncs/v3.0.0/zephyr/include/zephyr/fs/littlefs.h:91:35: note: in definition of macro 'FS_LITTLEFS_DECLARE_CUSTOM_CONFIG'
   91 |         static struct fs_littlefs name = {                                                \
      |                                   ^~~~
/opt/nordic/ncs/v3.0.0/zephyr/samples/subsys/usb/mass/src/main.c:30:1: note: in expansion of macro 'FS_LITTLEFS_DECLARE_DEFAULT_CONFIG'
   30 | FS_LITTLEFS_DECLARE_DEFAULT_CONFIG(storage);
      | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/opt/nordic/ncs/v3.0.0/zephyr/samples/subsys/usb/mass/src/main.c:30:36: note: in expansion of macro 'storage'
   30 | FS_LITTLEFS_DECLARE_DEFAULT_CONFIG(storage);
      |                                    ^~~~~~~
[159/278] Building C object zephyr/drivers/disk/CMakeFiles/drivers__disk.dir/flashdisk.c.obj
FAILED: zephyr/drivers/disk/CMakeFiles/drivers__disk.dir/flashdisk.c.obj
ccache /Users/tudor/zephyr-sdk-0.17.0/arm-zephyr-eabi/bin/arm-zephyr-eabi-gcc -DKERNEL -DK_HEAP_MEM_POOL_SIZE=0 -DMBEDTLS_CONFIG_FILE=\"nrf-config.h\" -DMBEDTLS_PSA_CRYPTO_CONFIG_FILE=\"nrf-psa-crypto-config.h\" -DNRF5340_XXAA_APPLICATION -DNRF_SKIP_FICR_NS_COPY_TO_RAM -DNRF_TRUSTZONE_NONSECURE -DPICOLIBC_LONG_LONG_PRINTF_SCANF -DUSE_PARTITION_MANAGER=1 -D__LINUX_ERRNO_EXTENSIONS__ -D__PROGRAM_START -D__ZEPHYR_SUPERVISOR__ -D__ZEPHYR__=1 -I/opt/nordic/ncs/v3.0.0/zephyr/samples/subsys/usb/mass/build/mass/zephyr/include/generated/zephyr -I/opt/nordic/ncs/v3.0.0/zephyr/include -I/opt/nordic/ncs/v3.0.0/zephyr/samples/subsys/usb/mass/build/mass/zephyr/include/generated -I/opt/nordic/ncs/v3.0.0/zephyr/soc/nordic -I/opt/nordic/ncs/v3.0.0/zephyr/soc/nordic/nrf53/. -I/opt/nordic/ncs/v3.0.0/zephyr/soc/nordic/common/. -I/opt/nordic/ncs/v3.0.0/zephyr/subsys/usb/device -I/opt/nordic/ncs/v3.0.0/zephyr/drivers/usb/common/nrf_usbd_common/. -I/opt/nordic/ncs/v3.0.0/nrf/include -I/opt/nordic/ncs/v3.0.0/zephyr/samples/subsys/usb/mass/build/mass/tfm/api_ns/interface/include -I/opt/nordic/ncs/v3.0.0/nrf/modules/trusted-firmware-m/. -I/opt/nordic/ncs/v3.0.0/nrf/include/tfm -I/opt/nordic/ncs/v3.0.0/nrf/tests/include -I/opt/nordic/ncs/v3.0.0/modules/hal/cmsis/CMSIS/Core/Include -I/opt/nordic/ncs/v3.0.0/zephyr/modules/cmsis/. -I/opt/nordic/ncs/v3.0.0/nrf/modules/hal_nordic/. -I/opt/nordic/ncs/v3.0.0/modules/hal/nordic/nrfx -I/opt/nordic/ncs/v3.0.0/modules/hal/nordic/nrfx/drivers/include -I/opt/nordic/ncs/v3.0.0/modules/hal/nordic/nrfx/mdk -I/opt/nordic/ncs/v3.0.0/zephyr/modules/hal_nordic/nrfx/. -I/opt/nordic/ncs/v3.0.0/zephyr/samples/subsys/usb/mass/build/mass/generated/interface_nrf_security_psa -I/opt/nordic/ncs/v3.0.0/nrf/subsys/nrf_security/include -I/opt/nordic/ncs/v3.0.0/modules/crypto/oberon-psa-crypto/include -I/opt/nordic/ncs/v3.0.0/nrf/subsys/nrf_security/src/utils -I/opt/nordic/ncs/v3.0.0/modules/crypto/oberon-psa-crypto/library -I/opt/nordic/ncs/v3.0.0/modules/crypto/mbedtls/library -I/opt/nordic/ncs/v3.0.0/modules/crypto/mbedtls/include -I/opt/nordic/ncs/v3.0.0/modules/crypto/mbedtls/include/library -I/opt/nordic/ncs/v3.0.0/nrfxlib/crypto/nrf_oberon/include -I/opt/nordic/ncs/v3.0.0/nrfxlib/crypto/nrf_oberon/include/mbedtls -isystem /opt/nordic/ncs/v3.0.0/zephyr/lib/libc/common/include -Wshadow -fno-strict-aliasing -Os -imacros /opt/nordic/ncs/v3.0.0/zephyr/samples/subsys/usb/mass/build/mass/zephyr/include/generated/zephyr/autoconf.h -fno-printf-return-value -fno-common -g -gdwarf-4 -fdiagnostics-color=always -mcpu=cortex-m33 -mthumb -mabi=aapcs -mfp16-format=ieee -mtp=soft --sysroot=/Users/tudor/zephyr-sdk-0.17.0/arm-zephyr-eabi/arm-zephyr-eabi -imacros /opt/nordic/ncs/v3.0.0/zephyr/include/zephyr/toolchain/zephyr_stdint.h -Wall -Wformat -Wformat-security -Wno-format-zero-length -Wdouble-promotion -Wno-pointer-sign -Wpointer-arith -Wexpansion-to-defined -Wno-unused-but-set-variable -Werror=implicit-int -fno-pic -fno-pie -fno-asynchronous-unwind-tables -ftls-model=local-exec -fno-reorder-functions --param=min-pagesize=0 -fno-defer-pop -fmacro-prefix-map=/opt/nordic/ncs/v3.0.0/zephyr/samples/subsys/usb/mass=CMAKE_SOURCE_DIR -fmacro-prefix-map=/opt/nordic/ncs/v3.0.0/zephyr=ZEPHYR_BASE -fmacro-prefix-map=/opt/nordic/ncs/v3.0.0=WEST_TOPDIR -ffunction-sections -fdata-sections -specs=picolibc.specs -std=c99 -MD -MT zephyr/drivers/disk/CMakeFiles/drivers__disk.dir/flashdisk.c.obj -MF zephyr/drivers/disk/CMakeFiles/drivers__disk.dir/flashdisk.c.obj.d -o zephyr/drivers/disk/CMakeFiles/drivers__disk.dir/flashdisk.c.obj -c /opt/nordic/ncs/v3.0.0/zephyr/drivers/disk/flashdisk.c
/opt/nordic/ncs/v3.0.0/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)
      | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/opt/nordic/ncs/v3.0.0/zephyr/drivers/disk/flashdisk.c: In function 'PM_FOREACH_AFFILIATED_TO_disk':
/opt/nordic/ncs/v3.0.0/zephyr/drivers/disk/flashdisk.c:572:30: error: storage class specified for parameter 'flash_disks'
  572 | static struct flashdisk_data flash_disks[] = {
      |                              ^~~~~~~~~~~
/opt/nordic/ncs/v3.0.0/zephyr/drivers/disk/flashdisk.c:572:15: error: parameter 'flash_disks' is initialized
  572 | static struct flashdisk_data flash_disks[] = {
      |               ^~~~~~~~~~~~~~
/opt/nordic/ncs/v3.0.0/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)
      |                                       ^~~~~~~~~~~~~~~~~~~~~~~~
/opt/nordic/ncs/v3.0.0/zephyr/drivers/disk/flashdisk.c:573:39: note: each undeclared identifier is reported only once for each function it appears in
/opt/nordic/ncs/v3.0.0/zephyr/drivers/disk/flashdisk.c:582:1: error: expected declaration specifiers before 'PM_FOREACH_AFFILIATED_TO_disk'
  582 | PM_FOREACH_AFFILIATED_TO_disk(VERIFY_CACHE_SIZE_IS_NOT_ZERO_IF_NOT_READ_ONLY)
      | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /opt/nordic/ncs/v3.0.0/zephyr/include/zephyr/toolchain/gcc.h:98,
                 from /opt/nordic/ncs/v3.0.0/zephyr/include/zephyr/toolchain.h:50,
                 from /opt/nordic/ncs/v3.0.0/zephyr/include/zephyr/sys/__assert.h:11,
                 from /opt/nordic/ncs/v3.0.0/zephyr/drivers/disk/flashdisk.c:10:
/opt/nordic/ncs/v3.0.0/zephyr/include/zephyr/init.h:141:44: error: storage class specified for parameter '__init_disk_flash_init'
  141 | #define Z_INIT_ENTRY_NAME(init_id) _CONCAT(__init_, init_id)
      |                                            ^~~~~~~
/opt/nordic/ncs/v3.0.0/zephyr/include/zephyr/toolchain/common.h:137:26: note: in definition of macro '_DO_CONCAT'
  137 | #define _DO_CONCAT(x, y) x ## y
      |                          ^
/opt/nordic/ncs/v3.0.0/zephyr/include/zephyr/init.h:141:36: note: in expansion of macro '_CONCAT'
  141 | #define Z_INIT_ENTRY_NAME(init_id) _CONCAT(__init_, init_id)
      |                                    ^~~~~~~
/opt/nordic/ncs/v3.0.0/zephyr/include/zephyr/init.h:241:17: note: in expansion of macro 'Z_INIT_ENTRY_NAME'
  241 |                 Z_INIT_ENTRY_NAME(name) = {.init_fn = {.sys = (init_fn_)},                \
      |                 ^~~~~~~~~~~~~~~~~
/opt/nordic/ncs/v3.0.0/zephyr/include/zephyr/init.h:223:9: note: in expansion of macro 'SYS_INIT_NAMED'
  223 |         SYS_INIT_NAMED(init_fn, init_fn, level, prio)
      |         ^~~~~~~~~~~~~~
/opt/nordic/ncs/v3.0.0/zephyr/drivers/disk/flashdisk.c:612:1: note: in expansion of macro 'SYS_INIT'
  612 | SYS_INIT(disk_flash_init, POST_KERNEL, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT);
      | ^~~~~~~~
/opt/nordic/ncs/v3.0.0/zephyr/include/zephyr/init.h:239:42: error: parameter '__init_disk_flash_init' is initialized
  239 |         static const Z_DECL_ALIGN(struct init_entry)                                      \
      |                                          ^~~~~~~~~~
/opt/nordic/ncs/v3.0.0/zephyr/include/zephyr/toolchain/common.h:195:55: note: in definition of macro 'Z_DECL_ALIGN'
  195 | #define Z_DECL_ALIGN(type) __aligned(__alignof(type)) type
      |                                                       ^~~~
/opt/nordic/ncs/v3.0.0/zephyr/include/zephyr/init.h:223:9: note: in expansion of macro 'SYS_INIT_NAMED'
  223 |         SYS_INIT_NAMED(init_fn, init_fn, level, prio)
      |         ^~~~~~~~~~~~~~
/opt/nordic/ncs/v3.0.0/zephyr/drivers/disk/flashdisk.c:612:1: note: in expansion of macro 'SYS_INIT'
  612 | SYS_INIT(disk_flash_init, POST_KERNEL, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT);
      | ^~~~~~~~
/opt/nordic/ncs/v3.0.0/zephyr/include/zephyr/init.h:141:44: error: section attribute not allowed for '__init_disk_flash_init'
  141 | #define Z_INIT_ENTRY_NAME(init_id) _CONCAT(__init_, init_id)
      |                                            ^~~~~~~
/opt/nordic/ncs/v3.0.0/zephyr/include/zephyr/toolchain/common.h:137:26: note: in definition of macro '_DO_CONCAT'
  137 | #define _DO_CONCAT(x, y) x ## y
      |                          ^
/opt/nordic/ncs/v3.0.0/zephyr/include/zephyr/init.h:141:36: note: in expansion of macro '_CONCAT'
  141 | #define Z_INIT_ENTRY_NAME(init_id) _CONCAT(__init_, init_id)
      |                                    ^~~~~~~
/opt/nordic/ncs/v3.0.0/zephyr/include/zephyr/init.h:241:17: note: in expansion of macro 'Z_INIT_ENTRY_NAME'
  241 |                 Z_INIT_ENTRY_NAME(name) = {.init_fn = {.sys = (init_fn_)},                \
      |                 ^~~~~~~~~~~~~~~~~
/opt/nordic/ncs/v3.0.0/zephyr/include/zephyr/init.h:223:9: note: in expansion of macro 'SYS_INIT_NAMED'
  223 |         SYS_INIT_NAMED(init_fn, init_fn, level, prio)
      |         ^~~~~~~~~~~~~~
/opt/nordic/ncs/v3.0.0/zephyr/drivers/disk/flashdisk.c:612:1: note: in expansion of macro 'SYS_INIT'
  612 | SYS_INIT(disk_flash_init, POST_KERNEL, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT);
      | ^~~~~~~~
/opt/nordic/ncs/v3.0.0/zephyr/include/zephyr/init.h:239:42: warning: 'used' attribute ignored [-Wattributes]
  239 |         static const Z_DECL_ALIGN(struct init_entry)                                      \
      |                                          ^~~~~~~~~~
/opt/nordic/ncs/v3.0.0/zephyr/include/zephyr/toolchain/common.h:195:55: note: in definition of macro 'Z_DECL_ALIGN'
  195 | #define Z_DECL_ALIGN(type) __aligned(__alignof(type)) type
      |                                                       ^~~~
/opt/nordic/ncs/v3.0.0/zephyr/include/zephyr/init.h:223:9: note: in expansion of macro 'SYS_INIT_NAMED'
  223 |         SYS_INIT_NAMED(init_fn, init_fn, level, prio)
      |         ^~~~~~~~~~~~~~
/opt/nordic/ncs/v3.0.0/zephyr/drivers/disk/flashdisk.c:612:1: note: in expansion of macro 'SYS_INIT'
  612 | SYS_INIT(disk_flash_init, POST_KERNEL, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT);
      | ^~~~~~~~
/opt/nordic/ncs/v3.0.0/zephyr/include/zephyr/init.h:141:44: error: alignment may not be specified for '__init_disk_flash_init'
  141 | #define Z_INIT_ENTRY_NAME(init_id) _CONCAT(__init_, init_id)
      |                                            ^~~~~~~
/opt/nordic/ncs/v3.0.0/zephyr/include/zephyr/toolchain/common.h:137:26: note: in definition of macro '_DO_CONCAT'
  137 | #define _DO_CONCAT(x, y) x ## y
      |                          ^
/opt/nordic/ncs/v3.0.0/zephyr/include/zephyr/init.h:141:36: note: in expansion of macro '_CONCAT'
  141 | #define Z_INIT_ENTRY_NAME(init_id) _CONCAT(__init_, init_id)
      |                                    ^~~~~~~
/opt/nordic/ncs/v3.0.0/zephyr/include/zephyr/init.h:241:17: note: in expansion of macro 'Z_INIT_ENTRY_NAME'
  241 |                 Z_INIT_ENTRY_NAME(name) = {.init_fn = {.sys = (init_fn_)},                \
      |                 ^~~~~~~~~~~~~~~~~
/opt/nordic/ncs/v3.0.0/zephyr/include/zephyr/init.h:223:9: note: in expansion of macro 'SYS_INIT_NAMED'
  223 |         SYS_INIT_NAMED(init_fn, init_fn, level, prio)
      |         ^~~~~~~~~~~~~~
/opt/nordic/ncs/v3.0.0/zephyr/drivers/disk/flashdisk.c:612:1: note: in expansion of macro 'SYS_INIT'
  612 | SYS_INIT(disk_flash_init, POST_KERNEL, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT);
      | ^~~~~~~~
In file included from /opt/nordic/ncs/v3.0.0/zephyr/include/zephyr/device.h:13,
                 from /opt/nordic/ncs/v3.0.0/zephyr/include/zephyr/sw_isr_table.h:18,
                 from /opt/nordic/ncs/v3.0.0/zephyr/include/zephyr/arch/arm/irq.h:19,
                 from /opt/nordic/ncs/v3.0.0/zephyr/include/zephyr/arch/arm/arch.h:24,
                 from /opt/nordic/ncs/v3.0.0/zephyr/include/zephyr/arch/cpu.h:19,
                 from /opt/nordic/ncs/v3.0.0/zephyr/include/zephyr/kernel_includes.h:36,
                 from /opt/nordic/ncs/v3.0.0/zephyr/include/zephyr/kernel.h:17,
                 from /opt/nordic/ncs/v3.0.0/zephyr/include/zephyr/drivers/disk.h:30,
                 from /opt/nordic/ncs/v3.0.0/zephyr/drivers/disk/flashdisk.c:12:
/opt/nordic/ncs/v3.0.0/zephyr/drivers/disk/flashdisk.c:612:10: error: 'disk_flash_init' undeclared (first use in this function)
  612 | SYS_INIT(disk_flash_init, POST_KERNEL, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT);
      |          ^~~~~~~~~~~~~~~
/opt/nordic/ncs/v3.0.0/zephyr/include/zephyr/init.h:241:64: note: in definition of macro 'SYS_INIT_NAMED'
  241 |                 Z_INIT_ENTRY_NAME(name) = {.init_fn = {.sys = (init_fn_)},                \
      |                                                                ^~~~~~~~
/opt/nordic/ncs/v3.0.0/zephyr/drivers/disk/flashdisk.c:612:1: note: in expansion of macro 'SYS_INIT'
  612 | SYS_INIT(disk_flash_init, POST_KERNEL, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT);
      | ^~~~~~~~
/opt/nordic/ncs/v3.0.0/zephyr/drivers/disk/flashdisk.c:533:1: error: type of 'DEFINE_FLASHDISKS_CACHE' defaults to 'int' [-Werror=implicit-int]
  533 | PM_FOREACH_AFFILIATED_TO_disk(DEFINE_FLASHDISKS_CACHE)
      | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/opt/nordic/ncs/v3.0.0/zephyr/include/zephyr/init.h:141:44: error: declaration for parameter '__init_disk_flash_init' but no such parameter
  141 | #define Z_INIT_ENTRY_NAME(init_id) _CONCAT(__init_, init_id)
      |                                            ^~~~~~~
/opt/nordic/ncs/v3.0.0/zephyr/include/zephyr/toolchain/common.h:137:26: note: in definition of macro '_DO_CONCAT'
  137 | #define _DO_CONCAT(x, y) x ## y
      |                          ^
/opt/nordic/ncs/v3.0.0/zephyr/include/zephyr/init.h:141:36: note: in expansion of macro '_CONCAT'
  141 | #define Z_INIT_ENTRY_NAME(init_id) _CONCAT(__init_, init_id)
      |                                    ^~~~~~~
/opt/nordic/ncs/v3.0.0/zephyr/include/zephyr/init.h:241:17: note: in expansion of macro 'Z_INIT_ENTRY_NAME'
  241 |                 Z_INIT_ENTRY_NAME(name) = {.init_fn = {.sys = (init_fn_)},                \
      |                 ^~~~~~~~~~~~~~~~~
/opt/nordic/ncs/v3.0.0/zephyr/include/zephyr/init.h:223:9: note: in expansion of macro 'SYS_INIT_NAMED'
  223 |         SYS_INIT_NAMED(init_fn, init_fn, level, prio)
      |         ^~~~~~~~~~~~~~
/opt/nordic/ncs/v3.0.0/zephyr/drivers/disk/flashdisk.c:612:1: note: in expansion of macro 'SYS_INIT'
  612 | SYS_INIT(disk_flash_init, POST_KERNEL, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT);
      | ^~~~~~~~
/opt/nordic/ncs/v3.0.0/zephyr/drivers/disk/flashdisk.c:572:30: error: declaration for parameter 'flash_disks' but no such parameter
  572 | static struct flashdisk_data flash_disks[] = {
      |                              ^~~~~~~~~~~
/opt/nordic/ncs/v3.0.0/zephyr/drivers/disk/flashdisk.c:613: error: expected '{' at end of input
/opt/nordic/ncs/v3.0.0/zephyr/drivers/disk/flashdisk.c:613: warning: control reaches end of non-void function [-Wreturn-type]
/opt/nordic/ncs/v3.0.0/zephyr/drivers/disk/flashdisk.c: At top level:
/opt/nordic/ncs/v3.0.0/zephyr/drivers/disk/flashdisk.c:464:37: warning: 'flash_disk_ops' defined but not used [-Wunused-const-variable=]
  464 | static const struct disk_operations flash_disk_ops = {
      |                                     ^~~~~~~~~~~~~~
cc1: some warnings being treated as errors
[168/278] Building C object zephyr/drivers/usb/device/CMakeFiles/drivers__usb__device.dir/usb_dc_nrfx.c.obj
ninja: build stopped: subcommand failed.
FAILED: _sysbuild/sysbuild/images/mass-prefix/src/mass-stamp/mass-build /opt/nordic/ncs/v3.0.0/zephyr/samples/subsys/usb/mass/build/_sysbuild/sysbuild/images/mass-prefix/src/mass-stamp/mass-build
cd /opt/nordic/ncs/v3.0.0/zephyr/samples/subsys/usb/mass/build/mass && /opt/homebrew/bin/cmake --build .
ninja: build stopped: subcommand failed.
FATAL ERROR: command exited with status 1: /opt/homebrew/bin/cmake --build /opt/nordic/ncs/v3.0.0/zephyr/samples/subsys/usb/mass/build

The whole sample project folder: 

8686.mass.zip

Any and all help is gladly welcome! :)

Parents
  • Hey Tudor Slight smile

    Like all zephyr samples this might not work immediately on an nRF, but typically does after some configuration. Could you have a look at this previous case about it?

    Regards,

    Elfving

  • Finished trying it; didn't work.

    Whole folder with the changes from that ticket:

     2260.mass.zip

    Logs when trying to build it:

    root@admins-MacBook-Air-2 mass #
    root@admins-MacBook-Air-2 mass #
    root@admins-MacBook-Air-2 mass #
    root@admins-MacBook-Air-2 mass # west build -b nrf7002dk/nrf5340/cpuapp/ns --pristine
    -- west build: generating a build system
    Loading Zephyr module(s) (Zephyr base): sysbuild_default
    -- Found Python3: /opt/homebrew/opt/[email protected]/bin/python3.13 (found suitable version "3.13.3", minimum required is "3.10") found components: Interpreter
    -- Cache files will be written to: /Users/tudor/Library/Caches/zephyr
    -- Found west (found suitable version "1.3.0", minimum required is "0.14.0")
    -- Board: nrf7002dk, qualifiers: nrf5340/cpuapp/ns
    Parsing /opt/nordic/ncs/v3.0.0/zephyr/share/sysbuild/Kconfig
    Loaded configuration '/opt/nordic/ncs/v3.0.0/zephyr/samples/subsys/usb/mass/build/zephyr/.config'
    No change to configuration in '/opt/nordic/ncs/v3.0.0/zephyr/samples/subsys/usb/mass/build/zephyr/.config'
    No change to Kconfig header in '/opt/nordic/ncs/v3.0.0/zephyr/samples/subsys/usb/mass/build/_sysbuild/autoconf.h'
    --
       **************************
       * Running CMake for mass *
       **************************
    
    Loading Zephyr default modules (Zephyr base).
    -- Application: /opt/nordic/ncs/v3.0.0/zephyr/samples/subsys/usb/mass
    -- CMake version: 4.0.2
    -- Found Python3: /opt/homebrew/bin/python3 (found suitable version "3.13.3", minimum required is "3.10") found components: Interpreter
    -- Cache files will be written to: /Users/tudor/Library/Caches/zephyr
    -- Zephyr version: 4.0.99 (/opt/nordic/ncs/v3.0.0/zephyr)
    -- Found west (found suitable version "1.3.0", minimum required is "0.14.0")
    -- Board: nrf7002dk, qualifiers: nrf5340/cpuapp/ns
    -- ZEPHYR_TOOLCHAIN_VARIANT not set, trying to locate Zephyr SDK
    -- Found host-tools: zephyr 0.17.0 (/Users/tudor/zephyr-sdk-0.17.0)
    -- Found toolchain: zephyr 0.17.0 (/Users/tudor/zephyr-sdk-0.17.0)
    -- Could NOT find Dtc (missing: DTC) (Required is at least version "1.4.6")
    Hint: The project() command has not yet been called.  It sets up system-specific search paths.
    -- Found BOARD.dts: /opt/nordic/ncs/v3.0.0/zephyr/boards/nordic/nrf7002dk/nrf7002dk_nrf5340_cpuapp_ns.dts
    -- Generated zephyr.dts: /opt/nordic/ncs/v3.0.0/zephyr/samples/subsys/usb/mass/build/mass/zephyr/zephyr.dts
    -- Generated pickled edt: /opt/nordic/ncs/v3.0.0/zephyr/samples/subsys/usb/mass/build/mass/zephyr/edt.pickle
    -- Generated zephyr.dts: /opt/nordic/ncs/v3.0.0/zephyr/samples/subsys/usb/mass/build/mass/zephyr/zephyr.dts
    -- Generated devicetree_generated.h: /opt/nordic/ncs/v3.0.0/zephyr/samples/subsys/usb/mass/build/mass/zephyr/include/generated/zephyr/devicetree_generated.h
    -- Including generated dts.cmake file: /opt/nordic/ncs/v3.0.0/zephyr/samples/subsys/usb/mass/build/mass/zephyr/dts.cmake
    Parsing /opt/nordic/ncs/v3.0.0/zephyr/samples/subsys/usb/mass/Kconfig
    Loaded configuration '/opt/nordic/ncs/v3.0.0/zephyr/boards/nordic/nrf7002dk/nrf7002dk_nrf5340_cpuapp_ns_defconfig'
    Merged configuration '/opt/nordic/ncs/v3.0.0/zephyr/samples/subsys/usb/mass/prj.conf'
    Merged configuration '/opt/nordic/ncs/v3.0.0/zephyr/samples/subsys/usb/mass/build/mass/zephyr/.config.sysbuild'
    Configuration saved to '/opt/nordic/ncs/v3.0.0/zephyr/samples/subsys/usb/mass/build/mass/zephyr/.config'
    Kconfig header saved to '/opt/nordic/ncs/v3.0.0/zephyr/samples/subsys/usb/mass/build/mass/zephyr/include/generated/zephyr/autoconf.h'
    -- Found GnuLd: /Users/tudor/zephyr-sdk-0.17.0/arm-zephyr-eabi/arm-zephyr-eabi/bin/ld.bfd (found version "2.38")
    -- The C compiler identification is GNU 12.2.0
    -- The CXX compiler identification is GNU 12.2.0
    -- The ASM compiler identification is GNU
    -- Found assembler: /Users/tudor/zephyr-sdk-0.17.0/arm-zephyr-eabi/bin/arm-zephyr-eabi-gcc
    CMake Warning at /opt/nordic/ncs/v3.0.0/zephyr/subsys/usb/device/CMakeLists.txt:22 (message):
      CONFIG_USB_DEVICE_VID has default value 0x2FE3.
    
      This value is only for testing and MUST be configured for USB products.
    
    
    =========== Generating psa_crypto_config ===============
    Backup: CONFIG_MBEDTLS_PSA_CRYPTO_SPM: False
    Backup: CONFIG_MBEDTLS_PSA_CRYPTO_C: False
    Backup: CONFIG_MBEDTLS_PSA_CRYPTO_KEY_ID_ENCODES_OWNER: False
    Backup: CONFIG_MBEDTLS_PLATFORM_SETUP_TEARDOWN_ALT: False
    Backup: CONFIG_MBEDTLS_THREADING: False
    Backup: CONFIG_MBEDTLS_THREADING_ALT: False
    =========== Checkpoint: backup ===============
    Restore: CONFIG_MBEDTLS_PSA_CRYPTO_SPM: False
    Restore: CONFIG_MBEDTLS_PSA_CRYPTO_C: False
    Restore: CONFIG_MBEDTLS_PSA_CRYPTO_KEY_ID_ENCODES_OWNER: False
    Restore: CONFIG_MBEDTLS_PLATFORM_SETUP_TEARDOWN_ALT: False
    Restore: CONFIG_MBEDTLS_THREADING: False
    Restore: CONFIG_MBEDTLS_THREADING_ALT: False
    =========== End psa_crypto_config ===============
    =========== Generating psa_crypto_library_config ===============
    Backup: CONFIG_MBEDTLS_PSA_CRYPTO_C: False
    Backup: CONFIG_MBEDTLS_PSA_CRYPTO_KEY_ID_ENCODES_OWNER: False
    Backup: CONFIG_MBEDTLS_PSA_CRYPTO_SPM: False
    Backup: CONFIG_MBEDTLS_USE_PSA_CRYPTO: True
    Backup: CONFIG_MBEDTLS_PLATFORM_PRINTF_ALT: False
    Backup: CONFIG_MBEDTLS_THREADING: False
    Backup: CONFIG_MBEDTLS_THREADING_ALT: False
    =========== Checkpoint: backup ===============
    Restore: CONFIG_MBEDTLS_PSA_CRYPTO_C: False
    Restore: CONFIG_MBEDTLS_PSA_CRYPTO_KEY_ID_ENCODES_OWNER: False
    Restore: CONFIG_MBEDTLS_PSA_CRYPTO_SPM: False
    Restore: CONFIG_MBEDTLS_USE_PSA_CRYPTO: True
    Restore: CONFIG_MBEDTLS_PLATFORM_PRINTF_ALT: False
    Restore: CONFIG_MBEDTLS_THREADING: False
    Restore: CONFIG_MBEDTLS_THREADING_ALT: False
    =========== End psa_crypto_library_config ===============
    -- Using ccache: /opt/homebrew/bin/ccache
    CMake Warning at /opt/nordic/ncs/v3.0.0/zephyr/CMakeLists.txt:1002 (message):
      No SOURCES given to Zephyr library: drivers__disk
    
      Excluding target from build.
    
    
    -- Configuring done (4.0s)
    -- Generating done (0.2s)
    -- Build files have been written to: /opt/nordic/ncs/v3.0.0/zephyr/samples/subsys/usb/mass/build/mass
    Dropping partition 'nonsecure_storage' since it is empty.
    -- Configuring done (5.8s)
    -- Generating done (0.0s)
    -- Build files have been written to: /opt/nordic/ncs/v3.0.0/zephyr/samples/subsys/usb/mass/build
    -- west build: building application
    [5/10] Performing build step for 'mass'
    [1/258] Preparing syscall dependency handling
    
    [6/258] Generating include/generated/zephyr/version.h
    -- Zephyr version: 4.0.99 (/opt/nordic/ncs/v3.0.0/zephyr), build: v4.0.99-ncs1
    [7/258] Generating ../../tfm/CMakeCache.txt
    -- Found Git: /usr/bin/git (found version "2.39.5 (Apple Git-154)")
    -- The C compiler identification is GNU 12.2.0
    -- The CXX compiler identification is GNU 12.2.0
    -- The ASM compiler identification is GNU
    -- Found assembler: /Users/tudor/zephyr-sdk-0.17.0/arm-zephyr-eabi/bin/arm-zephyr-eabi-gcc
    -- Found Python3: /opt/homebrew/bin/python3 (found version "3.13.3") found components: Interpreter
    -- Found Python3: /opt/homebrew/bin/python3 (found suitable version "3.13.3", minimum required is "3.10") found components: Interpreter
    -- Cache files will be written to: /Users/tudor/Library/Caches/zephyr
    CMake Warning (dev) at /opt/nordic/ncs/v3.0.0/nrf/modules/trusted-firmware-m/tfm_boards/nrf5340_cpuapp/CMakeLists.txt:21 (install):
      Policy CMP0177 is not set: install() DESTINATION paths are normalized.  Run
      "cmake --help-policy CMP0177" for policy details.  Use the cmake_policy
      command to set the policy and suppress this warning.
    This warning is for project developers.  Use -Wno-dev to suppress it.
    
    -- Configuring done (0.6s)
    -- Generating done (0.0s)
    -- Build files have been written to: /opt/nordic/ncs/v3.0.0/zephyr/samples/subsys/usb/mass/build/mass/tfm
    [12/258] Performing build step for 'tfm'
    [135/139] Linking C executable bin/tfm_s.axf
    Memory region         Used Size  Region Size  %age Used
               FLASH:       32100 B        32 KB     97.96%
                 RAM:       10404 B        32 KB     31.75%
    [139/139] Linking C static library secure_fw/libtfm_s_veneers.a
    [19/258] Performing install step for 'tfm'
    -- Install configuration: "MinSizeRel"
    ----- Installing platform NS -----
    [88/258] Building C object CMakeFiles/app.dir/src/main.c.obj
    FAILED: CMakeFiles/app.dir/src/main.c.obj
    ccache /Users/tudor/zephyr-sdk-0.17.0/arm-zephyr-eabi/bin/arm-zephyr-eabi-gcc -DKERNEL -DK_HEAP_MEM_POOL_SIZE=0 -DMBEDTLS_CONFIG_FILE=\"nrf-config.h\" -DMBEDTLS_PSA_CRYPTO_CONFIG_FILE=\"nrf-psa-crypto-config.h\" -DNRF5340_XXAA_APPLICATION -DNRF_SKIP_FICR_NS_COPY_TO_RAM -DNRF_TRUSTZONE_NONSECURE -DPICOLIBC_LONG_LONG_PRINTF_SCANF -DTFM_PSA_API -DUSE_PARTITION_MANAGER=1 -DZEPHYR_CONFIG_OVERRIDE=zephyr_fatfs_config.h -D__LINUX_ERRNO_EXTENSIONS__ -D__PROGRAM_START -D__ZEPHYR__=1 -I/opt/nordic/ncs/v3.0.0/zephyr/samples/subsys/usb/common -I/opt/nordic/ncs/v3.0.0/zephyr/samples/subsys/usb/mass/build/mass/tfm/api_ns/interface/include -I/opt/nordic/ncs/v3.0.0/zephyr/samples/subsys/usb/mass/build/mass/zephyr/include/generated/zephyr -I/opt/nordic/ncs/v3.0.0/zephyr/include -I/opt/nordic/ncs/v3.0.0/zephyr/samples/subsys/usb/mass/build/mass/zephyr/include/generated -I/opt/nordic/ncs/v3.0.0/zephyr/soc/nordic -I/opt/nordic/ncs/v3.0.0/zephyr/soc/nordic/nrf53/. -I/opt/nordic/ncs/v3.0.0/zephyr/soc/nordic/common/. -I/opt/nordic/ncs/v3.0.0/zephyr/subsys/usb/device -I/opt/nordic/ncs/v3.0.0/zephyr/drivers/usb/common/nrf_usbd_common/. -I/opt/nordic/ncs/v3.0.0/nrf/include -I/opt/nordic/ncs/v3.0.0/nrf/modules/trusted-firmware-m/. -I/opt/nordic/ncs/v3.0.0/nrf/include/tfm -I/opt/nordic/ncs/v3.0.0/nrf/tests/include -I/opt/nordic/ncs/v3.0.0/modules/hal/cmsis/CMSIS/Core/Include -I/opt/nordic/ncs/v3.0.0/zephyr/modules/cmsis/. -I/opt/nordic/ncs/v3.0.0/nrf/modules/hal_nordic/. -I/opt/nordic/ncs/v3.0.0/modules/hal/nordic/nrfx -I/opt/nordic/ncs/v3.0.0/modules/hal/nordic/nrfx/drivers/include -I/opt/nordic/ncs/v3.0.0/modules/hal/nordic/nrfx/mdk -I/opt/nordic/ncs/v3.0.0/zephyr/modules/hal_nordic/nrfx/. -I/opt/nordic/ncs/v3.0.0/zephyr/samples/subsys/usb/mass/build/mass/generated/interface_nrf_security_psa -I/opt/nordic/ncs/v3.0.0/nrf/subsys/nrf_security/include -I/opt/nordic/ncs/v3.0.0/modules/crypto/oberon-psa-crypto/include -I/opt/nordic/ncs/v3.0.0/nrf/subsys/nrf_security/src/utils -I/opt/nordic/ncs/v3.0.0/modules/crypto/oberon-psa-crypto/library -I/opt/nordic/ncs/v3.0.0/modules/crypto/mbedtls/library -I/opt/nordic/ncs/v3.0.0/modules/crypto/mbedtls/include -I/opt/nordic/ncs/v3.0.0/modules/crypto/mbedtls/include/library -I/opt/nordic/ncs/v3.0.0/nrfxlib/crypto/nrf_oberon/include -I/opt/nordic/ncs/v3.0.0/nrfxlib/crypto/nrf_oberon/include/mbedtls -I/opt/nordic/ncs/v3.0.0/zephyr/modules/fatfs -I/opt/nordic/ncs/v3.0.0/modules/fs/fatfs/include -isystem /opt/nordic/ncs/v3.0.0/zephyr/lib/libc/common/include -fno-strict-aliasing -Os -imacros /opt/nordic/ncs/v3.0.0/zephyr/samples/subsys/usb/mass/build/mass/zephyr/include/generated/zephyr/autoconf.h -fno-printf-return-value -fno-common -g -gdwarf-4 -fdiagnostics-color=always -mcpu=cortex-m33 -mthumb -mabi=aapcs -mfp16-format=ieee -mtp=soft --sysroot=/Users/tudor/zephyr-sdk-0.17.0/arm-zephyr-eabi/arm-zephyr-eabi -imacros /opt/nordic/ncs/v3.0.0/zephyr/include/zephyr/toolchain/zephyr_stdint.h -Wall -Wformat -Wformat-security -Wno-format-zero-length -Wdouble-promotion -Wno-pointer-sign -Wpointer-arith -Wexpansion-to-defined -Wno-unused-but-set-variable -Werror=implicit-int -fno-pic -fno-pie -fno-asynchronous-unwind-tables -ftls-model=local-exec -fno-reorder-functions --param=min-pagesize=0 -fno-defer-pop -fmacro-prefix-map=/opt/nordic/ncs/v3.0.0/zephyr/samples/subsys/usb/mass=CMAKE_SOURCE_DIR -fmacro-prefix-map=/opt/nordic/ncs/v3.0.0/zephyr=ZEPHYR_BASE -fmacro-prefix-map=/opt/nordic/ncs/v3.0.0=WEST_TOPDIR -ffunction-sections -fdata-sections -specs=picolibc.specs -std=c99 -MD -MT CMakeFiles/app.dir/src/main.c.obj -MF CMakeFiles/app.dir/src/main.c.obj.d -o CMakeFiles/app.dir/src/main.c.obj -c /opt/nordic/ncs/v3.0.0/zephyr/samples/subsys/usb/mass/src/main.c
    /opt/nordic/ncs/v3.0.0/zephyr/samples/subsys/usb/mass/src/main.c:36:2: error: #error No supported disk driver enabled
       36 | #error No supported disk driver enabled
          |  ^~~~~
    [99/258] Building C object zephyr/CMakeFiles/zephyr.dir/subsys/logging/log_core.c.obj
    ninja: build stopped: subcommand failed.
    FAILED: _sysbuild/sysbuild/images/mass-prefix/src/mass-stamp/mass-build /opt/nordic/ncs/v3.0.0/zephyr/samples/subsys/usb/mass/build/_sysbuild/sysbuild/images/mass-prefix/src/mass-stamp/mass-build
    cd /opt/nordic/ncs/v3.0.0/zephyr/samples/subsys/usb/mass/build/mass && /opt/homebrew/bin/cmake --build .
    ninja: build stopped: subcommand failed.
    FATAL ERROR: command exited with status 1: /opt/homebrew/bin/cmake --build /opt/nordic/ncs/v3.0.0/zephyr/samples/subsys/usb/mass/build
    root@admins-MacBook-Air-2 mass #
    root@admins-MacBook-Air-2 mass #
    root@admins-MacBook-Air-2 mass #

  • I ended up commenting out this chunk of code in main.c:

    // #if !defined(CONFIG_DISK_DRIVER_FLASH) && \
    // 	!defined(CONFIG_DISK_DRIVER_RAM) && \
    // 	!defined(CONFIG_DISK_DRIVER_SDMMC)
    // #error No supported disk driver enabled
    // #endif

    since this got things moving along.

    The sample project builds but the mass storage doesn't really work. Here's the startup log:

    *** Booting nRF Connect SDK v3.0.0-3bfc46578e42 ***
    *** Using Zephyr OS v4.0.99-a0e545cb437a ***
    [00:00:00.458,618] <err> usb_msc: Storage init ERROR !!!! - Aborting USB init
    [00:00:00.458,679] <err> fs: fs mount error (-5)
    [00:00:00.458,709] <err> main: Failed to mount filesystem
    [00:00:00.458,862] <inf> main: The device is put in USB mass storage mode.

    Edit: I ended up adding some debug prints to figure out what's going on. Based on those logs, I found that:

    - struct disk_info *disk_access_get_di(const char *name) should iterate through a list of disks but the list is empty.
    - the function int disk_access_init(const char *pdrv) returns the default return code that initialises at its start: 
    int rc = -EINVAL; (which is -22). This happens due to the function from the previous point not returning a valid disk node.
    Also worth mentioning that I added the proposed fix from the ticket you linked:
    CONFIG_SPI_NOR_FLASH_LAYOUT_PAGE_SIZE=4096

    Nothing changed and the logs from this message are generated with this CONFIG_ option set.
  • Another slight update.
    After endlessly struggling with this, I decided to try build for another board that needs no configuration.

    After looking at this documentation (note that we're on SDK version v3.0.0): https://docs.nordicsemi.com/bundle/ncs-3.0.0/page/zephyr/samples/subsys/usb/mass/README.html

    I found the "LittleFS Example" section and that is exactly what we want since we'd like the LittleFS file system also. Although I don't have an nrf52840dk on hand, I decided to build for it since it had an *.overlay already set up in the sample folder, so it should work.

    Sadly, it didn't. Build log:

    root@admins-MacBook-Air-2 mass #
    root@admins-MacBook-Air-2 mass # west build -b nrf52840dk/nrf52840 --pristine -- -DCONFIG_APP_MSC_STORAGE_FLASH_LITTLEFS=y
    -- west build: making build dir /opt/nordic/ncs/v3.0.0/zephyr/samples/subsys/usb/mass/build pristine
    -- west build: generating a build system
    Loading Zephyr module(s) (Zephyr base): sysbuild_default
    -- Found Python3: /opt/homebrew/opt/[email protected]/bin/python3.13 (found suitable version "3.13.3", minimum required is "3.10") found components: Interpreter
    -- Cache files will be written to: /Users/tudor/Library/Caches/zephyr
    -- Found west (found suitable version "1.3.0", minimum required is "0.14.0")
    -- Board: nrf52840dk, qualifiers: nrf52840
    Parsing /opt/nordic/ncs/v3.0.0/zephyr/share/sysbuild/Kconfig
    Loaded configuration '/opt/nordic/ncs/v3.0.0/zephyr/samples/subsys/usb/mass/build/_sysbuild/empty.conf'
    Merged configuration '/opt/nordic/ncs/v3.0.0/zephyr/samples/subsys/usb/mass/build/_sysbuild/empty.conf'
    Configuration saved to '/opt/nordic/ncs/v3.0.0/zephyr/samples/subsys/usb/mass/build/zephyr/.config'
    Kconfig header saved to '/opt/nordic/ncs/v3.0.0/zephyr/samples/subsys/usb/mass/build/_sysbuild/autoconf.h'
    --
       **************************
       * Running CMake for mass *
       **************************
    
    Loading Zephyr default modules (Zephyr base).
    -- Application: /opt/nordic/ncs/v3.0.0/zephyr/samples/subsys/usb/mass
    -- CMake version: 4.0.2
    -- Found Python3: /opt/homebrew/bin/python3 (found suitable version "3.13.3", minimum required is "3.10") found components: Interpreter
    -- Cache files will be written to: /Users/tudor/Library/Caches/zephyr
    -- Zephyr version: 4.0.99 (/opt/nordic/ncs/v3.0.0/zephyr)
    -- Found west (found suitable version "1.3.0", minimum required is "0.14.0")
    -- Board: nrf52840dk, qualifiers: nrf52840
    -- ZEPHYR_TOOLCHAIN_VARIANT not set, trying to locate Zephyr SDK
    -- Found host-tools: zephyr 0.17.0 (/Users/tudor/zephyr-sdk-0.17.0)
    -- Found toolchain: zephyr 0.17.0 (/Users/tudor/zephyr-sdk-0.17.0)
    -- Could NOT find Dtc (missing: DTC) (Required is at least version "1.4.6")
    Hint: The project() command has not yet been called.  It sets up system-specific search paths.
    -- Found BOARD.dts: /opt/nordic/ncs/v3.0.0/zephyr/boards/nordic/nrf52840dk/nrf52840dk_nrf52840.dts
    -- Found devicetree overlay: /opt/nordic/ncs/v3.0.0/zephyr/samples/subsys/usb/mass/boards/nrf52840dk_nrf52840.overlay
    -- Generated zephyr.dts: /opt/nordic/ncs/v3.0.0/zephyr/samples/subsys/usb/mass/build/mass/zephyr/zephyr.dts
    -- Generated pickled edt: /opt/nordic/ncs/v3.0.0/zephyr/samples/subsys/usb/mass/build/mass/zephyr/edt.pickle
    -- Generated zephyr.dts: /opt/nordic/ncs/v3.0.0/zephyr/samples/subsys/usb/mass/build/mass/zephyr/zephyr.dts
    -- Generated devicetree_generated.h: /opt/nordic/ncs/v3.0.0/zephyr/samples/subsys/usb/mass/build/mass/zephyr/include/generated/zephyr/devicetree_generated.h
    -- Including generated dts.cmake file: /opt/nordic/ncs/v3.0.0/zephyr/samples/subsys/usb/mass/build/mass/zephyr/dts.cmake
    Parsing /opt/nordic/ncs/v3.0.0/zephyr/samples/subsys/usb/mass/Kconfig
    Loaded configuration '/opt/nordic/ncs/v3.0.0/zephyr/boards/nordic/nrf52840dk/nrf52840dk_nrf52840_defconfig'
    Merged configuration '/opt/nordic/ncs/v3.0.0/zephyr/samples/subsys/usb/mass/prj.conf'
    Merged configuration '/opt/nordic/ncs/v3.0.0/zephyr/samples/subsys/usb/mass/build/mass/zephyr/misc/generated/extra_kconfig_options.conf'
    Merged configuration '/opt/nordic/ncs/v3.0.0/zephyr/samples/subsys/usb/mass/build/mass/zephyr/.config.sysbuild'
    Configuration saved to '/opt/nordic/ncs/v3.0.0/zephyr/samples/subsys/usb/mass/build/mass/zephyr/.config'
    Kconfig header saved to '/opt/nordic/ncs/v3.0.0/zephyr/samples/subsys/usb/mass/build/mass/zephyr/include/generated/zephyr/autoconf.h'
    -- Found GnuLd: /Users/tudor/zephyr-sdk-0.17.0/arm-zephyr-eabi/arm-zephyr-eabi/bin/ld.bfd (found version "2.38")
    -- The C compiler identification is GNU 12.2.0
    -- The CXX compiler identification is GNU 12.2.0
    -- The ASM compiler identification is GNU
    -- Found assembler: /Users/tudor/zephyr-sdk-0.17.0/arm-zephyr-eabi/bin/arm-zephyr-eabi-gcc
    CMake Warning at /opt/nordic/ncs/v3.0.0/zephyr/subsys/usb/device/CMakeLists.txt:22 (message):
      CONFIG_USB_DEVICE_VID has default value 0x2FE3.
    
      This value is only for testing and MUST be configured for USB products.
    
    
    -- Using ccache: /opt/homebrew/bin/ccache
    -- Configuring done (4.3s)
    -- Generating done (0.2s)
    -- Build files have been written to: /opt/nordic/ncs/v3.0.0/zephyr/samples/subsys/usb/mass/build/mass
    -- Configuring done (6.3s)
    -- Generating done (0.0s)
    -- Build files have been written to: /opt/nordic/ncs/v3.0.0/zephyr/samples/subsys/usb/mass/build
    -- west build: building application
    [5/10] Performing build step for 'mass'
    [1/196] Preparing syscall dependency handling
    
    [6/196] Generating include/generated/zephyr/version.h
    -- Zephyr version: 4.0.99 (/opt/nordic/ncs/v3.0.0/zephyr), build: v4.0.99-ncs1
    [97/196] Building C object zephyr/drivers/disk/CMakeFiles/drivers__disk.dir/flashdisk.c.obj
    FAILED: zephyr/drivers/disk/CMakeFiles/drivers__disk.dir/flashdisk.c.obj
    ccache /Users/tudor/zephyr-sdk-0.17.0/arm-zephyr-eabi/bin/arm-zephyr-eabi-gcc -DKERNEL -DK_HEAP_MEM_POOL_SIZE=0 -DNRF52840_XXAA -DPICOLIBC_LONG_LONG_PRINTF_SCANF -DUSE_PARTITION_MANAGER=1 -D__LINUX_ERRNO_EXTENSIONS__ -D__PROGRAM_START -D__ZEPHYR_SUPERVISOR__ -D__ZEPHYR__=1 -I/opt/nordic/ncs/v3.0.0/zephyr/samples/subsys/usb/mass/build/mass/zephyr/include/generated/zephyr -I/opt/nordic/ncs/v3.0.0/zephyr/include -I/opt/nordic/ncs/v3.0.0/zephyr/samples/subsys/usb/mass/build/mass/zephyr/include/generated -I/opt/nordic/ncs/v3.0.0/zephyr/soc/nordic -I/opt/nordic/ncs/v3.0.0/zephyr/soc/nordic/nrf52/. -I/opt/nordic/ncs/v3.0.0/zephyr/soc/nordic/common/. -I/opt/nordic/ncs/v3.0.0/zephyr/subsys/usb/device -I/opt/nordic/ncs/v3.0.0/zephyr/drivers/usb/common/nrf_usbd_common/. -I/opt/nordic/ncs/v3.0.0/nrf/include -I/opt/nordic/ncs/v3.0.0/nrf/tests/include -I/opt/nordic/ncs/v3.0.0/modules/hal/cmsis/CMSIS/Core/Include -I/opt/nordic/ncs/v3.0.0/zephyr/modules/cmsis/. -I/opt/nordic/ncs/v3.0.0/nrf/modules/hal_nordic/. -I/opt/nordic/ncs/v3.0.0/modules/hal/nordic/nrfx -I/opt/nordic/ncs/v3.0.0/modules/hal/nordic/nrfx/drivers/include -I/opt/nordic/ncs/v3.0.0/modules/hal/nordic/nrfx/mdk -I/opt/nordic/ncs/v3.0.0/zephyr/modules/hal_nordic/nrfx/. -I/opt/nordic/ncs/v3.0.0/modules/debug/segger/SEGGER -I/opt/nordic/ncs/v3.0.0/modules/debug/segger/Config -isystem /opt/nordic/ncs/v3.0.0/zephyr/lib/libc/common/include -isystem /opt/nordic/ncs/v3.0.0/nrfxlib/crypto/nrf_cc310_platform/include -Wshadow -fno-strict-aliasing -Os -imacros /opt/nordic/ncs/v3.0.0/zephyr/samples/subsys/usb/mass/build/mass/zephyr/include/generated/zephyr/autoconf.h -fno-printf-return-value -fno-common -g -gdwarf-4 -fdiagnostics-color=always -mcpu=cortex-m4 -mthumb -mabi=aapcs -mfp16-format=ieee -mtp=soft --sysroot=/Users/tudor/zephyr-sdk-0.17.0/arm-zephyr-eabi/arm-zephyr-eabi -imacros /opt/nordic/ncs/v3.0.0/zephyr/include/zephyr/toolchain/zephyr_stdint.h -Wall -Wformat -Wformat-security -Wno-format-zero-length -Wdouble-promotion -Wno-pointer-sign -Wpointer-arith -Wexpansion-to-defined -Wno-unused-but-set-variable -Werror=implicit-int -fno-pic -fno-pie -fno-asynchronous-unwind-tables -ftls-model=local-exec -fno-reorder-functions --param=min-pagesize=0 -fno-defer-pop -fmacro-prefix-map=/opt/nordic/ncs/v3.0.0/zephyr/samples/subsys/usb/mass=CMAKE_SOURCE_DIR -fmacro-prefix-map=/opt/nordic/ncs/v3.0.0/zephyr=ZEPHYR_BASE -fmacro-prefix-map=/opt/nordic/ncs/v3.0.0=WEST_TOPDIR -ffunction-sections -fdata-sections -specs=picolibc.specs -std=c99 -MD -MT zephyr/drivers/disk/CMakeFiles/drivers__disk.dir/flashdisk.c.obj -MF zephyr/drivers/disk/CMakeFiles/drivers__disk.dir/flashdisk.c.obj.d -o zephyr/drivers/disk/CMakeFiles/drivers__disk.dir/flashdisk.c.obj -c /opt/nordic/ncs/v3.0.0/zephyr/drivers/disk/flashdisk.c
    /opt/nordic/ncs/v3.0.0/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)
          | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    /opt/nordic/ncs/v3.0.0/zephyr/drivers/disk/flashdisk.c: In function 'PM_FOREACH_AFFILIATED_TO_disk':
    /opt/nordic/ncs/v3.0.0/zephyr/drivers/disk/flashdisk.c:572:30: error: storage class specified for parameter 'flash_disks'
      572 | static struct flashdisk_data flash_disks[] = {
          |                              ^~~~~~~~~~~
    /opt/nordic/ncs/v3.0.0/zephyr/drivers/disk/flashdisk.c:572:15: error: parameter 'flash_disks' is initialized
      572 | static struct flashdisk_data flash_disks[] = {
          |               ^~~~~~~~~~~~~~
    /opt/nordic/ncs/v3.0.0/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)
          |                                       ^~~~~~~~~~~~~~~~~~~~~~~~
    /opt/nordic/ncs/v3.0.0/zephyr/drivers/disk/flashdisk.c:573:39: note: each undeclared identifier is reported only once for each function it appears in
    /opt/nordic/ncs/v3.0.0/zephyr/drivers/disk/flashdisk.c:582:1: error: expected declaration specifiers before 'PM_FOREACH_AFFILIATED_TO_disk'
      582 | PM_FOREACH_AFFILIATED_TO_disk(VERIFY_CACHE_SIZE_IS_NOT_ZERO_IF_NOT_READ_ONLY)
          | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    In file included from /opt/nordic/ncs/v3.0.0/zephyr/include/zephyr/toolchain/gcc.h:98,
                     from /opt/nordic/ncs/v3.0.0/zephyr/include/zephyr/toolchain.h:50,
                     from /opt/nordic/ncs/v3.0.0/zephyr/include/zephyr/sys/__assert.h:11,
                     from /opt/nordic/ncs/v3.0.0/zephyr/drivers/disk/flashdisk.c:10:
    /opt/nordic/ncs/v3.0.0/zephyr/include/zephyr/init.h:141:44: error: storage class specified for parameter '__init_disk_flash_init'
      141 | #define Z_INIT_ENTRY_NAME(init_id) _CONCAT(__init_, init_id)
          |                                            ^~~~~~~
    /opt/nordic/ncs/v3.0.0/zephyr/include/zephyr/toolchain/common.h:137:26: note: in definition of macro '_DO_CONCAT'
      137 | #define _DO_CONCAT(x, y) x ## y
          |                          ^
    /opt/nordic/ncs/v3.0.0/zephyr/include/zephyr/init.h:141:36: note: in expansion of macro '_CONCAT'
      141 | #define Z_INIT_ENTRY_NAME(init_id) _CONCAT(__init_, init_id)
          |                                    ^~~~~~~
    /opt/nordic/ncs/v3.0.0/zephyr/include/zephyr/init.h:241:17: note: in expansion of macro 'Z_INIT_ENTRY_NAME'
      241 |                 Z_INIT_ENTRY_NAME(name) = {.init_fn = {.sys = (init_fn_)},                \
          |                 ^~~~~~~~~~~~~~~~~
    /opt/nordic/ncs/v3.0.0/zephyr/include/zephyr/init.h:223:9: note: in expansion of macro 'SYS_INIT_NAMED'
      223 |         SYS_INIT_NAMED(init_fn, init_fn, level, prio)
          |         ^~~~~~~~~~~~~~
    /opt/nordic/ncs/v3.0.0/zephyr/drivers/disk/flashdisk.c:613:1: note: in expansion of macro 'SYS_INIT'
      613 | SYS_INIT(disk_flash_init, POST_KERNEL, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT);
          | ^~~~~~~~
    /opt/nordic/ncs/v3.0.0/zephyr/include/zephyr/init.h:239:42: error: parameter '__init_disk_flash_init' is initialized
      239 |         static const Z_DECL_ALIGN(struct init_entry)                                      \
          |                                          ^~~~~~~~~~
    /opt/nordic/ncs/v3.0.0/zephyr/include/zephyr/toolchain/common.h:195:55: note: in definition of macro 'Z_DECL_ALIGN'
      195 | #define Z_DECL_ALIGN(type) __aligned(__alignof(type)) type
          |                                                       ^~~~
    /opt/nordic/ncs/v3.0.0/zephyr/include/zephyr/init.h:223:9: note: in expansion of macro 'SYS_INIT_NAMED'
      223 |         SYS_INIT_NAMED(init_fn, init_fn, level, prio)
          |         ^~~~~~~~~~~~~~
    /opt/nordic/ncs/v3.0.0/zephyr/drivers/disk/flashdisk.c:613:1: note: in expansion of macro 'SYS_INIT'
      613 | SYS_INIT(disk_flash_init, POST_KERNEL, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT);
          | ^~~~~~~~
    /opt/nordic/ncs/v3.0.0/zephyr/include/zephyr/init.h:141:44: error: section attribute not allowed for '__init_disk_flash_init'
      141 | #define Z_INIT_ENTRY_NAME(init_id) _CONCAT(__init_, init_id)
          |                                            ^~~~~~~
    /opt/nordic/ncs/v3.0.0/zephyr/include/zephyr/toolchain/common.h:137:26: note: in definition of macro '_DO_CONCAT'
      137 | #define _DO_CONCAT(x, y) x ## y
          |                          ^
    /opt/nordic/ncs/v3.0.0/zephyr/include/zephyr/init.h:141:36: note: in expansion of macro '_CONCAT'
      141 | #define Z_INIT_ENTRY_NAME(init_id) _CONCAT(__init_, init_id)
          |                                    ^~~~~~~
    /opt/nordic/ncs/v3.0.0/zephyr/include/zephyr/init.h:241:17: note: in expansion of macro 'Z_INIT_ENTRY_NAME'
      241 |                 Z_INIT_ENTRY_NAME(name) = {.init_fn = {.sys = (init_fn_)},                \
          |                 ^~~~~~~~~~~~~~~~~
    /opt/nordic/ncs/v3.0.0/zephyr/include/zephyr/init.h:223:9: note: in expansion of macro 'SYS_INIT_NAMED'
      223 |         SYS_INIT_NAMED(init_fn, init_fn, level, prio)
          |         ^~~~~~~~~~~~~~
    /opt/nordic/ncs/v3.0.0/zephyr/drivers/disk/flashdisk.c:613:1: note: in expansion of macro 'SYS_INIT'
      613 | SYS_INIT(disk_flash_init, POST_KERNEL, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT);
          | ^~~~~~~~
    /opt/nordic/ncs/v3.0.0/zephyr/include/zephyr/init.h:239:42: warning: 'used' attribute ignored [-Wattributes]
      239 |         static const Z_DECL_ALIGN(struct init_entry)                                      \
          |                                          ^~~~~~~~~~
    /opt/nordic/ncs/v3.0.0/zephyr/include/zephyr/toolchain/common.h:195:55: note: in definition of macro 'Z_DECL_ALIGN'
      195 | #define Z_DECL_ALIGN(type) __aligned(__alignof(type)) type
          |                                                       ^~~~
    /opt/nordic/ncs/v3.0.0/zephyr/include/zephyr/init.h:223:9: note: in expansion of macro 'SYS_INIT_NAMED'
      223 |         SYS_INIT_NAMED(init_fn, init_fn, level, prio)
          |         ^~~~~~~~~~~~~~
    /opt/nordic/ncs/v3.0.0/zephyr/drivers/disk/flashdisk.c:613:1: note: in expansion of macro 'SYS_INIT'
      613 | SYS_INIT(disk_flash_init, POST_KERNEL, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT);
          | ^~~~~~~~
    /opt/nordic/ncs/v3.0.0/zephyr/include/zephyr/init.h:141:44: error: alignment may not be specified for '__init_disk_flash_init'
      141 | #define Z_INIT_ENTRY_NAME(init_id) _CONCAT(__init_, init_id)
          |                                            ^~~~~~~
    /opt/nordic/ncs/v3.0.0/zephyr/include/zephyr/toolchain/common.h:137:26: note: in definition of macro '_DO_CONCAT'
      137 | #define _DO_CONCAT(x, y) x ## y
          |                          ^
    /opt/nordic/ncs/v3.0.0/zephyr/include/zephyr/init.h:141:36: note: in expansion of macro '_CONCAT'
      141 | #define Z_INIT_ENTRY_NAME(init_id) _CONCAT(__init_, init_id)
          |                                    ^~~~~~~
    /opt/nordic/ncs/v3.0.0/zephyr/include/zephyr/init.h:241:17: note: in expansion of macro 'Z_INIT_ENTRY_NAME'
      241 |                 Z_INIT_ENTRY_NAME(name) = {.init_fn = {.sys = (init_fn_)},                \
          |                 ^~~~~~~~~~~~~~~~~
    /opt/nordic/ncs/v3.0.0/zephyr/include/zephyr/init.h:223:9: note: in expansion of macro 'SYS_INIT_NAMED'
      223 |         SYS_INIT_NAMED(init_fn, init_fn, level, prio)
          |         ^~~~~~~~~~~~~~
    /opt/nordic/ncs/v3.0.0/zephyr/drivers/disk/flashdisk.c:613:1: note: in expansion of macro 'SYS_INIT'
      613 | SYS_INIT(disk_flash_init, POST_KERNEL, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT);
          | ^~~~~~~~
    In file included from /opt/nordic/ncs/v3.0.0/zephyr/include/zephyr/device.h:13,
                     from /opt/nordic/ncs/v3.0.0/zephyr/include/zephyr/sw_isr_table.h:18,
                     from /opt/nordic/ncs/v3.0.0/zephyr/include/zephyr/arch/arm/irq.h:19,
                     from /opt/nordic/ncs/v3.0.0/zephyr/include/zephyr/arch/arm/arch.h:24,
                     from /opt/nordic/ncs/v3.0.0/zephyr/include/zephyr/arch/cpu.h:19,
                     from /opt/nordic/ncs/v3.0.0/zephyr/include/zephyr/kernel_includes.h:36,
                     from /opt/nordic/ncs/v3.0.0/zephyr/include/zephyr/kernel.h:17,
                     from /opt/nordic/ncs/v3.0.0/zephyr/include/zephyr/drivers/disk.h:30,
                     from /opt/nordic/ncs/v3.0.0/zephyr/drivers/disk/flashdisk.c:12:
    /opt/nordic/ncs/v3.0.0/zephyr/drivers/disk/flashdisk.c:613:10: error: 'disk_flash_init' undeclared (first use in this function)
      613 | SYS_INIT(disk_flash_init, POST_KERNEL, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT);
          |          ^~~~~~~~~~~~~~~
    /opt/nordic/ncs/v3.0.0/zephyr/include/zephyr/init.h:241:64: note: in definition of macro 'SYS_INIT_NAMED'
      241 |                 Z_INIT_ENTRY_NAME(name) = {.init_fn = {.sys = (init_fn_)},                \
          |                                                                ^~~~~~~~
    /opt/nordic/ncs/v3.0.0/zephyr/drivers/disk/flashdisk.c:613:1: note: in expansion of macro 'SYS_INIT'
      613 | SYS_INIT(disk_flash_init, POST_KERNEL, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT);
          | ^~~~~~~~
    /opt/nordic/ncs/v3.0.0/zephyr/drivers/disk/flashdisk.c:533:1: error: type of 'DEFINE_FLASHDISKS_CACHE' defaults to 'int' [-Werror=implicit-int]
      533 | PM_FOREACH_AFFILIATED_TO_disk(DEFINE_FLASHDISKS_CACHE)
          | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    /opt/nordic/ncs/v3.0.0/zephyr/include/zephyr/init.h:141:44: error: declaration for parameter '__init_disk_flash_init' but no such parameter
      141 | #define Z_INIT_ENTRY_NAME(init_id) _CONCAT(__init_, init_id)
          |                                            ^~~~~~~
    /opt/nordic/ncs/v3.0.0/zephyr/include/zephyr/toolchain/common.h:137:26: note: in definition of macro '_DO_CONCAT'
      137 | #define _DO_CONCAT(x, y) x ## y
          |                          ^
    /opt/nordic/ncs/v3.0.0/zephyr/include/zephyr/init.h:141:36: note: in expansion of macro '_CONCAT'
      141 | #define Z_INIT_ENTRY_NAME(init_id) _CONCAT(__init_, init_id)
          |                                    ^~~~~~~
    /opt/nordic/ncs/v3.0.0/zephyr/include/zephyr/init.h:241:17: note: in expansion of macro 'Z_INIT_ENTRY_NAME'
      241 |                 Z_INIT_ENTRY_NAME(name) = {.init_fn = {.sys = (init_fn_)},                \
          |                 ^~~~~~~~~~~~~~~~~
    /opt/nordic/ncs/v3.0.0/zephyr/include/zephyr/init.h:223:9: note: in expansion of macro 'SYS_INIT_NAMED'
      223 |         SYS_INIT_NAMED(init_fn, init_fn, level, prio)
          |         ^~~~~~~~~~~~~~
    /opt/nordic/ncs/v3.0.0/zephyr/drivers/disk/flashdisk.c:613:1: note: in expansion of macro 'SYS_INIT'
      613 | SYS_INIT(disk_flash_init, POST_KERNEL, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT);
          | ^~~~~~~~
    /opt/nordic/ncs/v3.0.0/zephyr/drivers/disk/flashdisk.c:572:30: error: declaration for parameter 'flash_disks' but no such parameter
      572 | static struct flashdisk_data flash_disks[] = {
          |                              ^~~~~~~~~~~
    /opt/nordic/ncs/v3.0.0/zephyr/drivers/disk/flashdisk.c:614: error: expected '{' at end of input
    /opt/nordic/ncs/v3.0.0/zephyr/drivers/disk/flashdisk.c:614: warning: control reaches end of non-void function [-Wreturn-type]
    /opt/nordic/ncs/v3.0.0/zephyr/drivers/disk/flashdisk.c: At top level:
    /opt/nordic/ncs/v3.0.0/zephyr/drivers/disk/flashdisk.c:464:37: warning: 'flash_disk_ops' defined but not used [-Wunused-const-variable=]
      464 | static const struct disk_operations flash_disk_ops = {
          |                                     ^~~~~~~~~~~~~~
    cc1: some warnings being treated as errors
    [108/196] Building C object zephyr/drivers/usb/device/CMakeFiles/drivers__usb__device.dir/usb_dc_nrfx.c.obj
    ninja: build stopped: subcommand failed.
    FAILED: _sysbuild/sysbuild/images/mass-prefix/src/mass-stamp/mass-build /opt/nordic/ncs/v3.0.0/zephyr/samples/subsys/usb/mass/build/_sysbuild/sysbuild/images/mass-prefix/src/mass-stamp/mass-build
    cd /opt/nordic/ncs/v3.0.0/zephyr/samples/subsys/usb/mass/build/mass && /opt/homebrew/bin/cmake --build .
    ninja: build stopped: subcommand failed.
    FATAL ERROR: command exited with status 1: /opt/homebrew/bin/cmake --build /opt/nordic/ncs/v3.0.0/zephyr/samples/subsys/usb/mass/build
    root@admins-MacBook-Air-2 mass #

  • Slight update:

    After a myriad of trial and errors, I got to a state that seems to be WAAAY closer to the desired one:

    4452.mass.zip

    (above is the whole sample project with the added modifications)

    Build command and output:

    west build -b nrf7002dk/nrf5340/cpuapp/ns --pristine -- -DCONFIG_APP_MSC_STORAGE_FLASH_LITTLEFS=y ; west flash
    -- west build: making build dir /opt/nordic/ncs/v3.0.0/zephyr/samples/subsys/usb/mass/build pristine
    -- west build: generating a build system
    Loading Zephyr module(s) (Zephyr base): sysbuild_default
    -- Found Python3: /opt/homebrew/opt/[email protected]/bin/python3.13 (found suitable version "3.13.3", minimum required is "3.10") found components: Interpreter
    -- Cache files will be written to: /Users/tudor/Library/Caches/zephyr
    -- Found west (found suitable version "1.3.0", minimum required is "0.14.0")
    -- Board: nrf7002dk, qualifiers: nrf5340/cpuapp/ns
    Parsing /opt/nordic/ncs/v3.0.0/zephyr/share/sysbuild/Kconfig
    Loaded configuration '/opt/nordic/ncs/v3.0.0/zephyr/samples/subsys/usb/mass/build/_sysbuild/empty.conf'
    Merged configuration '/opt/nordic/ncs/v3.0.0/zephyr/samples/subsys/usb/mass/build/_sysbuild/empty.conf'
    Configuration saved to '/opt/nordic/ncs/v3.0.0/zephyr/samples/subsys/usb/mass/build/zephyr/.config'
    Kconfig header saved to '/opt/nordic/ncs/v3.0.0/zephyr/samples/subsys/usb/mass/build/_sysbuild/autoconf.h'
    --
       **************************
       * Running CMake for mass *
       **************************
    
    Loading Zephyr default modules (Zephyr base).
    -- Application: /opt/nordic/ncs/v3.0.0/zephyr/samples/subsys/usb/mass
    -- CMake version: 4.0.3
    -- Found Python3: /opt/homebrew/bin/python3 (found suitable version "3.13.3", minimum required is "3.10") found components: Interpreter
    -- Cache files will be written to: /Users/tudor/Library/Caches/zephyr
    -- Zephyr version: 4.0.99 (/opt/nordic/ncs/v3.0.0/zephyr)
    -- Found west (found suitable version "1.3.0", minimum required is "0.14.0")
    -- Board: nrf7002dk, qualifiers: nrf5340/cpuapp/ns
    -- ZEPHYR_TOOLCHAIN_VARIANT not set, trying to locate Zephyr SDK
    -- Found host-tools: zephyr 0.17.0 (/Users/tudor/zephyr-sdk-0.17.0)
    -- Found toolchain: zephyr 0.17.0 (/Users/tudor/zephyr-sdk-0.17.0)
    -- Could NOT find Dtc (missing: DTC) (Required is at least version "1.4.6")
    Hint: The project() command has not yet been called.  It sets up system-specific search paths.
    -- Found BOARD.dts: /opt/nordic/ncs/v3.0.0/zephyr/boards/nordic/nrf7002dk/nrf7002dk_nrf5340_cpuapp_ns.dts
    -- Found devicetree overlay: /opt/nordic/ncs/v3.0.0/zephyr/samples/subsys/usb/mass/boards/nrf7002dk_nrf5340_cpuapp_ns.overlay
    -- Generated zephyr.dts: /opt/nordic/ncs/v3.0.0/zephyr/samples/subsys/usb/mass/build/mass/zephyr/zephyr.dts
    -- Generated pickled edt: /opt/nordic/ncs/v3.0.0/zephyr/samples/subsys/usb/mass/build/mass/zephyr/edt.pickle
    -- Generated zephyr.dts: /opt/nordic/ncs/v3.0.0/zephyr/samples/subsys/usb/mass/build/mass/zephyr/zephyr.dts
    -- Generated devicetree_generated.h: /opt/nordic/ncs/v3.0.0/zephyr/samples/subsys/usb/mass/build/mass/zephyr/include/generated/zephyr/devicetree_generated.h
    -- Including generated dts.cmake file: /opt/nordic/ncs/v3.0.0/zephyr/samples/subsys/usb/mass/build/mass/zephyr/dts.cmake
    
    warning: DISK_DRIVER_FLASH (defined at drivers/disk/Kconfig.flash:4) was assigned the value 'y' but
    got the value 'n'. Check these unsatisfied dependencies: DT_HAS_ZEPHYR_FLASH_DISK_ENABLED (=n). See
    http://docs.zephyrproject.org/latest/kconfig.html#CONFIG_DISK_DRIVER_FLASH and/or look up
    DISK_DRIVER_FLASH in the menuconfig/guiconfig interface. The Application Development Primer, Setting
    Configuration Values, and Kconfig - Tips and Best Practices sections of the manual might be helpful
    too.
    
    Parsing /opt/nordic/ncs/v3.0.0/zephyr/samples/subsys/usb/mass/Kconfig
    Loaded configuration '/opt/nordic/ncs/v3.0.0/zephyr/boards/nordic/nrf7002dk/nrf7002dk_nrf5340_cpuapp_ns_defconfig'
    Merged configuration '/opt/nordic/ncs/v3.0.0/zephyr/samples/subsys/usb/mass/prj.conf'
    Merged configuration '/opt/nordic/ncs/v3.0.0/zephyr/samples/subsys/usb/mass/boards/nrf7002dk_nrf5340_cpuapp_ns.conf'
    Merged configuration '/opt/nordic/ncs/v3.0.0/zephyr/samples/subsys/usb/mass/build/mass/zephyr/misc/generated/extra_kconfig_options.conf'
    Merged configuration '/opt/nordic/ncs/v3.0.0/zephyr/samples/subsys/usb/mass/build/mass/zephyr/.config.sysbuild'
    Configuration saved to '/opt/nordic/ncs/v3.0.0/zephyr/samples/subsys/usb/mass/build/mass/zephyr/.config'
    Kconfig header saved to '/opt/nordic/ncs/v3.0.0/zephyr/samples/subsys/usb/mass/build/mass/zephyr/include/generated/zephyr/autoconf.h'
    -- Found GnuLd: /Users/tudor/zephyr-sdk-0.17.0/arm-zephyr-eabi/arm-zephyr-eabi/bin/ld.bfd (found version "2.38")
    -- The C compiler identification is GNU 12.2.0
    -- The CXX compiler identification is GNU 12.2.0
    -- The ASM compiler identification is GNU
    -- Found assembler: /Users/tudor/zephyr-sdk-0.17.0/arm-zephyr-eabi/bin/arm-zephyr-eabi-gcc
    CMake Warning at /opt/nordic/ncs/v3.0.0/zephyr/subsys/usb/device/CMakeLists.txt:22 (message):
      CONFIG_USB_DEVICE_VID has default value 0x2FE3.
    
      This value is only for testing and MUST be configured for USB products.
    
    
    =========== Generating psa_crypto_config ===============
    Backup: CONFIG_MBEDTLS_PSA_CRYPTO_SPM: False
    Backup: CONFIG_MBEDTLS_PSA_CRYPTO_C: False
    Backup: CONFIG_MBEDTLS_PSA_CRYPTO_KEY_ID_ENCODES_OWNER: False
    Backup: CONFIG_MBEDTLS_PLATFORM_SETUP_TEARDOWN_ALT: False
    Backup: CONFIG_MBEDTLS_THREADING: False
    Backup: CONFIG_MBEDTLS_THREADING_ALT: False
    =========== Checkpoint: backup ===============
    Restore: CONFIG_MBEDTLS_PSA_CRYPTO_SPM: False
    Restore: CONFIG_MBEDTLS_PSA_CRYPTO_C: False
    Restore: CONFIG_MBEDTLS_PSA_CRYPTO_KEY_ID_ENCODES_OWNER: False
    Restore: CONFIG_MBEDTLS_PLATFORM_SETUP_TEARDOWN_ALT: False
    Restore: CONFIG_MBEDTLS_THREADING: False
    Restore: CONFIG_MBEDTLS_THREADING_ALT: False
    =========== End psa_crypto_config ===============
    =========== Generating psa_crypto_library_config ===============
    Backup: CONFIG_MBEDTLS_PSA_CRYPTO_C: False
    Backup: CONFIG_MBEDTLS_PSA_CRYPTO_KEY_ID_ENCODES_OWNER: False
    Backup: CONFIG_MBEDTLS_PSA_CRYPTO_SPM: False
    Backup: CONFIG_MBEDTLS_USE_PSA_CRYPTO: True
    Backup: CONFIG_MBEDTLS_PLATFORM_PRINTF_ALT: False
    Backup: CONFIG_MBEDTLS_THREADING: False
    Backup: CONFIG_MBEDTLS_THREADING_ALT: False
    =========== Checkpoint: backup ===============
    Restore: CONFIG_MBEDTLS_PSA_CRYPTO_C: False
    Restore: CONFIG_MBEDTLS_PSA_CRYPTO_KEY_ID_ENCODES_OWNER: False
    Restore: CONFIG_MBEDTLS_PSA_CRYPTO_SPM: False
    Restore: CONFIG_MBEDTLS_USE_PSA_CRYPTO: True
    Restore: CONFIG_MBEDTLS_PLATFORM_PRINTF_ALT: False
    Restore: CONFIG_MBEDTLS_THREADING: False
    Restore: CONFIG_MBEDTLS_THREADING_ALT: False
    =========== End psa_crypto_library_config ===============
    -- Using ccache: /opt/homebrew/bin/ccache
    CMake Warning at /opt/nordic/ncs/v3.0.0/zephyr/CMakeLists.txt:1002 (message):
      No SOURCES given to Zephyr library: drivers__disk
    
      Excluding target from build.
    
    
    -- Configuring done (4.2s)
    -- Generating done (0.2s)
    -- Build files have been written to: /opt/nordic/ncs/v3.0.0/zephyr/samples/subsys/usb/mass/build/mass
    -- Configuring done (6.7s)
    -- Generating done (0.0s)
    -- Build files have been written to: /opt/nordic/ncs/v3.0.0/zephyr/samples/subsys/usb/mass/build
    -- west build: building application
    [5/10] Performing build step for 'mass'
    [1/290] Preparing syscall dependency handling
    
    [6/290] Generating include/generated/zephyr/version.h
    -- Zephyr version: 4.0.99 (/opt/nordic/ncs/v3.0.0/zephyr), build: v4.0.99-ncs1
    [7/290] Generating ../../tfm/CMakeCache.txt
    -- Found Git: /usr/bin/git (found version "2.39.5 (Apple Git-154)")
    -- The C compiler identification is GNU 12.2.0
    -- The CXX compiler identification is GNU 12.2.0
    -- The ASM compiler identification is GNU
    -- Found assembler: /Users/tudor/zephyr-sdk-0.17.0/arm-zephyr-eabi/bin/arm-zephyr-eabi-gcc
    -- Found Python3: /opt/homebrew/bin/python3 (found version "3.13.3") found components: Interpreter
    -- Found Python3: /opt/homebrew/bin/python3 (found suitable version "3.13.3", minimum required is "3.10") found components: Interpreter
    -- Cache files will be written to: /Users/tudor/Library/Caches/zephyr
    CMake Warning (dev) at /opt/nordic/ncs/v3.0.0/nrf/modules/trusted-firmware-m/tfm_boards/nrf5340_cpuapp/CMakeLists.txt:21 (install):
      Policy CMP0177 is not set: install() DESTINATION paths are normalized.  Run
      "cmake --help-policy CMP0177" for policy details.  Use the cmake_policy
      command to set the policy and suppress this warning.
    This warning is for project developers.  Use -Wno-dev to suppress it.
    
    -- Configuring done (0.6s)
    -- Generating done (0.1s)
    -- Build files have been written to: /opt/nordic/ncs/v3.0.0/zephyr/samples/subsys/usb/mass/build/mass/tfm
    [12/290] Performing build step for 'tfm'
    [135/139] Linking C executable bin/tfm_s.axf
    Memory region         Used Size  Region Size  %age Used
               FLASH:       32100 B        32 KB     97.96%
                 RAM:       10404 B        32 KB     31.75%
    [139/139] Linking C static library secure_fw/libtfm_s_veneers.a
    [19/290] Performing install step for 'tfm'
    -- Install configuration: "MinSizeRel"
    ----- Installing platform NS -----
    [95/290] Building C object CMakeFiles/app.dir/src/main.c.obj
    /opt/nordic/ncs/v3.0.0/zephyr/samples/subsys/usb/mass/src/main.c:33:1: warning: multi-line comment [-Wcomment]
       33 | // #if !defined(CONFIG_DISK_DRIVER_FLASH) && \
          | ^
    [290/290] Linking C executable zephyr/zephyr.elf
    Memory region         Used Size  Region Size  %age Used
               FLASH:       83992 B       944 KB      8.69%
                 RAM:       17312 B       416 KB      4.06%
            IDT_LIST:          0 GB        32 KB      0.00%
    Generating files from /opt/nordic/ncs/v3.0.0/zephyr/samples/subsys/usb/mass/build/mass/zephyr/zephyr.elf for board: nrf7002dk
    [10/10] Generating ../merged.hex
    -- west flash: rebuilding
    [0/5] Performing build step for 'mass'
    [0/14] Performing build step for 'tfm'
    ninja: no work to do.
    [2/3] Performing install step for 'tfm'
    -- Install configuration: "MinSizeRel"
    ----- Installing platform NS -----
    [3/3] Completed 'tfm'
    [4/5] cd /opt/nordic/ncs/v3.0.0/zephyr/samples/subsys/usb/mass/build/_sysbuild && /opt/homebrew/bin/cmake -E true
    -- west flash: using runner nrfutil
    -- runners.nrfutil: reset after flashing requested
    Using board 001050707950
    -- runners.nrfutil: Flashing file: /opt/nordic/ncs/v3.0.0/zephyr/samples/subsys/usb/mass/build/merged.hex
    -- runners.nrfutil: Erasing address ranges touched by firmware
    -- runners.nrfutil: Programming image
    -- runners.nrfutil: Verifying image
    -- runners.nrfutil: Reset
    -- runners.nrfutil: Board with serial number 1050707950 flashed successfully.

    Board startup log:

    [00:00:00.420,959] <inf> spi_nor: mx25r6435f@0: 8 MiBy flash
    [00:00:00.422,149] <inf> littlefs: littlefs partition at /lfs0
    [00:00:00.422,180] <inf> littlefs: LittleFS version 2.9, disk version 2.1
    [00:00:00.422,363] <inf> littlefs: FS at flash-controller@39000:0xf4000 is 6 0x1000-byte blocks with 512 cycle
    [00:00:00.422,363] <inf> littlefs: partition sizes: rd 16 ; pr 16 ; ca 64 ; la 32
    [00:00:00.422,576] <inf> littlefs: Automount /lfs0 succeeded
    *** Booting nRF Connect SDK v3.0.0-3bfc46578e42 ***
    *** Using Zephyr OS v4.0.99-a0e545cb437a ***
    [00:00:00.422,698] <err> usb_msc: Storage init ERROR !!!! - Aborting USB init
    [00:00:00.422,729] <inf> littlefs: LittleFS version 2.9, disk version 2.1
    [00:00:00.424,194] <inf> littlefs: FS at mx25r6435f@0:0x0 is 2048 0x1000-byte blocks with 512 cycle
    [00:00:00.424,194] <inf> littlefs: partition sizes: rd 16 ; pr 16 ; ca 64 ; la 32
    Mount /lfs: 0
    /lfs: bsize = 16 ; frsize = 4096 ; blocks = 2048 ; bfree = 2046
    /lfs opendir: 0
    End of files
    [00:00:00.477,325] <inf> main: The device is put in USB mass storage mode.

    This makes things more favourable since we have the littlefs filesystem enabled in the main controller and the mx25r6435f configured to have its own filesystem referenced. Ideally, we'd have both the FS and the disk on the mx25r6435f in two partitions (let's say 1MB for the FS and 7MB for the disk), but that's the final step.

    Currently the biggest issue is that the mx25r6435f isn't exposed as a mass storage disk.

    How MacOS sees the board when plugged in:

    tudor@Mac littlefs-fuse % log show --predicate 'eventMessage contains "USB"' --last 10m | grep -i Zephyr
    2025-07-03 09:16:11.852763+0100 0x268a     Default     0x0                  1198   0    icdd: [com.apple.imagecapture:icdd]            [Removed] | [USB][          Zephyr MSC ] ( 0, 0, 0) @ 0x140000 |
    2025-07-03 09:16:11.852805+0100 0x268a     Default     0x0                  1198   0    icdd: [com.apple.imagecapture:icdd]            [Removed] | [USB][          Zephyr MSC ] ( 8, 6,50) @ 0x140000 |
    2025-07-03 09:16:12.659585+0100 0x268a     Default     0x0                  1198   0    icdd: [com.apple.imagecapture:icdd]                Added | 0x100004e4 - [USB][          Zephyr MSC ] ( 0, 0, 0) @ 0x140000 |
    2025-07-03 09:16:12.659799+0100 0x268a     Default     0x0                  1198   0    icdd: [com.apple.imagecapture:icdd]             Inferior | 0x100004e5 - [USB][          Zephyr MSC ] ( 8, 6,50) @ 0x140000 |
    (log with USB connection events)

    tudor@Mac littlefs-fuse % system_profiler SPUSBDataType
    USB:
    
        USB 3.1 Bus:
    
          Host Controller Driver: AppleT8132USBXHCI
    
            USB3.1 Hub:
    
              Product ID: 0x0626
              Vendor ID: 0x05e3  (Genesys Logic, Inc.)
              Version: 6.63
              Speed: Up to 5 Gb/s
              Manufacturer: GenesysLogic
              Location ID: 0x00200000 / 1
              Current Available (mA): 900
              Current Required (mA): 0
              Extra Operating Current (mA): 0
    
                AX88179B:
    
                  Product ID: 0x1790
                  Vendor ID: 0x0b95  (ASIX Electronics Corporation)
                  Version: 2.00
                  Serial Number: 006C1FF71CDB4E
                  Speed: Up to 5 Gb/s
                  Manufacturer: ASIX
                  Location ID: 0x00230000 / 3
                  Current Available (mA): 900
                  Current Required (mA): 184
                  Extra Operating Current (mA): 0
    
            USB2.1 Hub:
    
              Product ID: 0x0610
              Vendor ID: 0x05e3  (Genesys Logic, Inc.)
              Version: 6.63
              Speed: Up to 480 Mb/s
              Manufacturer: GenesysLogic
              Location ID: 0x00100000 / 2
              Current Available (mA): 500
              Current Required (mA): 100
              Extra Operating Current (mA): 0
    
                Zephyr MSC:
    
                  Product ID: 0x0008
                  Vendor ID: 0x2fe3
                  Version: 4.00
                  Serial Number: 21DE3ED9722C5446
                  Speed: Up to 12 Mb/s
                  Manufacturer: ZEPHYR
                  Location ID: 0x00140000 / 5
                  Current Available (mA): 500
                  Current Required (mA): 100
                  Extra Operating Current (mA): 0
    
                J-Link:
    
                  Product ID: 0x1061
                  Vendor ID: 0x1366
                  Version: 1.00
                  Serial Number: 001050707950
                  Speed: Up to 12 Mb/s
                  Manufacturer: SEGGER
                  Location ID: 0x00110000 / 4
                  Current Available (mA): 500
                  Current Required (mA): 500
                  Extra Operating Current (mA): 0
                  Media:
                    MSD Volume:
                      Capacity: 11.2 MB (11,176,448 bytes)
                      Removable Media: Yes
                      BSD Name: disk5
                      Logical Unit: 0
                      Partition Map Type: Unknown
                      S.M.A.R.T. status: Verified
                      USB Interface: 5
    
        USB 3.1 Bus:
    
          Host Controller Driver: AppleT8132USBXHCI

    (detailed information about connected USB peripherals)

    But in the high level OS, we see nothing:

    Trying it on Windows, presents the volume, but it has no size (0 bytes used, 0 bytes free).

    Edit:

    I know that I need to enable this chunk of code:

    // &msc_disk0 {
    //     compatible = "zephyr,flash-disk";
    //     partition = <&storage_partition>;
    //     disk-name = "STORAGE";
    //     cache-size = <4096>;
    //     // sector-size = <512>;
    // };

    But the moment I do that, the build breaks:

    tudor@Mac mass % west build -b nrf7002dk/nrf5340/cpuapp/ns --pristine -- -DCONFIG_APP_MSC_STORAGE_FLASH_LITTLEFS=y
    -- west build: making build dir /opt/nordic/ncs/v3.0.0/zephyr/samples/subsys/usb/mass/build pristine
    -- west build: generating a build system
    Loading Zephyr module(s) (Zephyr base): sysbuild_default
    -- Found Python3: /opt/homebrew/opt/[email protected]/bin/python3.13 (found suitable version "3.13.3", minimum required is "3.10") found components: Interpreter
    -- Cache files will be written to: /Users/tudor/Library/Caches/zephyr
    -- Found west (found suitable version "1.3.0", minimum required is "0.14.0")
    -- Board: nrf7002dk, qualifiers: nrf5340/cpuapp/ns
    Parsing /opt/nordic/ncs/v3.0.0/zephyr/share/sysbuild/Kconfig
    Loaded configuration '/opt/nordic/ncs/v3.0.0/zephyr/samples/subsys/usb/mass/build/_sysbuild/empty.conf'
    Merged configuration '/opt/nordic/ncs/v3.0.0/zephyr/samples/subsys/usb/mass/build/_sysbuild/empty.conf'
    Configuration saved to '/opt/nordic/ncs/v3.0.0/zephyr/samples/subsys/usb/mass/build/zephyr/.config'
    Kconfig header saved to '/opt/nordic/ncs/v3.0.0/zephyr/samples/subsys/usb/mass/build/_sysbuild/autoconf.h'
    --
       **************************
       * Running CMake for mass *
       **************************
    
    Loading Zephyr default modules (Zephyr base).
    -- Application: /opt/nordic/ncs/v3.0.0/zephyr/samples/subsys/usb/mass
    -- CMake version: 4.0.3
    -- Found Python3: /opt/homebrew/bin/python3 (found suitable version "3.13.3", minimum required is "3.10") found components: Interpreter
    -- Cache files will be written to: /Users/tudor/Library/Caches/zephyr
    -- Zephyr version: 4.0.99 (/opt/nordic/ncs/v3.0.0/zephyr)
    -- Found west (found suitable version "1.3.0", minimum required is "0.14.0")
    -- Board: nrf7002dk, qualifiers: nrf5340/cpuapp/ns
    -- ZEPHYR_TOOLCHAIN_VARIANT not set, trying to locate Zephyr SDK
    -- Found host-tools: zephyr 0.17.0 (/Users/tudor/zephyr-sdk-0.17.0)
    -- Found toolchain: zephyr 0.17.0 (/Users/tudor/zephyr-sdk-0.17.0)
    -- Could NOT find Dtc (missing: DTC) (Required is at least version "1.4.6")
    Hint: The project() command has not yet been called.  It sets up system-specific search paths.
    -- Found BOARD.dts: /opt/nordic/ncs/v3.0.0/zephyr/boards/nordic/nrf7002dk/nrf7002dk_nrf5340_cpuapp_ns.dts
    -- Found devicetree overlay: /opt/nordic/ncs/v3.0.0/zephyr/samples/subsys/usb/mass/boards/nrf7002dk_nrf5340_cpuapp_ns.overlay
    -- Generated zephyr.dts: /opt/nordic/ncs/v3.0.0/zephyr/samples/subsys/usb/mass/build/mass/zephyr/zephyr.dts
    -- Generated pickled edt: /opt/nordic/ncs/v3.0.0/zephyr/samples/subsys/usb/mass/build/mass/zephyr/edt.pickle
    -- Generated zephyr.dts: /opt/nordic/ncs/v3.0.0/zephyr/samples/subsys/usb/mass/build/mass/zephyr/zephyr.dts
    -- Generated devicetree_generated.h: /opt/nordic/ncs/v3.0.0/zephyr/samples/subsys/usb/mass/build/mass/zephyr/include/generated/zephyr/devicetree_generated.h
    -- Including generated dts.cmake file: /opt/nordic/ncs/v3.0.0/zephyr/samples/subsys/usb/mass/build/mass/zephyr/dts.cmake
    Parsing /opt/nordic/ncs/v3.0.0/zephyr/samples/subsys/usb/mass/Kconfig
    Loaded configuration '/opt/nordic/ncs/v3.0.0/zephyr/boards/nordic/nrf7002dk/nrf7002dk_nrf5340_cpuapp_ns_defconfig'
    Merged configuration '/opt/nordic/ncs/v3.0.0/zephyr/samples/subsys/usb/mass/prj.conf'
    Merged configuration '/opt/nordic/ncs/v3.0.0/zephyr/samples/subsys/usb/mass/boards/nrf7002dk_nrf5340_cpuapp_ns.conf'
    Merged configuration '/opt/nordic/ncs/v3.0.0/zephyr/samples/subsys/usb/mass/build/mass/zephyr/misc/generated/extra_kconfig_options.conf'
    Merged configuration '/opt/nordic/ncs/v3.0.0/zephyr/samples/subsys/usb/mass/build/mass/zephyr/.config.sysbuild'
    Configuration saved to '/opt/nordic/ncs/v3.0.0/zephyr/samples/subsys/usb/mass/build/mass/zephyr/.config'
    Kconfig header saved to '/opt/nordic/ncs/v3.0.0/zephyr/samples/subsys/usb/mass/build/mass/zephyr/include/generated/zephyr/autoconf.h'
    -- Found GnuLd: /Users/tudor/zephyr-sdk-0.17.0/arm-zephyr-eabi/arm-zephyr-eabi/bin/ld.bfd (found version "2.38")
    -- The C compiler identification is GNU 12.2.0
    -- The CXX compiler identification is GNU 12.2.0
    -- The ASM compiler identification is GNU
    -- Found assembler: /Users/tudor/zephyr-sdk-0.17.0/arm-zephyr-eabi/bin/arm-zephyr-eabi-gcc
    CMake Warning at /opt/nordic/ncs/v3.0.0/zephyr/subsys/usb/device/CMakeLists.txt:22 (message):
      CONFIG_USB_DEVICE_VID has default value 0x2FE3.
    
      This value is only for testing and MUST be configured for USB products.
    
    
    =========== Generating psa_crypto_config ===============
    Backup: CONFIG_MBEDTLS_PSA_CRYPTO_SPM: False
    Backup: CONFIG_MBEDTLS_PSA_CRYPTO_C: False
    Backup: CONFIG_MBEDTLS_PSA_CRYPTO_KEY_ID_ENCODES_OWNER: False
    Backup: CONFIG_MBEDTLS_PLATFORM_SETUP_TEARDOWN_ALT: False
    Backup: CONFIG_MBEDTLS_THREADING: False
    Backup: CONFIG_MBEDTLS_THREADING_ALT: False
    =========== Checkpoint: backup ===============
    Restore: CONFIG_MBEDTLS_PSA_CRYPTO_SPM: False
    Restore: CONFIG_MBEDTLS_PSA_CRYPTO_C: False
    Restore: CONFIG_MBEDTLS_PSA_CRYPTO_KEY_ID_ENCODES_OWNER: False
    Restore: CONFIG_MBEDTLS_PLATFORM_SETUP_TEARDOWN_ALT: False
    Restore: CONFIG_MBEDTLS_THREADING: False
    Restore: CONFIG_MBEDTLS_THREADING_ALT: False
    =========== End psa_crypto_config ===============
    =========== Generating psa_crypto_library_config ===============
    Backup: CONFIG_MBEDTLS_PSA_CRYPTO_C: False
    Backup: CONFIG_MBEDTLS_PSA_CRYPTO_KEY_ID_ENCODES_OWNER: False
    Backup: CONFIG_MBEDTLS_PSA_CRYPTO_SPM: False
    Backup: CONFIG_MBEDTLS_USE_PSA_CRYPTO: True
    Backup: CONFIG_MBEDTLS_PLATFORM_PRINTF_ALT: False
    Backup: CONFIG_MBEDTLS_THREADING: False
    Backup: CONFIG_MBEDTLS_THREADING_ALT: False
    =========== Checkpoint: backup ===============
    Restore: CONFIG_MBEDTLS_PSA_CRYPTO_C: False
    Restore: CONFIG_MBEDTLS_PSA_CRYPTO_KEY_ID_ENCODES_OWNER: False
    Restore: CONFIG_MBEDTLS_PSA_CRYPTO_SPM: False
    Restore: CONFIG_MBEDTLS_USE_PSA_CRYPTO: True
    Restore: CONFIG_MBEDTLS_PLATFORM_PRINTF_ALT: False
    Restore: CONFIG_MBEDTLS_THREADING: False
    Restore: CONFIG_MBEDTLS_THREADING_ALT: False
    =========== End psa_crypto_library_config ===============
    -- Using ccache: /opt/homebrew/bin/ccache
    -- Configuring done (4.1s)
    -- Generating done (0.3s)
    -- Build files have been written to: /opt/nordic/ncs/v3.0.0/zephyr/samples/subsys/usb/mass/build/mass
    -- Configuring done (6.3s)
    -- Generating done (0.0s)
    -- Build files have been written to: /opt/nordic/ncs/v3.0.0/zephyr/samples/subsys/usb/mass/build
    -- west build: building application
    [5/10] Performing build step for 'mass'
    [1/294] Preparing syscall dependency handling
    
    [8/294] Generating include/generated/zephyr/version.h
    -- Zephyr version: 4.0.99 (/opt/nordic/ncs/v3.0.0/zephyr), build: v4.0.99-ncs1
    [9/294] Generating ../../tfm/CMakeCache.txt
    -- Found Git: /usr/bin/git (found version "2.39.5 (Apple Git-154)")
    -- The C compiler identification is GNU 12.2.0
    -- The CXX compiler identification is GNU 12.2.0
    -- The ASM compiler identification is GNU
    -- Found assembler: /Users/tudor/zephyr-sdk-0.17.0/arm-zephyr-eabi/bin/arm-zephyr-eabi-gcc
    -- Found Python3: /opt/homebrew/bin/python3 (found version "3.13.3") found components: Interpreter
    -- Found Python3: /opt/homebrew/bin/python3 (found suitable version "3.13.3", minimum required is "3.10") found components: Interpreter
    -- Cache files will be written to: /Users/tudor/Library/Caches/zephyr
    CMake Warning (dev) at /opt/nordic/ncs/v3.0.0/nrf/modules/trusted-firmware-m/tfm_boards/nrf5340_cpuapp/CMakeLists.txt:21 (install):
      Policy CMP0177 is not set: install() DESTINATION paths are normalized.  Run
      "cmake --help-policy CMP0177" for policy details.  Use the cmake_policy
      command to set the policy and suppress this warning.
    This warning is for project developers.  Use -Wno-dev to suppress it.
    
    -- Configuring done (0.6s)
    -- Generating done (0.0s)
    -- Build files have been written to: /opt/nordic/ncs/v3.0.0/zephyr/samples/subsys/usb/mass/build/mass/tfm
    [14/294] Performing build step for 'tfm'
    [135/139] Linking C executable bin/tfm_s.axf
    Memory region         Used Size  Region Size  %age Used
               FLASH:       32100 B        32 KB     97.96%
                 RAM:       10404 B        32 KB     31.75%
    [139/139] Linking C static library secure_fw/libtfm_s_veneers.a
    [21/294] Performing install step for 'tfm'
    -- Install configuration: "MinSizeRel"
    ----- Installing platform NS -----
    [119/294] Building C object CMakeFiles/app.dir/src/main.c.obj
    /opt/nordic/ncs/v3.0.0/zephyr/samples/subsys/usb/mass/src/main.c:34:1: warning: multi-line comment [-Wcomment]
       34 | // #if !defined(CONFIG_DISK_DRIVER_FLASH) && \
          | ^
    [181/294] Building C object zephyr/drivers/disk/CMakeFiles/drivers__disk.dir/flashdisk.c.obj
    FAILED: zephyr/drivers/disk/CMakeFiles/drivers__disk.dir/flashdisk.c.obj
    ccache /Users/tudor/zephyr-sdk-0.17.0/arm-zephyr-eabi/bin/arm-zephyr-eabi-gcc -DKERNEL -DK_HEAP_MEM_POOL_SIZE=0 -DMBEDTLS_CONFIG_FILE=\"nrf-config.h\" -DMBEDTLS_PSA_CRYPTO_CONFIG_FILE=\"nrf-psa-crypto-config.h\" -DNRF5340_XXAA_APPLICATION -DNRF_SKIP_FICR_NS_COPY_TO_RAM -DNRF_TRUSTZONE_NONSECURE -DPICOLIBC_LONG_LONG_PRINTF_SCANF -DUSE_PARTITION_MANAGER=1 -D__LINUX_ERRNO_EXTENSIONS__ -D__PROGRAM_START -D__ZEPHYR_SUPERVISOR__ -D__ZEPHYR__=1 -I/opt/nordic/ncs/v3.0.0/zephyr/samples/subsys/usb/mass/build/mass/zephyr/include/generated/zephyr -I/opt/nordic/ncs/v3.0.0/zephyr/include -I/opt/nordic/ncs/v3.0.0/zephyr/samples/subsys/usb/mass/build/mass/zephyr/include/generated -I/opt/nordic/ncs/v3.0.0/zephyr/soc/nordic -I/opt/nordic/ncs/v3.0.0/zephyr/soc/nordic/nrf53/. -I/opt/nordic/ncs/v3.0.0/zephyr/soc/nordic/common/. -I/opt/nordic/ncs/v3.0.0/zephyr/subsys/usb/device -I/opt/nordic/ncs/v3.0.0/zephyr/subsys/settings/include -I/opt/nordic/ncs/v3.0.0/zephyr/drivers/usb/common/nrf_usbd_common/. -I/opt/nordic/ncs/v3.0.0/nrf/include -I/opt/nordic/ncs/v3.0.0/zephyr/samples/subsys/usb/mass/build/mass/tfm/api_ns/interface/include -I/opt/nordic/ncs/v3.0.0/nrf/subsys/settings/include -I/opt/nordic/ncs/v3.0.0/nrf/modules/trusted-firmware-m/. -I/opt/nordic/ncs/v3.0.0/nrf/include/tfm -I/opt/nordic/ncs/v3.0.0/nrf/tests/include -I/opt/nordic/ncs/v3.0.0/modules/hal/cmsis/CMSIS/Core/Include -I/opt/nordic/ncs/v3.0.0/zephyr/modules/cmsis/. -I/opt/nordic/ncs/v3.0.0/nrf/modules/hal_nordic/. -I/opt/nordic/ncs/v3.0.0/modules/hal/nordic/nrfx -I/opt/nordic/ncs/v3.0.0/modules/hal/nordic/nrfx/drivers/include -I/opt/nordic/ncs/v3.0.0/modules/hal/nordic/nrfx/mdk -I/opt/nordic/ncs/v3.0.0/zephyr/modules/hal_nordic/nrfx/. -I/opt/nordic/ncs/v3.0.0/zephyr/samples/subsys/usb/mass/build/mass/input_files -I/opt/nordic/ncs/v3.0.0/zephyr/samples/subsys/usb/mass/build/mass -I/opt/nordic/ncs/v3.0.0/zephyr/samples/subsys/usb/mass/build/mass/generated/interface_nrf_security_psa -I/opt/nordic/ncs/v3.0.0/nrf/subsys/nrf_security/include -I/opt/nordic/ncs/v3.0.0/modules/crypto/oberon-psa-crypto/include -I/opt/nordic/ncs/v3.0.0/nrf/subsys/nrf_security/src/utils -I/opt/nordic/ncs/v3.0.0/modules/crypto/oberon-psa-crypto/library -I/opt/nordic/ncs/v3.0.0/modules/crypto/mbedtls/library -I/opt/nordic/ncs/v3.0.0/modules/crypto/mbedtls/include -I/opt/nordic/ncs/v3.0.0/modules/crypto/mbedtls/include/library -I/opt/nordic/ncs/v3.0.0/nrfxlib/crypto/nrf_oberon/include -I/opt/nordic/ncs/v3.0.0/nrfxlib/crypto/nrf_oberon/include/mbedtls -isystem /opt/nordic/ncs/v3.0.0/zephyr/lib/libc/common/include -Wshadow -fno-strict-aliasing -Os -imacros /opt/nordic/ncs/v3.0.0/zephyr/samples/subsys/usb/mass/build/mass/zephyr/include/generated/zephyr/autoconf.h -fno-printf-return-value -fno-common -g -gdwarf-4 -fdiagnostics-color=always -mcpu=cortex-m33 -mthumb -mabi=aapcs -mfp16-format=ieee -mtp=soft --sysroot=/Users/tudor/zephyr-sdk-0.17.0/arm-zephyr-eabi/arm-zephyr-eabi -imacros /opt/nordic/ncs/v3.0.0/zephyr/include/zephyr/toolchain/zephyr_stdint.h -Wall -Wformat -Wformat-security -Wno-format-zero-length -Wdouble-promotion -Wno-pointer-sign -Wpointer-arith -Wexpansion-to-defined -Wno-unused-but-set-variable -Werror=implicit-int -fno-pic -fno-pie -fno-asynchronous-unwind-tables -ftls-model=local-exec -fno-reorder-functions --param=min-pagesize=0 -fno-defer-pop -fmacro-prefix-map=/opt/nordic/ncs/v3.0.0/zephyr/samples/subsys/usb/mass=CMAKE_SOURCE_DIR -fmacro-prefix-map=/opt/nordic/ncs/v3.0.0/zephyr=ZEPHYR_BASE -fmacro-prefix-map=/opt/nordic/ncs/v3.0.0=WEST_TOPDIR -ffunction-sections -fdata-sections -specs=picolibc.specs -std=c99 -MD -MT zephyr/drivers/disk/CMakeFiles/drivers__disk.dir/flashdisk.c.obj -MF zephyr/drivers/disk/CMakeFiles/drivers__disk.dir/flashdisk.c.obj.d -o zephyr/drivers/disk/CMakeFiles/drivers__disk.dir/flashdisk.c.obj -c /opt/nordic/ncs/v3.0.0/zephyr/drivers/disk/flashdisk.c
    /opt/nordic/ncs/v3.0.0/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)
          | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    /opt/nordic/ncs/v3.0.0/zephyr/drivers/disk/flashdisk.c: In function 'PM_FOREACH_AFFILIATED_TO_disk':
    /opt/nordic/ncs/v3.0.0/zephyr/drivers/disk/flashdisk.c:572:30: error: storage class specified for parameter 'flash_disks'
      572 | static struct flashdisk_data flash_disks[] = {
          |                              ^~~~~~~~~~~
    /opt/nordic/ncs/v3.0.0/zephyr/drivers/disk/flashdisk.c:572:15: error: parameter 'flash_disks' is initialized
      572 | static struct flashdisk_data flash_disks[] = {
          |               ^~~~~~~~~~~~~~
    /opt/nordic/ncs/v3.0.0/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)
          |                                       ^~~~~~~~~~~~~~~~~~~~~~~~
    /opt/nordic/ncs/v3.0.0/zephyr/drivers/disk/flashdisk.c:573:39: note: each undeclared identifier is reported only once for each function it appears in
    /opt/nordic/ncs/v3.0.0/zephyr/drivers/disk/flashdisk.c:582:1: error: expected declaration specifiers before 'PM_FOREACH_AFFILIATED_TO_disk'
      582 | PM_FOREACH_AFFILIATED_TO_disk(VERIFY_CACHE_SIZE_IS_NOT_ZERO_IF_NOT_READ_ONLY)
          | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    In file included from /opt/nordic/ncs/v3.0.0/zephyr/include/zephyr/toolchain/gcc.h:98,
                     from /opt/nordic/ncs/v3.0.0/zephyr/include/zephyr/toolchain.h:50,
                     from /opt/nordic/ncs/v3.0.0/zephyr/include/zephyr/sys/__assert.h:11,
                     from /opt/nordic/ncs/v3.0.0/zephyr/drivers/disk/flashdisk.c:10:
    /opt/nordic/ncs/v3.0.0/zephyr/include/zephyr/init.h:141:44: error: storage class specified for parameter '__init_disk_flash_init'
      141 | #define Z_INIT_ENTRY_NAME(init_id) _CONCAT(__init_, init_id)
          |                                            ^~~~~~~
    /opt/nordic/ncs/v3.0.0/zephyr/include/zephyr/toolchain/common.h:137:26: note: in definition of macro '_DO_CONCAT'
      137 | #define _DO_CONCAT(x, y) x ## y
          |                          ^
    /opt/nordic/ncs/v3.0.0/zephyr/include/zephyr/init.h:141:36: note: in expansion of macro '_CONCAT'
      141 | #define Z_INIT_ENTRY_NAME(init_id) _CONCAT(__init_, init_id)
          |                                    ^~~~~~~
    /opt/nordic/ncs/v3.0.0/zephyr/include/zephyr/init.h:241:17: note: in expansion of macro 'Z_INIT_ENTRY_NAME'
      241 |                 Z_INIT_ENTRY_NAME(name) = {.init_fn = {.sys = (init_fn_)},                \
          |                 ^~~~~~~~~~~~~~~~~
    /opt/nordic/ncs/v3.0.0/zephyr/include/zephyr/init.h:223:9: note: in expansion of macro 'SYS_INIT_NAMED'
      223 |         SYS_INIT_NAMED(init_fn, init_fn, level, prio)
          |         ^~~~~~~~~~~~~~
    /opt/nordic/ncs/v3.0.0/zephyr/drivers/disk/flashdisk.c:613:1: note: in expansion of macro 'SYS_INIT'
      613 | SYS_INIT(disk_flash_init, POST_KERNEL, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT);
          | ^~~~~~~~
    /opt/nordic/ncs/v3.0.0/zephyr/include/zephyr/init.h:239:42: error: parameter '__init_disk_flash_init' is initialized
      239 |         static const Z_DECL_ALIGN(struct init_entry)                                      \
          |                                          ^~~~~~~~~~
    /opt/nordic/ncs/v3.0.0/zephyr/include/zephyr/toolchain/common.h:195:55: note: in definition of macro 'Z_DECL_ALIGN'
      195 | #define Z_DECL_ALIGN(type) __aligned(__alignof(type)) type
          |                                                       ^~~~
    /opt/nordic/ncs/v3.0.0/zephyr/include/zephyr/init.h:223:9: note: in expansion of macro 'SYS_INIT_NAMED'
      223 |         SYS_INIT_NAMED(init_fn, init_fn, level, prio)
          |         ^~~~~~~~~~~~~~
    /opt/nordic/ncs/v3.0.0/zephyr/drivers/disk/flashdisk.c:613:1: note: in expansion of macro 'SYS_INIT'
      613 | SYS_INIT(disk_flash_init, POST_KERNEL, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT);
          | ^~~~~~~~
    /opt/nordic/ncs/v3.0.0/zephyr/include/zephyr/init.h:141:44: error: section attribute not allowed for '__init_disk_flash_init'
      141 | #define Z_INIT_ENTRY_NAME(init_id) _CONCAT(__init_, init_id)
          |                                            ^~~~~~~
    /opt/nordic/ncs/v3.0.0/zephyr/include/zephyr/toolchain/common.h:137:26: note: in definition of macro '_DO_CONCAT'
      137 | #define _DO_CONCAT(x, y) x ## y
          |                          ^
    /opt/nordic/ncs/v3.0.0/zephyr/include/zephyr/init.h:141:36: note: in expansion of macro '_CONCAT'
      141 | #define Z_INIT_ENTRY_NAME(init_id) _CONCAT(__init_, init_id)
          |                                    ^~~~~~~
    /opt/nordic/ncs/v3.0.0/zephyr/include/zephyr/init.h:241:17: note: in expansion of macro 'Z_INIT_ENTRY_NAME'
      241 |                 Z_INIT_ENTRY_NAME(name) = {.init_fn = {.sys = (init_fn_)},                \
          |                 ^~~~~~~~~~~~~~~~~
    /opt/nordic/ncs/v3.0.0/zephyr/include/zephyr/init.h:223:9: note: in expansion of macro 'SYS_INIT_NAMED'
      223 |         SYS_INIT_NAMED(init_fn, init_fn, level, prio)
          |         ^~~~~~~~~~~~~~
    /opt/nordic/ncs/v3.0.0/zephyr/drivers/disk/flashdisk.c:613:1: note: in expansion of macro 'SYS_INIT'
      613 | SYS_INIT(disk_flash_init, POST_KERNEL, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT);
          | ^~~~~~~~
    /opt/nordic/ncs/v3.0.0/zephyr/include/zephyr/init.h:239:42: warning: 'used' attribute ignored [-Wattributes]
      239 |         static const Z_DECL_ALIGN(struct init_entry)                                      \
          |                                          ^~~~~~~~~~
    /opt/nordic/ncs/v3.0.0/zephyr/include/zephyr/toolchain/common.h:195:55: note: in definition of macro 'Z_DECL_ALIGN'
      195 | #define Z_DECL_ALIGN(type) __aligned(__alignof(type)) type
          |                                                       ^~~~
    /opt/nordic/ncs/v3.0.0/zephyr/include/zephyr/init.h:223:9: note: in expansion of macro 'SYS_INIT_NAMED'
      223 |         SYS_INIT_NAMED(init_fn, init_fn, level, prio)
          |         ^~~~~~~~~~~~~~
    /opt/nordic/ncs/v3.0.0/zephyr/drivers/disk/flashdisk.c:613:1: note: in expansion of macro 'SYS_INIT'
      613 | SYS_INIT(disk_flash_init, POST_KERNEL, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT);
          | ^~~~~~~~
    /opt/nordic/ncs/v3.0.0/zephyr/include/zephyr/init.h:141:44: error: alignment may not be specified for '__init_disk_flash_init'
      141 | #define Z_INIT_ENTRY_NAME(init_id) _CONCAT(__init_, init_id)
          |                                            ^~~~~~~
    /opt/nordic/ncs/v3.0.0/zephyr/include/zephyr/toolchain/common.h:137:26: note: in definition of macro '_DO_CONCAT'
      137 | #define _DO_CONCAT(x, y) x ## y
          |                          ^
    /opt/nordic/ncs/v3.0.0/zephyr/include/zephyr/init.h:141:36: note: in expansion of macro '_CONCAT'
      141 | #define Z_INIT_ENTRY_NAME(init_id) _CONCAT(__init_, init_id)
          |                                    ^~~~~~~
    /opt/nordic/ncs/v3.0.0/zephyr/include/zephyr/init.h:241:17: note: in expansion of macro 'Z_INIT_ENTRY_NAME'
      241 |                 Z_INIT_ENTRY_NAME(name) = {.init_fn = {.sys = (init_fn_)},                \
          |                 ^~~~~~~~~~~~~~~~~
    /opt/nordic/ncs/v3.0.0/zephyr/include/zephyr/init.h:223:9: note: in expansion of macro 'SYS_INIT_NAMED'
      223 |         SYS_INIT_NAMED(init_fn, init_fn, level, prio)
          |         ^~~~~~~~~~~~~~
    /opt/nordic/ncs/v3.0.0/zephyr/drivers/disk/flashdisk.c:613:1: note: in expansion of macro 'SYS_INIT'
      613 | SYS_INIT(disk_flash_init, POST_KERNEL, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT);
          | ^~~~~~~~
    In file included from /opt/nordic/ncs/v3.0.0/zephyr/include/zephyr/device.h:13,
                     from /opt/nordic/ncs/v3.0.0/zephyr/include/zephyr/sw_isr_table.h:18,
                     from /opt/nordic/ncs/v3.0.0/zephyr/include/zephyr/arch/arm/irq.h:19,
                     from /opt/nordic/ncs/v3.0.0/zephyr/include/zephyr/arch/arm/arch.h:24,
                     from /opt/nordic/ncs/v3.0.0/zephyr/include/zephyr/arch/cpu.h:19,
                     from /opt/nordic/ncs/v3.0.0/zephyr/include/zephyr/kernel_includes.h:36,
                     from /opt/nordic/ncs/v3.0.0/zephyr/include/zephyr/kernel.h:17,
                     from /opt/nordic/ncs/v3.0.0/zephyr/include/zephyr/drivers/disk.h:30,
                     from /opt/nordic/ncs/v3.0.0/zephyr/drivers/disk/flashdisk.c:12:
    /opt/nordic/ncs/v3.0.0/zephyr/drivers/disk/flashdisk.c:613:10: error: 'disk_flash_init' undeclared (first use in this function)
      613 | SYS_INIT(disk_flash_init, POST_KERNEL, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT);
          |          ^~~~~~~~~~~~~~~
    /opt/nordic/ncs/v3.0.0/zephyr/include/zephyr/init.h:241:64: note: in definition of macro 'SYS_INIT_NAMED'
      241 |                 Z_INIT_ENTRY_NAME(name) = {.init_fn = {.sys = (init_fn_)},                \
          |                                                                ^~~~~~~~
    /opt/nordic/ncs/v3.0.0/zephyr/drivers/disk/flashdisk.c:613:1: note: in expansion of macro 'SYS_INIT'
      613 | SYS_INIT(disk_flash_init, POST_KERNEL, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT);
          | ^~~~~~~~
    /opt/nordic/ncs/v3.0.0/zephyr/drivers/disk/flashdisk.c:533:1: error: type of 'DEFINE_FLASHDISKS_CACHE' defaults to 'int' [-Werror=implicit-int]
      533 | PM_FOREACH_AFFILIATED_TO_disk(DEFINE_FLASHDISKS_CACHE)
          | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    /opt/nordic/ncs/v3.0.0/zephyr/include/zephyr/init.h:141:44: error: declaration for parameter '__init_disk_flash_init' but no such parameter
      141 | #define Z_INIT_ENTRY_NAME(init_id) _CONCAT(__init_, init_id)
          |                                            ^~~~~~~
    /opt/nordic/ncs/v3.0.0/zephyr/include/zephyr/toolchain/common.h:137:26: note: in definition of macro '_DO_CONCAT'
      137 | #define _DO_CONCAT(x, y) x ## y
          |                          ^
    /opt/nordic/ncs/v3.0.0/zephyr/include/zephyr/init.h:141:36: note: in expansion of macro '_CONCAT'
      141 | #define Z_INIT_ENTRY_NAME(init_id) _CONCAT(__init_, init_id)
          |                                    ^~~~~~~
    /opt/nordic/ncs/v3.0.0/zephyr/include/zephyr/init.h:241:17: note: in expansion of macro 'Z_INIT_ENTRY_NAME'
      241 |                 Z_INIT_ENTRY_NAME(name) = {.init_fn = {.sys = (init_fn_)},                \
          |                 ^~~~~~~~~~~~~~~~~
    /opt/nordic/ncs/v3.0.0/zephyr/include/zephyr/init.h:223:9: note: in expansion of macro 'SYS_INIT_NAMED'
      223 |         SYS_INIT_NAMED(init_fn, init_fn, level, prio)
          |         ^~~~~~~~~~~~~~
    /opt/nordic/ncs/v3.0.0/zephyr/drivers/disk/flashdisk.c:613:1: note: in expansion of macro 'SYS_INIT'
      613 | SYS_INIT(disk_flash_init, POST_KERNEL, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT);
          | ^~~~~~~~
    /opt/nordic/ncs/v3.0.0/zephyr/drivers/disk/flashdisk.c:572:30: error: declaration for parameter 'flash_disks' but no such parameter
      572 | static struct flashdisk_data flash_disks[] = {
          |                              ^~~~~~~~~~~
    /opt/nordic/ncs/v3.0.0/zephyr/drivers/disk/flashdisk.c:614: error: expected '{' at end of input
    /opt/nordic/ncs/v3.0.0/zephyr/drivers/disk/flashdisk.c:614: warning: control reaches end of non-void function [-Wreturn-type]
    /opt/nordic/ncs/v3.0.0/zephyr/drivers/disk/flashdisk.c: At top level:
    /opt/nordic/ncs/v3.0.0/zephyr/drivers/disk/flashdisk.c:464:37: warning: 'flash_disk_ops' defined but not used [-Wunused-const-variable=]
      464 | static const struct disk_operations flash_disk_ops = {
          |                                     ^~~~~~~~~~~~~~
    cc1: some warnings being treated as errors
    [192/294] Building C object zephyr/drivers/usb/device/CMakeFiles/drivers__usb__device.dir/usb_dc_nrfx.c.obj
    ninja: build stopped: subcommand failed.
    FAILED: _sysbuild/sysbuild/images/mass-prefix/src/mass-stamp/mass-build /opt/nordic/ncs/v3.0.0/zephyr/samples/subsys/usb/mass/build/_sysbuild/sysbuild/images/mass-prefix/src/mass-stamp/mass-build
    cd /opt/nordic/ncs/v3.0.0/zephyr/samples/subsys/usb/mass/build/mass && /opt/homebrew/bin/cmake --build .
    ninja: build stopped: subcommand failed.
    FATAL ERROR: command exited with status 1: /opt/homebrew/bin/cmake --build /opt/nordic/ncs/v3.0.0/zephyr/samples/subsys/usb/mass/build

Reply
  • Slight update:

    After a myriad of trial and errors, I got to a state that seems to be WAAAY closer to the desired one:

    4452.mass.zip

    (above is the whole sample project with the added modifications)

    Build command and output:

    west build -b nrf7002dk/nrf5340/cpuapp/ns --pristine -- -DCONFIG_APP_MSC_STORAGE_FLASH_LITTLEFS=y ; west flash
    -- west build: making build dir /opt/nordic/ncs/v3.0.0/zephyr/samples/subsys/usb/mass/build pristine
    -- west build: generating a build system
    Loading Zephyr module(s) (Zephyr base): sysbuild_default
    -- Found Python3: /opt/homebrew/opt/[email protected]/bin/python3.13 (found suitable version "3.13.3", minimum required is "3.10") found components: Interpreter
    -- Cache files will be written to: /Users/tudor/Library/Caches/zephyr
    -- Found west (found suitable version "1.3.0", minimum required is "0.14.0")
    -- Board: nrf7002dk, qualifiers: nrf5340/cpuapp/ns
    Parsing /opt/nordic/ncs/v3.0.0/zephyr/share/sysbuild/Kconfig
    Loaded configuration '/opt/nordic/ncs/v3.0.0/zephyr/samples/subsys/usb/mass/build/_sysbuild/empty.conf'
    Merged configuration '/opt/nordic/ncs/v3.0.0/zephyr/samples/subsys/usb/mass/build/_sysbuild/empty.conf'
    Configuration saved to '/opt/nordic/ncs/v3.0.0/zephyr/samples/subsys/usb/mass/build/zephyr/.config'
    Kconfig header saved to '/opt/nordic/ncs/v3.0.0/zephyr/samples/subsys/usb/mass/build/_sysbuild/autoconf.h'
    --
       **************************
       * Running CMake for mass *
       **************************
    
    Loading Zephyr default modules (Zephyr base).
    -- Application: /opt/nordic/ncs/v3.0.0/zephyr/samples/subsys/usb/mass
    -- CMake version: 4.0.3
    -- Found Python3: /opt/homebrew/bin/python3 (found suitable version "3.13.3", minimum required is "3.10") found components: Interpreter
    -- Cache files will be written to: /Users/tudor/Library/Caches/zephyr
    -- Zephyr version: 4.0.99 (/opt/nordic/ncs/v3.0.0/zephyr)
    -- Found west (found suitable version "1.3.0", minimum required is "0.14.0")
    -- Board: nrf7002dk, qualifiers: nrf5340/cpuapp/ns
    -- ZEPHYR_TOOLCHAIN_VARIANT not set, trying to locate Zephyr SDK
    -- Found host-tools: zephyr 0.17.0 (/Users/tudor/zephyr-sdk-0.17.0)
    -- Found toolchain: zephyr 0.17.0 (/Users/tudor/zephyr-sdk-0.17.0)
    -- Could NOT find Dtc (missing: DTC) (Required is at least version "1.4.6")
    Hint: The project() command has not yet been called.  It sets up system-specific search paths.
    -- Found BOARD.dts: /opt/nordic/ncs/v3.0.0/zephyr/boards/nordic/nrf7002dk/nrf7002dk_nrf5340_cpuapp_ns.dts
    -- Found devicetree overlay: /opt/nordic/ncs/v3.0.0/zephyr/samples/subsys/usb/mass/boards/nrf7002dk_nrf5340_cpuapp_ns.overlay
    -- Generated zephyr.dts: /opt/nordic/ncs/v3.0.0/zephyr/samples/subsys/usb/mass/build/mass/zephyr/zephyr.dts
    -- Generated pickled edt: /opt/nordic/ncs/v3.0.0/zephyr/samples/subsys/usb/mass/build/mass/zephyr/edt.pickle
    -- Generated zephyr.dts: /opt/nordic/ncs/v3.0.0/zephyr/samples/subsys/usb/mass/build/mass/zephyr/zephyr.dts
    -- Generated devicetree_generated.h: /opt/nordic/ncs/v3.0.0/zephyr/samples/subsys/usb/mass/build/mass/zephyr/include/generated/zephyr/devicetree_generated.h
    -- Including generated dts.cmake file: /opt/nordic/ncs/v3.0.0/zephyr/samples/subsys/usb/mass/build/mass/zephyr/dts.cmake
    
    warning: DISK_DRIVER_FLASH (defined at drivers/disk/Kconfig.flash:4) was assigned the value 'y' but
    got the value 'n'. Check these unsatisfied dependencies: DT_HAS_ZEPHYR_FLASH_DISK_ENABLED (=n). See
    http://docs.zephyrproject.org/latest/kconfig.html#CONFIG_DISK_DRIVER_FLASH and/or look up
    DISK_DRIVER_FLASH in the menuconfig/guiconfig interface. The Application Development Primer, Setting
    Configuration Values, and Kconfig - Tips and Best Practices sections of the manual might be helpful
    too.
    
    Parsing /opt/nordic/ncs/v3.0.0/zephyr/samples/subsys/usb/mass/Kconfig
    Loaded configuration '/opt/nordic/ncs/v3.0.0/zephyr/boards/nordic/nrf7002dk/nrf7002dk_nrf5340_cpuapp_ns_defconfig'
    Merged configuration '/opt/nordic/ncs/v3.0.0/zephyr/samples/subsys/usb/mass/prj.conf'
    Merged configuration '/opt/nordic/ncs/v3.0.0/zephyr/samples/subsys/usb/mass/boards/nrf7002dk_nrf5340_cpuapp_ns.conf'
    Merged configuration '/opt/nordic/ncs/v3.0.0/zephyr/samples/subsys/usb/mass/build/mass/zephyr/misc/generated/extra_kconfig_options.conf'
    Merged configuration '/opt/nordic/ncs/v3.0.0/zephyr/samples/subsys/usb/mass/build/mass/zephyr/.config.sysbuild'
    Configuration saved to '/opt/nordic/ncs/v3.0.0/zephyr/samples/subsys/usb/mass/build/mass/zephyr/.config'
    Kconfig header saved to '/opt/nordic/ncs/v3.0.0/zephyr/samples/subsys/usb/mass/build/mass/zephyr/include/generated/zephyr/autoconf.h'
    -- Found GnuLd: /Users/tudor/zephyr-sdk-0.17.0/arm-zephyr-eabi/arm-zephyr-eabi/bin/ld.bfd (found version "2.38")
    -- The C compiler identification is GNU 12.2.0
    -- The CXX compiler identification is GNU 12.2.0
    -- The ASM compiler identification is GNU
    -- Found assembler: /Users/tudor/zephyr-sdk-0.17.0/arm-zephyr-eabi/bin/arm-zephyr-eabi-gcc
    CMake Warning at /opt/nordic/ncs/v3.0.0/zephyr/subsys/usb/device/CMakeLists.txt:22 (message):
      CONFIG_USB_DEVICE_VID has default value 0x2FE3.
    
      This value is only for testing and MUST be configured for USB products.
    
    
    =========== Generating psa_crypto_config ===============
    Backup: CONFIG_MBEDTLS_PSA_CRYPTO_SPM: False
    Backup: CONFIG_MBEDTLS_PSA_CRYPTO_C: False
    Backup: CONFIG_MBEDTLS_PSA_CRYPTO_KEY_ID_ENCODES_OWNER: False
    Backup: CONFIG_MBEDTLS_PLATFORM_SETUP_TEARDOWN_ALT: False
    Backup: CONFIG_MBEDTLS_THREADING: False
    Backup: CONFIG_MBEDTLS_THREADING_ALT: False
    =========== Checkpoint: backup ===============
    Restore: CONFIG_MBEDTLS_PSA_CRYPTO_SPM: False
    Restore: CONFIG_MBEDTLS_PSA_CRYPTO_C: False
    Restore: CONFIG_MBEDTLS_PSA_CRYPTO_KEY_ID_ENCODES_OWNER: False
    Restore: CONFIG_MBEDTLS_PLATFORM_SETUP_TEARDOWN_ALT: False
    Restore: CONFIG_MBEDTLS_THREADING: False
    Restore: CONFIG_MBEDTLS_THREADING_ALT: False
    =========== End psa_crypto_config ===============
    =========== Generating psa_crypto_library_config ===============
    Backup: CONFIG_MBEDTLS_PSA_CRYPTO_C: False
    Backup: CONFIG_MBEDTLS_PSA_CRYPTO_KEY_ID_ENCODES_OWNER: False
    Backup: CONFIG_MBEDTLS_PSA_CRYPTO_SPM: False
    Backup: CONFIG_MBEDTLS_USE_PSA_CRYPTO: True
    Backup: CONFIG_MBEDTLS_PLATFORM_PRINTF_ALT: False
    Backup: CONFIG_MBEDTLS_THREADING: False
    Backup: CONFIG_MBEDTLS_THREADING_ALT: False
    =========== Checkpoint: backup ===============
    Restore: CONFIG_MBEDTLS_PSA_CRYPTO_C: False
    Restore: CONFIG_MBEDTLS_PSA_CRYPTO_KEY_ID_ENCODES_OWNER: False
    Restore: CONFIG_MBEDTLS_PSA_CRYPTO_SPM: False
    Restore: CONFIG_MBEDTLS_USE_PSA_CRYPTO: True
    Restore: CONFIG_MBEDTLS_PLATFORM_PRINTF_ALT: False
    Restore: CONFIG_MBEDTLS_THREADING: False
    Restore: CONFIG_MBEDTLS_THREADING_ALT: False
    =========== End psa_crypto_library_config ===============
    -- Using ccache: /opt/homebrew/bin/ccache
    CMake Warning at /opt/nordic/ncs/v3.0.0/zephyr/CMakeLists.txt:1002 (message):
      No SOURCES given to Zephyr library: drivers__disk
    
      Excluding target from build.
    
    
    -- Configuring done (4.2s)
    -- Generating done (0.2s)
    -- Build files have been written to: /opt/nordic/ncs/v3.0.0/zephyr/samples/subsys/usb/mass/build/mass
    -- Configuring done (6.7s)
    -- Generating done (0.0s)
    -- Build files have been written to: /opt/nordic/ncs/v3.0.0/zephyr/samples/subsys/usb/mass/build
    -- west build: building application
    [5/10] Performing build step for 'mass'
    [1/290] Preparing syscall dependency handling
    
    [6/290] Generating include/generated/zephyr/version.h
    -- Zephyr version: 4.0.99 (/opt/nordic/ncs/v3.0.0/zephyr), build: v4.0.99-ncs1
    [7/290] Generating ../../tfm/CMakeCache.txt
    -- Found Git: /usr/bin/git (found version "2.39.5 (Apple Git-154)")
    -- The C compiler identification is GNU 12.2.0
    -- The CXX compiler identification is GNU 12.2.0
    -- The ASM compiler identification is GNU
    -- Found assembler: /Users/tudor/zephyr-sdk-0.17.0/arm-zephyr-eabi/bin/arm-zephyr-eabi-gcc
    -- Found Python3: /opt/homebrew/bin/python3 (found version "3.13.3") found components: Interpreter
    -- Found Python3: /opt/homebrew/bin/python3 (found suitable version "3.13.3", minimum required is "3.10") found components: Interpreter
    -- Cache files will be written to: /Users/tudor/Library/Caches/zephyr
    CMake Warning (dev) at /opt/nordic/ncs/v3.0.0/nrf/modules/trusted-firmware-m/tfm_boards/nrf5340_cpuapp/CMakeLists.txt:21 (install):
      Policy CMP0177 is not set: install() DESTINATION paths are normalized.  Run
      "cmake --help-policy CMP0177" for policy details.  Use the cmake_policy
      command to set the policy and suppress this warning.
    This warning is for project developers.  Use -Wno-dev to suppress it.
    
    -- Configuring done (0.6s)
    -- Generating done (0.1s)
    -- Build files have been written to: /opt/nordic/ncs/v3.0.0/zephyr/samples/subsys/usb/mass/build/mass/tfm
    [12/290] Performing build step for 'tfm'
    [135/139] Linking C executable bin/tfm_s.axf
    Memory region         Used Size  Region Size  %age Used
               FLASH:       32100 B        32 KB     97.96%
                 RAM:       10404 B        32 KB     31.75%
    [139/139] Linking C static library secure_fw/libtfm_s_veneers.a
    [19/290] Performing install step for 'tfm'
    -- Install configuration: "MinSizeRel"
    ----- Installing platform NS -----
    [95/290] Building C object CMakeFiles/app.dir/src/main.c.obj
    /opt/nordic/ncs/v3.0.0/zephyr/samples/subsys/usb/mass/src/main.c:33:1: warning: multi-line comment [-Wcomment]
       33 | // #if !defined(CONFIG_DISK_DRIVER_FLASH) && \
          | ^
    [290/290] Linking C executable zephyr/zephyr.elf
    Memory region         Used Size  Region Size  %age Used
               FLASH:       83992 B       944 KB      8.69%
                 RAM:       17312 B       416 KB      4.06%
            IDT_LIST:          0 GB        32 KB      0.00%
    Generating files from /opt/nordic/ncs/v3.0.0/zephyr/samples/subsys/usb/mass/build/mass/zephyr/zephyr.elf for board: nrf7002dk
    [10/10] Generating ../merged.hex
    -- west flash: rebuilding
    [0/5] Performing build step for 'mass'
    [0/14] Performing build step for 'tfm'
    ninja: no work to do.
    [2/3] Performing install step for 'tfm'
    -- Install configuration: "MinSizeRel"
    ----- Installing platform NS -----
    [3/3] Completed 'tfm'
    [4/5] cd /opt/nordic/ncs/v3.0.0/zephyr/samples/subsys/usb/mass/build/_sysbuild && /opt/homebrew/bin/cmake -E true
    -- west flash: using runner nrfutil
    -- runners.nrfutil: reset after flashing requested
    Using board 001050707950
    -- runners.nrfutil: Flashing file: /opt/nordic/ncs/v3.0.0/zephyr/samples/subsys/usb/mass/build/merged.hex
    -- runners.nrfutil: Erasing address ranges touched by firmware
    -- runners.nrfutil: Programming image
    -- runners.nrfutil: Verifying image
    -- runners.nrfutil: Reset
    -- runners.nrfutil: Board with serial number 1050707950 flashed successfully.

    Board startup log:

    [00:00:00.420,959] <inf> spi_nor: mx25r6435f@0: 8 MiBy flash
    [00:00:00.422,149] <inf> littlefs: littlefs partition at /lfs0
    [00:00:00.422,180] <inf> littlefs: LittleFS version 2.9, disk version 2.1
    [00:00:00.422,363] <inf> littlefs: FS at flash-controller@39000:0xf4000 is 6 0x1000-byte blocks with 512 cycle
    [00:00:00.422,363] <inf> littlefs: partition sizes: rd 16 ; pr 16 ; ca 64 ; la 32
    [00:00:00.422,576] <inf> littlefs: Automount /lfs0 succeeded
    *** Booting nRF Connect SDK v3.0.0-3bfc46578e42 ***
    *** Using Zephyr OS v4.0.99-a0e545cb437a ***
    [00:00:00.422,698] <err> usb_msc: Storage init ERROR !!!! - Aborting USB init
    [00:00:00.422,729] <inf> littlefs: LittleFS version 2.9, disk version 2.1
    [00:00:00.424,194] <inf> littlefs: FS at mx25r6435f@0:0x0 is 2048 0x1000-byte blocks with 512 cycle
    [00:00:00.424,194] <inf> littlefs: partition sizes: rd 16 ; pr 16 ; ca 64 ; la 32
    Mount /lfs: 0
    /lfs: bsize = 16 ; frsize = 4096 ; blocks = 2048 ; bfree = 2046
    /lfs opendir: 0
    End of files
    [00:00:00.477,325] <inf> main: The device is put in USB mass storage mode.

    This makes things more favourable since we have the littlefs filesystem enabled in the main controller and the mx25r6435f configured to have its own filesystem referenced. Ideally, we'd have both the FS and the disk on the mx25r6435f in two partitions (let's say 1MB for the FS and 7MB for the disk), but that's the final step.

    Currently the biggest issue is that the mx25r6435f isn't exposed as a mass storage disk.

    How MacOS sees the board when plugged in:

    tudor@Mac littlefs-fuse % log show --predicate 'eventMessage contains "USB"' --last 10m | grep -i Zephyr
    2025-07-03 09:16:11.852763+0100 0x268a     Default     0x0                  1198   0    icdd: [com.apple.imagecapture:icdd]            [Removed] | [USB][          Zephyr MSC ] ( 0, 0, 0) @ 0x140000 |
    2025-07-03 09:16:11.852805+0100 0x268a     Default     0x0                  1198   0    icdd: [com.apple.imagecapture:icdd]            [Removed] | [USB][          Zephyr MSC ] ( 8, 6,50) @ 0x140000 |
    2025-07-03 09:16:12.659585+0100 0x268a     Default     0x0                  1198   0    icdd: [com.apple.imagecapture:icdd]                Added | 0x100004e4 - [USB][          Zephyr MSC ] ( 0, 0, 0) @ 0x140000 |
    2025-07-03 09:16:12.659799+0100 0x268a     Default     0x0                  1198   0    icdd: [com.apple.imagecapture:icdd]             Inferior | 0x100004e5 - [USB][          Zephyr MSC ] ( 8, 6,50) @ 0x140000 |
    (log with USB connection events)

    tudor@Mac littlefs-fuse % system_profiler SPUSBDataType
    USB:
    
        USB 3.1 Bus:
    
          Host Controller Driver: AppleT8132USBXHCI
    
            USB3.1 Hub:
    
              Product ID: 0x0626
              Vendor ID: 0x05e3  (Genesys Logic, Inc.)
              Version: 6.63
              Speed: Up to 5 Gb/s
              Manufacturer: GenesysLogic
              Location ID: 0x00200000 / 1
              Current Available (mA): 900
              Current Required (mA): 0
              Extra Operating Current (mA): 0
    
                AX88179B:
    
                  Product ID: 0x1790
                  Vendor ID: 0x0b95  (ASIX Electronics Corporation)
                  Version: 2.00
                  Serial Number: 006C1FF71CDB4E
                  Speed: Up to 5 Gb/s
                  Manufacturer: ASIX
                  Location ID: 0x00230000 / 3
                  Current Available (mA): 900
                  Current Required (mA): 184
                  Extra Operating Current (mA): 0
    
            USB2.1 Hub:
    
              Product ID: 0x0610
              Vendor ID: 0x05e3  (Genesys Logic, Inc.)
              Version: 6.63
              Speed: Up to 480 Mb/s
              Manufacturer: GenesysLogic
              Location ID: 0x00100000 / 2
              Current Available (mA): 500
              Current Required (mA): 100
              Extra Operating Current (mA): 0
    
                Zephyr MSC:
    
                  Product ID: 0x0008
                  Vendor ID: 0x2fe3
                  Version: 4.00
                  Serial Number: 21DE3ED9722C5446
                  Speed: Up to 12 Mb/s
                  Manufacturer: ZEPHYR
                  Location ID: 0x00140000 / 5
                  Current Available (mA): 500
                  Current Required (mA): 100
                  Extra Operating Current (mA): 0
    
                J-Link:
    
                  Product ID: 0x1061
                  Vendor ID: 0x1366
                  Version: 1.00
                  Serial Number: 001050707950
                  Speed: Up to 12 Mb/s
                  Manufacturer: SEGGER
                  Location ID: 0x00110000 / 4
                  Current Available (mA): 500
                  Current Required (mA): 500
                  Extra Operating Current (mA): 0
                  Media:
                    MSD Volume:
                      Capacity: 11.2 MB (11,176,448 bytes)
                      Removable Media: Yes
                      BSD Name: disk5
                      Logical Unit: 0
                      Partition Map Type: Unknown
                      S.M.A.R.T. status: Verified
                      USB Interface: 5
    
        USB 3.1 Bus:
    
          Host Controller Driver: AppleT8132USBXHCI

    (detailed information about connected USB peripherals)

    But in the high level OS, we see nothing:

    Trying it on Windows, presents the volume, but it has no size (0 bytes used, 0 bytes free).

    Edit:

    I know that I need to enable this chunk of code:

    // &msc_disk0 {
    //     compatible = "zephyr,flash-disk";
    //     partition = <&storage_partition>;
    //     disk-name = "STORAGE";
    //     cache-size = <4096>;
    //     // sector-size = <512>;
    // };

    But the moment I do that, the build breaks:

    tudor@Mac mass % west build -b nrf7002dk/nrf5340/cpuapp/ns --pristine -- -DCONFIG_APP_MSC_STORAGE_FLASH_LITTLEFS=y
    -- west build: making build dir /opt/nordic/ncs/v3.0.0/zephyr/samples/subsys/usb/mass/build pristine
    -- west build: generating a build system
    Loading Zephyr module(s) (Zephyr base): sysbuild_default
    -- Found Python3: /opt/homebrew/opt/[email protected]/bin/python3.13 (found suitable version "3.13.3", minimum required is "3.10") found components: Interpreter
    -- Cache files will be written to: /Users/tudor/Library/Caches/zephyr
    -- Found west (found suitable version "1.3.0", minimum required is "0.14.0")
    -- Board: nrf7002dk, qualifiers: nrf5340/cpuapp/ns
    Parsing /opt/nordic/ncs/v3.0.0/zephyr/share/sysbuild/Kconfig
    Loaded configuration '/opt/nordic/ncs/v3.0.0/zephyr/samples/subsys/usb/mass/build/_sysbuild/empty.conf'
    Merged configuration '/opt/nordic/ncs/v3.0.0/zephyr/samples/subsys/usb/mass/build/_sysbuild/empty.conf'
    Configuration saved to '/opt/nordic/ncs/v3.0.0/zephyr/samples/subsys/usb/mass/build/zephyr/.config'
    Kconfig header saved to '/opt/nordic/ncs/v3.0.0/zephyr/samples/subsys/usb/mass/build/_sysbuild/autoconf.h'
    --
       **************************
       * Running CMake for mass *
       **************************
    
    Loading Zephyr default modules (Zephyr base).
    -- Application: /opt/nordic/ncs/v3.0.0/zephyr/samples/subsys/usb/mass
    -- CMake version: 4.0.3
    -- Found Python3: /opt/homebrew/bin/python3 (found suitable version "3.13.3", minimum required is "3.10") found components: Interpreter
    -- Cache files will be written to: /Users/tudor/Library/Caches/zephyr
    -- Zephyr version: 4.0.99 (/opt/nordic/ncs/v3.0.0/zephyr)
    -- Found west (found suitable version "1.3.0", minimum required is "0.14.0")
    -- Board: nrf7002dk, qualifiers: nrf5340/cpuapp/ns
    -- ZEPHYR_TOOLCHAIN_VARIANT not set, trying to locate Zephyr SDK
    -- Found host-tools: zephyr 0.17.0 (/Users/tudor/zephyr-sdk-0.17.0)
    -- Found toolchain: zephyr 0.17.0 (/Users/tudor/zephyr-sdk-0.17.0)
    -- Could NOT find Dtc (missing: DTC) (Required is at least version "1.4.6")
    Hint: The project() command has not yet been called.  It sets up system-specific search paths.
    -- Found BOARD.dts: /opt/nordic/ncs/v3.0.0/zephyr/boards/nordic/nrf7002dk/nrf7002dk_nrf5340_cpuapp_ns.dts
    -- Found devicetree overlay: /opt/nordic/ncs/v3.0.0/zephyr/samples/subsys/usb/mass/boards/nrf7002dk_nrf5340_cpuapp_ns.overlay
    -- Generated zephyr.dts: /opt/nordic/ncs/v3.0.0/zephyr/samples/subsys/usb/mass/build/mass/zephyr/zephyr.dts
    -- Generated pickled edt: /opt/nordic/ncs/v3.0.0/zephyr/samples/subsys/usb/mass/build/mass/zephyr/edt.pickle
    -- Generated zephyr.dts: /opt/nordic/ncs/v3.0.0/zephyr/samples/subsys/usb/mass/build/mass/zephyr/zephyr.dts
    -- Generated devicetree_generated.h: /opt/nordic/ncs/v3.0.0/zephyr/samples/subsys/usb/mass/build/mass/zephyr/include/generated/zephyr/devicetree_generated.h
    -- Including generated dts.cmake file: /opt/nordic/ncs/v3.0.0/zephyr/samples/subsys/usb/mass/build/mass/zephyr/dts.cmake
    Parsing /opt/nordic/ncs/v3.0.0/zephyr/samples/subsys/usb/mass/Kconfig
    Loaded configuration '/opt/nordic/ncs/v3.0.0/zephyr/boards/nordic/nrf7002dk/nrf7002dk_nrf5340_cpuapp_ns_defconfig'
    Merged configuration '/opt/nordic/ncs/v3.0.0/zephyr/samples/subsys/usb/mass/prj.conf'
    Merged configuration '/opt/nordic/ncs/v3.0.0/zephyr/samples/subsys/usb/mass/boards/nrf7002dk_nrf5340_cpuapp_ns.conf'
    Merged configuration '/opt/nordic/ncs/v3.0.0/zephyr/samples/subsys/usb/mass/build/mass/zephyr/misc/generated/extra_kconfig_options.conf'
    Merged configuration '/opt/nordic/ncs/v3.0.0/zephyr/samples/subsys/usb/mass/build/mass/zephyr/.config.sysbuild'
    Configuration saved to '/opt/nordic/ncs/v3.0.0/zephyr/samples/subsys/usb/mass/build/mass/zephyr/.config'
    Kconfig header saved to '/opt/nordic/ncs/v3.0.0/zephyr/samples/subsys/usb/mass/build/mass/zephyr/include/generated/zephyr/autoconf.h'
    -- Found GnuLd: /Users/tudor/zephyr-sdk-0.17.0/arm-zephyr-eabi/arm-zephyr-eabi/bin/ld.bfd (found version "2.38")
    -- The C compiler identification is GNU 12.2.0
    -- The CXX compiler identification is GNU 12.2.0
    -- The ASM compiler identification is GNU
    -- Found assembler: /Users/tudor/zephyr-sdk-0.17.0/arm-zephyr-eabi/bin/arm-zephyr-eabi-gcc
    CMake Warning at /opt/nordic/ncs/v3.0.0/zephyr/subsys/usb/device/CMakeLists.txt:22 (message):
      CONFIG_USB_DEVICE_VID has default value 0x2FE3.
    
      This value is only for testing and MUST be configured for USB products.
    
    
    =========== Generating psa_crypto_config ===============
    Backup: CONFIG_MBEDTLS_PSA_CRYPTO_SPM: False
    Backup: CONFIG_MBEDTLS_PSA_CRYPTO_C: False
    Backup: CONFIG_MBEDTLS_PSA_CRYPTO_KEY_ID_ENCODES_OWNER: False
    Backup: CONFIG_MBEDTLS_PLATFORM_SETUP_TEARDOWN_ALT: False
    Backup: CONFIG_MBEDTLS_THREADING: False
    Backup: CONFIG_MBEDTLS_THREADING_ALT: False
    =========== Checkpoint: backup ===============
    Restore: CONFIG_MBEDTLS_PSA_CRYPTO_SPM: False
    Restore: CONFIG_MBEDTLS_PSA_CRYPTO_C: False
    Restore: CONFIG_MBEDTLS_PSA_CRYPTO_KEY_ID_ENCODES_OWNER: False
    Restore: CONFIG_MBEDTLS_PLATFORM_SETUP_TEARDOWN_ALT: False
    Restore: CONFIG_MBEDTLS_THREADING: False
    Restore: CONFIG_MBEDTLS_THREADING_ALT: False
    =========== End psa_crypto_config ===============
    =========== Generating psa_crypto_library_config ===============
    Backup: CONFIG_MBEDTLS_PSA_CRYPTO_C: False
    Backup: CONFIG_MBEDTLS_PSA_CRYPTO_KEY_ID_ENCODES_OWNER: False
    Backup: CONFIG_MBEDTLS_PSA_CRYPTO_SPM: False
    Backup: CONFIG_MBEDTLS_USE_PSA_CRYPTO: True
    Backup: CONFIG_MBEDTLS_PLATFORM_PRINTF_ALT: False
    Backup: CONFIG_MBEDTLS_THREADING: False
    Backup: CONFIG_MBEDTLS_THREADING_ALT: False
    =========== Checkpoint: backup ===============
    Restore: CONFIG_MBEDTLS_PSA_CRYPTO_C: False
    Restore: CONFIG_MBEDTLS_PSA_CRYPTO_KEY_ID_ENCODES_OWNER: False
    Restore: CONFIG_MBEDTLS_PSA_CRYPTO_SPM: False
    Restore: CONFIG_MBEDTLS_USE_PSA_CRYPTO: True
    Restore: CONFIG_MBEDTLS_PLATFORM_PRINTF_ALT: False
    Restore: CONFIG_MBEDTLS_THREADING: False
    Restore: CONFIG_MBEDTLS_THREADING_ALT: False
    =========== End psa_crypto_library_config ===============
    -- Using ccache: /opt/homebrew/bin/ccache
    -- Configuring done (4.1s)
    -- Generating done (0.3s)
    -- Build files have been written to: /opt/nordic/ncs/v3.0.0/zephyr/samples/subsys/usb/mass/build/mass
    -- Configuring done (6.3s)
    -- Generating done (0.0s)
    -- Build files have been written to: /opt/nordic/ncs/v3.0.0/zephyr/samples/subsys/usb/mass/build
    -- west build: building application
    [5/10] Performing build step for 'mass'
    [1/294] Preparing syscall dependency handling
    
    [8/294] Generating include/generated/zephyr/version.h
    -- Zephyr version: 4.0.99 (/opt/nordic/ncs/v3.0.0/zephyr), build: v4.0.99-ncs1
    [9/294] Generating ../../tfm/CMakeCache.txt
    -- Found Git: /usr/bin/git (found version "2.39.5 (Apple Git-154)")
    -- The C compiler identification is GNU 12.2.0
    -- The CXX compiler identification is GNU 12.2.0
    -- The ASM compiler identification is GNU
    -- Found assembler: /Users/tudor/zephyr-sdk-0.17.0/arm-zephyr-eabi/bin/arm-zephyr-eabi-gcc
    -- Found Python3: /opt/homebrew/bin/python3 (found version "3.13.3") found components: Interpreter
    -- Found Python3: /opt/homebrew/bin/python3 (found suitable version "3.13.3", minimum required is "3.10") found components: Interpreter
    -- Cache files will be written to: /Users/tudor/Library/Caches/zephyr
    CMake Warning (dev) at /opt/nordic/ncs/v3.0.0/nrf/modules/trusted-firmware-m/tfm_boards/nrf5340_cpuapp/CMakeLists.txt:21 (install):
      Policy CMP0177 is not set: install() DESTINATION paths are normalized.  Run
      "cmake --help-policy CMP0177" for policy details.  Use the cmake_policy
      command to set the policy and suppress this warning.
    This warning is for project developers.  Use -Wno-dev to suppress it.
    
    -- Configuring done (0.6s)
    -- Generating done (0.0s)
    -- Build files have been written to: /opt/nordic/ncs/v3.0.0/zephyr/samples/subsys/usb/mass/build/mass/tfm
    [14/294] Performing build step for 'tfm'
    [135/139] Linking C executable bin/tfm_s.axf
    Memory region         Used Size  Region Size  %age Used
               FLASH:       32100 B        32 KB     97.96%
                 RAM:       10404 B        32 KB     31.75%
    [139/139] Linking C static library secure_fw/libtfm_s_veneers.a
    [21/294] Performing install step for 'tfm'
    -- Install configuration: "MinSizeRel"
    ----- Installing platform NS -----
    [119/294] Building C object CMakeFiles/app.dir/src/main.c.obj
    /opt/nordic/ncs/v3.0.0/zephyr/samples/subsys/usb/mass/src/main.c:34:1: warning: multi-line comment [-Wcomment]
       34 | // #if !defined(CONFIG_DISK_DRIVER_FLASH) && \
          | ^
    [181/294] Building C object zephyr/drivers/disk/CMakeFiles/drivers__disk.dir/flashdisk.c.obj
    FAILED: zephyr/drivers/disk/CMakeFiles/drivers__disk.dir/flashdisk.c.obj
    ccache /Users/tudor/zephyr-sdk-0.17.0/arm-zephyr-eabi/bin/arm-zephyr-eabi-gcc -DKERNEL -DK_HEAP_MEM_POOL_SIZE=0 -DMBEDTLS_CONFIG_FILE=\"nrf-config.h\" -DMBEDTLS_PSA_CRYPTO_CONFIG_FILE=\"nrf-psa-crypto-config.h\" -DNRF5340_XXAA_APPLICATION -DNRF_SKIP_FICR_NS_COPY_TO_RAM -DNRF_TRUSTZONE_NONSECURE -DPICOLIBC_LONG_LONG_PRINTF_SCANF -DUSE_PARTITION_MANAGER=1 -D__LINUX_ERRNO_EXTENSIONS__ -D__PROGRAM_START -D__ZEPHYR_SUPERVISOR__ -D__ZEPHYR__=1 -I/opt/nordic/ncs/v3.0.0/zephyr/samples/subsys/usb/mass/build/mass/zephyr/include/generated/zephyr -I/opt/nordic/ncs/v3.0.0/zephyr/include -I/opt/nordic/ncs/v3.0.0/zephyr/samples/subsys/usb/mass/build/mass/zephyr/include/generated -I/opt/nordic/ncs/v3.0.0/zephyr/soc/nordic -I/opt/nordic/ncs/v3.0.0/zephyr/soc/nordic/nrf53/. -I/opt/nordic/ncs/v3.0.0/zephyr/soc/nordic/common/. -I/opt/nordic/ncs/v3.0.0/zephyr/subsys/usb/device -I/opt/nordic/ncs/v3.0.0/zephyr/subsys/settings/include -I/opt/nordic/ncs/v3.0.0/zephyr/drivers/usb/common/nrf_usbd_common/. -I/opt/nordic/ncs/v3.0.0/nrf/include -I/opt/nordic/ncs/v3.0.0/zephyr/samples/subsys/usb/mass/build/mass/tfm/api_ns/interface/include -I/opt/nordic/ncs/v3.0.0/nrf/subsys/settings/include -I/opt/nordic/ncs/v3.0.0/nrf/modules/trusted-firmware-m/. -I/opt/nordic/ncs/v3.0.0/nrf/include/tfm -I/opt/nordic/ncs/v3.0.0/nrf/tests/include -I/opt/nordic/ncs/v3.0.0/modules/hal/cmsis/CMSIS/Core/Include -I/opt/nordic/ncs/v3.0.0/zephyr/modules/cmsis/. -I/opt/nordic/ncs/v3.0.0/nrf/modules/hal_nordic/. -I/opt/nordic/ncs/v3.0.0/modules/hal/nordic/nrfx -I/opt/nordic/ncs/v3.0.0/modules/hal/nordic/nrfx/drivers/include -I/opt/nordic/ncs/v3.0.0/modules/hal/nordic/nrfx/mdk -I/opt/nordic/ncs/v3.0.0/zephyr/modules/hal_nordic/nrfx/. -I/opt/nordic/ncs/v3.0.0/zephyr/samples/subsys/usb/mass/build/mass/input_files -I/opt/nordic/ncs/v3.0.0/zephyr/samples/subsys/usb/mass/build/mass -I/opt/nordic/ncs/v3.0.0/zephyr/samples/subsys/usb/mass/build/mass/generated/interface_nrf_security_psa -I/opt/nordic/ncs/v3.0.0/nrf/subsys/nrf_security/include -I/opt/nordic/ncs/v3.0.0/modules/crypto/oberon-psa-crypto/include -I/opt/nordic/ncs/v3.0.0/nrf/subsys/nrf_security/src/utils -I/opt/nordic/ncs/v3.0.0/modules/crypto/oberon-psa-crypto/library -I/opt/nordic/ncs/v3.0.0/modules/crypto/mbedtls/library -I/opt/nordic/ncs/v3.0.0/modules/crypto/mbedtls/include -I/opt/nordic/ncs/v3.0.0/modules/crypto/mbedtls/include/library -I/opt/nordic/ncs/v3.0.0/nrfxlib/crypto/nrf_oberon/include -I/opt/nordic/ncs/v3.0.0/nrfxlib/crypto/nrf_oberon/include/mbedtls -isystem /opt/nordic/ncs/v3.0.0/zephyr/lib/libc/common/include -Wshadow -fno-strict-aliasing -Os -imacros /opt/nordic/ncs/v3.0.0/zephyr/samples/subsys/usb/mass/build/mass/zephyr/include/generated/zephyr/autoconf.h -fno-printf-return-value -fno-common -g -gdwarf-4 -fdiagnostics-color=always -mcpu=cortex-m33 -mthumb -mabi=aapcs -mfp16-format=ieee -mtp=soft --sysroot=/Users/tudor/zephyr-sdk-0.17.0/arm-zephyr-eabi/arm-zephyr-eabi -imacros /opt/nordic/ncs/v3.0.0/zephyr/include/zephyr/toolchain/zephyr_stdint.h -Wall -Wformat -Wformat-security -Wno-format-zero-length -Wdouble-promotion -Wno-pointer-sign -Wpointer-arith -Wexpansion-to-defined -Wno-unused-but-set-variable -Werror=implicit-int -fno-pic -fno-pie -fno-asynchronous-unwind-tables -ftls-model=local-exec -fno-reorder-functions --param=min-pagesize=0 -fno-defer-pop -fmacro-prefix-map=/opt/nordic/ncs/v3.0.0/zephyr/samples/subsys/usb/mass=CMAKE_SOURCE_DIR -fmacro-prefix-map=/opt/nordic/ncs/v3.0.0/zephyr=ZEPHYR_BASE -fmacro-prefix-map=/opt/nordic/ncs/v3.0.0=WEST_TOPDIR -ffunction-sections -fdata-sections -specs=picolibc.specs -std=c99 -MD -MT zephyr/drivers/disk/CMakeFiles/drivers__disk.dir/flashdisk.c.obj -MF zephyr/drivers/disk/CMakeFiles/drivers__disk.dir/flashdisk.c.obj.d -o zephyr/drivers/disk/CMakeFiles/drivers__disk.dir/flashdisk.c.obj -c /opt/nordic/ncs/v3.0.0/zephyr/drivers/disk/flashdisk.c
    /opt/nordic/ncs/v3.0.0/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)
          | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    /opt/nordic/ncs/v3.0.0/zephyr/drivers/disk/flashdisk.c: In function 'PM_FOREACH_AFFILIATED_TO_disk':
    /opt/nordic/ncs/v3.0.0/zephyr/drivers/disk/flashdisk.c:572:30: error: storage class specified for parameter 'flash_disks'
      572 | static struct flashdisk_data flash_disks[] = {
          |                              ^~~~~~~~~~~
    /opt/nordic/ncs/v3.0.0/zephyr/drivers/disk/flashdisk.c:572:15: error: parameter 'flash_disks' is initialized
      572 | static struct flashdisk_data flash_disks[] = {
          |               ^~~~~~~~~~~~~~
    /opt/nordic/ncs/v3.0.0/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)
          |                                       ^~~~~~~~~~~~~~~~~~~~~~~~
    /opt/nordic/ncs/v3.0.0/zephyr/drivers/disk/flashdisk.c:573:39: note: each undeclared identifier is reported only once for each function it appears in
    /opt/nordic/ncs/v3.0.0/zephyr/drivers/disk/flashdisk.c:582:1: error: expected declaration specifiers before 'PM_FOREACH_AFFILIATED_TO_disk'
      582 | PM_FOREACH_AFFILIATED_TO_disk(VERIFY_CACHE_SIZE_IS_NOT_ZERO_IF_NOT_READ_ONLY)
          | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    In file included from /opt/nordic/ncs/v3.0.0/zephyr/include/zephyr/toolchain/gcc.h:98,
                     from /opt/nordic/ncs/v3.0.0/zephyr/include/zephyr/toolchain.h:50,
                     from /opt/nordic/ncs/v3.0.0/zephyr/include/zephyr/sys/__assert.h:11,
                     from /opt/nordic/ncs/v3.0.0/zephyr/drivers/disk/flashdisk.c:10:
    /opt/nordic/ncs/v3.0.0/zephyr/include/zephyr/init.h:141:44: error: storage class specified for parameter '__init_disk_flash_init'
      141 | #define Z_INIT_ENTRY_NAME(init_id) _CONCAT(__init_, init_id)
          |                                            ^~~~~~~
    /opt/nordic/ncs/v3.0.0/zephyr/include/zephyr/toolchain/common.h:137:26: note: in definition of macro '_DO_CONCAT'
      137 | #define _DO_CONCAT(x, y) x ## y
          |                          ^
    /opt/nordic/ncs/v3.0.0/zephyr/include/zephyr/init.h:141:36: note: in expansion of macro '_CONCAT'
      141 | #define Z_INIT_ENTRY_NAME(init_id) _CONCAT(__init_, init_id)
          |                                    ^~~~~~~
    /opt/nordic/ncs/v3.0.0/zephyr/include/zephyr/init.h:241:17: note: in expansion of macro 'Z_INIT_ENTRY_NAME'
      241 |                 Z_INIT_ENTRY_NAME(name) = {.init_fn = {.sys = (init_fn_)},                \
          |                 ^~~~~~~~~~~~~~~~~
    /opt/nordic/ncs/v3.0.0/zephyr/include/zephyr/init.h:223:9: note: in expansion of macro 'SYS_INIT_NAMED'
      223 |         SYS_INIT_NAMED(init_fn, init_fn, level, prio)
          |         ^~~~~~~~~~~~~~
    /opt/nordic/ncs/v3.0.0/zephyr/drivers/disk/flashdisk.c:613:1: note: in expansion of macro 'SYS_INIT'
      613 | SYS_INIT(disk_flash_init, POST_KERNEL, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT);
          | ^~~~~~~~
    /opt/nordic/ncs/v3.0.0/zephyr/include/zephyr/init.h:239:42: error: parameter '__init_disk_flash_init' is initialized
      239 |         static const Z_DECL_ALIGN(struct init_entry)                                      \
          |                                          ^~~~~~~~~~
    /opt/nordic/ncs/v3.0.0/zephyr/include/zephyr/toolchain/common.h:195:55: note: in definition of macro 'Z_DECL_ALIGN'
      195 | #define Z_DECL_ALIGN(type) __aligned(__alignof(type)) type
          |                                                       ^~~~
    /opt/nordic/ncs/v3.0.0/zephyr/include/zephyr/init.h:223:9: note: in expansion of macro 'SYS_INIT_NAMED'
      223 |         SYS_INIT_NAMED(init_fn, init_fn, level, prio)
          |         ^~~~~~~~~~~~~~
    /opt/nordic/ncs/v3.0.0/zephyr/drivers/disk/flashdisk.c:613:1: note: in expansion of macro 'SYS_INIT'
      613 | SYS_INIT(disk_flash_init, POST_KERNEL, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT);
          | ^~~~~~~~
    /opt/nordic/ncs/v3.0.0/zephyr/include/zephyr/init.h:141:44: error: section attribute not allowed for '__init_disk_flash_init'
      141 | #define Z_INIT_ENTRY_NAME(init_id) _CONCAT(__init_, init_id)
          |                                            ^~~~~~~
    /opt/nordic/ncs/v3.0.0/zephyr/include/zephyr/toolchain/common.h:137:26: note: in definition of macro '_DO_CONCAT'
      137 | #define _DO_CONCAT(x, y) x ## y
          |                          ^
    /opt/nordic/ncs/v3.0.0/zephyr/include/zephyr/init.h:141:36: note: in expansion of macro '_CONCAT'
      141 | #define Z_INIT_ENTRY_NAME(init_id) _CONCAT(__init_, init_id)
          |                                    ^~~~~~~
    /opt/nordic/ncs/v3.0.0/zephyr/include/zephyr/init.h:241:17: note: in expansion of macro 'Z_INIT_ENTRY_NAME'
      241 |                 Z_INIT_ENTRY_NAME(name) = {.init_fn = {.sys = (init_fn_)},                \
          |                 ^~~~~~~~~~~~~~~~~
    /opt/nordic/ncs/v3.0.0/zephyr/include/zephyr/init.h:223:9: note: in expansion of macro 'SYS_INIT_NAMED'
      223 |         SYS_INIT_NAMED(init_fn, init_fn, level, prio)
          |         ^~~~~~~~~~~~~~
    /opt/nordic/ncs/v3.0.0/zephyr/drivers/disk/flashdisk.c:613:1: note: in expansion of macro 'SYS_INIT'
      613 | SYS_INIT(disk_flash_init, POST_KERNEL, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT);
          | ^~~~~~~~
    /opt/nordic/ncs/v3.0.0/zephyr/include/zephyr/init.h:239:42: warning: 'used' attribute ignored [-Wattributes]
      239 |         static const Z_DECL_ALIGN(struct init_entry)                                      \
          |                                          ^~~~~~~~~~
    /opt/nordic/ncs/v3.0.0/zephyr/include/zephyr/toolchain/common.h:195:55: note: in definition of macro 'Z_DECL_ALIGN'
      195 | #define Z_DECL_ALIGN(type) __aligned(__alignof(type)) type
          |                                                       ^~~~
    /opt/nordic/ncs/v3.0.0/zephyr/include/zephyr/init.h:223:9: note: in expansion of macro 'SYS_INIT_NAMED'
      223 |         SYS_INIT_NAMED(init_fn, init_fn, level, prio)
          |         ^~~~~~~~~~~~~~
    /opt/nordic/ncs/v3.0.0/zephyr/drivers/disk/flashdisk.c:613:1: note: in expansion of macro 'SYS_INIT'
      613 | SYS_INIT(disk_flash_init, POST_KERNEL, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT);
          | ^~~~~~~~
    /opt/nordic/ncs/v3.0.0/zephyr/include/zephyr/init.h:141:44: error: alignment may not be specified for '__init_disk_flash_init'
      141 | #define Z_INIT_ENTRY_NAME(init_id) _CONCAT(__init_, init_id)
          |                                            ^~~~~~~
    /opt/nordic/ncs/v3.0.0/zephyr/include/zephyr/toolchain/common.h:137:26: note: in definition of macro '_DO_CONCAT'
      137 | #define _DO_CONCAT(x, y) x ## y
          |                          ^
    /opt/nordic/ncs/v3.0.0/zephyr/include/zephyr/init.h:141:36: note: in expansion of macro '_CONCAT'
      141 | #define Z_INIT_ENTRY_NAME(init_id) _CONCAT(__init_, init_id)
          |                                    ^~~~~~~
    /opt/nordic/ncs/v3.0.0/zephyr/include/zephyr/init.h:241:17: note: in expansion of macro 'Z_INIT_ENTRY_NAME'
      241 |                 Z_INIT_ENTRY_NAME(name) = {.init_fn = {.sys = (init_fn_)},                \
          |                 ^~~~~~~~~~~~~~~~~
    /opt/nordic/ncs/v3.0.0/zephyr/include/zephyr/init.h:223:9: note: in expansion of macro 'SYS_INIT_NAMED'
      223 |         SYS_INIT_NAMED(init_fn, init_fn, level, prio)
          |         ^~~~~~~~~~~~~~
    /opt/nordic/ncs/v3.0.0/zephyr/drivers/disk/flashdisk.c:613:1: note: in expansion of macro 'SYS_INIT'
      613 | SYS_INIT(disk_flash_init, POST_KERNEL, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT);
          | ^~~~~~~~
    In file included from /opt/nordic/ncs/v3.0.0/zephyr/include/zephyr/device.h:13,
                     from /opt/nordic/ncs/v3.0.0/zephyr/include/zephyr/sw_isr_table.h:18,
                     from /opt/nordic/ncs/v3.0.0/zephyr/include/zephyr/arch/arm/irq.h:19,
                     from /opt/nordic/ncs/v3.0.0/zephyr/include/zephyr/arch/arm/arch.h:24,
                     from /opt/nordic/ncs/v3.0.0/zephyr/include/zephyr/arch/cpu.h:19,
                     from /opt/nordic/ncs/v3.0.0/zephyr/include/zephyr/kernel_includes.h:36,
                     from /opt/nordic/ncs/v3.0.0/zephyr/include/zephyr/kernel.h:17,
                     from /opt/nordic/ncs/v3.0.0/zephyr/include/zephyr/drivers/disk.h:30,
                     from /opt/nordic/ncs/v3.0.0/zephyr/drivers/disk/flashdisk.c:12:
    /opt/nordic/ncs/v3.0.0/zephyr/drivers/disk/flashdisk.c:613:10: error: 'disk_flash_init' undeclared (first use in this function)
      613 | SYS_INIT(disk_flash_init, POST_KERNEL, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT);
          |          ^~~~~~~~~~~~~~~
    /opt/nordic/ncs/v3.0.0/zephyr/include/zephyr/init.h:241:64: note: in definition of macro 'SYS_INIT_NAMED'
      241 |                 Z_INIT_ENTRY_NAME(name) = {.init_fn = {.sys = (init_fn_)},                \
          |                                                                ^~~~~~~~
    /opt/nordic/ncs/v3.0.0/zephyr/drivers/disk/flashdisk.c:613:1: note: in expansion of macro 'SYS_INIT'
      613 | SYS_INIT(disk_flash_init, POST_KERNEL, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT);
          | ^~~~~~~~
    /opt/nordic/ncs/v3.0.0/zephyr/drivers/disk/flashdisk.c:533:1: error: type of 'DEFINE_FLASHDISKS_CACHE' defaults to 'int' [-Werror=implicit-int]
      533 | PM_FOREACH_AFFILIATED_TO_disk(DEFINE_FLASHDISKS_CACHE)
          | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    /opt/nordic/ncs/v3.0.0/zephyr/include/zephyr/init.h:141:44: error: declaration for parameter '__init_disk_flash_init' but no such parameter
      141 | #define Z_INIT_ENTRY_NAME(init_id) _CONCAT(__init_, init_id)
          |                                            ^~~~~~~
    /opt/nordic/ncs/v3.0.0/zephyr/include/zephyr/toolchain/common.h:137:26: note: in definition of macro '_DO_CONCAT'
      137 | #define _DO_CONCAT(x, y) x ## y
          |                          ^
    /opt/nordic/ncs/v3.0.0/zephyr/include/zephyr/init.h:141:36: note: in expansion of macro '_CONCAT'
      141 | #define Z_INIT_ENTRY_NAME(init_id) _CONCAT(__init_, init_id)
          |                                    ^~~~~~~
    /opt/nordic/ncs/v3.0.0/zephyr/include/zephyr/init.h:241:17: note: in expansion of macro 'Z_INIT_ENTRY_NAME'
      241 |                 Z_INIT_ENTRY_NAME(name) = {.init_fn = {.sys = (init_fn_)},                \
          |                 ^~~~~~~~~~~~~~~~~
    /opt/nordic/ncs/v3.0.0/zephyr/include/zephyr/init.h:223:9: note: in expansion of macro 'SYS_INIT_NAMED'
      223 |         SYS_INIT_NAMED(init_fn, init_fn, level, prio)
          |         ^~~~~~~~~~~~~~
    /opt/nordic/ncs/v3.0.0/zephyr/drivers/disk/flashdisk.c:613:1: note: in expansion of macro 'SYS_INIT'
      613 | SYS_INIT(disk_flash_init, POST_KERNEL, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT);
          | ^~~~~~~~
    /opt/nordic/ncs/v3.0.0/zephyr/drivers/disk/flashdisk.c:572:30: error: declaration for parameter 'flash_disks' but no such parameter
      572 | static struct flashdisk_data flash_disks[] = {
          |                              ^~~~~~~~~~~
    /opt/nordic/ncs/v3.0.0/zephyr/drivers/disk/flashdisk.c:614: error: expected '{' at end of input
    /opt/nordic/ncs/v3.0.0/zephyr/drivers/disk/flashdisk.c:614: warning: control reaches end of non-void function [-Wreturn-type]
    /opt/nordic/ncs/v3.0.0/zephyr/drivers/disk/flashdisk.c: At top level:
    /opt/nordic/ncs/v3.0.0/zephyr/drivers/disk/flashdisk.c:464:37: warning: 'flash_disk_ops' defined but not used [-Wunused-const-variable=]
      464 | static const struct disk_operations flash_disk_ops = {
          |                                     ^~~~~~~~~~~~~~
    cc1: some warnings being treated as errors
    [192/294] Building C object zephyr/drivers/usb/device/CMakeFiles/drivers__usb__device.dir/usb_dc_nrfx.c.obj
    ninja: build stopped: subcommand failed.
    FAILED: _sysbuild/sysbuild/images/mass-prefix/src/mass-stamp/mass-build /opt/nordic/ncs/v3.0.0/zephyr/samples/subsys/usb/mass/build/_sysbuild/sysbuild/images/mass-prefix/src/mass-stamp/mass-build
    cd /opt/nordic/ncs/v3.0.0/zephyr/samples/subsys/usb/mass/build/mass && /opt/homebrew/bin/cmake --build .
    ninja: build stopped: subcommand failed.
    FATAL ERROR: command exited with status 1: /opt/homebrew/bin/cmake --build /opt/nordic/ncs/v3.0.0/zephyr/samples/subsys/usb/mass/build

Children
No Data
Related