<?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>Implementing custom BLE transfer process in bootloader?</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/111298/implementing-custom-ble-transfer-process-in-bootloader</link><description>I&amp;#39;m working on a complex legacy codebase for the nRF52840, which uses nRF5 SDK 15.0.0 and the S140 SoftDevice v6.0.0. The device previously only used a custom RF protocol both in the bootloader and in the main application, but I need to add BLE support</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Mon, 22 Jul 2024 18:23:35 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/111298/implementing-custom-ble-transfer-process-in-bootloader" /><item><title>RE: Implementing custom BLE transfer process in bootloader?</title><link>https://devzone.nordicsemi.com/thread/495096?ContentTypeID=1</link><pubDate>Mon, 22 Jul 2024 18:23:35 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0234552f-65ef-4df9-9026-d9cb962413a0</guid><dc:creator>rbmarcus</dc:creator><description>&lt;p&gt;Hello again Vidar. I just wanted to follow up on the code that allowed me to use custom BLE services in my bootloader. Modifying the stack initialization function to call these functions solved the problem:&lt;br /&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;static void ble_stack_init(void) {
    uint32_t ram_start = 0;
    NRF_SDH_BLE_OBSERVER(m_ble_evt_observer, BLE_OBSERVER_PRIO, ble_evt_handler, NULL);

    nrf_dfu_mbr_init_sd();
    sd_softdevice_vector_table_base_set(BOOTLOADER_START_ADDR);
    nrf_sdh_enable_request();
    nrf_sdh_ble_app_ram_start_get(&amp;amp;ram_start);
    nrf_sdh_ble_default_cfg_set(APP_BLE_CONN_CFG_TAG, &amp;amp;ram_start);
    nrf_sdh_ble_enable(&amp;amp;ram_start);
}&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;One small edge case: I needed to include various nrf_bootloader*.c sources in my Makefile. Omitting them did not result in compiler or linker errors, but prevented the bootloader from being recognized. With my code changes, I am able to initialize the BLE stack, advertise, and connect without requiring a call to nrf_bootloader_init().&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Implementing custom BLE transfer process in bootloader?</title><link>https://devzone.nordicsemi.com/thread/490270?ContentTypeID=1</link><pubDate>Mon, 24 Jun 2024 12:10:55 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:445cfa9f-4a14-4067-a00b-dbbdb5ac0563</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;Good to hear that you were able to make the NUS service work in the bootloader. You can probably remove the nrf_dfu.c file from your bootloader project, then declare your own&amp;nbsp;nrf_dfu_init() function to initialize your custom DFU handling.&amp;nbsp;&lt;span&gt;nrf_dfu_init() is called&amp;nbsp;from&amp;nbsp;nrf_bootloader_init() when entering DFU mode. The WDT module is initialized before&amp;nbsp;nrf_dfu_init().&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Implementing custom BLE transfer process in bootloader?</title><link>https://devzone.nordicsemi.com/thread/490090?ContentTypeID=1</link><pubDate>Sat, 22 Jun 2024 18:34:31 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:434c697a-3944-4677-9384-0caac4386e32</guid><dc:creator>rbmarcus</dc:creator><description>&lt;p&gt;Thank you for your response Vidar. I managed to shoehorn a functional prototype of the custom bootloader BLE process outlined in my OP by copying the BLE library code from my main app. Among other required changes, this required me to comment out the DFU_TRANSPORT_REGISTER definition from &lt;code&gt;nrf_dfu_ble.c&lt;/code&gt; and any references to the nRF driver watchdog from my original custom bootloader code. It looks like BLE setup in the bootloader will route to other Nordic libraries? To be clear, I don&amp;#39;t want to use the existing Nordic infrastructure for DFU, but rather for my custom service to be the only custom service available. I would also like to keep the original code and watchdog timer usage intact. Is this still possible to accomplish?&lt;/p&gt;
&lt;p&gt;On the bright side, I did still get a functional and connectable bootloader build with NUS included and plenty of flash overhead remaining.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Implementing custom BLE transfer process in bootloader?</title><link>https://devzone.nordicsemi.com/thread/485117?ContentTypeID=1</link><pubDate>Tue, 21 May 2024 12:37:13 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5517b072-33e1-429f-ab43-f545339ffa83</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;When modifying the bootloader, it is important to note that you cannot do OTA DFU to a bootloader with a different start address. Therefore, I would recommend you assess how much free space you have to work with before spending too much effort on the implementation. It may be that it is not possible to add the BLE DFU transport without allocating more flash to the bootloader, which means you cannot update the bootloader on existing devices.&lt;/p&gt;
&lt;p&gt;Typical memory layout with bootlaoder:&amp;nbsp;&lt;a title="Memory layout" href="https://infocenter.nordicsemi.com/topic/sdk_nrf5_v17.1.0/lib_bootloader.html?cp=9_1_3_5_0_7#lib_bootloader_memory"&gt;Memory layout&lt;/a&gt;.&lt;/p&gt;
[quote user=""]Implementing a custom BLE service in the bootloader should be able to circumvent most of these issues, but is it possible to do this?[/quote]
&lt;p&gt;I don&amp;#39;t see any problems with adding additional services, provided you have enough flash for these extra features.&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Vidar&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>