<?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>Flashing bootloader, softdevice and application issue</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/71769/flashing-bootloader-softdevice-and-application-issue</link><description>Hello. I&amp;#39;m having an issue with nrfjprog that has been discussed in this forum several times but I can&amp;#39;t manage to get it working. I&amp;#39;ll link some of mentioned posts at the end of this post. My goal: I&amp;#39;d like to have a powershell script in which I can</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 25 Feb 2021 12:37:52 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/71769/flashing-bootloader-softdevice-and-application-issue" /><item><title>RE: Flashing bootloader, softdevice and application issue</title><link>https://devzone.nordicsemi.com/thread/296249?ContentTypeID=1</link><pubDate>Thu, 25 Feb 2021 12:37:52 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c98c4039-6585-4dfd-a0db-fd34422e5548</guid><dc:creator>Edvin</dc:creator><description>&lt;p&gt;I am not sure whether using the private key is actually necessary when generating bootloader settings with the default settings in the bootloader (but I tend to include it). When testing these things, I suggest using scripts like the one attached earlier. It saves you a lot of time, and it ensures that you are testing the same every time (it is very easy to forget a step or two). If you want to use Segger Embedded Studio instead of the armgcc makefile, just replace the application .hex file that I copied into files\buttonless_app.hex.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Edvin&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Flashing bootloader, softdevice and application issue</title><link>https://devzone.nordicsemi.com/thread/296216?ContentTypeID=1</link><pubDate>Thu, 25 Feb 2021 11:04:43 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:adeb7bb1-92da-4405-a98e-9e810a917b9f</guid><dc:creator>PauDC</dc:creator><description>&lt;p&gt;Thank you for this information.&lt;/p&gt;
&lt;p&gt;This mixed&amp;nbsp; with your previous reply solved the problems and my doubts.&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Pau&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Flashing bootloader, softdevice and application issue</title><link>https://devzone.nordicsemi.com/thread/296214?ContentTypeID=1</link><pubDate>Thu, 25 Feb 2021 11:03:36 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:97dc2769-708d-416d-87c7-635a88cc36ed</guid><dc:creator>PauDC</dc:creator><description>&lt;p&gt;Hello Edvin,&lt;/p&gt;
&lt;p&gt;I was able to flash everything thanks to this answer.&lt;/p&gt;
&lt;p&gt;The main difference I see between what you posted and what I did is that when creating the bootloader settings I didn&amp;#39;t add the private key.&lt;/p&gt;
&lt;p&gt;I will test more to see if this was the only reason my script was failing.&lt;/p&gt;
&lt;p&gt;Thank you very much,&lt;/p&gt;
&lt;p&gt;Best regards.&lt;/p&gt;
&lt;p&gt;Pau&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Flashing bootloader, softdevice and application issue</title><link>https://devzone.nordicsemi.com/thread/295604?ContentTypeID=1</link><pubDate>Mon, 22 Feb 2021 13:49:31 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:894bf405-3b13-49b7-80da-31b5039e2e3e</guid><dc:creator>Edvin</dc:creator><description>[quote user="PauDC"]I created a new folder in which I only copied the softdevice.hex, bootloader.hex and application.hex. Is this a bad practice? Could this be my mistake?[/quote]
&lt;p&gt;&amp;nbsp;That is fine, as long as you remember to update them. Remember that whenever you change the smallest detail in the application, it results in a new .hex file, which you need to generate a new set of settings for. You can see in the script that I delete and always copy the latest application to be flashed into the folder &amp;quot;files&amp;quot;.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Please also note that you can flash the files using nrfjprog (the order doesn&amp;#39;t matter). But if you try to debug in SES, then SES will upload a modified version of the .hex file, so the CRC will not match with the bootloader settings anymore. If you need to debug the application after you have programmed a bootloader, you should use the option: Target -&amp;gt; Attach Debugger:&lt;/p&gt;
&lt;p&gt;&lt;img src="https://devzone.nordicsemi.com/resized-image/__size/320x240/__key/communityserver-discussions-components-files/4/pastedimage1614001718419v1.png" alt=" " /&gt;&lt;/p&gt;
&lt;p&gt;Which will hook onto the debugger without flashing anything. In order for this to work, you need to make sure that the nRF is manually flashed with the very latest application compile.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;But before you test the debugging part, make sure that you have uploaded the bootloader settings.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;BR,&lt;br /&gt;Edvin&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Flashing bootloader, softdevice and application issue</title><link>https://devzone.nordicsemi.com/thread/295496?ContentTypeID=1</link><pubDate>Mon, 22 Feb 2021 08:50:35 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3345180e-4393-411f-bca0-321e549c1ccf</guid><dc:creator>PauDC</dc:creator><description>&lt;p&gt;Hello Edvin,&lt;/p&gt;
&lt;p&gt;Thanks for your reply. I still have to test the script you attached. But I&amp;#39;ve read and analysed the rest of your reply and I have a few doubts and comments.&lt;/p&gt;
&lt;p&gt;Q: When you merged the bootloader settings and the bootloader, did you also program that application?&lt;br /&gt;A: I did in one of my trials. I also tried merging all my .hex files into one calling mergehex several times. These things didn&amp;#39;t work, so I started from the beginning, trying to make the settings and bootloader work.&lt;br /&gt;&lt;br /&gt;&amp;quot;- Replaced the dfu_public_key.c in the original location in the sdk with your personal private key. &lt;br /&gt;- installed the &amp;quot;make&amp;quot; toolchain. If you are using an IDE, please compile the projects up front, and change the paths in the attached scripts. &amp;quot;&lt;br /&gt;&lt;br /&gt;I did replace the key. I&amp;#39;m using Segger Studio as my IDE. &lt;br /&gt;I created a new folder in which I only copied the softdevice.hex, bootloader.hex and application.hex. Is this a bad practice? Could this be my mistake?&lt;br /&gt;&lt;br /&gt;Where can I find the softdevice ID? I&amp;#39;m asking this because I&amp;#39;m still using sdk 17.0.0. I found this &lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/67234/dfu-softdevice-s132-7-2-0-version-code"&gt;post&lt;/a&gt; and I&amp;#39;ve opened the 3 files I found on tesc&amp;#39;s answer and wasn&amp;#39;t able to find any code similar to the one you mentioned in your notes. &lt;br /&gt;&lt;br /&gt;Lastly, when you say&lt;br /&gt;&amp;quot;Please note that I flash all 4 .hex files: Softdevice, Bootloader, Application and Bootloader Settings. You can merge them and program them all in one, if you like.&amp;quot;&lt;br /&gt;&lt;br /&gt;Do you specifically flash them in that order? Is the flashing or merging order relevant?&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Pau&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Flashing bootloader, softdevice and application issue</title><link>https://devzone.nordicsemi.com/thread/295307?ContentTypeID=1</link><pubDate>Fri, 19 Feb 2021 11:35:39 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:992c343d-de90-4e03-b772-ad1420f5d31c</guid><dc:creator>Edvin</dc:creator><description>&lt;p&gt;Can you describe what you did? If you are stuck, please try the pca10040_debug bootloader project, and monitor the RTT log. What does it say?&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Did you program all the 4 files: Bootloader, Softdevice, application and bootloader settings?&lt;/p&gt;
&lt;p&gt;Can you show me how you did it, and how you generated the bootloader settings?&lt;/p&gt;
&lt;p&gt;Edit: I just noticed that this question was from &lt;a href="https://devzone.nordicsemi.com/members/teodf"&gt;teodf&lt;/a&gt;, and not the original poster. What did you do? What have you programmed on your DK? Are you using a DK? How do you perform the DFU? What is your DFU master? Are you using a phone, nRF Connect for iOS/Android? nRF Connect for Desktop? nrfutil?&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;BR,&lt;/p&gt;
&lt;p&gt;Edvin&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Flashing bootloader, softdevice and application issue</title><link>https://devzone.nordicsemi.com/thread/295283?ContentTypeID=1</link><pubDate>Fri, 19 Feb 2021 09:45:23 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b48fac61-22c6-4a76-a15f-343803d0696b</guid><dc:creator>teodf</dc:creator><description>&lt;p&gt;Hi Edvin,&lt;/p&gt;
&lt;p&gt;I arrive to flash all but my application never Start, there are just the two led of bootloader was light up.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;You have a solution ?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Flashing bootloader, softdevice and application issue</title><link>https://devzone.nordicsemi.com/thread/295159?ContentTypeID=1</link><pubDate>Thu, 18 Feb 2021 14:54:21 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:602e09b6-0d2e-4258-8b64-2ab02976a0b9</guid><dc:creator>Edvin</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;Creating these scripts is a good idea when working with a bootloader, because the bootloader will reject applications that are flashed without the correct bootloader settings.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;So you are on the track of something. And you may merge the bootloader with the settings hex file, but that is not necessary. Just make sure you program them all.&lt;/p&gt;
&lt;p&gt;Why your setup is currently not working, I am not sure. When you merged the bootloader settings and the bootloader, did you also program that application?&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Let us take it from the start&lt;/p&gt;
&lt;p&gt;Let us assume you have already:&lt;/p&gt;
&lt;p&gt;- Replaced the dfu_public_key.c in the original location in the sdk with your personal private key.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;- installed the &amp;quot;make&amp;quot; toolchain. If you are using an IDE, please compile the projects up front, and change the paths in the attached scripts.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;If you copy the attached script into a .bat file (e.g. name it test.bat), place it in SDK17.0.2\examples\dfu\secure_bootloader\pca10040_s132_ble\armgcc and run it from a power shell or a command line, I believe it should work.&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="batchfile"&gt;make -j9 
make -j9 -C ..\..\..\..\ble_peripheral\ble_app_buttonless_dfu\pca10040\s132\armgcc

set TARGET_SNR=682396787
set CONNECTIVITY_SNR=683963588

mkdir files

del files\bl_settings.hex
del files\buttonless_app.hex

copy ..\..\..\..\ble_peripheral\ble_app_buttonless_dfu\pca10040\s132\armgcc\_build\nrf52832_xxaa.hex files\buttonless_app.hex
nrfutil settings generate --family NRF52 --application files\buttonless_app.hex --application-version 1 --bootloader-version 1 --bl-settings-version 1 --key-file ..\..\..\private.key files\bl_settings.hex

nrfjprog -e --snr %TARGET_SNR%
nrfjprog --program ..\..\..\..\..\components\softdevice\s132\hex\s132_nrf52_7.2.0_softdevice.hex --verify --snr %TARGET_SNR%
nrfjprog --program _build\nrf52832_xxaa_s132.hex --verify --snr %TARGET_SNR%
nrfjprog --program files\buttonless_app.hex --verify --snr %TARGET_SNR%
nrfjprog --program files\bl_settings.hex --verify --snr %TARGET_SNR%
nrfjprog --reset --snr %TARGET_SNR%

:: if you want to also perform a DFU from another DK, uncomment the lines below, and make sure to set the serial numbers correctly.


::TIMEOUT 5

::nrfutil pkg generate --application files\buttonless_app.hex --application-version 2 --sd-req 0x0101 --hw-version 52 --key-file ..\..\..\private.key files\dfu_image_v2.zip
::nrfutil pkg generate --application files\buttonless_app.hex --application-version 3 --sd-req 0x0101 --hw-version 52 --key-file ..\..\..\private.key files\dfu_image_v3.zip
::nrfutil pkg generate --application files\buttonless_app.hex --application-version 4 --sd-req 0x0101 --hw-version 52 --key-file ..\..\..\private.key files\dfu_image_v4.zip
::nrfutil pkg generate --application files\buttonless_app.hex --application-version 5 --sd-req 0x0101 --hw-version 52 --key-file ..\..\..\private.key files\dfu_image_v5.zip


::nrfutil dfu ble -pkg files\dfu_image_v2.zip -ic NRF52 -snr %CONNECTIVITY_SNR% -n &amp;quot;Nordic_Buttonless&amp;quot;
::TIMEOUT 10
::nrfutil dfu ble -pkg files\dfu_image_v3.zip -ic NRF52 -snr %CONNECTIVITY_SNR% -n &amp;quot;Nordic_Buttonless&amp;quot;

&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Notes:&lt;/p&gt;
&lt;p&gt;- Set the serial number of the programmer on your DK. The TARGET_SNR refers to the nRF52832 DK with the bootloader, and the CONNECTIVITY_SNR refers to the other DK that you will use to update the nRF52832 over the air.&lt;/p&gt;
&lt;p&gt;- The softdevice ID of the S132 from SDK17.0.2 is 0x0101.&lt;/p&gt;
&lt;p&gt;- Useful nrfutil commands:&amp;nbsp;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;nrfutil settings generate --help&lt;/li&gt;
&lt;li&gt;nrfutil pkg generate --help&lt;/li&gt;
&lt;li&gt;nrfutil dfu ble --help&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Please note that I flash all 4 .hex files: Softdevice, Bootloader, Application and Bootloader Settings. You can merge them and program them all in one, if you like.&lt;/p&gt;
&lt;p&gt;If you have reset the device after programming the bootloader but before programming the bootloader settings, add the flag --sectorerase to the nrfjprog command programming the bootloader settings.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Let me know if it doesn&amp;#39;t work.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Edvin&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>