<?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>ncs 2.1.0: BLE Stacks Overrun when code built for debug with CONFIG_NO_OPTIMIZATIONS=y</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/93691/ncs-2-1-0-ble-stacks-overrun-when-code-built-for-debug-with-config_no_optimizations-y</link><description>When building my BLE application for debug, the BLE stacks overflow and crash the firmware. Note that this happens every release of ncs. Would be great to have the stacks setup properly when full debug is built. Or AT LEAST make all the stacks configurable</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 21 Feb 2023 08:02:39 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/93691/ncs-2-1-0-ble-stacks-overrun-when-code-built-for-debug-with-config_no_optimizations-y" /><item><title>RE: ncs 2.1.0: BLE Stacks Overrun when code built for debug with CONFIG_NO_OPTIMIZATIONS=y</title><link>https://devzone.nordicsemi.com/thread/411016?ContentTypeID=1</link><pubDate>Tue, 21 Feb 2023 08:02:39 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8fc04d72-b7fa-4ccb-acb6-9933b98a22c1</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;Please add this to the github issue here:&amp;nbsp;&lt;a href="https://github.com/zephyrproject-rtos/zephyr/issues/52105"&gt;https://github.com/zephyrproject-rtos/zephyr/issues/52105&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: ncs 2.1.0: BLE Stacks Overrun when code built for debug with CONFIG_NO_OPTIMIZATIONS=y</title><link>https://devzone.nordicsemi.com/thread/410970?ContentTypeID=1</link><pubDate>Mon, 20 Feb 2023 20:03:47 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:eb9a0a69-e696-4f58-b9ac-0d2580243e54</guid><dc:creator>denis</dc:creator><description>&lt;p&gt;Another stack that isn&amp;#39;t configurable and is overrun with no optimizations:&lt;/p&gt;
&lt;div&gt;
&lt;div&gt;&lt;span&gt;In&amp;nbsp;zephyr/drivers/bluetooth/hci/spi.c:&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;static&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;K_KERNEL_STACK_DEFINE&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt;spi_rx_stack&lt;/span&gt;&lt;span&gt;, &lt;/span&gt;&lt;span&gt;512&lt;/span&gt;&lt;span&gt;);&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;/div&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: ncs 2.1.0: BLE Stacks Overrun when code built for debug with CONFIG_NO_OPTIMIZATIONS=y</title><link>https://devzone.nordicsemi.com/thread/396088?ContentTypeID=1</link><pubDate>Wed, 16 Nov 2022 20:09:59 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:645abdb2-2b5c-4b10-9ef1-a17f782145a5</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;I could only find one symbol which selects CONFIG_BT_LONG_WQ when I searched through the SDK and that&amp;#39;s the BT_TINYCRYPT_ECC symbol in the zephyr tree.&lt;/p&gt;
&lt;p&gt;So, as far as I can tell, CONFIG_BT_LONG_WQ should not become set if you add the following settings to your debug configuration:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;CONFIG_BT_GATT_CACHING=n
CONFIG_BT_TINYCRYPT_ECC=n
CONFIG_BT_CTLR_ECDH=n&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;If it still gets enabled, please look for warnings in the build log to see if any of the symbols above end up getting overridden.&lt;/p&gt;
&lt;p&gt;For anyone else who may be reading this: LE secure connection pairing will not be available with this configuration, so it should not be used in production FW where BT pairing is required.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: ncs 2.1.0: BLE Stacks Overrun when code built for debug with CONFIG_NO_OPTIMIZATIONS=y</title><link>https://devzone.nordicsemi.com/thread/396073?ContentTypeID=1</link><pubDate>Wed, 16 Nov 2022 18:20:00 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:cf7e1c83-dbc8-4d2e-bded-37c9bf4251fe</guid><dc:creator>denis</dc:creator><description>&lt;div&gt;
&lt;div&gt;&lt;span&gt;I can&amp;nbsp;CONFIG_BT_CTLR_ECDH=n so that ncs doesn&amp;#39;t create the&amp;nbsp;BT_CTLR_ECDH thread. &amp;nbsp;So that works around it for now.&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;I tried a few config changes so that the BT long work queue isn&amp;#39;t created, but kept finding&amp;nbsp;other options that enable it. &amp;nbsp;Do you know of some set of config settings that can be used to disable the BT long work queue to work around the hard fault that occurs in it when using&amp;nbsp;CONFIG_NO_OPTIMIZATIONS=y?&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;# in ncs&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;# CONFIG_BT_CTLR_ECDH_STACK_SIZE=4096 # Can&amp;#39;t be set...&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;# this should disable the thread above, so don&amp;#39;t need to deal with it:&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;CONFIG_BT_CTLR_ECDH&lt;/span&gt;&lt;span&gt;=n&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;#&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;# in Zephyr&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;#CONFIG_BT_LONG_WQ_STACK_SIZE=4096 # Can&amp;#39;t be set...&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;# and the stack is too small when using CONFIG_NO_OPTIMIZATIONS=y leading to a fault...&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: ncs 2.1.0: BLE Stacks Overrun when code built for debug with CONFIG_NO_OPTIMIZATIONS=y</title><link>https://devzone.nordicsemi.com/thread/396069?ContentTypeID=1</link><pubDate>Wed, 16 Nov 2022 17:28:39 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e4c2a4ae-2184-4c9b-933a-ca36c50ad707</guid><dc:creator>denis</dc:creator><description>&lt;p&gt;I am able to set&amp;nbsp;CONFIG_BT_CTLR_SDC_RX_STACK_SIZE.&lt;/p&gt;
&lt;p&gt;In ncs I can&amp;#39;t set&amp;nbsp;CONFIG_BT_CTLR_ECDH_STACK_SIZE.&lt;/p&gt;
&lt;p&gt;In Zephyr I can&amp;#39;t set CONFIG_BT_LONG_WQ_STACK_SIZE.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: ncs 2.1.0: BLE Stacks Overrun when code built for debug with CONFIG_NO_OPTIMIZATIONS=y</title><link>https://devzone.nordicsemi.com/thread/395650?ContentTypeID=1</link><pubDate>Mon, 14 Nov 2022 21:12:28 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4847806f-1e7b-49a7-b436-e768c4365d8e</guid><dc:creator>denis</dc:creator><description>&lt;p&gt;I have not tried the SDK samples with&amp;nbsp;CONFIG_NO_OPTIMIZATIONS=y. &amp;nbsp;Is that part of the normal QA process at Nordic?&lt;/p&gt;
&lt;p&gt;I have had the stack overflows with 3 different customers projects recently. &amp;nbsp;So pretty common for me and easy to reproduce with real projects.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: ncs 2.1.0: BLE Stacks Overrun when code built for debug with CONFIG_NO_OPTIMIZATIONS=y</title><link>https://devzone.nordicsemi.com/thread/394882?ContentTypeID=1</link><pubDate>Wed, 09 Nov 2022 10:43:21 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:45e9a201-9e9c-4409-ad1d-d569104d0043</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;Have you seen this problem with any of the SDK samples, or is it only with your application, and is it easy for you to reproduce? I use these debug symbols regularly when I debug our sample projects, but I have never encountered stack overflows in those internal threads with the non-configurable stack sizes.&lt;/p&gt;
&lt;p&gt;What was the error you got when you tried to change the BT_CTLR_SDC_RX_STACK_SIZE symbol? This symbol is defined with a prompt and is meant to be configurable: &lt;a href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/2.1.2/zephyr/build/kconfig/setting.html#visible-and-invisible-kconfig-symbols"&gt;https://developer.nordicsemi.com/nRF_Connect_SDK/doc/2.1.2/zephyr/build/kconfig/setting.html#visible-and-invisible-kconfig-symbols&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Vidar&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Update: &lt;/strong&gt;I made a feature request: &lt;a id="" href="https://github.com/zephyrproject-rtos/zephyr/issues/52105"&gt;https://github.com/zephyrproject-rtos/zephyr/issues/52105&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>