<?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>Best practice for storage of bootloader and application version</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/30134/best-practice-for-storage-of-bootloader-and-application-version</link><description>I am implementing the Device Information Service, and want to include the bootloader version as &amp;quot;Firmware revision&amp;quot; in DIS and the application version as &amp;quot;Software revision&amp;quot;. 
 I am wondering where the best place is to store this information. Some places</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 26 Nov 2019 22:00:21 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/30134/best-practice-for-storage-of-bootloader-and-application-version" /><item><title>RE: Best practice for storage of bootloader and application version</title><link>https://devzone.nordicsemi.com/thread/222186?ContentTypeID=1</link><pubDate>Tue, 26 Nov 2019 22:00:21 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8e008016-f63a-46a0-ab6e-ccbe41d2149f</guid><dc:creator>rnelson</dc:creator><description>&lt;p&gt;Thanks for the tip. You don&amp;#39;t actually need to copy the bootloader settings to RAM, they can be used directly from flash, like this:&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;pre&gt;    nrf_dfu_settings_t  *p_dfu_settings = (nrf_dfu_settings_t *) BOOTLOADER_SETTINGS_ADDRESS;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; char bl[30];&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; sprintf(bl, &amp;quot;Bootloader %d\nSettings %d&amp;quot;, p_dfu_settings-&amp;gt;bootloader_version, p_dfu_settings-&amp;gt;settings_version);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ble_srv_ascii_to_utf8(&amp;amp;dis_init.hw_rev_str, bl);&lt;br /&gt;
&lt;/pre&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Best practice for storage of bootloader and application version</title><link>https://devzone.nordicsemi.com/thread/221367?ContentTypeID=1</link><pubDate>Thu, 21 Nov 2019 14:55:42 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7fad2d43-dd83-4750-9743-0f026a4be889</guid><dc:creator>Igor</dc:creator><description>&lt;p&gt;This is how I load versions info into DIS:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;#include &amp;lt;ble_dis.h&amp;gt;
#include &amp;lt;nrf_dfu_settings.h&amp;gt;
#include &amp;lt;nrf_sdm.h&amp;gt;
#include &amp;lt;sdk_errors.h&amp;gt;
#include &amp;lt;stdlib.h&amp;gt;

#define MANUFACTURER_NAME &amp;quot;...&amp;quot;

uint8_t m_dfu_settings_buffer[BOOTLOADER_SETTINGS_PAGE_SIZE];
nrf_dfu_settings_t s_dfu_settings;

ret_code_t dis_init() {
    ble_dis_init_t dis_init = {0};
    dis_init.dis_char_rd_sec = SEC_OPEN;
    memcpy(&amp;amp;m_dfu_settings_buffer, (void *)BOOTLOADER_SETTINGS_ADDRESS, BOOTLOADER_SETTINGS_PAGE_SIZE);
    memcpy(&amp;amp;s_dfu_settings, m_dfu_settings_buffer, sizeof(nrf_dfu_settings_t));

    // Manufacturer
    ble_srv_ascii_to_utf8(&amp;amp;dis_init.manufact_name_str, MANUFACTURER_NAME);
    // Firmware (Soft Device)
    char sd[20];
    sprintf(sd, &amp;quot;S%d %d.%d.%d&amp;quot;, SD_VARIANT_ID, SD_MAJOR_VERSION, SD_MINOR_VERSION, SD_BUGFIX_VERSION);
    ble_srv_ascii_to_utf8(&amp;amp;dis_init.fw_rev_str, sd);
    // Application
    char app[3];
    itoa(s_dfu_settings.app_version, app, 10);
    ble_srv_ascii_to_utf8(&amp;amp;dis_init.sw_rev_str, app);
    // Hardware (Bootloader)
    char bl[30];
    sprintf(bl, &amp;quot;Bootloader %d\nSettings %d&amp;quot;, s_dfu_settings.bootloader_version, s_dfu_settings.settings_version);
    ble_srv_ascii_to_utf8(&amp;amp;dis_init.hw_rev_str, bl);

    ret_code_t err = ble_dis_init(&amp;amp;dis_init);
    return err;
}&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Best practice for storage of bootloader and application version</title><link>https://devzone.nordicsemi.com/thread/119954?ContentTypeID=1</link><pubDate>Tue, 06 Feb 2018 13:45:32 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c484f86f-be98-49ab-b6f9-f2395a14e9dc</guid><dc:creator>J&amp;#248;rgen Holmefjord</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;The &lt;em&gt;bootloader_version&lt;/em&gt; and &lt;em&gt;app_verison&lt;/em&gt; are stored in the bootloader settings in the struct &lt;a href="http://infocenter.nordicsemi.com/topic/com.nordic.infocenter.sdk5.v14.2.0/structnrf__dfu__settings__t.html" target="_self"&gt;nrf_dfu_settings_t&lt;/a&gt;. This struct is stored in flash, at the address given by the &lt;a href="http://infocenter.nordicsemi.com/topic/com.nordic.infocenter.sdk5.v14.2.0/lib_bootloader.html?cp=4_0_0_3_5_0_1#lib_bootloader_memory"&gt;Bootloader memory layout&lt;/a&gt; documentation. Note that this is related to softdevice, and you should use the&amp;nbsp;define&amp;nbsp;&lt;em&gt;BOOTLOADER_SETTINGS_ADDRESS&lt;/em&gt;&amp;nbsp;to make sure you look at the correct location. The file&amp;nbsp;&lt;em&gt;nrf_dfu_settings.c&lt;/em&gt; show how to retrieve the struct from flash.&lt;/p&gt;
&lt;p&gt;There is currently no correlation between DIS in the application, and the bootloader settings, but I think this is the best approach to implement it yourself.&lt;/p&gt;
&lt;p&gt;Best regards,&lt;br /&gt;Jørgen&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>