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! :)

Related