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).

  • I added the exact same pm_static.yml file and the same prj.conf to the hello_world sample. In addition I enabled CONFIG_BOOTLOADER_MCUBOOT=y in hello_world/prj.conf. It ran without any errors.

    Test it yourself here. I used nrf52dk_nrf52832 and NCS v1.9.0-rc1:

    hello_world_with_mcuboot.zip

    Can you test it yourself and see if you get it to work?

    So based on the information/files you've given me, I'm not sure what may cause it to fail. Could you look at the sample hello_world_with_mcuboot I uploaded and see how that differs from your sample?

      i'm not able to enable logs in that build

    The reason you don't see any logs from mcuboot, is because you disable the (uart)console:

    CONFIG_CONSOLE=n
    CONFIG_UART_CONSOLE=n
    CONFIG_CONSOLE_HANDLER=n

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

    One question, do you get "Unable to find bootable image" after performing a DFU, or do you get it just when trying to boot the main application?

    Best regards,

    Simon

  • Thanks for quick answer :)

    Problem occurs after regular "west flash" (flashing merged.hex).
    I will now try the example you provided and compare it to my own. In this time, i also attach my zephyr app prj.conf.
    I did some optimization here to save space, maybe I cut too much, please take a look:
    (these setting are for BT DFU application)

    CONFIG_SIZE_OPTIMIZATIONS=y
    
    CONFIG_GPIO=y
    CONFIG_PWM=y
    CONFIG_ADC=y
    CONFIG_NRFX_TIMER0=y
    CONFIG_FLASH=y
    CONFIG_FLASH_PAGE_LAYOUT=y
    CONFIG_FLASH_MAP=y
    
    CONFIG_BT=y
    CONFIG_BT_PERIPHERAL=y
    CONFIG_BT_DEVICE_NAME="nordic"
    
    CONFIG_BT_SMP=y
    CONFIG_BT_LBS=y
    
    # Enable mcumgr.
    CONFIG_MCUMGR=y
    
    # Enable most core commands.
    CONFIG_MCUMGR_CMD_IMG_MGMT=y
    CONFIG_MCUMGR_CMD_OS_MGMT=y
    
    # Ensure an MCUboot-compatible binary is generated.
    CONFIG_BOOTLOADER_MCUBOOT=y
    
    # Allow for large Bluetooth data packets.
    CONFIG_BT_L2CAP_TX_MTU=252
    CONFIG_BT_BUF_ACL_RX_SIZE=256
    
    # Enable the Bluetooth (unauthenticated) and shell mcumgr transports.
    CONFIG_MCUMGR_SMP_BT=y
    CONFIG_MCUMGR_SMP_BT_AUTHEN=n
    
    # Some command handlers require a large stack.
    CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=4096
    
    CONFIG_SPI=n
    CONFIG_I2C=n
    CONFIG_BOOT_BANNER=n
    CONFIG_CONSOLE=n
    CONFIG_UART_CONSOLE=n
    CONFIG_STDOUT_CONSOLE=n
    CONFIG_PRINTK=n
    CONFIG_EARLY_CONSOLE=n
    CONFIG_TIMESLICING=n
    CONFIG_MINIMAL_LIBC_MALLOC=n
    CONFIG_LOG=n
    CONFIG_ASSERT=n
    
    # Disable Bluetooth features not needed
    CONFIG_BT_DEBUG_NONE=y
    CONFIG_BT_ASSERT=n
    CONFIG_BT_DATA_LEN_UPDATE=n
    CONFIG_BT_PHY_UPDATE=n
    CONFIG_BT_GATT_CACHING=n
    CONFIG_BT_GAP_PERIPHERAL_PREF_PARAMS=n
    CONFIG_BT_HCI_VS_EXT=n
    CONFIG_BT_CTLR_PRIVACY=n
    CONFIG_BT_CTLR_PHY_2M=n


  • Small update from me. After removing these from mcuboot .conf

    CONFIG_MULTITHREADING=y
    CONFIG_CONSOLE=n
    CONFIG_UART_CONSOLE=n
    CONFIG_CONSOLE_HANDLER=n
    MCUBoot is loading application again. I will investigte deeper and check if DFU is working.
  • Interesting. Yes, let me know if you get it to work or not

  • OK, I think I found the reason. It is not about specific content of mcuboot .conf file . It is about modyfing it itself. After modyfing mcuboot.conf bootloader is being not only rebuilt but also re-generated. 
    But if I do Pristine Build (without modifying bootloader .config) bootloader will no longer load application.
    After any change in mcuboot config file and rebuild (it takes longer then) and flash it starts working again. 

    So maybe mcuboot has to be regenerated every time application is changed?
    Only Pristine Build is causing this error, regular build does not affect starting app by bootloader.
    (after every pristine build i need to modify mcuboot.conf and rebuild again, only after this process bootloader will load app again)

    I guess i'm doing something wrong with building/flashing process.

Related