<?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>SDK 7.2 - DFU Bootloader - HardFault after calling sd_mbr_command</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/8063/sdk-7-2---dfu-bootloader---hardfault-after-calling-sd_mbr_command</link><description>SoftDevice : S110 7.1 
 
 
 SDK 7.2 
 
 
 Example : dfu\bootloader (using dual bank) 
 
 
 Using IAR 7.1 
 
 
 (Before debugging with IAR, I downloaded both the bootloader.hex and s110 7.1 hex with nrfjprog.exe) 
 
 Modified SDK files :</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 15 Jul 2015 13:11:13 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/8063/sdk-7-2---dfu-bootloader---hardfault-after-calling-sd_mbr_command" /><item><title>RE: SDK 7.2 - DFU Bootloader - HardFault after calling sd_mbr_command</title><link>https://devzone.nordicsemi.com/thread/28916?ContentTypeID=1</link><pubDate>Wed, 15 Jul 2015 13:11:13 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3c49e51f-6347-4090-a604-f96140f1ea7c</guid><dc:creator>Susheel Nuguru</dc:creator><description>&lt;p&gt;Your IAR settings should match the ones like you showed in KEIL, There must be some way in IAR that you can make this in .icf file? But iif you cannot have IRAM2 configuration , then you must make some other way to make sure that globals in dfu_ble_svc.c go to NoInit part of RAM. else your code will not work. This thread has become very long, if you have any other doubts regarding it, please open another thread.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SDK 7.2 - DFU Bootloader - HardFault after calling sd_mbr_command</title><link>https://devzone.nordicsemi.com/thread/28915?ContentTypeID=1</link><pubDate>Wed, 15 Jul 2015 11:14:29 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e35a94f9-50c9-48a3-a160-238a6601d2e3</guid><dc:creator>MANGO</dc:creator><description>&lt;p&gt;Are you talking about this settings at Keil uVIsion?&lt;/p&gt;
