USB Mass Storage with MCUBOOT

Hi Devzone,

I am facing an issue on my nrf52840-based custom board when I try to set up the USB mass storage class on an external NOR Flash as well as having MCUBoot enabled with the secondary slot partition on that same external flash.

I am able to reproduce the issue on a nRF52840 DK with Zephyr's USB Mass storage sample and the following configuration:

Windows, NCS v2.6.1 (my original issue also happens on v2.7.0, I have not tried v2.7.0 with the DK)

I have a pm_static.yml file defined as follows:

mcuboot_secondary:
  address: 0x00000
  region: external_flash
  size: 0xdb000

storage_partition:
  affiliation: disk
  extra_params: {
      disk_name: "NAND",
      disk_cache_size: 4096,
      disk_sector_size: 512,
      disk_read_only: 0
  }
  address: 0xdb000
  region: external_flash
  size: 0xf25000

I modified the sample overlay for the nrf52840DK:

/*
 * Copyright (c) 2019 Peter Bigot Consulting, LLC
 *
 * SPDX-License-Identifier: Apache-2.0
 */

/delete-node/ &storage_partition;

&mx25r64 {
	partitions {
		compatible = "fixed-partitions";
		#address-cells = <1>;
		#size-cells = <1>;

		mcuboot_secondary: partition@0 {
			reg = <0x0 0xdb000>;
			read-only;
		};
		storage_partition: partition@db000 {
			reg = <0xdb000 0xf25000>;
		};
	};
};

/ {

	chosen {
		nordic,pm-ext-flash = &mx25r64;
	};
	
	msc_disk0 {
		compatible = "zephyr,flash-disk";
		partition = <&storage_partition>;
		disk-name = "NAND";
		cache-size = <4096>;
	};
};

And finally the proj.conf file. I added two configurations to the sample file: CONFIG_APP_MSC_STORAGE_FLASH_FATFS to enable FAT filesystem on the flash device, and  CONFIG_BOOTLOADER_MCUBOOT to add MCUBoot

CONFIG_STDOUT_CONSOLE=y

#USB related configs
CONFIG_USB_DEVICE_STACK=y
CONFIG_USB_DEVICE_PRODUCT="Zephyr MSC sample"
CONFIG_USB_DEVICE_PID=0x0008
CONFIG_LOG=y
CONFIG_USB_DRIVER_LOG_LEVEL_ERR=y
CONFIG_USB_MASS_STORAGE=y
CONFIG_USB_DEVICE_LOG_LEVEL_ERR=y
CONFIG_USB_MASS_STORAGE_LOG_LEVEL_ERR=y
CONFIG_USB_DEVICE_INITIALIZE_AT_BOOT=n

CONFIG_MAIN_STACK_SIZE=1536

CONFIG_BOOTLOADER_MCUBOOT=y

CONFIG_APP_MSC_STORAGE_FLASH_FATFS=y

With MCUBoot disabled, the program compiles and performs fine, however when I enable MCUBoot I get the following error:

[101/195] Building C object zephyr/drivers/disk/CMakeFiles/drivers__disk.dir/flashdisk.c.obj
FAILED: zephyr/drivers/disk/CMakeFiles/drivers__disk.dir/flashdisk.c.obj 
C:\ncs\toolchains\cf2149caf2\opt\zephyr-sdk\arm-zephyr-eabi\bin\arm-zephyr-eabi-gcc.exe -DKERNEL -DNRF52840_XXAA -DPICOLIBC_LONG_LONG_PRINTF_SCANF -DUSE_PARTITION_MANAGER=1 -D_FORTIFY_SOURCE=1 -D_POSIX_C_SOURCE=200809 -D__LINUX_ERRNO_EXTENSIONS__ -D__PROGRAM_START -D__ZEPHYR_SUPERVISOR__ -D__ZEPHYR__=1 -IC:/Users/LPC-008/Documents/eqs-motion-s-zephyr/zephyr/include -IC:/Users/LPC-008/Documents/eqs-motion-s-zephyr/zephyr/samples/subsys/usb/mass/build/zephyr/include/generated -IC:/Users/LPC-008/Documents/eqs-motion-s-zephyr/zephyr/soc/arm/nordic_nrf/nrf52 -IC:/Users/LPC-008/Documents/eqs-motion-s-zephyr/zephyr/soc/common/nordic_nrf/. -IC:/Users/LPC-008/Documents/eqs-motion-s-zephyr/zephyr/soc/arm/nordic_nrf/common/. -IC:/Users/LPC-008/Documents/eqs-motion-s-zephyr/zephyr/subsys/usb/device -IC:/Users/LPC-008/Documents/eqs-motion-s-zephyr/zephyr/drivers/usb/common/nrf_usbd_common/. -IC:/Users/LPC-008/Documents/eqs-motion-s-zephyr/eqs-motion-s-zephyr.git/include -IC:/Users/LPC-008/Documents/eqs-motion-s-zephyr/eqs-motion-s-zephyr.git/include/shared_types -IC:/Users/LPC-008/Documents/eqs-motion-s-zephyr/nrf/include -IC:/Users/LPC-008/Documents/eqs-motion-s-zephyr/nrf/tests/include -IC:/Users/LPC-008/Documents/eqs-motion-s-zephyr/modules/hal/cmsis/CMSIS/Core/Include -IC:/Users/LPC-008/Documents/eqs-motion-s-zephyr/zephyr/modules/cmsis/. -IC:/Users/LPC-008/Documents/eqs-motion-s-zephyr/modules/hal/nordic/nrfx -IC:/Users/LPC-008/Documents/eqs-motion-s-zephyr/modules/hal/nordic/nrfx/drivers/include -IC:/Users/LPC-008/Documents/eqs-motion-s-zephyr/modules/hal/nordic/nrfx/mdk -IC:/Users/LPC-008/Documents/eqs-motion-s-zephyr/zephyr/modules/hal_nordic/nrfx/. -IC:/Users/LPC-008/Documents/eqs-motion-s-zephyr/modules/debug/segger/SEGGER -IC:/Users/LPC-008/Documents/eqs-motion-s-zephyr/modules/debug/segger/Config -isystem C:/Users/LPC-008/Documents/eqs-motion-s-zephyr/zephyr/lib/libc/common/include -isystem C:/Users/LPC-008/Documents/eqs-motion-s-zephyr/nrfxlib/crypto/nrf_cc310_platform/include -Wshadow -fno-strict-aliasing -Os -imacros C:/Users/LPC-008/Documents/eqs-motion-s-zephyr/zephyr/samples/subsys/usb/mass/build/zephyr/include/generated/autoconf.h -fno-printf-return-value -fno-common -g -gdwarf-4 -fdiagnostics-color=always -mcpu=cortex-m4 -mthumb -mabi=aapcs -mfp16-format=ieee -mtp=soft --sysroot=C:/ncs/toolchains/cf2149caf2/opt/zephyr-sdk/arm-zephyr-eabi/arm-zephyr-eabi -imacros C:/Users/LPC-008/Documents/eqs-motion-s-zephyr/zephyr/include/zephyr/toolchain/zephyr_stdint.h -Wall -Wformat -Wformat-security -Wno-format-zero-length -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=C:/Users/LPC-008/Documents/eqs-motion-s-zephyr/zephyr/samples/subsys/usb/mass=CMAKE_SOURCE_DIR -fmacro-prefix-map=C:/Users/LPC-008/Documents/eqs-motion-s-zephyr/zephyr=ZEPHYR_BASE -fmacro-prefix-map=C:/Users/LPC-008/Documents/eqs-motion-s-zephyr=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 C:/Users/LPC-008/Documents/eqs-motion-s-zephyr/zephyr/drivers/disk/flashdisk.c
C:/Users/LPC-008/Documents/eqs-motion-s-zephyr/zephyr/drivers/disk/flashdisk.c:484:1: error: return type defaults to 'int' [-Werror=implicit-int]
  484 | PM_FOREACH_AFFILIATED_TO_disk(DEFINE_FLASHDISKS_CACHE)
      | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
