<?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>OTA upgrade example, application upgrade via j-link</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/46758/ota-upgrade-example-application-upgrade-via-j-link</link><description>I am successfully using the ZigBee OTA upgrade example, but the firmware upgrade takes quite long, approximately a half an hour, so it is not an adequate time at the firmware development stage. Now my workflow looks like: 1) Test new firmware features</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Mon, 06 May 2019 14:30:14 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/46758/ota-upgrade-example-application-upgrade-via-j-link" /><item><title>RE: OTA upgrade example, application upgrade via j-link</title><link>https://devzone.nordicsemi.com/thread/185537?ContentTypeID=1</link><pubDate>Mon, 06 May 2019 14:30:14 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4aa29db4-c300-4e27-ac84-de48aa3aece9</guid><dc:creator>AnnaR</dc:creator><description>&lt;p&gt;Hi, Andreas.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
[quote userid="73423" url="~/f/nordic-q-a/46758/ota-upgrade-example-application-upgrade-via-j-link/185326"]My idea of your problem was that you wanted to do a upgrade of your client firmware without having to do OTA, correct?[/quote]
&lt;p&gt;Absolutely correct.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Many thanks to you for so perfect explanation!&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Sincerely,&lt;/p&gt;
&lt;p&gt;Anna&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: OTA upgrade example, application upgrade via j-link</title><link>https://devzone.nordicsemi.com/thread/185326?ContentTypeID=1</link><pubDate>Mon, 06 May 2019 05:59:59 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3ed2edf2-194a-418c-ab85-311950131a37</guid><dc:creator>AndreasF</dc:creator><description>&lt;p&gt;Hi Anna.&lt;/p&gt;
&lt;p&gt;Sorry for not clarifying enough. My idea of your problem was that you wanted to do a upgrade of your client firmware without having to do OTA, correct?&lt;/p&gt;
&lt;p&gt;About the settings:&lt;/p&gt;
&lt;p&gt;&lt;img src="https://devzone.nordicsemi.com/resized-image/__size/320x240/__key/support-attachments/beef5d1b77644c448dabff31668f3a47-3241480b40fc47828d961e0514468ae0/pastedimage1557121483717v1.png" alt=" " /&gt;&lt;/p&gt;
&lt;p&gt;As you can see here, there is many &amp;quot;settings&amp;quot; and each with an purpose. For example, the CRC value (0x67E076C0) is checked by the bootloader when it is booted, if the value is not correct the device will not boot. That is why you have to generate new settings page when you upgrade your device. The settings page also has to be signed with the private key you used to generate the bootloader and the client with.&lt;/p&gt;
&lt;p&gt;Is this more clear?&lt;/p&gt;
&lt;p&gt;How to upload a new firmware without doing it OTA:&lt;/p&gt;
&lt;p&gt;I&amp;#39;ve used the command line tool &lt;strong&gt;nrfutil&amp;nbsp;&lt;/strong&gt;when I did this test, as I&amp;#39;m not quite sure how SES behaves when it comes to &lt;strong&gt;sectorerase.&amp;nbsp;&lt;/strong&gt;But you can still do this by flashing the output&amp;nbsp;&lt;strong&gt;.hex&lt;/strong&gt; file SES provides.&lt;/p&gt;
&lt;p&gt;1. You generate a private key and the &lt;strong&gt;dfu_public_key&lt;/strong&gt;&lt;strong&gt;.c &lt;/strong&gt;file.&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;nrfutil keys generate priv.pem 

nrfutil keys display --key pk --format code priv.pem --out_file dfu_public_key.c &lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;2. You generate the 1st edition of your bootloader and client and sign them with your generated key.&lt;/p&gt;
&lt;p&gt;3. You generate and sign a bootloader settings page for the client, you merge this settings page with the client.&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;nrfutil settings generate --family NRF52840 --application &amp;lt;path_to_application&amp;gt;.hex --application-version 0x01010101 --bootloader-version 1 --bl-settings-version 2 --app-boot-validation VALIDATE_ECDSA_P256_SHA256 --key-file priv.pem settings.hex 
mergehex -m &amp;lt;path_to_client&amp;gt;.hex settings.hex -o dfu_client.hex
&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;4. You do the following programming &lt;strong&gt;with cmd:&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;nrfjprog -f nrf52 -e
nrfjprog -f nrf52 -r --program &amp;lt;path to mbr_nrf52_2.4.1_mbr&amp;gt;.hex --chiperase
nrfjprog -f nrf52 -r --program &amp;lt;path to the bootloader hex file&amp;gt;.hex
nrfjprog -f nrf52 -r --program &amp;lt;path to the merged dfu_client&amp;gt;.hex --sectorerase&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;You have now programmed the first edition of your client and bootloader.&lt;/p&gt;
&lt;p&gt;If you now do any modifications to you client, you simply clean the client project, and build it over again.&lt;/p&gt;
&lt;p&gt;If you wish to upgrade your device with your modified client project, you do this:&lt;/p&gt;
&lt;p&gt;1. Clean and rebuild the project.&lt;/p&gt;
&lt;p&gt;2. You generate and sign a bootloader settings page for the modified client, you merge this settings page with the modified client.&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;nrfutil settings generate --family NRF52840 --application &amp;lt;path to modified client hex&amp;gt;.hex --application-version 1 --bootloader-version 1 --bl-settings-version 2 --app-boot-validation VALIDATE_ECDSA_P256_SHA256 --key-file priv.pem settings.hex 
mergehex -m &amp;lt;path to modified client hex&amp;gt;.hex settings.hex -o dfu_client.hex 
&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;3. You do the following programming &lt;strong&gt;with cmd:&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;nrfjprog -f nrf52 -r --program dfu_client.hex --sectorerase 

