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 #

  • HAhah gotya

    Tudor B. said:
    - when connecting it to Windows, if you copy a file to it and then decide to delete it, the file doesn't go to my computer's Recycle Bin, but rather a hidden folder is created that's named ".Trashed". To truly delete the file; you must delete it from inside the .Trashed folder. Is this a bug or a feature?

    Hehe a strange feature I guess. Sounds a bit confusing, though I guess windows doesn't want to just move any file to its own recycle bin. This soft delete function in the app should be possible to simply remove though.

    Tudor B. said:
    - if you restart/ power on your Windows machine and left the usb mass storage connected, the explorer.exe doesn't start correctly until you unplug the devkit.

    Odd. Though the machine does otherwise start up? Is it set to boot from USB? It looks like this is a general issue others have faced as well. You could try delaying opening the MSD interface until after explorer.exe presumably starts.

    Tudor B. said:
    - for the life of me, I can't get it to expose the full 8MB of flash as a mass storage. I tried modifying the related register in the overlay file into: reg = <0x00000000 0x00800000>; but to no effect. I also tried "nrfjprog --eraseall" and "nrfjprog --recover" but whatever I do, the usb mass storage created is always 2MB in size.

    That is interesting. I assume the issue is related to something like this and this. Does changing the size change anything? Could you make sure that your changes to that parameter are having an effect?

    Tudor B. said:
    - also we'd like to access it from the code as to be able to read/ write those files. I assume that'll be possible, right?

    Yeah, though you might have to turn off this interface for the computer while doing it. See here and here.

    Regards,

    Elfving

  • Thank you for the hasty reply Elfving!

    I'll check those points out and get back to you in 1H tops.

    Edit: I'll try once again: is it possible to have a short call please so that we can quickly sort these kinks out and test really fast?

  • I found the related .dts. Path: /opt/nordic/ncs/v3.0.0/zephyr/boards/nordic/nrf7002dk/nrf5340_cpuapp_common.dtsi

    What we're interested in:

    &spi4 {
    	compatible = "nordic,nrf-spim";
    	status = "okay";
    	pinctrl-0 = <&spi4_default>;
    	pinctrl-1 = <&spi4_sleep>;
    	pinctrl-names = "default", "sleep";
    	cs-gpios = <&gpio0 11 GPIO_ACTIVE_LOW>;
    	mx25r64: mx25r6435f@0 {
    		compatible = "jedec,spi-nor";
    		reg = <0>;
    		spi-max-frequency = <33000000>;
    		jedec-id = [c2 28 17];
    		sfdp-bfp = [
    			e5 20 f1 ff ff ff ff 03 44 eb 08 6b 08 3b 04 bb
    			ee ff ff ff ff ff 00 ff ff ff 00 ff 0c 20 0f 52
    			10 d8 00 ff 23 72 f5 00 82 ed 04 cc 44 83 68 44
    			30 b0 30 b0 f7 c4 d5 5c 00 be 29 ff f0 d0 ff ff
    		];
    		size = <67108864>;
    		has-dpd;
    		t-enter-dpd = <10000>;
    		t-exit-dpd = <5000>;
    	};
    };

    As far as I can tell, "size = <67108864>;" is technically correct since based on the memory's datasheet (which can be found here: https://www.macronix.com/Lists/Datasheet/Attachments/8868/MX25R6435F,%20Wide%20Range,%2064Mb,%20v1.6.pdf), we have:

    1. FEATURES 
    GENERAL
    • Supports Serial Peripheral Interface -- Mode 0 and Mode 3
    • 67,108,864 x 1 bit structure or 33,554,432 x 2 bits (two I/O mode) structure or 16,777,216 x 4 bits (four I/O mode) structure

    So, I suspect that <size> isn't the problem.

  • Also a VERY interesting point:

    I gave the same archive that Alexander provided to a colleague and told him about the modification to:

    reg = <0x00000000 0x00800000>;

    And to him, the full 8MB are exposed, but he had issues with using folders: creating a folder on the mass storage, ejecting and reconnecting it, lead to that folder being seen as a file. Repeating the previous process. but with the extra step of adding a file inside the folder, lead to the same behaviour. He mentioned that he might have some local SDK modifications related to his current task (external XIP), but he suspects that shouldn't have any impact.

    He also said that he thinks the culprit would be a CMAKE version mismatch since I have "cmake version 4.0.3" and he has "cmake version 3.31.6". Personally I doubt that the difference in CMAKE causes the issue, but I'll provide my most recent build log just in case:

    root@admins-MacBook-Air-2 mass_Alex_test # west build -b nrf7002dk/nrf5340/cpuapp --pristine ; west flash
    -- west build: making build dir /opt/nordic/ncs/v3.0.0/zephyr/samples/subsys/usb/mass_Alex_test/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
    Parsing /opt/nordic/ncs/v3.0.0/zephyr/share/sysbuild/Kconfig
    Loaded configuration '/opt/nordic/ncs/v3.0.0/zephyr/samples/subsys/usb/mass_Alex_test/build/_sysbuild/empty.conf'
    Merged configuration '/opt/nordic/ncs/v3.0.0/zephyr/samples/subsys/usb/mass_Alex_test/sysbuild.conf'
    Configuration saved to '/opt/nordic/ncs/v3.0.0/zephyr/samples/subsys/usb/mass_Alex_test/build/zephyr/.config'
    Kconfig header saved to '/opt/nordic/ncs/v3.0.0/zephyr/samples/subsys/usb/mass_Alex_test/build/_sysbuild/autoconf.h'
    --
       ************************************
       * Running CMake for mass_Alex_test *
       ************************************
    
    Loading Zephyr default modules (Zephyr base).
    -- Application: /opt/nordic/ncs/v3.0.0/zephyr/samples/subsys/usb/mass_Alex_test
    -- 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
    -- 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.dts
    -- Found devicetree overlay: /opt/nordic/ncs/v3.0.0/zephyr/samples/subsys/usb/mass_Alex_test/boards/nrf7002dk_nrf5340_cpuapp.overlay
    -- Generated zephyr.dts: /opt/nordic/ncs/v3.0.0/zephyr/samples/subsys/usb/mass_Alex_test/build/mass_Alex_test/zephyr/zephyr.dts
    -- Generated pickled edt: /opt/nordic/ncs/v3.0.0/zephyr/samples/subsys/usb/mass_Alex_test/build/mass_Alex_test/zephyr/edt.pickle
    -- Generated zephyr.dts: /opt/nordic/ncs/v3.0.0/zephyr/samples/subsys/usb/mass_Alex_test/build/mass_Alex_test/zephyr/zephyr.dts
    -- Generated devicetree_generated.h: /opt/nordic/ncs/v3.0.0/zephyr/samples/subsys/usb/mass_Alex_test/build/mass_Alex_test/zephyr/include/generated/zephyr/devicetree_generated.h
    -- Including generated dts.cmake file: /opt/nordic/ncs/v3.0.0/zephyr/samples/subsys/usb/mass_Alex_test/build/mass_Alex_test/zephyr/dts.cmake
    Parsing /opt/nordic/ncs/v3.0.0/zephyr/samples/subsys/usb/mass_Alex_test/Kconfig
    Loaded configuration '/opt/nordic/ncs/v3.0.0/zephyr/boards/nordic/nrf7002dk/nrf7002dk_nrf5340_cpuapp_defconfig'
    Merged configuration '/opt/nordic/ncs/v3.0.0/zephyr/samples/subsys/usb/mass_Alex_test/prj.conf'
    Merged configuration '/opt/nordic/ncs/v3.0.0/zephyr/samples/subsys/usb/mass_Alex_test/build/mass_Alex_test/zephyr/.config.sysbuild'
    Configuration saved to '/opt/nordic/ncs/v3.0.0/zephyr/samples/subsys/usb/mass_Alex_test/build/mass_Alex_test/zephyr/.config'
    Kconfig header saved to '/opt/nordic/ncs/v3.0.0/zephyr/samples/subsys/usb/mass_Alex_test/build/mass_Alex_test/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 (3.9s)
    -- Generating done (0.2s)
    -- Build files have been written to: /opt/nordic/ncs/v3.0.0/zephyr/samples/subsys/usb/mass_Alex_test/build/mass_Alex_test
    -- Configuring done (6.0s)
    -- Generating done (0.0s)
    -- Build files have been written to: /opt/nordic/ncs/v3.0.0/zephyr/samples/subsys/usb/mass_Alex_test/build
    -- west build: building application
    [5/8] Performing build step for 'mass_Alex_test'
    [1/198] Preparing syscall dependency handling
    
    [6/198] Generating include/generated/zephyr/version.h
    -- Zephyr version: 4.0.99 (/opt/nordic/ncs/v3.0.0/zephyr), build: v4.0.99-ncs1
    [198/198] Linking C executable zephyr/zephyr.elf
    Memory region         Used Size  Region Size  %age Used
               FLASH:       75664 B         1 MB      7.22%
                 RAM:       22328 B       448 KB      4.87%
            IDT_LIST:          0 GB        32 KB      0.00%
    Generating files from /opt/nordic/ncs/v3.0.0/zephyr/samples/subsys/usb/mass_Alex_test/build/mass_Alex_test/zephyr/zephyr.elf for board: nrf7002dk
    [8/8] Completed 'mass_Alex_test'
    -- west flash: rebuilding
    [0/3] Performing build step for 'mass_Alex_test'
    ninja: no work to do.
    [3/3] Completed 'mass_Alex_test'
    -- 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_Alex_test/build/mass_Alex_test/zephyr/zephyr.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.

    Edit:

    Going down the build comparison rabbit hole, we discovered that:

    - the cmake version installed doesn't make a difference

    - I didn't have DTC installed (in my build log we can find: "-- Could NOT find Dtc (missing: DTC) (Required is at least version "1.4.6")"

    - I installed DTC and now I get: "-- Found Dtc: /opt/homebrew/bin/dtc (found suitable version "1.7.2", minimum required is "1.4.6")"

    - there are still two differences between our builds:

         * he has python version is "[email protected]" and mine is "[email protected]".

         * he has three extra options enabled via the menuconfig build:

          

    warning: FS_FATFS_LFN (defined at subsys/fs/Kconfig.fatfs:116) was assigned the value 'y' but got
    the value 'n'. Check these unsatisfied dependencies: FAT_FILESYSTEM_ELM (=n), FILE_SYSTEM (=n). See
    http://docs.zephyrproject.org/latest/kconfig.html#CONFIG_FS_FATFS_LFN and/or look up FS_FATFS_LFN 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: FS_FATFS_MAX_LFN (defined at subsys/fs/Kconfig.fatfs:161) was assigned the value '255' but
    got the value ''. Check these unsatisfied dependencies: FS_FATFS_LFN (=n), FAT_FILESYSTEM_ELM (=n),
    FILE_SYSTEM (=n). See http://docs.zephyrproject.org/latest/kconfig.html#CONFIG_FS_FATFS_MAX_LFN
    and/or look up FS_FATFS_MAX_LFN 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: FS_FATFS_CODEPAGE (defined at subsys/fs/Kconfig.fatfs:172) was assigned the value '437' but
    got the value ''. Check these unsatisfied dependencies: FAT_FILESYSTEM_ELM (=n), FILE_SYSTEM (=n).
    See http://docs.zephyrproject.org/latest/kconfig.html#CONFIG_FS_FATFS_CODEPAGE and/or look up
    FS_FATFS_CODEPAGE 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.

    For the sake of completeness, this is his build:

    root@SANDAs-MacBook-Air mass_Alex_test # west build -b nrf7002dk/nrf5340/cpuapp --pristine
    -- west build: making build dir /Users/sandabogdanmadalin/ncs/nrf/applications/mass_Alex_test/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.12 (found suitable version "3.12.10", minimum required is "3.10") found components: Interpreter
    -- Cache files will be written to: /Users/sandabogdanmadalin/Library/Caches/zephyr
    -- Found west (found suitable version "1.3.0", minimum required is "0.14.0")
    -- Board: nrf7002dk, qualifiers: nrf5340/cpuapp
    Parsing /Users/sandabogdanmadalin/ncs/nrf/zephyr/share/sysbuild/Kconfig
    Loaded configuration '/Users/sandabogdanmadalin/ncs/nrf/applications/mass_Alex_test/build/_sysbuild/empty.conf'
    Merged configuration '/Users/sandabogdanmadalin/ncs/nrf/applications/mass_Alex_test/sysbuild.conf'
    Configuration saved to '/Users/sandabogdanmadalin/ncs/nrf/applications/mass_Alex_test/build/zephyr/.config'
    Kconfig header saved to '/Users/sandabogdanmadalin/ncs/nrf/applications/mass_Alex_test/build/_sysbuild/autoconf.h'
    -- 
       ************************************
       * Running CMake for mass_Alex_test *
       ************************************
    
    Loading Zephyr default modules (Zephyr base).
    -- Application: /Users/sandabogdanmadalin/ncs/nrf/applications/mass_Alex_test
    -- CMake version: 3.31.6
    -- Found Python3: /opt/homebrew/opt/python/libexec/bin/python (found suitable version "3.13.3", minimum required is "3.10") found components: Interpreter
    -- Cache files will be written to: /Users/sandabogdanmadalin/Library/Caches/zephyr
    -- Zephyr version: 4.0.99 (/Users/sandabogdanmadalin/ncs/nrf/zephyr)
    -- Found west (found suitable version "1.3.0", minimum required is "0.14.0")
    -- Board: nrf7002dk, qualifiers: nrf5340/cpuapp
    -- ZEPHYR_TOOLCHAIN_VARIANT not set, trying to locate Zephyr SDK
    -- Found host-tools: zephyr 0.17.0 (/opt/zephyr-sdk-0.17.0)
    -- Found toolchain: zephyr 0.17.0 (/opt/zephyr-sdk-0.17.0)
    -- Found Dtc: /opt/homebrew/bin/dtc (found suitable version "1.7.2", minimum required is "1.4.6")
    -- Found BOARD.dts: /Users/sandabogdanmadalin/ncs/nrf/zephyr/boards/nordic/nrf7002dk/nrf7002dk_nrf5340_cpuapp.dts
    -- Found devicetree overlay: /Users/sandabogdanmadalin/ncs/nrf/applications/mass_Alex_test/boards/nrf7002dk_nrf5340_cpuapp.overlay
    -- Generated zephyr.dts: /Users/sandabogdanmadalin/ncs/nrf/applications/mass_Alex_test/build/mass_Alex_test/zephyr/zephyr.dts
    -- Generated pickled edt: /Users/sandabogdanmadalin/ncs/nrf/applications/mass_Alex_test/build/mass_Alex_test/zephyr/edt.pickle
    -- Generated zephyr.dts: /Users/sandabogdanmadalin/ncs/nrf/applications/mass_Alex_test/build/mass_Alex_test/zephyr/zephyr.dts
    -- Generated devicetree_generated.h: /Users/sandabogdanmadalin/ncs/nrf/applications/mass_Alex_test/build/mass_Alex_test/zephyr/include/generated/zephyr/devicetree_generated.h
    -- Including generated dts.cmake file: /Users/sandabogdanmadalin/ncs/nrf/applications/mass_Alex_test/build/mass_Alex_test/zephyr/dts.cmake
    
    warning: FS_FATFS_LFN (defined at subsys/fs/Kconfig.fatfs:116) was assigned the value 'y' but got
    the value 'n'. Check these unsatisfied dependencies: FAT_FILESYSTEM_ELM (=n), FILE_SYSTEM (=n). See
    http://docs.zephyrproject.org/latest/kconfig.html#CONFIG_FS_FATFS_LFN and/or look up FS_FATFS_LFN 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: FS_FATFS_MAX_LFN (defined at subsys/fs/Kconfig.fatfs:161) was assigned the value '255' but
    got the value ''. Check these unsatisfied dependencies: FS_FATFS_LFN (=n), FAT_FILESYSTEM_ELM (=n),
    FILE_SYSTEM (=n). See http://docs.zephyrproject.org/latest/kconfig.html#CONFIG_FS_FATFS_MAX_LFN
    and/or look up FS_FATFS_MAX_LFN 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: FS_FATFS_CODEPAGE (defined at subsys/fs/Kconfig.fatfs:172) was assigned the value '437' but
    got the value ''. Check these unsatisfied dependencies: FAT_FILESYSTEM_ELM (=n), FILE_SYSTEM (=n).
    See http://docs.zephyrproject.org/latest/kconfig.html#CONFIG_FS_FATFS_CODEPAGE and/or look up
    FS_FATFS_CODEPAGE 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 /Users/sandabogdanmadalin/ncs/nrf/applications/mass_Alex_test/Kconfig
    Loaded configuration '/Users/sandabogdanmadalin/ncs/nrf/zephyr/boards/nordic/nrf7002dk/nrf7002dk_nrf5340_cpuapp_defconfig'
    Merged configuration '/Users/sandabogdanmadalin/ncs/nrf/applications/mass_Alex_test/prj.conf'
    Merged configuration '/Users/sandabogdanmadalin/ncs/nrf/applications/mass_Alex_test/build/mass_Alex_test/zephyr/.config.sysbuild'
    Configuration saved to '/Users/sandabogdanmadalin/ncs/nrf/applications/mass_Alex_test/build/mass_Alex_test/zephyr/.config'
    Kconfig header saved to '/Users/sandabogdanmadalin/ncs/nrf/applications/mass_Alex_test/build/mass_Alex_test/zephyr/include/generated/zephyr/autoconf.h'
    -- Found GnuLd: /opt/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: /opt/zephyr-sdk-0.17.0/arm-zephyr-eabi/bin/arm-zephyr-eabi-gcc
    CMake Warning at /Users/sandabogdanmadalin/ncs/nrf/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 (3.8s)
    -- Generating done (0.2s)
    -- Build files have been written to: /Users/sandabogdanmadalin/ncs/nrf/applications/mass_Alex_test/build/mass_Alex_test
    -- Configuring done (5.8s)
    -- Generating done (0.0s)
    -- Build files have been written to: /Users/sandabogdanmadalin/ncs/nrf/applications/mass_Alex_test/build
    -- west build: building application
    [5/8] Performing build step for 'mass_Alex_test'
    [1/190] Preparing syscall dependency handling
    
    [6/190] Generating include/generated/zephyr/version.h
    -- Zephyr version: 4.0.99 (/Users/sandabogdanmadalin/ncs/nrf/zephyr), build: v4.0.99-ncs1
    [190/190] Linking C executable zephyr/zephyr.elf
    Memory region         Used Size  Region Size  %age Used
               FLASH:       63444 B         1 MB      6.05%
                 RAM:       21296 B       448 KB      4.64%
            IDT_LIST:          0 GB        32 KB      0.00%
    Generating files from /Users/sandabogdanmadalin/ncs/nrf/applications/mass_Alex_test/build/mass_Alex_test/zephyr/zephyr.elf for board: nrf7002dk
    [8/8] Completed 'mass_Alex_test'
    root@SANDAs-MacBook-Air mass_Alex_test # west flash
    -- west flash: rebuilding
    [0/3] Performing build step for 'mass_Alex_test'
    ninja: no work to do.
    [3/3] Completed 'mass_Alex_test'
    -- west flash: using runner nrfutil
    -- runners.nrfutil: reset after flashing requested
    Using board 001050784114
    -- runners.nrfutil: Flashing file: /Users/sandabogdanmadalin/ncs/nrf/applications/mass_Alex_test/build/mass_Alex_test/zephyr/zephyr.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 1050784114 flashed successfully.

    And this is my build:

    root@192 mass_Alex_test # west build -b nrf7002dk/nrf5340/cpuapp --pristine ; west flash
    -- west build: making build dir /opt/nordic/ncs/v3.0.0/zephyr/samples/subsys/usb/mass_Alex_test/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
    Parsing /opt/nordic/ncs/v3.0.0/zephyr/share/sysbuild/Kconfig
    Loaded configuration '/opt/nordic/ncs/v3.0.0/zephyr/samples/subsys/usb/mass_Alex_test/build/_sysbuild/empty.conf'
    Merged configuration '/opt/nordic/ncs/v3.0.0/zephyr/samples/subsys/usb/mass_Alex_test/sysbuild.conf'
    Configuration saved to '/opt/nordic/ncs/v3.0.0/zephyr/samples/subsys/usb/mass_Alex_test/build/zephyr/.config'
    Kconfig header saved to '/opt/nordic/ncs/v3.0.0/zephyr/samples/subsys/usb/mass_Alex_test/build/_sysbuild/autoconf.h'
    --
       ************************************
       * Running CMake for mass_Alex_test *
       ************************************
    
    Loading Zephyr default modules (Zephyr base).
    -- Application: /opt/nordic/ncs/v3.0.0/zephyr/samples/subsys/usb/mass_Alex_test
    -- CMake version: 3.31.6
    -- 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
    -- 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)
    -- Found Dtc: /opt/homebrew/bin/dtc (found suitable version "1.7.2", minimum required is "1.4.6")
    -- Found BOARD.dts: /opt/nordic/ncs/v3.0.0/zephyr/boards/nordic/nrf7002dk/nrf7002dk_nrf5340_cpuapp.dts
    -- Found devicetree overlay: /opt/nordic/ncs/v3.0.0/zephyr/samples/subsys/usb/mass_Alex_test/boards/nrf7002dk_nrf5340_cpuapp.overlay
    -- Generated zephyr.dts: /opt/nordic/ncs/v3.0.0/zephyr/samples/subsys/usb/mass_Alex_test/build/mass_Alex_test/zephyr/zephyr.dts
    -- Generated pickled edt: /opt/nordic/ncs/v3.0.0/zephyr/samples/subsys/usb/mass_Alex_test/build/mass_Alex_test/zephyr/edt.pickle
    -- Generated zephyr.dts: /opt/nordic/ncs/v3.0.0/zephyr/samples/subsys/usb/mass_Alex_test/build/mass_Alex_test/zephyr/zephyr.dts
    -- Generated devicetree_generated.h: /opt/nordic/ncs/v3.0.0/zephyr/samples/subsys/usb/mass_Alex_test/build/mass_Alex_test/zephyr/include/generated/zephyr/devicetree_generated.h
    -- Including generated dts.cmake file: /opt/nordic/ncs/v3.0.0/zephyr/samples/subsys/usb/mass_Alex_test/build/mass_Alex_test/zephyr/dts.cmake
    Parsing /opt/nordic/ncs/v3.0.0/zephyr/samples/subsys/usb/mass_Alex_test/Kconfig
    Loaded configuration '/opt/nordic/ncs/v3.0.0/zephyr/boards/nordic/nrf7002dk/nrf7002dk_nrf5340_cpuapp_defconfig'
    Merged configuration '/opt/nordic/ncs/v3.0.0/zephyr/samples/subsys/usb/mass_Alex_test/prj.conf'
    Merged configuration '/opt/nordic/ncs/v3.0.0/zephyr/samples/subsys/usb/mass_Alex_test/build/mass_Alex_test/zephyr/.config.sysbuild'
    Configuration saved to '/opt/nordic/ncs/v3.0.0/zephyr/samples/subsys/usb/mass_Alex_test/build/mass_Alex_test/zephyr/.config'
    Kconfig header saved to '/opt/nordic/ncs/v3.0.0/zephyr/samples/subsys/usb/mass_Alex_test/build/mass_Alex_test/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 (3.5s)
    -- Generating done (0.2s)
    -- Build files have been written to: /opt/nordic/ncs/v3.0.0/zephyr/samples/subsys/usb/mass_Alex_test/build/mass_Alex_test
    -- Configuring done (5.2s)
    -- Generating done (0.0s)
    -- Build files have been written to: /opt/nordic/ncs/v3.0.0/zephyr/samples/subsys/usb/mass_Alex_test/build
    -- west build: building application
    [5/8] Performing build step for 'mass_Alex_test'
    [1/190] Preparing syscall dependency handling
    
    [6/190] Generating include/generated/zephyr/version.h
    -- Zephyr version: 4.0.99 (/opt/nordic/ncs/v3.0.0/zephyr), build: v4.0.99-ncs1
    [190/190] Linking C executable zephyr/zephyr.elf
    Memory region         Used Size  Region Size  %age Used
               FLASH:       63580 B         1 MB      6.06%
                 RAM:       21296 B       448 KB      4.64%
            IDT_LIST:          0 GB        32 KB      0.00%
    Generating files from /opt/nordic/ncs/v3.0.0/zephyr/samples/subsys/usb/mass_Alex_test/build/mass_Alex_test/zephyr/zephyr.elf for board: nrf7002dk
    [8/8] Completed 'mass_Alex_test'
    -- west flash: rebuilding
    [0/3] Performing build step for 'mass_Alex_test'
    ninja: no work to do.
    [3/3] Completed 'mass_Alex_test'
    -- 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_Alex_test/build/mass_Alex_test/zephyr/zephyr.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.

  • I agree that the size does look right, unfortunately :P Does changing it have an effect? Ie. can you make it claim to be 3 and 1 MB by changing the size parameter? And although 67108864 should imply 0x800000, could you try adding that as well, and see if it reacts in any way?

    Are you using any overlay that might overwrite these partitions, like a pm_static file?

    Tudor B. said:
    Edit: I'll try once again: is it possible to have a short call please so that we can quickly sort these kinks out and test really fast?

    I guess we could give this a go sometime next week, as it might also be practical to come up to speed in regards to what has been done while I was away. Though the thing is that it won't necessarily make anything go faster, as I won't necessarily immediately see what is wrong. I would typically have to search around. 

    EDIT: Didnt see your latest reply. That it works for Alex could also be a sign that there is an overlay file or something build-wise that is different between you two.. though I am not really seeing any sign of a pm file in the buildlog.

    Regards,

    Elfving