C:/Users/LPC-008/Documents/eqs-motion-s-zephyr/zephyr/drivers/disk/flashdisk.c: In function 'PM_FOREACH_AFFILIATED_TO_disk':
C:/Users/LPC-008/Documents/eqs-motion-s-zephyr/zephyr/drivers/disk/flashdisk.c:523:30: error: storage class specified for parameter 'flash_disks'
  523 | static struct flashdisk_data flash_disks[] = {
      |                              ^~~~~~~~~~~
C:/Users/LPC-008/Documents/eqs-motion-s-zephyr/zephyr/drivers/disk/flashdisk.c:523:15: error: parameter 'flash_disks' is initialized
  523 | static struct flashdisk_data flash_disks[] = {
      |               ^~~~~~~~~~~~~~
C:/Users/LPC-008/Documents/eqs-motion-s-zephyr/zephyr/drivers/disk/flashdisk.c:524:39: error: 'DEFINE_FLASHDISKS_DEVICE' undeclared (first use in this function)
  524 |         PM_FOREACH_AFFILIATED_TO_disk(DEFINE_FLASHDISKS_DEVICE)
      |                                       ^~~~~~~~~~~~~~~~~~~~~~~~
C:/Users/LPC-008/Documents/eqs-motion-s-zephyr/zephyr/drivers/disk/flashdisk.c:524:39: note: each undeclared identifier is reported only once for each function it appears in
C:/Users/LPC-008/Documents/eqs-motion-s-zephyr/zephyr/drivers/disk/flashdisk.c:533:1: error: expected declaration specifiers before 'PM_FOREACH_AFFILIATED_TO_disk'
  533 | PM_FOREACH_AFFILIATED_TO_disk(VERIFY_CACHE_SIZE_IS_NOT_ZERO_IF_NOT_READ_ONLY)
      | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from C:/Users/LPC-008/Documents/eqs-motion-s-zephyr/zephyr/include/zephyr/toolchain/gcc.h:98,
                 from C:/Users/LPC-008/Documents/eqs-motion-s-zephyr/zephyr/include/zephyr/toolchain.h:50,
                 from C:/Users/LPC-008/Documents/eqs-motion-s-zephyr/zephyr/include/zephyr/sys/__assert.h:11,
                 from C:/Users/LPC-008/Documents/eqs-motion-s-zephyr/zephyr/drivers/disk/flashdisk.c:10:
C:/Users/LPC-008/Documents/eqs-motion-s-zephyr/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)
      |                                            ^~~~~~~
C:/Users/LPC-008/Documents/eqs-motion-s-zephyr/zephyr/include/zephyr/toolchain/common.h:137:26: note: in definition of macro '_DO_CONCAT'
  137 | #define _DO_CONCAT(x, y) x ## y
      |                          ^
C:/Users/LPC-008/Documents/eqs-motion-s-zephyr/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)
      |                                    ^~~~~~~
C:/Users/LPC-008/Documents/eqs-motion-s-zephyr/zephyr/include/zephyr/init.h:208:17: note: in expansion of macro 'Z_INIT_ENTRY_NAME'
  208 |                 Z_INIT_ENTRY_NAME(name) = {.init_fn = {.sys = (init_fn_)}}
      |                 ^~~~~~~~~~~~~~~~~
C:/Users/LPC-008/Documents/eqs-motion-s-zephyr/zephyr/include/zephyr/init.h:190:9: note: in expansion of macro 'SYS_INIT_NAMED'
  190 |         SYS_INIT_NAMED(init_fn, init_fn, level, prio)
      |         ^~~~~~~~~~~~~~
