<?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>Custom bootloader with softdevice with jump to a specific address of app</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/112868/custom-bootloader-with-softdevice-with-jump-to-a-specific-address-of-app</link><description>Hi! 
 
 I try to explain quickly my setup that is working, I am on nrf52805 and I have SD112 ( 7.2.0 ) onboard. I am ok with placing bootloader at specific address using linker file, working correctly and also jump to the app is working correctly. My</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Mon, 15 Jul 2024 13:55:29 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/112868/custom-bootloader-with-softdevice-with-jump-to-a-specific-address-of-app" /><item><title>RE: Custom bootloader with softdevice with jump to a specific address of app</title><link>https://devzone.nordicsemi.com/thread/493937?ContentTypeID=1</link><pubDate>Mon, 15 Jul 2024 13:55:29 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d992e793-f30e-44ad-9df5-7e39d4acd8a8</guid><dc:creator>marklander</dc:creator><description>&lt;p&gt;Got it working! Thanks for your support!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Custom bootloader with softdevice with jump to a specific address of app</title><link>https://devzone.nordicsemi.com/thread/493923?ContentTypeID=1</link><pubDate>Mon, 15 Jul 2024 13:29:31 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7f8819d2-5e52-4fa8-9431-1a2932e1883c</guid><dc:creator>Vidar Berg</dc:creator><description>[quote user="marklander"]SD_MBR_COMMAND_IRQ_FORWARD_ADDRESS_SET and then jump always to 0x1000[/quote]