Reply
  • I agree that the size does look right, unfortunately :P Does changing it have an effect? Ie. can you make it claim to be 3 and 1 MB by changing the size parameter? And although 67108864 should imply 0x800000, could you try adding that as well, and see if it reacts in any way?

    Are you using any overlay that might overwrite these partitions, like a pm_static file?

    Tudor B. said:
    Edit: I'll try once again: is it possible to have a short call please so that we can quickly sort these kinks out and test really fast?

    I guess we could give this a go sometime next week, as it might also be practical to come up to speed in regards to what has been done while I was away. Though the thing is that it won't necessarily make anything go faster, as I won't necessarily immediately see what is wrong. I would typically have to search around. 

    EDIT: Didnt see your latest reply. That it works for Alex could also be a sign that there is an overlay file or something build-wise that is different between you two.. though I am not really seeing any sign of a pm file in the buildlog.

    Regards,

    Elfving

Children
  • Interesting point! Just tried it with 1MB: "reg = <0x00000000 0x00100000>;"

    And indeed MacOS detected a 1MB disk. Will try to slowly increase the size to see what happens.
    No pm_static.yml is present. The sample is identical to the most recent .zip that I attached here, but with the change to make the disk 8MB: 
    reg = <0x00000000 0x00800000>;

    Can't wait for next week then! :)

    Edit:

    Played around with it a bit more. If I set the limit to 3MB, this happens:

    (in a high level layer, the disk is still reported as 2MB)

    But also!:

    (low level, it's correctly detected as 3MB)

    I tried connecting it to Windows, but still it appears as a 2MB usb mass storage.

    Edit 2:

    I manually added the three CONFIG_ options that my colleague had; more exactly:

    CONFIG_FS_FATFS_LFN=y
    CONFIG_FS_FATFS_MAX_LFN=255
    CONFIG_FS_FATFS_CODEPAGE=437

    And now the only difference between our builds is that he has Python 3.12 and I have Python 3.13. Yet the behaviour is the same as described above.

    Edit 3:

    Interestingly enough, I put a 1.7MB image in a folder on the mass storage. The curious part is: even after "nrfjprog --eraseall" AND "nrfjprog --recover", the folder and image are still there! This suggests to me that whatever I did on my own (before getting this sample from Alexander) using the pm_static and the partition manager might have configured the mx25r64 chip to have 2MB in size and now with Alex's sample I can't really reconfigure it to 8MB.

  • Writing a separate message to not make things confusing (not sure if you get notifications if I edit my reply or not, but I didn't when you edited yours).

    The sample as Alex gave me (with 2MB) works exactly as intended for both me and him. Our issue is that I tried increasing it to 8MB and it stayed at 2MB, then I gave it to a colleague and told him to increase it to 8MB and for him it worked.

  • Quick update:

    Alexander returned to the office and after presenting the current state of things to him, he suggested that I simply format the mass storage when I connect it to my PC. -> it worked perfectly!

    Now we finally have the full 8MB of the external chip accessible as a USB Mass Storage disk! Yay!

    The only question that remains: can we get it working using LittleFS also? :)

  • Sorry about the wait again, this time I've been OOO sick. Though I am very glad that Alexander can once again swoop in and help out when I'm unable to Stuck out tongue

    Tudor B. said:
    The sample as Alex gave me (with 2MB) works exactly as intended for both me and him. Our issue is that I tried increasing it to 8MB and it stayed at 2MB, then I gave it to a colleague and told him to increase it to 8MB and for him it worked.
    Tudor B. said:
    Alexander returned to the office and after presenting the current state of things to him, he suggested that I simply format the mass storage when I connect it to my PC. -> it worked perfectly!

    Heheh perfect! I wouldn't have thought of that myself. Though I guess it would have to be something silly at fault when it works on your coworkers side and not yours.

    Tudor B. said:
    The only question that remains: can we get it working using LittleFS also? :)

    Hopefully you just need an additional config and some dts changes for that to work (see here)

    Tudor B. said:

    Currently our architect and CEO are pushing for LittleFS for both File System and USB Mass Storage since it's more reliable and has error correction (theoretically). There's something called LittleFS FUSE that helps OSes recognise disks that have the LittleFS File System. I've played with it a bit but at this point I'm not sure if LFS FUSE ain't working correctly or if my config of the sample project is erroneous so LFS FUSE won't read the disk correctly.

    I see that you have some arguments for littleFS here, though consider whether it would actually work with the OS you are using first. I've seen a lot of people claiming that Fat has more native OS support.

    Regards,

    Elfving

  • Hello and welcome back once again Elfving! Glad to hear you're better!

    Things have evolved yet again since our last chat here. I'll paste the mail that I've sent to Alexander here:

    Me and two colleagues have tried to integrate the sample that you provided into our project. Although the sample that you provided works perfectly as a standalone project, I think it's impossible for us to integrate it since we're building for non secure and implicitly using a small TFM partition to store some data. This implicitly requires SB_CONFIG_PARTITION_MANAGER to be enabled. By leaving it disabled (as it is in the sample), we get a plethora of TFM partition issues (the attached build log).
    In essence, could you provide a sample that has this TFM configuration enabled, together with the USB mass storage?:
    CONFIG_ARM_TRUSTZONE_M=y
    CONFIG_BUILD_WITH_TFM=y

    CONFIG_TFM_PROFILE_TYPE_MINIMAL=y
    Thanks for the support Elfving. Hope we can sort it out fast. :)
Related