Warning FLASH_SIMULATOR unassigned starting from NCS SDK 2.7.0 due to missing default flash_sim.overlay from build

I have found that in NCS SDK 2.6.2 it was very simple to enable FLASH_SIMULATOR as part of the mcuboot configuration overlays. But starting from SDK 2.7.0, I keep getting the following warnings:

warning: FLASH_SIMULATOR (defined at drivers/flash/Kconfig.simulator:6) was assigned the value 'y'
but got the value 'n'. Check these unsatisfied dependencies: DT_HAS_ZEPHYR_SIM_FLASH_ENABLED (=n).
See http://docs.zephyrproject.org/latest/kconfig.html#CONFIG_FLASH_SIMULATOR and/or look up
FLASH_SIMULATOR 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: FLASH_SIMULATOR_DOUBLE_WRITES (defined at drivers/flash/Kconfig.simulator:42) was assigned
the value 'y' but got the value 'n'. Check these unsatisfied dependencies: FLASH_SIMULATOR (=n). See
http://docs.zephyrproject.org/latest/kconfig.html#CONFIG_FLASH_SIMULATOR_DOUBLE_WRITES and/or look
up FLASH_SIMULATOR_DOUBLE_WRITES 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.

By examining some of my application's build artifacts built under SDK 2.6.2, I see that the flash_sim.overlay was being added by default to the build in the following in build/CMakeCache.txt:

//Default mcuboot configuration file
mcuboot_DTC_OVERLAY_FILE:STRING=/opt/nordic/ncs/v2.6.2/nrf/modules/mcuboot/flash_sim.overlay;/opt/nordic/ncs/v2.6.2/nrf/modules/mcuboot/usb.overlay;/Users/alfredoantolinez/dev/sensor_wearable/wearable/child_image/mcuboot/boards/nrf5340dk_nrf5340_cpuapp.overlay

When looking at the same file under a build with 2.7.0 and up, I only see:

//devicetree overlay file defined by main application
mcuboot_DTC_OVERLAY_FILE:INTERNAL=/{MYPROJPATH}/sysbuild/mcuboot.overlay

I imagine this is a product of switching to sysbuild and possibly providing flexibility to the user to use or not whatever they want for their builds. But I do liked the option to use the overlay provided by Nordic for this functionality.

What is the proper way to enable FLASH_SIMULATOR and including the flash_sim.overlay from Nordic starting from 2.7.0 as it is not clear to me?

I tried to add the following line in the project's CMakeLists.txt file right under the 

cmake_minimum_required
:

set(mcuboot_DTC_OVERLAY_FILE ${ZEPHYR_BASE}/../nrf/modules/mcuboot/flash_sim.overlay)

But that does not seem to be doing anything to the build.

Any help would be appreciated.

Thank you,

Alfredo

  • Update: I have figured out how to properly configure to enable FLASH_SIMULATOR and include the flash_sim.overlay in the project.

    In order to do this, I had to enable the following sysbuild configuration:

    SB_CONFIG_SECURE_BOOT_NETCORE=y
    SB_CONFIG_NETCORE_APP_UPDATE=y

    The primary goal for this configuration that I am trying to get working is for network core updates.

    Now, after getting around the FLASH_SIMULATOR warning, I still get an assertion failure related to partitions during the build:

    /opt/nordic/ncs/v2.9.0/zephyr/include/zephyr/toolchain/gcc.h:87:36: error: static assertion failed: "Missing partitions?"
       87 | #define BUILD_ASSERT(EXPR, MSG...) _Static_assert((EXPR), "" MSG)
          |                                    ^~~~~~~~~~~~~~
    /opt/nordic/ncs/v2.9.0/zephyr/subsys/mgmt/mcumgr/grp/img_mgmt/src/zephyr_img_mgmt.c:43:1: note: in expansion of macro 'BUILD_ASSERT'
       43 | BUILD_ASSERT(FIXED_PARTITION_EXISTS(SLOT2_PARTITION) &&
          | ^~~~~~~~~~~~

    My understanding of the assertion is that my dts is missing a slot3_partition.. but I was also missing it in my SDK 2.6.2 build but I did not have this issue.

    See my current sysbuild.conf

    # MCUboot configuration
    SB_CONFIG_BOOTLOADER_MCUBOOT=y
    SB_CONFIG_MCUBOOT_MODE_OVERWRITE_ONLY=y
    SB_CONFIG_MCUBOOT_UPDATEABLE_IMAGES=2
    
    # Enable net core update (specifically for flash simualtor use)
    SB_CONFIG_SECURE_BOOT_NETCORE=y
    SB_CONFIG_NETCORE_APP_UPDATE=y
    
    # HCI IPC configuration
    SB_CONFIG_NETCORE_HCI_IPC=y

    See my mcuboot.conf

    CONFIG_PM_PARTITION_SIZE_MCUBOOT=0x10000
    CONFIG_BOOT_MAX_IMG_SECTORS=256
    
    #CONFIG_BOOT_UPGRADE_ONLY=y         # Unused bc sysbuild
    #CONFIG_UPDATEABLE_IMAGE_NUMBER=2   # Unused bc sysbuild
    CONFIG_FLASH_SIMULATOR=y
    CONFIG_FLASH_SIMULATOR_STATS=n
    CONFIG_FLASH_SIMULATOR_DOUBLE_WRITES=y

    Any help to get around the slot3_partition assertion is greatly appreciated.

    Thank you,

    Alfredo

  • It appears the only sysbuild configuration I was missing (based on nrf/samples/bluetooth/fast_pair/locator_tag sample) was 

    SB_CONFIG_PM_EXTERNAL_FLASH_MCUBOOT_SECONDARY=y
    After adding that to sysbuild.conf, the assertion disappeared.
    I still don't fully understand this series of configuration options, so if anyone has a clearer understanding, I'd appreciate the explanation.
     
    Thank you,
    Alfredo
  • Sorry for the delayed response Alfredo,

    The configuration option SB_CONFIG_PM_EXTERNAL_FLASH_MCUBOOT_SECONDARY=y plays a crucial role in the memory management and partitioning scheme used in sysbuild, particularly when working with MCUBoot and external flash memory in Nordic's NCS. The assertion you encountered likely occurred because MCUBoot was unable to locate or allocate memory for the secondary slot. Without SB_CONFIG_PM_EXTERNAL_FLASH_MCUBOOT_SECONDARY, sysbuild seems to default to placing the secondary slot in internal flash, which might conflict with other partitions or exceed available memory.

Related