<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://devzone.nordicsemi.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>MCUBoot active slot and version over SMP</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/119194/mcuboot-active-slot-and-version-over-smp</link><description>Hello, 
 I work on a board with nRF9160 and nRF52840. I can perform firmware update of both application and mcuboot for nRF52840 (using serial recovery mode) from the nRF9160 over SMP. 
 My question is: How nRF9160 can get information from nRF52840 in</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 13 Mar 2025 07:11:45 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/119194/mcuboot-active-slot-and-version-over-smp" /><item><title>RE: MCUBoot active slot and version over SMP</title><link>https://devzone.nordicsemi.com/thread/527084?ContentTypeID=1</link><pubDate>Thu, 13 Mar 2025 07:11:45 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:cece4fb1-b275-4286-b6cb-5bc7dd15137f</guid><dc:creator>tdfilip</dc:creator><description>&lt;p&gt;The following change in bs_list function in boot_serial.c file makes it possible to read over SMP both mcuboot&amp;nbsp;images in S0 and S1 and the application image:&lt;/p&gt;
&lt;p&gt;From this:&lt;br /&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;area_id = flash_area_id_from_multi_image_slot(image_index, slot);&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;To this:&lt;br /&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;            if(image_index == 1)
            {
                if(slot == 0) area_id = PM_S0_ID;
                else          area_id = PM_S1_ID;
            }
            else 
            {
                area_id = flash_area_id_from_multi_image_slot(image_index, slot);
            }&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;With this change, the bs_list will respond to request sent from nRF91 using&amp;nbsp;&lt;span&gt;dfu_target_smp_image_list_get() with the following images:&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Image 0, slot 0: PM_MCUBOOT_PRIMARY_ID&lt;br /&gt;Image 0, slot 1:&amp;nbsp;PM_MCUBOOT_SECONDARY_ID&lt;br /&gt;Image 1, slot 0:&amp;nbsp;PM_S0_ID&lt;br /&gt;Image 1,&amp;nbsp;slot 1:&amp;nbsp;PM_S1_ID&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;which solves both issues I mentioned before.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;I&amp;#39;d like to ask if that change can possibly break anything for me? Or maybe that&amp;#39;s what bs_list should respond with in the first place?&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Regards,&lt;br /&gt;Filip&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: MCUBoot active slot and version over SMP</title><link>https://devzone.nordicsemi.com/thread/526475?ContentTypeID=1</link><pubDate>Mon, 10 Mar 2025 07:07:19 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2eb3bf29-4b55-47e8-868e-37c529453e1d</guid><dc:creator>tdfilip</dc:creator><description>&lt;p&gt;&lt;span&gt;The dfu_target_smp_image_list_get()&amp;nbsp;is the function that I use on the nRF9160 side to read image list from the nRF52840 when it is in mcuboot. The problem is with bs_list function that is used to handle the request sent using dfu_target_smp_image_list_get().&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;So my question remains the same as in&amp;nbsp;my previous post.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;To be more precise, I don&amp;#39;t have a problem reading current application image and its version. The problem is with reading the current mcuboot version and the active mcuboot slot.&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: MCUBoot active slot and version over SMP</title><link>https://devzone.nordicsemi.com/thread/526403?ContentTypeID=1</link><pubDate>Fri, 07 Mar 2025 16:45:25 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7bdc85cf-e2f9-40a1-9de5-0f6fd475bc6a</guid><dc:creator>Sigurd</dc:creator><description>&lt;p&gt;Maybe dfu_target_smp_image_list_get() would be better:&lt;/p&gt;