C:/Users/LPC-008/Documents/eqs-motion-s-zephyr/zephyr/drivers/disk/flashdisk.c:563:1: note: in expansion of macro 'SYS_INIT'
  563 | SYS_INIT(disk_flash_init, APPLICATION, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT);
      | ^~~~~~~~
C:/Users/LPC-008/Documents/eqs-motion-s-zephyr/zephyr/include/zephyr/init.h:206:42: error: parameter '__init_disk_flash_init' is initialized
  206 |         static const Z_DECL_ALIGN(struct init_entry)                           \
      |                                          ^~~~~~~~~~
C:/Users/LPC-008/Documents/eqs-motion-s-zephyr/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
      |                                                       ^~~~
C:/Users/LPC-008/Documents/eqs-motion-s-zephyr/zephyr/include/zephyr/init.h:190:9: note: in expansion of macro 'SYS_INIT_NAMED'
  190 |         SYS_INIT_NAMED(init_fn, init_fn, level, prio)
      |         ^~~~~~~~~~~~~~
C:/Users/LPC-008/Documents/eqs-motion-s-zephyr/zephyr/drivers/disk/flashdisk.c:563:1: note: in expansion of macro 'SYS_INIT'
  563 | SYS_INIT(disk_flash_init, APPLICATION, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT);
      | ^~~~~~~~
C:/Users/LPC-008/Documents/eqs-motion-s-zephyr/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)
      |                                            ^~~~~~~
C:/Users/LPC-008/Documents/eqs-motion-s-zephyr/zephyr/include/zephyr/toolchain/common.h:137:26: note: in definition of macro '_DO_CONCAT'
  137 | #define _DO_CONCAT(x, y) x ## y
      |                          ^
C:/Users/LPC-008/Documents/eqs-motion-s-zephyr/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)
      |                                    ^~~~~~~
C:/Users/LPC-008/Documents/eqs-motion-s-zephyr/zephyr/include/zephyr/init.h:208:17: note: in expansion of macro 'Z_INIT_ENTRY_NAME'
  208 |                 Z_INIT_ENTRY_NAME(name) = {.init_fn = {.sys = (init_fn_)}}
      |                 ^~~~~~~~~~~~~~~~~
C:/Users/LPC-008/Documents/eqs-motion-s-zephyr/zephyr/include/zephyr/init.h:190:9: note: in expansion of macro 'SYS_INIT_NAMED'
  190 |         SYS_INIT_NAMED(init_fn, init_fn, level, prio)
      |         ^~~~~~~~~~~~~~
C:/Users/LPC-008/Documents/eqs-motion-s-zephyr/zephyr/drivers/disk/flashdisk.c:563:1: note: in expansion of macro 'SYS_INIT'
  563 | SYS_INIT(disk_flash_init, APPLICATION, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT);
      | ^~~~~~~~
C:/Users/LPC-008/Documents/eqs-motion-s-zephyr/zephyr/include/zephyr/init.h:206:42: warning: 'used' attribute ignored [-Wattributes]
  206 |         static const Z_DECL_ALIGN(struct init_entry)                           \
      |                                          ^~~~~~~~~~
C:/Users/LPC-008/Documents/eqs-motion-s-zephyr/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
      |                                                       ^~~~
C:/Users/LPC-008/Documents/eqs-motion-s-zephyr/zephyr/include/zephyr/init.h:190:9: note: in expansion of macro 'SYS_INIT_NAMED'
  190 |         SYS_INIT_NAMED(init_fn, init_fn, level, prio)
      |         ^~~~~~~~~~~~~~
C:/Users/LPC-008/Documents/eqs-motion-s-zephyr/zephyr/drivers/disk/flashdisk.c:563:1: note: in expansion of macro 'SYS_INIT'
  563 | SYS_INIT(disk_flash_init, APPLICATION, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT);
      | ^~~~~~~~
C:/Users/LPC-008/Documents/eqs-motion-s-zephyr/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)
      |                                            ^~~~~~~
