Retrieve the MCUboot version from the application

Hello,

I have a project with b0 + MCUboot + App.

My partitions are like this:

b0_container: 0x0 -> 0x9000 (0x9000)
	b0: 0x0 -> 0x8000 (0x8000)
	provision: 0x8000 -> 0x9000 (0x1000)

s0: 0x9000 -> 0x19200 (0x10200)
	s0_pad: 0x9000 -> 0x9200 (0x200)
	s0_image: 0x9200 -> 0x19200 (0x10000)
		mcuboot: 0x9200 -> 0x19200 (0x10000)

EMPTY_0: 0x19200 -> 0x1a000 (0xe00)

s1: 0x1a000 -> 0x2a200 (0x10200)
	s1_pad: 0x1a000 -> 0x1a200 (0x200)
	s1_image: 0x1a200 - 0x2a200 (0x10000)

EMPTY_1: 0x2a200 -> 0x2b000 (0xe00)

mcuboot_primary: 0x2b000 -> 0xe0000 (0xB5000)
	mcuboot_pad: 0x2b000 -> 0x2b200 (0x200)
	mcuboot_primary_app: 0x2b200 -> 0xe0000 (0xb4e00)
		app_image: 0x2b200 -> 0xe0000 (0xb4e00)
			app: 0x2b200 -> 0xe0000 (0xb4e00)

mcuboot_secondary: 0xe0000 -> 0xf0000 (0x10000)

settings_storage: 0xf0000 -> 0x100000 (0x10000)

sram_primary: 0x20000000 -> 0x20040000 (0x40000)

In my application, how can I retrieve the version number of the bootloader (MCUboot) that is currently active?

Thank you

Parents Reply
  • Hi,

    This function is what I need but it returns the error "-5": do you have any idea why?

    In the "boot_read_v1_header" function, I see:

    	/*
    	 * Sanity checks.
    	 *
    	 * Larger values in header_size than BOOT_HEADER_SIZE_V1 are
    	 * possible, e.g. if Zephyr was linked with
    	 * CONFIG_ROM_START_OFFSET > BOOT_HEADER_SIZE_V1.
    	 */
    	if ((v1_raw->header_magic != BOOT_HEADER_MAGIC_V1) ||
    	    (v1_raw->header_size < BOOT_HEADER_SIZE_V1)) {
    		return -EIO;
    	}

    Here I tried to read the header of the S0 image but v1_raw->header_magic=0x20009680 (not 

    0x96f3b83d)




    Thank you for your help

Children
Related