<?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>Bootloader hardfault</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/11336/bootloader-hardfault</link><description>Hi, 
 Im trying to use BLE DFU Bootloader from examples. I loaded SD8 and then bootloader via nrfStudio (dont have a valid app flashed), but I cant see the device from Android app.
I decided to do some debugging via Keil.
I recompiled Bootloader with</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Fri, 05 Feb 2016 07:29:53 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/11336/bootloader-hardfault" /><item><title>RE: Bootloader hardfault</title><link>https://devzone.nordicsemi.com/thread/42683?ContentTypeID=1</link><pubDate>Fri, 05 Feb 2016 07:29:53 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:512030b1-2ad8-4024-8f81-baf986a62eea</guid><dc:creator>bjorn-spockeli</dc:creator><description>&lt;p&gt;Happy to help :)&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Bootloader hardfault</title><link>https://devzone.nordicsemi.com/thread/42682?ContentTypeID=1</link><pubDate>Fri, 05 Feb 2016 05:08:03 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:57e4fddf-4bb9-4e41-8e54-3784f30dbf9d</guid><dc:creator>Sergy</dc:creator><description>&lt;p&gt;Yup, I confirm that everything works. Thanks so much for helping me out on this!!!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Bootloader hardfault</title><link>https://devzone.nordicsemi.com/thread/42681?ContentTypeID=1</link><pubDate>Tue, 02 Feb 2016 12:34:59 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:61d9e1c5-4f2d-4c45-b6fc-312a1545134d</guid><dc:creator>bjorn-spockeli</dc:creator><description>&lt;p&gt;As far as I know, that is normal.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Bootloader hardfault</title><link>https://devzone.nordicsemi.com/thread/42680?ContentTypeID=1</link><pubDate>Tue, 02 Feb 2016 12:18:56 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8400ae99-ddf7-4b9f-9beb-dfc85f7a228d</guid><dc:creator>Sergy</dc:creator><description>&lt;p&gt;What I meant to say - is it normal that it doesn&amp;#39;t occupy the whole page, but is trimmed to exactly number of bytes it takes?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Bootloader hardfault</title><link>https://devzone.nordicsemi.com/thread/42679?ContentTypeID=1</link><pubDate>Tue, 02 Feb 2016 12:08:19 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b544f51c-5a68-4aa3-95a1-633f06cad459</guid><dc:creator>bjorn-spockeli</dc:creator><description>&lt;p&gt;Well, its no wonder that the image is smalle, but yes,  I would expect it to be around 0x6000. I do not have an explenation for this, but as long as its below the &lt;code&gt;DFU_BL_IMAGE_MAX_SIZE&lt;/code&gt; I guess its O.K.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Bootloader hardfault</title><link>https://devzone.nordicsemi.com/thread/42676?ContentTypeID=1</link><pubDate>Tue, 02 Feb 2016 10:32:57 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6d24d6fb-1024-4259-8282-89a69ebec40f</guid><dc:creator>Sergy</dc:creator><description>&lt;p&gt;ah thats interesting, I have a &amp;quot;const&amp;quot; in front, not sure why:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;const uint8_t  m_boot_settings[CODE_PAGE_SIZE] __attribute__((at(BOOTLOADER_SETTINGS_ADDRESS))) __attribute__((used));
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;If I remove &amp;quot;const&amp;quot; I generate BIN file from HEX and the size of bin is 18832 (0x4990). A bit weird, no?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Bootloader hardfault</title><link>https://devzone.nordicsemi.com/thread/42675?ContentTypeID=1</link><pubDate>Tue, 02 Feb 2016 10:26:01 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c91654fa-c13d-4d8c-a674-5dff9623c350</guid><dc:creator>bjorn-spockeli</dc:creator><description>&lt;p&gt;I checked your &amp;quot;Bootloader Hex without BANK_VALID_APP&amp;quot; and the entire flash page from 0x3FC00 to 0x40000 is initialized to 0x00. How are you reserving the bootloader flash page? Line 18 in bootloader_settings.c should be the following:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;uint8_t  m_boot_settings[CODE_PAGE_SIZE] __attribute__((at(BOOTLOADER_SETTINGS_ADDRESS))) __attribute__((used));
&lt;/code&gt;&lt;/pre&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Bootloader hardfault</title><link>https://devzone.nordicsemi.com/thread/42674?ContentTypeID=1</link><pubDate>Tue, 02 Feb 2016 10:06:15 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9080aa21-1abd-4066-8120-090493b3e412</guid><dc:creator>bjorn-spockeli</dc:creator><description>&lt;p&gt;The bootloader settings flash page should start at &lt;code&gt;0x3FC00&lt;/code&gt;. &lt;code&gt;DFU_BL_IMAGE_MAX_SIZE&lt;/code&gt; is defined as (&lt;code&gt;BOOTLOADER_SETTINGS_ADDRESS&lt;/code&gt; - &lt;code&gt;BOOTLOADER_REGION_START&lt;/code&gt;) so in your case it will be 0x3FC00-0x39C00 = 6000. Have you written anything to flash above 0x3FC00 ?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Bootloader hardfault</title><link>https://devzone.nordicsemi.com/thread/42678?ContentTypeID=1</link><pubDate>Tue, 02 Feb 2016 09:30:00 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:826d04f1-3961-4780-aeec-f95480d55e93</guid><dc:creator>Sergy</dc:creator><description>&lt;p&gt;Yes I did remove it, but my bootloader start address is before bootloader settings, so may be there is some problem with that?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Bootloader hardfault</title><link>https://devzone.nordicsemi.com/thread/42677?ContentTypeID=1</link><pubDate>Tue, 02 Feb 2016 09:18:54 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:259ceab5-517f-4b21-962f-9a09d4aa6eb6</guid><dc:creator>bjorn-spockeli</dc:creator><description>&lt;p&gt;Did you remove the code that set the  BANK_APP_VALID flag on the bootloader settings page?  The bootloader settings flash page is 1kB and will be included in the image if something is written to it.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Bootloader hardfault</title><link>https://devzone.nordicsemi.com/thread/42673?ContentTypeID=1</link><pubDate>Thu, 28 Jan 2016 15:59:33 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1225d783-b3ca-4b21-9ea4-e21b3a5ca9f0</guid><dc:creator>Sergy</dc:creator><description>&lt;p&gt;ok I compiled it and was able to run debugger. Funny thing I used size 0x6000 and now it complains that image size is 0x6400. For some reason it keeps adding 1kb to the real size of the debugger?&lt;/p&gt;
&lt;p&gt;Also if I generate update package bin file inside its is 0x6400 size. Why does it create it 1kb bigger than in settings?&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;IROM: 0x39C00 0x6000

