This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Unable to find bootable image - MCUBoot

I try to integrate mcuboot and BT DFU into my application. I'm using SDK 1.8.0 and DK board nrf52832.

My problem is, that i got this message "Unable to find bootable image" by mcuboot (investigated via debugger, unfortunatelly  i'm not able to enable logs in that build).
So probably there is problem with partitions or maybe signature of the app.
This is my mcuboot.conf:

CONFIG_MULTITHREADING=y
CONFIG_CONSOLE=n
CONFIG_UART_CONSOLE=n
CONFIG_CONSOLE_HANDLER=n

CONFIG_BOOT_SIGNATURE_TYPE_RSA=y
CONFIG_BOOT_SIGNATURE_KEY_FILE="root-rsa-2048.pem"

And this is pm_static.yml:

app:
  address: 0xc200
  region: flash_primary
  size: 0x31E00
mcuboot:
  address: 0x0
  region: flash_primary
  size: 0xc000
mcuboot_pad:
  address: 0xc000
  region: flash_primary
  size: 0x200
mcuboot_primary:
  address: 0xc000
  orig_span: &id001
  - mcuboot_pad
  - app
  region: flash_primary
  size: 0x32000
  span: *id001
mcuboot_primary_app:
  address: 0xc200
  orig_span: &id002
  - app
  region: flash_primary
  size: 0x3E000
  span: *id002
mcuboot_secondary:
  address: 0x3E000
  region: flash_primary
  size: 0x32000
scratch_storage:
  address: 0x70000
  region: flash_primary
  size: 0xa000
settings_storage:
  address: 0x7a000
  region: flash_primary
  size: 0x6000

And also flash configuration from my .dts:

&flash0 {

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

		boot_partition: partition@0 {
			label = "mcuboot";
			reg = <0x00000000 0xc000>;
		};
		slot0_partition: partition@c000 {
			label = "image-0";
			reg = <0x0000C000 0x32000>;
		};
		slot1_partition: partition@3e000 {
			label = "image-1";
			reg = <0x0003E000 0x32000>;
		};
		scratch_partition: partition@70000 {
			label = "image-scratch";
			reg = <0x00070000 0xa000>;
		};
		storage_partition: partition@7a000 {
			label = "storage";
			reg = <0x0007a000 0x00006000>;
		};
	};
};

I'm building and flashing using the simplest way:

west build -b <board_name>
west flash (merged.hex is being flashed)

Before some changes (not important here) everything was working fine, and i was even able to upload images through bluetooth with positive answer. But after few rebuilds it stopped working (probably it was pure luck - this is why i suspect that something may be wrong with partition table).

  • Hi again,

    First sorry for the confusion ...

    I'm trying to see what differs between the two builds, and one thing I noticed is in the build/ncs/CMakeCache.txt file.

    When it fails, it more or less only differs in the following line:

    mcuboot_OVERLAY_CONFIG:INTERNAL=
      /xx/vsln-ncs/vt2-overlays/vt2-mcuboot-overlay.conf
      /xx/ncs/nrf/subsys/partition_manager/partition_manager_enabled.conf


    When it works it looks like this:

    mcuboot_OVERLAY_CONFIG:INTERNAL=
      /xx/vsln-ncs/vt2-overlays/vt2-mcuboot-overlay.conf
      /xx/ncs/nrf/subsys/partition_manager/partition_manager_enabled.conf
      ; /xx/vsln-ncs/vt2-overlays/vt2-mcuboot-overlay.conf
      /xx/ncs/nrf/subsys/partition_manager/ext_flash_mcuboot_secondary.conf

    And the .config only differs for mcuboot as I showed in a previous entry:

    $ diff build/ncs/mcuboot/zephyr/.config fail_build/ncs/mcuboot/zephyr/.config
      265,266c265,266
      < CONFIG_PARTITION_MANAGER_ENABLED=y
      < CONFIG_FLASH_MAP_CUSTOM=y
      ---
      > # CONFIG_PARTITION_MANAGER_ENABLED is not set
      > # CONFIG_FLASH_MAP_CUSTOM is not set

    So, it seems as if the config somehow is not correctly setup during a prestine build. The vt2-mcuboot-overlay.conf is included twice, and the ext_flash_mcuboot_secondary is only included in the working build.

    The ext_flash_mcuboot_secondary.conf is included in the CMakeFile.txt for the mcuboot, in the file ncs/nrf/modules/mcuboot/CMakeLists.txt:

      if (CONFIG_PM_EXTERNAL_FLASH_MCUBOOT_SECONDARY)
        # By passing this value we don't require the user to pass any overlay files
        # to the MCUboot child image for storing the secondary partition in
        # external flash.
        add_overlay_config(
          mcuboot
          ${ZEPHYR_NRF_MODULE_DIR}/subsys/partition_manager/ext_flash_mcuboot_secondary.conf
    )
      endif()

    And CONFIG_PM_EXTERNAL_FLASH_MCUBOOT_SECONDARY seems to be configured in the subsys/partition_manager/ext_flash_mcuboot_secondary.conf file, which seems odd since then we have a circular reference ... (the config is set in the file included if the config is set ...) ?

    And that is the only content of the file ncs/nrf/subsys/partition_manager/ext_flash_mcuboot_secondary.conf:

      CONFIG_PM_EXTERNAL_FLASH_MCUBOOT_SECONDARY
    =y

    I can't see that this config is set anywhere else ...

    Could that be that the MCUBOOT_SECONDARY somehow is not included in the first build, but in the second build the buildsystem gets that the MCUBOOT_SECONDARY should be included ... at least that how I interpret the CMakeCache.txt contents ... that could explain why the bootloader doesn't find the image in the first build.

    Best regards,
    Thomas

    ---

  • Hi guys,

    Can I use hello_world_with_mcuboot example above and build it in Segger Embedded Studio?

    Thank you.

    Kind regards

    Mohamed

  • When I commented these out I was able to get mcuboot serial log to work.

    Hi Simon,

    Apologies if I am intruding in this conversation. 

    I built hello_world_with_mcuboot project in Segger Embedded Studio (SES) and flashed the merged.hex file in the dev board nRF52833DK. Unfortunately, it is not behaving as expected.

    1- I am not seeing the "Hello World!" message.

    2- Each time I stop the debugger and restart by clicking 'Go' or F5 I get prompted with the message

    "The project zephyr/merged.hex is out of date and needs to be built. Build the project before debugging?"

    But I am sure nothing has changed in the project since the last build.

    Note, I have not changed anything in the project you provided in the zip file. Should I?

    Kind regards

    Mohamed

  • Hello Mohamed, could you please open a new case and ask your question there?

    Thomas: Even though your issue is kind of related as the initial topic, could you could open a new ticket as well (just link to this ticket and explain the current state), since the initial guy started this post got his issue resolved.

    I can see that this ticket has the status "verified answer", so it is locked, so none of you will be able to post any more replies here.

Related