<?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>nrfutil behavior incompatible with sdkv11 dfu_init_template.c</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/15539/nrfutil-behavior-incompatible-with-sdkv11-dfu_init_template-c</link><description>This is my first DFU project, and so this may be super-obvious to all of you. 
 I am writing this here to help others, because it appears that there are others out there right now struggling to get DFU working. 
 
 The SDKV11 dfu_init_template.c is</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 04 Aug 2016 13:20:57 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/15539/nrfutil-behavior-incompatible-with-sdkv11-dfu_init_template-c" /><item><title>RE: nrfutil behavior incompatible with sdkv11 dfu_init_template.c</title><link>https://devzone.nordicsemi.com/thread/59333?ContentTypeID=1</link><pubDate>Thu, 04 Aug 2016 13:20:57 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:aefc154f-849e-4615-9674-bcab2b73ac53</guid><dc:creator>Ray</dc:creator><description>&lt;p&gt;Ok, Øyvind, now I feel just plain dumb.&lt;/p&gt;
&lt;p&gt;First, thank you for telling me to re-read the readme for nrfutil.  Why?  Because at the very, very, very end of the file it refers to the repo of a secure bootloader that contains the SHA source code and sample bootloader that uses it.  I had been looking for that; that&amp;#39;s what I was referring to when in my note above I said &amp;quot;Perhaps I didn&amp;#39;t look hard enough.&amp;quot;&lt;/p&gt;
&lt;p&gt;MORE IMPORTANTLY, thank you for your comments, which caused me to poke around and read the Python source code for NRFUTIL.  Why did this help?  Because it made me realize that I made a truly dumb mistake.&lt;/p&gt;
&lt;p&gt;You see, when I had first tried NRFUTIL and didn&amp;#39;t know what I was doing, I had created a PEM keyfile, and had added this to the NRFUTIL command line in my makefile:  &amp;quot;--key-file $(APPNAME).pem&amp;quot;&lt;/p&gt;
&lt;p&gt;Of course, as I learned more about NRFUTIL, I realized that keyfiles were only needed for secure init, and I just forgot about it and focused on using CRC.&lt;/p&gt;
&lt;p&gt;When looking at the source code for NRFUTIL this morning, I realized that if the --key-file parameter is found on the command line, it a) jams the version to 0.8 rather than 0.5, b) includes the stuff in the init packet corresponding to the new secure/hashed format, and c) eliminates the CRC from the output under the assumption that you&amp;#39;re no longer using the old way of validating the image.&lt;/p&gt;
&lt;p&gt;The moment I removed the spurious --key-file argument from nrfutil, the CRC appeared in the output (and in the manifest.json), and the CRC check in the postvalidate() now works perfectly!&lt;/p&gt;
&lt;p&gt;And so, the reality is that the title of this topic &amp;quot;nrfutil behavior incompatible with sdkv11 dfu_init_template.c&amp;quot; is flat-out wrong.  NRFUTIL 0_5_1 behavior IS fully compatible with the dfu_init_template.c so long as you don&amp;#39;t stupidly use the --key-file parameter on the nrfutil command line.&lt;/p&gt;
&lt;p&gt;Thank you again for your help.  This has been quite a learning process, with a positive conclusion.&lt;/p&gt;
&lt;p&gt;If there IS one takeaway for you folks at Nordic, though, it is that I think you can probably see that DFU has enough moving parts (in understanding memory layouts and how it works, in getting the tooling loaded, in writing a buttonless bootloader, in creating the composite softdevice+app+bootloader image, in creating the download image, etc) that this it is probably worth the investment on your part in creating not one but a suite of multiple DFU examples for different build environments and with different security requirements.&lt;/p&gt;
&lt;p&gt;Thank you again.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrfutil behavior incompatible with sdkv11 dfu_init_template.c</title><link>https://devzone.nordicsemi.com/thread/59332?ContentTypeID=1</link><pubDate>Thu, 04 Aug 2016 09:32:18 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:834a4e01-8c2c-4668-b718-17285772536d</guid><dc:creator>zhouyu</dc:creator><description>&lt;p&gt;I got it. Leaving it empty is OK. My shell is like this.&amp;quot;nrfutil dfu genpkg --application app.hex --application-version 0xffffffff --dev-type 0xffff --dev-revision 0xffff app.zip&amp;quot;. Thank you all. You saved my life.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrfutil behavior incompatible with sdkv11 dfu_init_template.c</title><link>https://devzone.nordicsemi.com/thread/59331?ContentTypeID=1</link><pubDate>Thu, 04 Aug 2016 09:12:20 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b3ce639d-f380-444a-94d1-3a1ca1e81d50</guid><dc:creator>zhouyu</dc:creator><description>&lt;p&gt;I&amp;#39;m struggling to do dfu. What&amp;#39;s the nrfutil argument --sd-req for s132. Thanks in advance.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrfutil behavior incompatible with sdkv11 dfu_init_template.c</title><link>https://devzone.nordicsemi.com/thread/59330?ContentTypeID=1</link><pubDate>Thu, 04 Aug 2016 08:41:50 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:66db5fdc-b5e2-4e50-8497-0c5260284355</guid><dc:creator>&amp;#216;yvind Karlsen</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;Seems like you&amp;#39;ve pretty much figured this out yourself. I have not encountered the issues in 4, but it looks like you&amp;#39;ve found something that works for you.&lt;/p&gt;
&lt;p&gt;The .dat file is the one that is actually being sent to the device, a .json is bundeled as it is useful for interfacing with Android and applications as it is more readable than the .dat file.&lt;/p&gt;
&lt;p&gt;The application needs to know beforehand the format of the DFU packet, if it differs you will see odd behaviour, such as the CRC issues you&amp;#39;ve faced.&lt;/p&gt;
&lt;p&gt;For future reference there&amp;#39;s some additional information in the &lt;a href="https://github.com/NordicSemiconductor/pc-nrfutil/blob/master/README.md"&gt;readme&lt;/a&gt; for nrfutil.&lt;/p&gt;
&lt;p&gt;For those who are struggling with nrfutil you can apply this workaround.&lt;/p&gt;
&lt;p&gt;First off we will download the 0.5 branch of nrfutil (Turns out that the live branch is for a future SDK 12) &lt;a href="https://github.com/NordicSemiconductor/pc-nrfutil/archive/0_5_1.zip"&gt;direct link to zip here&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;After unzipping we need to install it, first we need to fix the dependencies, opening the requirements.txt file we find that we need to install the following (these should all have builds available through pip for &amp;quot;any&amp;quot; platform, if they don&amp;#39;t you will have to manually install):&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;pip install pyserial
pip install enum34
pip install click
pip install ecdsa
pip install behave
pip install py2exe
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;After installing the dependencies you should be able to run the installer from the unzip location, eg. &amp;quot;[MY UNZIP LOCATION]\pc-nrfutil-0_5_1&amp;quot;&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;python setup.py install
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The neat trick here is that the python script will run &amp;quot;uncompiled&amp;quot; so we can run main without wrappers, navigate to the nordicsemi folder and run &lt;strong&gt;main&lt;/strong&gt;.py&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;cd nordicsemi\
python __main__.py
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;For all intents and purposes this main.py is the same as nrfutil.&lt;/p&gt;
&lt;p&gt;Finally there&amp;#39;s a bug in the most recent SDK where the init files for some of the precompiled .zip files contain wrong values for SoftDevice version. As a sanity check I recommend running through the &lt;a href="https://devzone.nordicsemi.com/tutorials/9/"&gt;setting up DFU tutorial&lt;/a&gt;, there I also supply a working .zip.&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Øyvind&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>