<?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>How to change the mbr jump address location</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/85074/how-to-change-the-mbr-jump-address-location</link><description>Hi, 
 I am using nrf5280 development kit and 17.1.0 sdk. 
 i am working on ble_app_uart example code. 
 Its working fine no issue. Since the start address of the application is 0x27000 and i want to change it on to some other location as per my requirement</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 02 Mar 2022 09:10:25 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/85074/how-to-change-the-mbr-jump-address-location" /><item><title>RE: How to change the mbr jump address location</title><link>https://devzone.nordicsemi.com/thread/355737?ContentTypeID=1</link><pubDate>Wed, 02 Mar 2022 09:10:25 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c5163662-b770-445d-960a-cbd665d82aef</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;Ah, yes. That was it, sd_softdevice_vector_table_base_set() is needed. Good to hear it got resolved. And thanks for letting us know!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to change the mbr jump address location</title><link>https://devzone.nordicsemi.com/thread/355709?ContentTypeID=1</link><pubDate>Wed, 02 Mar 2022 07:31:43 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:cb113ef1-2bc9-410e-8213-638bb3fafce5</guid><dc:creator>R_S</dc:creator><description>&lt;p&gt;Hi Einar,&lt;/p&gt;
&lt;p&gt;The issue got resolved.&lt;/p&gt;
&lt;p&gt;I found that&amp;nbsp;under DFU we are also calling&amp;nbsp;ble_stack_init() function. But there is additional data added in that function.&lt;/p&gt;
&lt;p&gt;&lt;img src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/pastedimage1646206152616v1.png" alt=" " /&gt;&lt;/p&gt;
&lt;p&gt;So same thing i am calling in ble code under ble_stack_init() function. And after that its working fine.&lt;/p&gt;
&lt;p&gt;actually we need to use these two function calls on both the places once in bootloader before jumping to application and second is inside the application.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Regards&lt;/p&gt;
&lt;p&gt;R_S&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to change the mbr jump address location</title><link>https://devzone.nordicsemi.com/thread/355638?ContentTypeID=1</link><pubDate>Tue, 01 Mar 2022 16:16:14 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5f1869f7-2205-4543-a58f-e99fbc04da2f</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;I did not get a chance to look at this today, but I will test your code on my end tomorrow and get back to you.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to change the mbr jump address location</title><link>https://devzone.nordicsemi.com/thread/355340?ContentTypeID=1</link><pubDate>Mon, 28 Feb 2022 15:43:59 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:973d41e3-095c-472b-877c-36345ae69e73</guid><dc:creator>R_S</dc:creator><description>&lt;p&gt;HI,&lt;/p&gt;
&lt;p&gt;&lt;a href="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/pca10056_5F00_usb.zip"&gt;devzone.nordicsemi.com/.../pca10056_5F00_usb.zip&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;I have attached the bootloader code here.&lt;/p&gt;
&lt;p&gt;In main.c line no 218. i am calling &amp;quot;nrf_bootloader_app_start();&amp;quot; API to jump to the application part.&lt;/p&gt;
&lt;p&gt;And inside&amp;nbsp;nrf_bootloader_app_start() function i am given the start address as the application start address(0xED000).&lt;/p&gt;
&lt;p&gt;And also calling the function&amp;nbsp;nrf_dfu_mbr_init_sd() &amp;amp;&amp;nbsp;nrf_dfu_mbr_vector_table_set() as you mentioned.&lt;/p&gt;
&lt;p&gt;&lt;a href="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/3426.nrf_5F00_bootloader_5F00_app_5F00_start.c"&gt;devzone.nordicsemi.com/.../3426.nrf_5F00_bootloader_5F00_app_5F00_start.c&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;i also attached&amp;nbsp;nrf_bootloader_app_start.c file in which i have added these chnages.&lt;/p&gt;
&lt;p&gt;apart from that i dont have any change in the bootloader code. An the code i am using is open bootloader code.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Regards&lt;/p&gt;
&lt;p&gt;R_S&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to change the mbr jump address location</title><link>https://devzone.nordicsemi.com/thread/355318?ContentTypeID=1</link><pubDate>Mon, 28 Feb 2022 14:26:30 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:59a90273-9992-48cb-a1d1-9a3c19ade5a8</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;I see... Can you share your bootloader code, where you branch to the application, including configuring the MBR etc? Please include enough context, so include values of constants that may be set elsewhere etc.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to change the mbr jump address location</title><link>https://devzone.nordicsemi.com/thread/355077?ContentTypeID=1</link><pubDate>Fri, 25 Feb 2022 14:48:40 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:fa54e620-401f-43af-a4c9-14dbc48d8237</guid><dc:creator>R_S</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;I trace it and found the point where i am getting hard fault.&lt;/p&gt;
&lt;p&gt;&lt;img src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/pastedimage1645797404524v1.png" alt=" " /&gt;&lt;/p&gt;
&lt;p&gt;ret_code = sd_softdevice_enable(&amp;amp;clock_lf_cfg, app_error_fault_handler);&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;The result is same even after using&amp;nbsp;&lt;span&gt;nrf_dfu_mbr_vector_table_set() and not&amp;nbsp;nrf_dfu_mbr_irq_forward_address_set() in the bootloader code.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;And the value of registers are mentioned below:&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;img src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/pastedimage1645799889194v2.png" alt=" " /&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;And yes the only chage in my application is in .icf file that is flash start address change.&lt;/p&gt;
&lt;p&gt;Previously it was&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;img src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/pastedimage1645800090127v4.png" alt=" " /&gt;&lt;/p&gt;
&lt;p&gt;And Currently i changed it to this&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;img src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/pastedimage1645800039412v3.png" alt=" " /&gt;&lt;/p&gt;
&lt;p&gt;in previous case the application address was 27000 so in that case i directly flashed it without bootloader code.&lt;/p&gt;
&lt;p&gt;And in the current scenario as address is 0xED000, so i flashed it with Bootloader code. But not sure what goes wrong in this case? Because i had used open bootloader and secure bootloader together where code control first goes to open bootloader and then from there it jump to the secure bootloader and then it was no issue. But dont know what wrong&amp;nbsp;with this ble_app_uart code.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Regards&lt;/p&gt;
&lt;p&gt;R_S&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to change the mbr jump address location</title><link>https://devzone.nordicsemi.com/thread/354968?ContentTypeID=1</link><pubDate>Fri, 25 Feb 2022 09:40:35 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:fa78a0cc-d925-4511-a663-6eb10bcf0965</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;Looking at the screenshot I see you get a hard fault, and not the error I expected form sd_softdevice_enable(), I did not pay attention to that initially.&amp;nbsp;This shows that&amp;nbsp;t PC is 0x0 and LR is 0xffffffe9, where the LR indicates return to thread mode using main stack (and FPU has been used for some reason). But why is PC 0? That should not be the case and indicates that a NULL pointer has been executed. Could it be that you have a bug in&amp;nbsp;ble_stack_init() where that could happen? I suggest you debug there to pinpoint exactly where the issue is. Which function call do you do when you get the hardfault etc? Also, a look at the other CPU registers could be useful (get those for instance with &amp;quot;nrfjprog --readregs&amp;quot;).&amp;nbsp;&lt;/p&gt;
&lt;p&gt;So there may be another issue here. Please keep this change, though, as&amp;nbsp;running&amp;nbsp;nrf_dfu_mbr_init_sd() () is required in this case, as it runs the SoftDevice reset function that clears a magic word indicating that the SoftDevice has been initialized. Without it,&amp;nbsp;you will see&amp;nbsp;NRF_ERROR_INVALID_STATE returned from&amp;nbsp;sd_softdevice_enable(). That said, you should use&amp;nbsp;nrf_dfu_mbr_vector_table_set() and not&amp;nbsp;nrf_dfu_mbr_irq_forward_address_set(), so please adjust this and let me know what you see then.&lt;/p&gt;
&lt;p&gt;Do you still get this with the above suggested change? Is the only change in your application that it is located at a different address, and does the exact same application built to start immediately after the SoftDevice work as expected?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to change the mbr jump address location</title><link>https://devzone.nordicsemi.com/thread/354917?ContentTypeID=1</link><pubDate>Fri, 25 Feb 2022 05:56:09 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:24fe0e75-5e3b-4124-8105-2d97dd587db0</guid><dc:creator>R_S</dc:creator><description>&lt;p&gt;Hi&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I did the same way what you mentioned in your initial comment.&lt;/p&gt;
&lt;p&gt;nrf_dfu_mbr_init_sd(); and&amp;nbsp;nrf_dfu_mbr_irq_forward_address_set();&lt;/p&gt;
&lt;p&gt;and after that jump to the address where my application is there but still same issue i am facing&lt;/p&gt;
&lt;p&gt;again it get stuck in that ble_stack_init() function,&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Regards&lt;/p&gt;
&lt;p&gt;R_S&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to change the mbr jump address location</title><link>https://devzone.nordicsemi.com/thread/354727?ContentTypeID=1</link><pubDate>Thu, 24 Feb 2022 07:54:30 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9eadab0f-c885-4f4e-b5ac-2d60647c1b2f</guid><dc:creator>Einar Thorsrud</dc:creator><description>[quote user="R_S"]&lt;p&gt;&amp;quot;&lt;span&gt;nrf_dfu_mbr_irq_forward_address_set()&amp;quot; i already used in my bootloader code example to jump on application having different&amp;nbsp;address. But in this case i am not using any bootloader and i want directly jump to the application code (0xE8000 location) after softdevice. So for that whrere i need to use this function (&amp;quot;nrf_dfu_mbr_irq_forward_address_set()&amp;quot;).&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;because i have only hex file of softdevice code&amp;nbsp;so, that&amp;nbsp;part anyway i cannot edit.&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;[/quote]
&lt;p&gt;The boot sequence when using MBR and SoftDevice is in essense like this:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;MBR runs first (this is located at page 0, and is part of the SoftDevice hex).
&lt;ul&gt;
&lt;li&gt;MBR checks if a (bootloader) address is present in either a specific register in UICR (0x10001014) or in the end of the MBR params page (0x00000FF8).&amp;nbsp;&lt;/li&gt;
&lt;li&gt;If either of of these registers has a valid address (are not 0xFFFFFFFF), the MBR will jump there. If not, it will just jump to the bootloader at 0x1000.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;SoftDevice runs and passes execution the the application, which follows immediately after the SoftDevice.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;So the only way you can boot another location than what is immediately after the SoftDevice is to use the bootloader support in the MBR. However, that does not need to actually be a bootloader. It could also be your application. This would prevent you from using a bootloader though, as the MBR features needed for some types of updates (like bootloader or SoftDevice updates) would not work in this scenario. So If you ever want to add DFU/bootloader support, then you need to do as I described in my initial post.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
[quote user="R_S"]I am using bootloader code where i from softdevice code jump to the bootloader code and then in bootloader i am using&amp;nbsp;&lt;span&gt;nrf_dfu_mbr_irq_forward_address_set() and&amp;nbsp;nrf_bootloader_app_start_final() function to jump on the application code. control goes to the 0xE8000 address but it got stuck inside &amp;quot;ble_stack_init()&amp;quot; function and it through an exception error.&lt;/span&gt;[/quote]
&lt;p&gt;Yes, that is expected. That is because you are using&amp;nbsp;an approach that does not work. You need to use the approach demonstrated by the&amp;nbsp;bootloader&amp;nbsp;in SDK 14.2, as explained in more detail in my previous reply.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to change the mbr jump address location</title><link>https://devzone.nordicsemi.com/thread/354714?ContentTypeID=1</link><pubDate>Thu, 24 Feb 2022 04:54:59 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4dd0d02d-3bbd-4324-b830-47d566ef570d</guid><dc:creator>R_S</dc:creator><description>&lt;p&gt;Hi Einar,&lt;/p&gt;
&lt;p&gt;&amp;quot;&lt;span&gt;nrf_dfu_mbr_irq_forward_address_set()&amp;quot; i already used in my bootloader code example to jump on application having different&amp;nbsp;address. But in this case i am not using any bootloader and i want directly jump to the application code (0xE8000 location) after softdevice. So for that whrere i need to use this function (&amp;quot;nrf_dfu_mbr_irq_forward_address_set()&amp;quot;).&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;because i have only hex file of softdevice code&amp;nbsp;so, that&amp;nbsp;part anyway i cannot edit.&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;2nd case:&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;I am using bootloader code where i from softdevice code jump to the bootloader code and then in bootloader i am using&amp;nbsp;&lt;span&gt;nrf_dfu_mbr_irq_forward_address_set() and&amp;nbsp;nrf_bootloader_app_start_final() function to jump on the application code. control goes to the 0xE8000 address but it got stuck inside &amp;quot;ble_stack_init()&amp;quot; function and it through an exception error.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;span&gt;&lt;img src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/pastedimage1645678486165v1.png" alt=" " /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;span&gt;Regards&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;span&gt;R_S&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to change the mbr jump address location</title><link>https://devzone.nordicsemi.com/thread/354587?ContentTypeID=1</link><pubDate>Wed, 23 Feb 2022 13:19:48 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:bb2bf8a3-3093-44d8-9b91-22dadf0c6de7</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;How do you try to jump to&amp;nbsp;0xE8000?&lt;/p&gt;
&lt;p&gt;Without knowing more I suggest you refer to the bootloader in nRF5 SDK 14.2.0 (more recent SDK versions use a different approach). You can&amp;nbsp;refer to the implementation of &amp;lt;nRF5 SDK 14.2&amp;gt;\components\libraries\bootloader\nrf_bootloader_app_start.c you can see that nrf_bootloader_app_start() here takes any application start address and the way it configures the MBR and SoftDevice is different from more recent SoftDevices. You should use this approach, which can also be used with later SDK versions.&lt;/p&gt;
&lt;p&gt;To be more specific, In SDK &amp;gt;= 15.0.0, the boot process consists of forwarding interrupts to the SoftDevice using SD_MBR_COMMAND_IRQ_FORWARD_ADDRESS_SET (nrf_dfu_mbr_irq_forward_address_set()), and then always jumping to address 0x1000 (SoftDevice start) instead of the application start address. The old approach is to use the SD_MBR_COMMAND_INIT_SD and SD_MBR_COMMAND_VECTOR_TABLE_BASE_SET command, and start the application at a specific address. This is what you should use when the application is not always immediately after the SoftDevice.&lt;/p&gt;
&lt;p&gt;You can compare components\libraries\bootloader\nrf_bootloader_app_start.c in SDK 14.2 and a newer SDK to see both approaches.&lt;/p&gt;
&lt;p&gt;Einar&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>