C:/Users/LPC-008/Documents/eqs-motion-s-zephyr/zephyr/include/zephyr/toolchain/common.h:137:26: note: in definition of macro '_DO_CONCAT'
  137 | #define _DO_CONCAT(x, y) x ## y
      |                          ^
C:/Users/LPC-008/Documents/eqs-motion-s-zephyr/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)
      |                                    ^~~~~~~
C:/Users/LPC-008/Documents/eqs-motion-s-zephyr/zephyr/include/zephyr/init.h:208:17: note: in expansion of macro 'Z_INIT_ENTRY_NAME'
  208 |                 Z_INIT_ENTRY_NAME(name) = {.init_fn = {.sys = (init_fn_)}}
      |                 ^~~~~~~~~~~~~~~~~
C:/Users/LPC-008/Documents/eqs-motion-s-zephyr/zephyr/include/zephyr/init.h:190:9: note: in expansion of macro 'SYS_INIT_NAMED'
  190 |         SYS_INIT_NAMED(init_fn, init_fn, level, prio)
      |         ^~~~~~~~~~~~~~
C:/Users/LPC-008/Documents/eqs-motion-s-zephyr/zephyr/drivers/disk/flashdisk.c:563:1: note: in expansion of macro 'SYS_INIT'
  563 | SYS_INIT(disk_flash_init, APPLICATION, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT);
      | ^~~~~~~~
In file included from C:/Users/LPC-008/Documents/eqs-motion-s-zephyr/zephyr/include/zephyr/device.h:13,
                 from C:/Users/LPC-008/Documents/eqs-motion-s-zephyr/zephyr/include/zephyr/sw_isr_table.h:18,
                 from C:/Users/LPC-008/Documents/eqs-motion-s-zephyr/zephyr/include/zephyr/arch/arm/irq.h:19,
                 from C:/Users/LPC-008/Documents/eqs-motion-s-zephyr/zephyr/include/zephyr/arch/arm/arch.h:27,
                 from C:/Users/LPC-008/Documents/eqs-motion-s-zephyr/zephyr/include/zephyr/arch/cpu.h:19,
                 from C:/Users/LPC-008/Documents/eqs-motion-s-zephyr/zephyr/include/zephyr/kernel_includes.h:37,
                 from C:/Users/LPC-008/Documents/eqs-motion-s-zephyr/zephyr/include/zephyr/kernel.h:17,
                 from C:/Users/LPC-008/Documents/eqs-motion-s-zephyr/zephyr/include/zephyr/drivers/disk.h:28,
                 from C:/Users/LPC-008/Documents/eqs-motion-s-zephyr/zephyr/drivers/disk/flashdisk.c:12:
C:/Users/LPC-008/Documents/eqs-motion-s-zephyr/zephyr/drivers/disk/flashdisk.c:563:10: error: 'disk_flash_init' undeclared (first use in this function)
  563 | SYS_INIT(disk_flash_init, APPLICATION, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT);
      |          ^~~~~~~~~~~~~~~
C:/Users/LPC-008/Documents/eqs-motion-s-zephyr/zephyr/include/zephyr/init.h:208:64: note: in definition of macro 'SYS_INIT_NAMED'
  208 |                 Z_INIT_ENTRY_NAME(name) = {.init_fn = {.sys = (init_fn_)}}
      |                                                                ^~~~~~~~
C:/Users/LPC-008/Documents/eqs-motion-s-zephyr/zephyr/drivers/disk/flashdisk.c:563:1: note: in expansion of macro 'SYS_INIT'
  563 | SYS_INIT(disk_flash_init, APPLICATION, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT);
      | ^~~~~~~~
C:/Users/LPC-008/Documents/eqs-motion-s-zephyr/zephyr/drivers/disk/flashdisk.c:484:1: error: type of 'DEFINE_FLASHDISKS_CACHE' defaults to 'int' [-Werror=implicit-int]
  484 | PM_FOREACH_AFFILIATED_TO_disk(DEFINE_FLASHDISKS_CACHE)
      | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