Program Size: Code=17200 RO-data=4108 RW-data=212 ZI-data=3992
&lt;/code&gt;&lt;/pre&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Bootloader hardfault</title><link>https://devzone.nordicsemi.com/thread/42672?ContentTypeID=1</link><pubDate>Thu, 28 Jan 2016 15:22:54 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:23d5cb2b-206e-487e-af56-8c96e75c7a85</guid><dc:creator>Sergy</dc:creator><description>&lt;p&gt;I tried, but i get stopped out here:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;    __STATIC_INLINE void nrf_gpio_cfg_output(uint32_t pin_number)
{
    nrf_gpio_cfg(
            pin_number,
            NRF_GPIO_PIN_DIR_OUTPUT,
            NRF_GPIO_PIN_INPUT_DISCONNECT,
            NRF_GPIO_PIN_NOPULL,
            NRF_GPIO_PIN_S0S1,
            NRF_GPIO_PIN_NOSENSE);
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;without setting any breakpoint in this code.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Bootloader hardfault</title><link>https://devzone.nordicsemi.com/thread/42671?ContentTypeID=1</link><pubDate>Thu, 28 Jan 2016 15:18:48 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:81e79331-3715-4364-9b6e-f80b73f849e6</guid><dc:creator>bjorn-spockeli</dc:creator><description>&lt;p&gt;You&amp;#39;re not able to set breakpoints at the locations when using Level 3 or 2?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Bootloader hardfault</title><link>https://devzone.nordicsemi.com/thread/42670?ContentTypeID=1</link><pubDate>Thu, 28 Jan 2016 15:05:37 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5397f459-1b63-4b8c-89cc-ca96fa97b739</guid><dc:creator>Sergy</dc:creator><description>&lt;p&gt;I cant even compile it with Level 0 optimisation, I get this error: ._build\nrf51422_xxac.axf: Error: L6985E: Unable to automatically place AT section bootloader_settings.o(.ARM.__AT_0x0003FC00) with required base address 0x0003fc00. Please manually place in the scatter file using the --no_autoat option.&lt;/p&gt;
&lt;p&gt;If I use 24Kb or 25Kb, same error.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Bootloader hardfault</title><link>https://devzone.nordicsemi.com/thread/42669?ContentTypeID=1</link><pubDate>Thu, 28 Jan 2016 13:46:07 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:dddcbdf1-8400-4934-8a75-07ae5b985c1f</guid><dc:creator>bjorn-spockeli</dc:creator><description>&lt;p&gt;&lt;code&gt;NRF_ERROR_DATA_SIZE&lt;/code&gt; is returned  at line 334, 339, and 415 in &lt;code&gt;dfu_single_bank.c&lt;/code&gt; . Start a Debug Session in the bootloader project, set a breakpoint  at each of these locations and perform a firmware update.&lt;/p&gt;
&lt;p&gt;When I performed a DFU, I got caught at the breakpoint at line 334:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; if (m_start_packet.bl_image_size &amp;gt; DFU_BL_IMAGE_MAX_SIZE)
    {
        return NRF_ERROR_DATA_SIZE;
    }
&lt;/code&gt;&lt;/pre&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Bootloader hardfault</title><link>https://devzone.nordicsemi.com/thread/42668?ContentTypeID=1</link><pubDate>Thu, 28 Jan 2016 06:43:52 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0cdc3239-6881-4341-b4c8-51bd26bb19fb</guid><dc:creator>Sergy</dc:creator><description>&lt;p&gt;ive added a screenshot of NRF Studio where it shows that start address of bootloader is 0x3A000, so if the image size would be 0x6000 it wouldnt fit and we would get a programming error, correct?
Then the question is why you think image size is 0x6000, but NRF Studio programs it as 0x5C00 without errors and BL also works.&lt;/p&gt;
&lt;p&gt;Nevertheless I did what you suggested - Increased BL memory by another 1K, but the result is still the same - getting Exceeded Data Size error.
Do you have some other suggestions?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Bootloader hardfault</title><link>https://devzone.nordicsemi.com/thread/42667?ContentTypeID=1</link><pubDate>Wed, 27 Jan 2016 10:18:46 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:67eeae25-635d-4396-a3c2-53aa68bb239a</guid><dc:creator>bjorn-spockeli</dc:creator><description>&lt;p&gt;When you flash it using a programmer, you will update the bootloader start address that is written to a UICR register. This is not done when performing a OTA DFU, then you only replace the bootloader, but the bootloader start adress will remain the same as the old bootloader.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Bootloader hardfault</title><link>https://devzone.nordicsemi.com/thread/42666?ContentTypeID=1</link><pubDate>Wed, 27 Jan 2016 10:13:33 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c6464cfe-3763-4999-8bfd-988b8858a827</guid><dc:creator>Sergy</dc:creator><description>&lt;p&gt;Hm this is a bit weird. How do I flash it with a cable then and it works? There is no size check?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Bootloader hardfault</title><link>https://devzone.nordicsemi.com/thread/42665?ContentTypeID=1</link><pubDate>Wed, 27 Jan 2016 10:08:33 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4f4b4c95-e7c9-4786-ac14-a326ac3c958c</guid><dc:creator>bjorn-spockeli</dc:creator><description>&lt;p&gt;I found the issue. The image size was 0x6000 bytes and the size reserved for the bootloader was 0x5C00, i.e. 0x400 (1kB) too large.&lt;/p&gt;
&lt;p&gt;Change the ROM/RAM settings to the following&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;IROM1 start: 0x39C00 size:6000
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;and set &lt;code&gt;BOOTLOADER_REGION_START&lt;/code&gt; to 0x00039C00 in &lt;code&gt;dfu_types.h&lt;/code&gt;.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Bootloader hardfault</title><link>https://devzone.nordicsemi.com/thread/42664?ContentTypeID=1</link><pubDate>Wed, 27 Jan 2016 04:17:58 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:52805fe1-1df3-497f-a013-0298f9c3f56c</guid><dc:creator>Sergy</dc:creator><description>&lt;p&gt;I removed BANK_VALID_APP, but still having the same problem: Data Size Exceeds Limit. Just for the sake of clarity I tried two things:
1)first flashed SD+APP+BL with set BANK_VALID_APP. Then I tried OTA DFU and sent a BL without BANK_VALID_APP.&lt;/p&gt;
&lt;ol start="2"&gt;
&lt;li&gt;I loaded SD+BL without BANK_VALID_APP and tried to do OTA DFU. Got the same error.
Im attaching both new package and hex file to the main thread. Please have a look.&lt;/li&gt;
&lt;/ol&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Bootloader hardfault</title><link>https://devzone.nordicsemi.com/thread/42661?ContentTypeID=1</link><pubDate>Mon, 25 Jan 2016 10:12:21 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7b4d4c25-3917-4e98-b026-54ac940270f9</guid><dc:creator>bjorn-spockeli</dc:creator><description>&lt;p&gt;The size issue turned out to be error with the script I used to create a hexdump of the hexfile you sent me.&lt;/p&gt;
&lt;p&gt;In the bootloader hex you have set the BANK_VALID_APP flag on the bootloader settings flash page. If you are using a single bank bootloader, the application will be erased and the new bootloader is saved to the application flash space. When the bootloader is swapped with the old one, it will check the bootloader settings to see if the BANK_VALID_APP flag is set. If it is set, the bootloader will branch to what it thinks is a valid application, but in reality is just an empty flash area.&lt;/p&gt;
&lt;p&gt;Do not set the BANK_VALID_APP in bootlaoder images when performing OTA DFU. Only set it if you&amp;#39;re flashing BL+APP+SD using a programmer.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Bootloader hardfault</title><link>https://devzone.nordicsemi.com/thread/42660?ContentTypeID=1</link><pubDate>Mon, 25 Jan 2016 09:23:51 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b04824dc-7951-4631-b4b9-99481e69fae3</guid><dc:creator>Sergy</dc:creator><description>&lt;p&gt;Attached to main thread. I think O3 was enabled last time as well. File sizes seem identical.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Bootloader hardfault</title><link>https://devzone.nordicsemi.com/thread/42663?ContentTypeID=1</link><pubDate>Mon, 25 Jan 2016 07:56:16 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:68abdf77-ae40-4ba2-8aaf-06a28f987c7a</guid><dc:creator>bjorn-spockeli</dc:creator><description>&lt;p&gt;Ok, I am not sure why the hexfile is to big. Could you try compiling the bootloader again with optimization level 3 turned on?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Bootloader hardfault</title><link>https://devzone.nordicsemi.com/thread/42662?ContentTypeID=1</link><pubDate>Sat, 23 Jan 2016 12:03:28 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:808857b4-b42f-4feb-b802-78dfa0dc2d18</guid><dc:creator>Sergy</dc:creator><description>&lt;p&gt;I&amp;#39;m actually planning to make bootloader support UART update as well, so I need to have some space reserved for it, can&amp;#39;t make it smaller.
What makes hex file so big? Can we fix the root cause?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Bootloader hardfault</title><link>https://devzone.nordicsemi.com/thread/42659?ContentTypeID=1</link><pubDate>Fri, 22 Jan 2016 14:29:21 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b45a4378-6cb3-4672-9658-b9b973fe1933</guid><dc:creator>bjorn-spockeli</dc:creator><description>&lt;p&gt;My suggestion would be to revert to the default memory settings, i.e.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;IROM1 Start: 0x3C000 Size:0x3C00
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;and turn on compiler optimization to level 3(-O3). Then you have 144 bytes left of application flash space and you can use the Dual Bank Bootloader ( if your application is not going to be bigger thatn 72kB). If 72kB is not enough then you can use Single Bank.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>