<?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>Remove bootloader</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/99072/remove-bootloader</link><description>We have a project that was transitioned to use DFU and the secure bootloader. Prior to the transition, I would flash the softdevice and then be able to flash my app and debug it via GDB and openOCD. Since updating to the DFU the process has become cumbersome</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 27 Apr 2023 08:10:34 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/99072/remove-bootloader" /><item><title>RE: Remove bootloader</title><link>https://devzone.nordicsemi.com/thread/422657?ContentTypeID=1</link><pubDate>Thu, 27 Apr 2023 08:10:34 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9db49006-65a0-49fe-a8c1-ea4123763317</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;I am no GDB expert, but GDB should not&amp;nbsp;erease the flash (without being told to). Note that debugging with a SoftDevice is special, as it will often&amp;nbsp;assert if you step or&amp;nbsp;continue from a breakpoint (because the RTC keeps running while the CPU is halted, and when you then continue, the SoftDvice will detect that it missed an event and assert). So while that will not give an&amp;nbsp;INVALID MEMORY ACCESS, it could make this issue irelevant if you only see it when continuing form a breakpoint or pause, as that is anyway not a sensible way to debug applications using the SoftDevice.&lt;/p&gt;
&lt;p&gt;PS: If you switch to openOCD, note that in the same way as GDB, it will assume that execution starts at the start address of the binary (elf file) you are debugging. But execution needs to start at address 0, so either make sure to configure that, or attach to a running target, so that the debugger does not affect the startup.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Remove bootloader</title><link>https://devzone.nordicsemi.com/thread/422603?ContentTypeID=1</link><pubDate>Wed, 26 Apr 2023 22:52:26 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:077d13ff-1364-42b2-b309-5eedb2350f13</guid><dc:creator>rhaley-starfish</dc:creator><description>&lt;p&gt;-Og -g3. I tried removing those flags as well but it didn&amp;#39;t help. When I flash the firmware and run it without a debugger, I get to a different spot in execution before it stops working, but I don&amp;#39;t see the INVALID MEMORY ACCESS. That only happens when it&amp;#39;s on the GDB debugger. GDB says it&amp;#39;s erasing the flash. I wonder if it&amp;#39;s mucking with things. I&amp;#39;ll try with openOCD I guess? This is very frustrating.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Remove bootloader</title><link>https://devzone.nordicsemi.com/thread/422429?ContentTypeID=1</link><pubDate>Wed, 26 Apr 2023 07:16:25 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5aa2e548-bd96-41ca-8328-6b08e93f4b79</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;Buttonless DFU will not work in this case obviously, but it should be OK to call&amp;nbsp;ble_dfu_buttonless_init(), and you can verify this by testing the buttonless DFU sample&amp;nbsp;application without a bootloader form SDK 17.1.0. The only thing you need to&amp;nbsp;comment&amp;nbsp;out to get the example to run&amp;nbsp;without a bootloader (assuming you don&amp;#39;t try to do buttonless DFU) is line 854-855:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;    // Initialize the async SVCI interface to bootloader before any interrupts are enabled.
    err_code = ble_dfu_buttonless_async_svci_init();
    APP_ERROR_CHECK(err_code);&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;What other changes did you do to your application when you are getting the invalid memory access error from the SoftDevice? Generally, this an error you get if you try to access memory or HW resources that is &lt;a href="https://infocenter.nordicsemi.com/topic/sds_s140/SDS/s1xx/sd_resource_reqs/hw_block_interrupt_vector.html"&gt;&amp;quot;owned&amp;quot; by the SoftDevice&lt;/a&gt;.&lt;/p&gt;
[quote user="rhaley-starfish"]I commented out that function and now I get a INVALID MEMORY ACCESS error when calling NRF_LOG_DEBUG, (even though there have been several previous NRF_LOG_INFO messages?)[/quote]
&lt;p&gt;It seems odd that you should get this when logging. Are you by any chance debugging with optimization enabled, and perhaps that makes it look like this is the case while it is not (with optimized code the machine code will not match the C code directly which can make it confusing).&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Remove bootloader</title><link>https://devzone.nordicsemi.com/thread/422360?ContentTypeID=1</link><pubDate>Tue, 25 Apr 2023 17:21:39 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:de03fb34-e414-457f-ad17-19f01557a620</guid><dc:creator>rhaley-starfish</dc:creator><description>&lt;p&gt;Hello, and thank you for the great answer.&amp;nbsp; I found that we were calling ble_dfu_buttoneless_init() which was causing the error. However, once I removed that call I am getting&amp;nbsp;SOFTDEVICE: INVALID MEMORY ACCESS any time I access stack based variables, notably structs that were initialized using&amp;nbsp;NRF_SDH_BLE_OBSERVER. For instance I pass the struct into a function as a pointer (which is tested for NULL) and the*second* line causes INVALID MEMORY ACCESS:&lt;br /&gt;&lt;br /&gt; p_sconf-&amp;gt;evt_handler = on_ow_sensor_conf_evt;&lt;br /&gt; p_sconf-&amp;gt;conn_handle = BLE_CONN_HANDLE_INVALID; //0xFF&lt;br /&gt;&lt;br /&gt;I commented out that function and now I get a INVALID MEMORY ACCESS error when calling NRF_LOG_DEBUG, (even though there have been several previous NRF_LOG_INFO messages?)&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Remove bootloader</title><link>https://devzone.nordicsemi.com/thread/422186?ContentTypeID=1</link><pubDate>Tue, 25 Apr 2023 07:17:03 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:bf1152f1-2da7-45b4-82f1-6332341f5432</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;Which function returned the error code that is checked at 1817 in your main.c?&lt;/p&gt;
&lt;p&gt;Generally, there are few dependencies between the application and a bootloader, so in most cases you can simply remove the bootloader and it will be OK with regards to the application. A important exception is if you use buttonless DFU, where you will get&amp;nbsp;NRF_ERROR_NO_MEM returned from&amp;nbsp;nrf_dfu_svci_vector_table_set(). So to test your application without a bootloader you will need to avoid calling that function.&lt;/p&gt;
&lt;p&gt;PS: What normally complicates debugging an application while having the bootloader is that the bootloader will not start the application if there is a CRC mismatch. So other than generating and flashing a new bootloader settings every time, you could also use a debug version of the bootloader where you for instance modify&amp;nbsp;app_is_valid() in&amp;nbsp;components/libraries/bootloader/nrf_bootloader.c to always return true to always consider the application as valid.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>