C:/Users/LPC-008/Documents/eqs-motion-s-zephyr/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)
      |                                            ^~~~~~~
C:/Users/LPC-008/Documents/eqs-motion-s-zephyr/zephyr/include/zephyr/toolchain/common.h:137:26: note: in definition of macro '_DO_CONCAT'
  137 | #define _DO_CONCAT(x, y) x ## y
      |                          ^
C:/Users/LPC-008/Documents/eqs-motion-s-zephyr/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)
      |                                    ^~~~~~~
C:/Users/LPC-008/Documents/eqs-motion-s-zephyr/zephyr/include/zephyr/init.h:208:17: note: in expansion of macro 'Z_INIT_ENTRY_NAME'
  208 |                 Z_INIT_ENTRY_NAME(name) = {.init_fn = {.sys = (init_fn_)}}
      |                 ^~~~~~~~~~~~~~~~~
C:/Users/LPC-008/Documents/eqs-motion-s-zephyr/zephyr/include/zephyr/init.h:190:9: note: in expansion of macro 'SYS_INIT_NAMED'
  190 |         SYS_INIT_NAMED(init_fn, init_fn, level, prio)
      |         ^~~~~~~~~~~~~~
C:/Users/LPC-008/Documents/eqs-motion-s-zephyr/zephyr/drivers/disk/flashdisk.c:563:1: note: in expansion of macro 'SYS_INIT'
  563 | SYS_INIT(disk_flash_init, APPLICATION, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT);
      | ^~~~~~~~
C:/Users/LPC-008/Documents/eqs-motion-s-zephyr/zephyr/drivers/disk/flashdisk.c:523:30: error: declaration for parameter 'flash_disks' but no such parameter
  523 | static struct flashdisk_data flash_disks[] = {
      |                              ^~~~~~~~~~~
C:/Users/LPC-008/Documents/eqs-motion-s-zephyr/zephyr/drivers/disk/flashdisk.c:565: error: expected '{' at end of input
C:/Users/LPC-008/Documents/eqs-motion-s-zephyr/zephyr/drivers/disk/flashdisk.c:565: warning: control reaches end of non-void function [-Wreturn-type]
C:/Users/LPC-008/Documents/eqs-motion-s-zephyr/zephyr/drivers/disk/flashdisk.c: At top level:
C:/Users/LPC-008/Documents/eqs-motion-s-zephyr/zephyr/drivers/disk/flashdisk.c:415:37: warning: 'flash_disk_ops' defined but not used [-Wunused-const-variable=]
  415 | static const struct disk_operations flash_disk_ops = {
      |                                     ^~~~~~~~~~~~~~
cc1.exe: some warnings being treated as errors
[109/195] Building C object zephyr/drivers/usb/device/CMakeFiles/drivers__usb__device.dir/usb_dc_nrfx.c.obj

On different projects I have been able to use both functionalities separately (mass storage on an external flash, and MCUBoot's secondary partition on an external flash), so I am confident the configuration for these individual things is correct, but for some reason I am not able to use these both at the same time ? Can you help me how to resolve the issue please ?

I am happy to provide more information if needed

Thanks in advance

Best regards,

Nicolas Goualard

  • Hi Nicolas,

    Abhjith is out of office, and I will continue supporting you in his stead.

    I have encountered a similar issue in the past. Could you please change the pm_static.yml to list the affiliation as followed instead?

      affiliation:
        - disk

    If that fixes it, then the root cause is some issue in processing the affiliation in Partition Manager script.

    If not, do you think you can help me confirm the following steps can reproduce your issue?

    • Start from hello_world
    • Add your pm_static.yml
    • Add your overlay
    • Add CONFIG_APP_MSC_STORAGE_FLASH_FATFS and CONFIG_BOOTLOADER_MCUBOOT

    If the steps work, I will try to replicate the issue and investigate further.

    Best regards,

    Hieu

Related