nrfjprog -r&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;And that&amp;#39;s it!&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
[quote user="AnnaR"]Does the bootloader settings also changes with each client firmware update, and need to be regenerated each time by nrfjprog? So, it appears as I cannot automate somehow this process via Segger Embedded Studio?&amp;nbsp;[/quote]
&lt;p&gt;&amp;nbsp;Yes, it does change and you need to regenerate it with &lt;strong&gt;nrfutil&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;I hope this clears up a few things.&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Andreas&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: OTA upgrade example, application upgrade via j-link</title><link>https://devzone.nordicsemi.com/thread/185263?ContentTypeID=1</link><pubDate>Fri, 03 May 2019 22:40:25 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:848d620a-5906-4fa6-8aed-dbf0273f11e6</guid><dc:creator>AnnaR</dc:creator><description>&lt;p&gt;Hi.&lt;/p&gt;
&lt;p&gt;Thanks for your reply.&lt;/p&gt;
&lt;p&gt;For the first time, I need to flash MBR, then bootloader, then generate bootloader settings, merge it with client firmware and flash the resulting hex (same commands as you provided).&lt;/p&gt;
&lt;p&gt;But for the second time, I just need to generate the OTA update package by the nrfjprog from my client hex, and use it via OTA server.&lt;/p&gt;
&lt;p&gt;I thought, I don&amp;rsquo;t need to generate again the bootloader settings because they were already flashed from the first time, so it is possible to download subsequent client firmware from Segger Embedded Studio? However, I can&amp;rsquo;t find in SES appropriate tuning like the &amp;ldquo;sectorerase&amp;rdquo;. I tried to put the path to the bootloader and MBR hex-es in the flash_placement.xml and flash in such a way, but in this case, client firmware was not started at all.&lt;/p&gt;
&lt;p&gt;Could you, please, clarify, if I will generate bootloader settings from the updated client hex (i.e., second and subsequent versions, not the first one), then merge it with client hex and flash by nrfjprog with sectorerase, shall it give me the same result, as if I downloaded the client firmware package via OTA?&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Does the bootloader settings also changes with each client firmware update, and need to be regenerated each time by nrfjprog? So, it appears as I cannot automate somehow this process via Segger Embedded Studio?&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Sincerely,&lt;/p&gt;
&lt;p&gt;Anna&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: OTA upgrade example, application upgrade via j-link</title><link>https://devzone.nordicsemi.com/thread/185203?ContentTypeID=1</link><pubDate>Fri, 03 May 2019 13:14:48 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6b777d18-3246-447a-b6c2-296edc165649</guid><dc:creator>AndreasF</dc:creator><description>&lt;p&gt;Hi again.&lt;/p&gt;
&lt;p&gt;You should be able to rebuild the client, generate a new settings page and flash it with sectorerase:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="bat"&gt;make -j -C client\pca10056\blank\armgcc clean
make -j -C client\pca10056\blank\armgcc 

nrfutil settings generate --family NRF52840 --application client\pca10056\blank\armgcc\_build\nrf52840_xxaa.hex --application-version 1 --bootloader-version 1 --bl-settings-version 2 --app-boot-validation VALIDATE_ECDSA_P256_SHA256 --key-file priv.pem settings.hex 
mergehex -m client\pca10056\blank\armgcc\_build\nrf52840_xxaa.hex settings.hex -o dfu_client.hex 

nrfjprog -f nrf52 -r --program dfu_client.hex --sectorerase

nrfjprog -r&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;I&amp;#39;ve tested it and it worked for me.&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Andreas&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: OTA upgrade example, application upgrade via j-link</title><link>https://devzone.nordicsemi.com/thread/184775?ContentTypeID=1</link><pubDate>Thu, 02 May 2019 07:54:00 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f4807658-6a22-476e-86be-c7fe0db6ad25</guid><dc:creator>AndreasF</dc:creator><description>&lt;p&gt;Hi.&lt;/p&gt;
&lt;p&gt;I&amp;#39;m looking into this issue.&lt;/p&gt;
&lt;p&gt;Please be patient :-)&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Andreas&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>