&lt;p&gt;This approach only works when the application starts at the default address (default start address is hardcoded within the Sotdevice).&amp;nbsp;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;The&amp;nbsp;&lt;span&gt;SD_MBR_COMMAND_INIT_SD is needed to initialize the Softdevice and make the MBR start forwarding interrupts to it.&amp;nbsp; After the Softdevice has been invoked with this command, the bootloader can instruct the Softdevice to relay application interrupts to the application&amp;#39;s vector table&amp;nbsp;with the&amp;nbsp;sd_softdevice_vector_table_base_set() function. The bootloader must then branch directly to your application&amp;#39;s reset handler.&amp;nbsp;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Custom bootloader with softdevice with jump to a specific address of app</title><link>https://devzone.nordicsemi.com/thread/493588?ContentTypeID=1</link><pubDate>Fri, 12 Jul 2024 08:49:19 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b0060f7e-664b-4fb9-a52f-c35984efa14b</guid><dc:creator>marklander</dc:creator><description>[quote userid="4240" url="~/f/nordic-q-a/112868/custom-bootloader-with-softdevice-with-jump-to-a-specific-address-of-app/493578"]It looks like everything is working correctly up until the point where you try to make the &amp;quot;jump&amp;quot; to the application. Are you able to step through the app&amp;#39;s start function with a debugger to see what happens?[/quote]
&lt;p&gt;Will try and see if I can use debug with Rust, for the jump i am using this &lt;a href="https://github.com/embassy-rs/embassy/blob/ed3da1721a4f704d3f2a8a1cf84d9fc051c71945/embassy-boot-nrf/src/lib.rs#L60"&gt;implementation&amp;nbsp;&lt;/a&gt;&amp;nbsp;let me know if it seems correct...&lt;/p&gt;
[quote userid="4240" url="~/f/nordic-q-a/112868/custom-bootloader-with-softdevice-with-jump-to-a-specific-address-of-app/493578"]Another thing you can try is to call &amp;#39;nrfjprog --readregs&amp;#39; after the jump to the main app to read out the core registers. This may provide us with some clues as to what the problem is.[/quote]
&lt;p&gt;Will try tonite at home&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Anyway looking to different posts like this i am bit confused if i need also to call the isr forward of mbr command like I see in this &lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/33610/can-t-jump-to-a-custom-app-location-using-nrf_bootloader_app_start-with-sdk-v15/130732"&gt;post&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;And also this &lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/66938/bootloader-with-2-or-3-applications/274379#274379"&gt;post&lt;/a&gt;&amp;nbsp;seems indicating that both approach can be used:&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; SD_MBR_COMMAND_INIT_SD&lt;/span&gt;&lt;span&gt;&amp;nbsp;and then&amp;nbsp;sd_softdevice_vector_table_base_set&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; or&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;SD_MBR_COMMAND_IRQ_FORWARD_ADDRESS_SET and then jump always to 0x1000&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;Anyway thanks for support, i will continue my investigation...&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Custom bootloader with softdevice with jump to a specific address of app</title><link>https://devzone.nordicsemi.com/thread/493578?ContentTypeID=1</link><pubDate>Fri, 12 Jul 2024 08:07:28 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:35a304b1-05e5-4e6c-b083-adc24c07ef4b</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;It looks like everything is working correctly up until the point where you try to make the &amp;quot;jump&amp;quot; to the application. Are you able to step through the app&amp;#39;s start function with a debugger to see what happens?&lt;/p&gt;
&lt;p&gt;Another thing you can try is to call &amp;#39;nrfjprog --readregs&amp;#39; after the jump to the main app to read out the core registers. This may provide us with some clues as to what the problem is.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Custom bootloader with softdevice with jump to a specific address of app</title><link>https://devzone.nordicsemi.com/thread/493530?ContentTypeID=1</link><pubDate>Thu, 11 Jul 2024 21:49:00 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:59a82392-1341-4754-91ec-393676809660</guid><dc:creator>marklander</dc:creator><description>[quote userid="4240" url="~/f/nordic-q-a/112868/custom-bootloader-with-softdevice-with-jump-to-a-specific-address-of-app/493237"]Issue the&amp;nbsp;SD_MBR_COMMAND_INIT_SD command through the&amp;nbsp;sd_mbr_command() API. This will cause the reset handler of the Softdevice to be executed.[/quote]
&lt;p&gt;Hi&amp;nbsp;&lt;a href="https://devzone.nordicsemi.com/members/vibe"&gt;Vidar Berg&lt;/a&gt;&amp;nbsp;,&lt;/p&gt;
&lt;p&gt;probably i am missing something...&lt;/p&gt;
&lt;p&gt;I tried your sequence and I still cannot see app starting...what i see is:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;span&gt;SD_MBR_COMMAND_INIT_SD&lt;/span&gt; return 0 - so seems executed correctly ( maybe I did not specify that i don&amp;#39;t us sd in bootloader, but I don&amp;#39;t think I need to enable it )&lt;/li&gt;
&lt;li&gt;Disabled all interrupts.&lt;/li&gt;
&lt;li&gt;&lt;span&gt;sd_softdevice_vector_table_base_set&lt;/span&gt; also returns 0 so seems correct...&lt;/li&gt;
&lt;li&gt;&lt;span&gt;At the end i tried to jump to main app start address and also to 0x1000 but nothing seems happening...&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;span&gt;Any advice on the sequence i made?&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Custom bootloader with softdevice with jump to a specific address of app</title><link>https://devzone.nordicsemi.com/thread/493243?ContentTypeID=1</link><pubDate>Wed, 10 Jul 2024 19:53:58 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3a0ee27d-e124-40cd-b271-c29350cd0a87</guid><dc:creator>marklander</dc:creator><description>&lt;p&gt;Ups! I got now that I am confusing sd_mbr_command_vector_table_base_set_t with &lt;span&gt;sd_softdevice_vector_table_base_set&lt;/span&gt;!&lt;/p&gt;
&lt;p&gt;So &lt;span&gt;sd_softdevice_vector_table_base_set&lt;/span&gt; will take the starting address of application with offset...and then I have to jump there&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Custom bootloader with softdevice with jump to a specific address of app</title><link>https://devzone.nordicsemi.com/thread/493241?ContentTypeID=1</link><pubDate>Wed, 10 Jul 2024 19:08:52 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d6ba0bb9-3817-48b2-85f6-a48613ab8d81</guid><dc:creator>marklander</dc:creator><description>&lt;p&gt;Thanks! I will try the exact sequnce you are suggesting.&lt;/p&gt;
&lt;p&gt;One thing i forgot...i am on rust. But i have all bindings to nrf mbr so i can emulate all the sequence.&lt;/p&gt;
&lt;p&gt;Two questions:&lt;/p&gt;
&lt;p&gt;What does the sofdevice &lt;span&gt;SD_MBR_COMMAND_INIT_SD&lt;/span&gt; do exactly?&lt;/p&gt;
&lt;p&gt;I have used sd_softdevice_vector_table_base_se&lt;span&gt;t function and seems that calling this a reset is issued immedeately ( while irq fuction does not reset ) am i right?&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;And do i need to reserve a flash page for settings for that command?&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Custom bootloader with softdevice with jump to a specific address of app</title><link>https://devzone.nordicsemi.com/thread/493237?ContentTypeID=1</link><pubDate>Wed, 10 Jul 2024 17:45:06 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:cf11608d-8cac-4260-8396-ac0d2cfbbdc1</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;Yes, this is possible. However, rather than using&amp;nbsp;&lt;span&gt;SD_MBR_COMMAND_IRQ_FORWARD_ADDRESS_SET, you can use the&amp;nbsp;SD_MBR_COMMAND_INIT_SD command. This will allow you to use the sd_softdevice_vector_table_base_set() function in your bootlaoder&amp;nbsp;and change to a non-default interrupt forwarding address for the Softdevice. The application start sequence in the bootloader should be something like this:&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;1. Issue the&amp;nbsp;SD_MBR_COMMAND_INIT_SD command through the&amp;nbsp;sd_mbr_command() API. This will cause the reset handler of the Softdevice to be executed.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;3. Disable interrupts globally&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;2. Now with the SD initialized, you can use&amp;nbsp;sd_softdevice_vector_table_base_set() to set the Softdevice vector forwarding address to your application&amp;#39;s vector table address.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;3. Forward execution to main application.&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Best regards,&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Vidar&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>