&lt;p&gt;&lt;a href="https://github.com/nrfconnect/sdk-nrf/blob/v2.9.0/subsys/dfu/dfu_target/src/dfu_target_smp.c#L296"&gt;https://github.com/nrfconnect/sdk-nrf/blob/v2.9.0/subsys/dfu/dfu_target/src/dfu_target_smp.c#L296&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Snippet that shows how to read version info:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;	struct mcumgr_image_state image_list = {0};
	struct mcumgr_image_data *list;
	size_t ver_len;
	int ret = dfu_target_smp_image_list_get(&amp;amp;image_list);

	if (ret) {
		LOG_WRN(&amp;quot;Failed to read SMP image list, error: %d&amp;quot;, ret);
		return -ENODATA;
	}

	/* Set the return value in case no active image is found */
	ret  = -ENODEV;

	list = image_list.image_list;
	for (int i = 0; i &amp;lt; image_list.image_list_length; ++i, ++list) {
		LOG_DBG(&amp;quot;%s Image(%d) slot(%d)&amp;quot;,
			list-&amp;gt;flags.active ? &amp;quot;Primary&amp;quot; : &amp;quot;Secondary&amp;quot;,
			list-&amp;gt;img_num,
			list-&amp;gt;slot_num);
		LOG_DBG(&amp;quot;  Version: %s&amp;quot;, list-&amp;gt;version);
		LOG_DBG(&amp;quot;  Bootable(%d) Pending(%d) Confirmed(%d)&amp;quot;,
			list-&amp;gt;flags.bootable, list-&amp;gt;flags.pending, list-&amp;gt;flags.confirmed);

		if (list-&amp;gt;flags.active) {
			ver_len = strlen(list-&amp;gt;version);
			if (ver_len &amp;gt;= sizeof(smp_ver)) {
				return -ENOBUFS;
			}
			memcpy(smp_ver, list-&amp;gt;version, ver_len + 1);
			ret = 0;
		}
	}

	return ret;&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: MCUBoot active slot and version over SMP</title><link>https://devzone.nordicsemi.com/thread/524345?ContentTypeID=1</link><pubDate>Mon, 24 Feb 2025 13:12:54 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0b85f577-fa2d-4b5a-8220-67bf9f976830</guid><dc:creator>tdfilip</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;The following function is used to get images data in file boot_serial.c in function bs_list to send it as response to cmd_read_image_list request:&lt;br /&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;static inline uint32_t __flash_area_ids_for_slot(int img, int slot)
{
    static const int all_slots[] = {
	ALL_AVAILABLE_SLOTS
	MCUBOOT_S0_S1_SLOTS
    };
    return all_slots[img * 2 + slot];
};&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;If I understand it correctly, it gives data of the following images:&lt;br /&gt;Image 0, slot 0: PM_MCUBOOT_PRIMARY_ID (application image in primary slot)&lt;br /&gt;&lt;span&gt;Image 0, slot 1:&lt;/span&gt; PM_MCUBOOT_SECONDARY_ID (mcuboot or application image in secondary slot)&lt;br /&gt;&lt;span&gt;Image 1, slot 0:&lt;/span&gt; PM_S1_ID (if S0 is used) / PM_S0_ID (if S1 is used)&lt;br /&gt;&lt;span&gt;Image 1,&amp;nbsp;slot 1:&lt;/span&gt;&amp;nbsp;&lt;span&gt;PM_MCUBOOT_SECONDARY_ID&amp;nbsp;(mcuboot or application image in secondary slot)&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Based on these&amp;nbsp;images, I do not have the information about the active mcuboot image (its version) and the active mcuboot slot. Correct me if my understanding is incorrect.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Also, why is PM_MCUBOOT_SECONDARY_ID sent twice - as image 0 slot 1 and image 1 slot 1?&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: MCUBoot active slot and version over SMP</title><link>https://devzone.nordicsemi.com/thread/524336?ContentTypeID=1</link><pubDate>Mon, 24 Feb 2025 12:42:53 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:09b381fc-1af7-4105-9750-503689953ecd</guid><dc:creator>Sigurd</dc:creator><description>&lt;p&gt;Hi! &lt;br /&gt;&lt;br /&gt;Mabye you can use this lib,&amp;nbsp;&lt;a href="https://github.com/nrfconnect/sdk-nrf/tree/main/subsys/net/lib/mcumgr_smp_client"&gt;https://github.com/nrfconnect/sdk-nrf/tree/main/subsys/net/lib/mcumgr_smp_client&lt;/a&gt;&amp;nbsp;, and use the&amp;nbsp;cmd_read_image_list() function.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>