&lt;p&gt;Is that the reason why it is splitted into iRAM1 and 2?&lt;/p&gt;
&lt;p&gt;But I&amp;#39;m not sure if I can split it when I use IAR.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SDK 7.2 - DFU Bootloader - HardFault after calling sd_mbr_command</title><link>https://devzone.nordicsemi.com/thread/28908?ContentTypeID=1</link><pubDate>Mon, 13 Jul 2015 09:09:55 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3132e826-e66a-4a44-99a2-71b923094930</guid><dc:creator>Susheel Nuguru</dc:creator><description>&lt;p&gt;your welcome.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SDK 7.2 - DFU Bootloader - HardFault after calling sd_mbr_command</title><link>https://devzone.nordicsemi.com/thread/28911?ContentTypeID=1</link><pubDate>Mon, 13 Jul 2015 08:57:46 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:53afaf28-fc25-4b44-bb9b-62b3132ac5b0</guid><dc:creator>MANGO</dc:creator><description>&lt;p&gt;Alright!! Thanks alot!! You are the best!&lt;/p&gt;
&lt;p&gt;I really appreciate you for helping a novice developer like me T.T.&lt;/p&gt;
&lt;p&gt;Have a nice day~&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SDK 7.2 - DFU Bootloader - HardFault after calling sd_mbr_command</title><link>https://devzone.nordicsemi.com/thread/28909?ContentTypeID=1</link><pubDate>Mon, 13 Jul 2015 08:02:17 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f139fe1d-e92b-4618-9ea7-e506b3d8e92a</guid><dc:creator>Susheel Nuguru</dc:creator><description>&lt;h2&gt;I think it does not really matter with RAM, because after the bootloader DFU is done there will be a system reset, so they can overlap.
Correction 15.07.2015&lt;/h2&gt;
&lt;p&gt;It matters with IRAM settings with bootloader and make sure it does not conflict with softdevice. Bootloader uses softdevice to advertise etc, so they need to work hand in hand. sorry for the initial wrong information.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SDK 7.2 - DFU Bootloader - HardFault after calling sd_mbr_command</title><link>https://devzone.nordicsemi.com/thread/28910?ContentTypeID=1</link><pubDate>Mon, 13 Jul 2015 07:53:56 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6ce4187e-6515-4a7f-b437-31b196aaf2d9</guid><dc:creator>MANGO</dc:creator><description>&lt;p&gt;Thanks, but what about the RAM?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SDK 7.2 - DFU Bootloader - HardFault after calling sd_mbr_command</title><link>https://devzone.nordicsemi.com/thread/28914?ContentTypeID=1</link><pubDate>Mon, 13 Jul 2015 06:59:13 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d2939764-dc98-4b6e-b9a9-df7f2bd93410</guid><dc:creator>Susheel Nuguru</dc:creator><description>&lt;p&gt;you are right, when you are using bootloader you should use 0x16000 size 0x26000 for application settings.
It normally worked until now with that settings even with bootloaders as applications were luckily small enough not to cross that dangerous line :)&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SDK 7.2 - DFU Bootloader - HardFault after calling sd_mbr_command</title><link>https://devzone.nordicsemi.com/thread/28913?ContentTypeID=1</link><pubDate>Mon, 13 Jul 2015 06:39:58 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2684ffad-7fd3-48fe-81a2-7dca3a36537b</guid><dc:creator>MANGO</dc:creator><description>&lt;p&gt;About 3), isn&amp;#39;t that the setting when the firmware is not using the bootloader?&lt;/p&gt;
&lt;p&gt;Since the bootloader&amp;#39;s start address is 0x0003 C000, if I set the&lt;/p&gt;
&lt;p&gt;application&amp;#39;s size to 0x0002 9000 (0x0001 6000 ~ 0x003 EFFF) , won&amp;#39;t it corrupt the bootloader?&lt;/p&gt;
&lt;p&gt;Also the iRAM as well, does it?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SDK 7.2 - DFU Bootloader - HardFault after calling sd_mbr_command</title><link>https://devzone.nordicsemi.com/thread/28912?ContentTypeID=1</link><pubDate>Mon, 13 Jul 2015 05:57:59 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3764eef7-afdd-48d5-ad74-3ab368e770cd</guid><dc:creator>Susheel Nuguru</dc:creator><description>&lt;ol&gt;
&lt;li&gt;Your settings will be right for an application using S110 7.x softdevice, Bootloader always goes to 0X3C000 til the last page of the available flash&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;2)MBR and Softdevice are merged into one hex, MBR starts at 0x0000 and softdevice in that hex starts at 0x1000. When we say start, we mean that the start of vector table for that unit is located at that address. We need these start addresses to make a proper jump of transferring interrupt context from MBR to softdevice.&lt;/p&gt;
&lt;p&gt;3)You application goes to the the address in the layout you have pointed in your point 2)
Which is in your case 0x16000  --&amp;gt; Look &lt;a href="https://devzone.nordicsemi.com/question/31703/nrf51822-iram-and-irom-settings-for-s110-sd/"&gt;here&lt;/a&gt;&lt;/p&gt;
&lt;ol start="4"&gt;
&lt;li&gt;Not 100% sure, may be Håkon can answer it.&lt;/li&gt;
&lt;/ol&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SDK 7.2 - DFU Bootloader - HardFault after calling sd_mbr_command</title><link>https://devzone.nordicsemi.com/thread/28907?ContentTypeID=1</link><pubDate>Thu, 09 Jul 2015 13:07:45 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:dbbf73f8-ca12-4d26-a785-7554b27bd0eb</guid><dc:creator>Susheel Nuguru</dc:creator><description>&lt;p&gt;no problem, please update us after you have tried it and accept the answer if it works :)&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SDK 7.2 - DFU Bootloader - HardFault after calling sd_mbr_command</title><link>https://devzone.nordicsemi.com/thread/28906?ContentTypeID=1</link><pubDate>Thu, 09 Jul 2015 13:05:24 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:488ce9c7-7870-403c-aafc-66dcd9d28cd0</guid><dc:creator>MANGO</dc:creator><description>&lt;p&gt;Okay! Thanks for your help. I apologize that I couldn&amp;#39;t thought whether it was iRAM or iROM and the typo&lt;/p&gt;
&lt;p&gt;of the wrong address. I was replying with my phone so I messed up. Anyway thanks a million!!!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SDK 7.2 - DFU Bootloader - HardFault after calling sd_mbr_command</title><link>https://devzone.nordicsemi.com/thread/28905?ContentTypeID=1</link><pubDate>Thu, 09 Jul 2015 12:58:03 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:651ed67b-2867-4245-ba2b-743677ec1b36</guid><dc:creator>Susheel Nuguru</dc:creator><description>&lt;p&gt;Yes you need to change  below in your dfu7_2.icf file (not 0x3C00 but 0x3C000. This is IROM not IRAM)&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;define symbol __ICFEDIT_intvec_start__ = 0x0003C000;
/*-Memory Regions-*/
define symbol __ICFEDIT_region_ROM_start__ = 0x0003C000;
&lt;/code&gt;&lt;/pre&gt;
&lt;ol start="2"&gt;
&lt;li&gt;yes your bootloader does not fit from 0X3C000 to end of flash if you do not set maximum optimizations. You can try it yourself and see that the linker will complain when you build your project with low optimzation level.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;My bad, &amp;quot;debug version&amp;quot; is not the right word to use here, sorry, i meant &amp;quot;non optimized version&amp;quot;.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SDK 7.2 - DFU Bootloader - HardFault after calling sd_mbr_command</title><link>https://devzone.nordicsemi.com/thread/28904?ContentTypeID=1</link><pubDate>Thu, 09 Jul 2015 12:52:09 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f3724744-b24a-4a17-8f9c-421ce2c0c3d1</guid><dc:creator>MANGO</dc:creator><description>&lt;p&gt;Due to other work, I cannot try it right now but&lt;/p&gt;
&lt;p&gt;I just 1) need to change the linker script manually to download my bootloader at 0x3C00&lt;/p&gt;
&lt;ol start="2"&gt;
&lt;li&gt;and change the code optimization to high, right?&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;There are some points I didn&amp;#39;t understand.&lt;/p&gt;
&lt;p&gt;First, what do you mean by &amp;quot;debug version of the bootloader&amp;quot;?&lt;/p&gt;
&lt;p&gt;What&amp;#39;s the difference with the bootloader which runs at run mode?&lt;/p&gt;
&lt;p&gt;Second, compared to Keil uVision, IAR doesn&amp;#39;t have the option for setting the bootloader address?&lt;/p&gt;
&lt;p&gt;I found threads that says set IRAM to 0x3C00 and I think there&amp;#39;s no option at IAR.&lt;/p&gt;
&lt;p&gt;Lastly, why using high level optimization is needed? To decrease the size of my firmware&amp;#39;s code size?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SDK 7.2 - DFU Bootloader - HardFault after calling sd_mbr_command</title><link>https://devzone.nordicsemi.com/thread/28903?ContentTypeID=1</link><pubDate>Thu, 09 Jul 2015 10:33:13 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e9b0448c-248d-4fe3-95fd-7edc18799d6c</guid><dc:creator>Susheel Nuguru</dc:creator><description>&lt;p&gt;Hi Mango,
I tried your project, Like Håkon said, you have to download your bootloader at 0X3C000, so you have to change the linker files. The debug version of your bootloader is big, so turn the optimizations to high and then you can compile it. I checked it atleast does not get a hardfault. If this is the same for you, please accept Håkon&amp;#39;s answer&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SDK 7.2 - DFU Bootloader - HardFault after calling sd_mbr_command</title><link>https://devzone.nordicsemi.com/thread/28917?ContentTypeID=1</link><pubDate>Wed, 08 Jul 2015 17:00:25 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a80b11fd-9500-443b-96da-96acda0aec85</guid><dc:creator>H&amp;#229;kon Alseth</dc:creator><description>&lt;p&gt;Hi Mango922,&lt;/p&gt;
&lt;p&gt;Unfortunately, I do not have IAR installed on my home computer, but I can spot one issue.
Your linker file, dfu7_2.icf, does not have the correct start address for the DFU bootloader start address set in dfu_types.h::BOOTLOADER_REGION_START.&lt;/p&gt;
&lt;p&gt;You&amp;#39;ll then get a hardfault as the softdevice forwards you to an unprogrammed section of the flash.
Change these sections in the linker script:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;*snip*
/*-Specials-*/
define symbol __ICFEDIT_intvec_start__ = 0x0003C000;
/*-Memory Regions-*/
define symbol __ICFEDIT_region_ROM_start__ = 0x0003C000;
*snip*
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Forgive me if I am forgetting/not seeing any other issues, I&amp;#39;ll team up with @Aryan tomorrow if you have any other issues.&lt;/p&gt;
&lt;p&gt;Cheers,
Håkon&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SDK 7.2 - DFU Bootloader - HardFault after calling sd_mbr_command</title><link>https://devzone.nordicsemi.com/thread/28902?ContentTypeID=1</link><pubDate>Wed, 08 Jul 2015 12:42:49 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:74206829-3da0-464f-b33f-4c74d13fbac0</guid><dc:creator>Susheel Nuguru</dc:creator><description>&lt;p&gt;Thanks, i&amp;#39;ll try it tomorrow, today i am kind of stuffed with other things.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SDK 7.2 - DFU Bootloader - HardFault after calling sd_mbr_command</title><link>https://devzone.nordicsemi.com/thread/28901?ContentTypeID=1</link><pubDate>Wed, 08 Jul 2015 10:05:30 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:28c49aff-fc3a-4caa-8470-8b94e897bea1</guid><dc:creator>Susheel Nuguru</dc:creator><description>&lt;p&gt;can you please give me your IAR project file, i can try your setup here. I do not see IAR support to that example, so i am assuming you made it yourself.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>