<?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>Unable to debug due to flashregion locked on Thingy91</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/106359/unable-to-debug-due-to-flashregion-locked-on-thingy91</link><description>Hello, 
 i am trying to build an application that scans networks and test which networks are accessible from which sim cards, and posting the results through https and runs on the Thingy91. 
 I am using sdk 2.5.0, modem version is 1.3.5 and i am debugging</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 06 Dec 2023 13:35:35 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/106359/unable-to-debug-due-to-flashregion-locked-on-thingy91" /><item><title>RE: Unable to debug due to flashregion locked on Thingy91</title><link>https://devzone.nordicsemi.com/thread/459195?ContentTypeID=1</link><pubDate>Wed, 06 Dec 2023 13:35:35 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:39d8454d-4f40-442b-81d7-661f29ee4fb9</guid><dc:creator>marco.peli</dc:creator><description>&lt;p&gt;Hi Hakon,&lt;/p&gt;
&lt;p&gt;ok thank you!&lt;/p&gt;
&lt;p&gt;I will buy a nrf9160dk and debug on it ;)&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Thank you!&lt;/p&gt;
&lt;p&gt;Best regards&lt;/p&gt;
&lt;p&gt;Marco Peli&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Unable to debug due to flashregion locked on Thingy91</title><link>https://devzone.nordicsemi.com/thread/459193?ContentTypeID=1</link><pubDate>Wed, 06 Dec 2023 13:33:23 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ad31d5b2-8000-4e41-bf9a-7f5776b93157</guid><dc:creator>H&amp;#229;kon Alseth</dc:creator><description>&lt;p&gt;Hi Marco,&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I would strongly recommend using the nRF9160-DK for development purposes.&lt;/p&gt;
[quote user="marco.peli"]The fact is that i cannot build my real application using the secure board because i get the error that pm_config.h, which file nrf_modem_os imports, cannot be found (and i need the modem library for my project)[/quote]
&lt;p&gt;Sorry for misunderstand the context, I thought you were debugging the secure image, but you configure the board itself as &amp;quot;thingy91_nrf9160&amp;quot; - ie. the secure board.&lt;/p&gt;
&lt;p&gt;This will not work when trying to communicate with the modem, as there is a hardware restriction in nRF9160 that enforces all communication with the modem to be in non-secure mode.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Kind regards,&lt;/p&gt;
&lt;p&gt;Håkon&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Unable to debug due to flashregion locked on Thingy91</title><link>https://devzone.nordicsemi.com/thread/459140?ContentTypeID=1</link><pubDate>Wed, 06 Dec 2023 10:49:49 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b8f09b5d-b12c-4fdb-b4ce-d42a47a507aa</guid><dc:creator>marco.peli</dc:creator><description>&lt;p&gt;Hi Hakon,&lt;/p&gt;
&lt;p&gt;here&amp;#39;s the output:&amp;nbsp;&lt;a href="https://pastebin.com/wVMuNyAJ"&gt;debug secure with -0g - Pastebin.com&lt;/a&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Do you suggest to debug the application on the nrf9160dk? I don&amp;#39;t have so much time thus if debugging the application on that board solves my issues i can go for that.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Thank you!&lt;/p&gt;
&lt;p&gt;Best Ragards&lt;/p&gt;
&lt;p&gt;Marco Peli&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Unable to debug due to flashregion locked on Thingy91</title><link>https://devzone.nordicsemi.com/thread/459126?ContentTypeID=1</link><pubDate>Wed, 06 Dec 2023 10:02:04 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2106ab90-6de2-4077-a38f-e531d6d0928e</guid><dc:creator>H&amp;#229;kon Alseth</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;The assert seems to only occur in thingy91, when TFM is built with DEBUG_OPTIMIZATIONS. Sorry for not spotting this earlier. I will report this internally.&lt;/p&gt;
&lt;p&gt;As a workaround to this, you can set any other optimization level on configuration (ie. in vscode), and then use &amp;quot;nRF Kconfig GUI&amp;quot; to change only your application optimization level:&lt;/p&gt;
&lt;p&gt;&lt;img style="max-height:240px;max-width:320px;" src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/pastedimage1701856807719v1.png" alt=" " /&gt;&lt;/p&gt;
&lt;p&gt;This will not re-compile tf-m image.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Over to your root problem:&lt;/p&gt;
[quote user="marco.peli"]The fact is that i cannot build my real application using the secure board because i get the error that pm_config.h, which file nrf_modem_os imports, cannot be found (and i need the modem library for my project)[/quote]
&lt;p&gt;Can you share the build output?&lt;/p&gt;
&lt;p&gt;Thingy91 is not the best platform to develop on, as it has a hard restriction on the partition layout of a project. It will enforce a static partition layout, to ensure that DFU can be done on the thingy91.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Kind regards,&lt;/p&gt;
&lt;p&gt;Håkon&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Unable to debug due to flashregion locked on Thingy91</title><link>https://devzone.nordicsemi.com/thread/459119?ContentTypeID=1</link><pubDate>Wed, 06 Dec 2023 09:09:27 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3a5f6d44-2d35-44e8-8c81-bde17812ad41</guid><dc:creator>marco.peli</dc:creator><description>&lt;p&gt;Hi Hakon,&amp;nbsp;&lt;/p&gt;
&lt;p&gt;a small update, i can successfully debug the blinky example if i build using the secure board (i was using the unsecure board until now). &lt;br /&gt;The fact is that i cannot build my real application using the secure board because i get the error that pm_config.h, which file nrf_modem_os imports, cannot be found (and i need the modem library for my project)&lt;br /&gt;&lt;br /&gt;Any thoughts on that?&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Thank you!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Unable to debug due to flashregion locked on Thingy91</title><link>https://devzone.nordicsemi.com/thread/459070?ContentTypeID=1</link><pubDate>Tue, 05 Dec 2023 21:05:11 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:03d1a0cd-00ff-43e2-b503-68ac4402b377</guid><dc:creator>marco.peli</dc:creator><description>&lt;p&gt;Hi Hakon,&lt;/p&gt;
&lt;p&gt;i tried to set &lt;span&gt;CONFIG_MAIN_STACK_SIZE&lt;/span&gt; to &lt;span&gt;3&lt;/span&gt;&lt;span&gt;2768&amp;nbsp;&lt;/span&gt;bytes with no result .&lt;/p&gt;
&lt;p&gt;As last resort, i tried debugging the very basic zephyr blinky example and i&amp;nbsp;the code gets stuck in the same instruction during debug.&lt;/p&gt;
&lt;p&gt;i also tried to set the&amp;nbsp;&lt;span&gt;CONFIG_MAIN_STACK_SIZE to 65536&amp;nbsp;&lt;/span&gt;&lt;span&gt;bytes (just to test) with the blinky sample, but same result: the code gets stuck in the same exact instruction during debug with -Og.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;I attach a screenshot of the cpu registers: &lt;a href="https://ibb.co/L8HcKTm"&gt;https://ibb.co/L8HcKTm&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Thank you!&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;Marco Peli&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Unable to debug due to flashregion locked on Thingy91</title><link>https://devzone.nordicsemi.com/thread/459018?ContentTypeID=1</link><pubDate>Tue, 05 Dec 2023 14:49:12 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c5ea43e0-9483-4be6-a19a-ebf140df0130</guid><dc:creator>H&amp;#229;kon Alseth</dc:creator><description>&lt;p&gt;Hi Marco,&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;The second thread there, seems to be in a&amp;nbsp;fault handler.&lt;/p&gt;
&lt;p&gt;Can you expand all debug fields here?&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Also, did you try to adjust the stack sizes (CONFIG_MAIN_STACK_SIZE) to see if this has any effect on the boot procedure?&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Kind regards,&lt;/p&gt;
&lt;p&gt;Håkon&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Unable to debug due to flashregion locked on Thingy91</title><link>https://devzone.nordicsemi.com/thread/459013?ContentTypeID=1</link><pubDate>Tue, 05 Dec 2023 14:36:13 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c88a0832-7def-49ed-95e4-e7e5ff646152</guid><dc:creator>marco.peli</dc:creator><description>&lt;p&gt;Hi Hakon,&lt;/p&gt;
&lt;p&gt;thank you for your support.&lt;/p&gt;
&lt;p&gt;Here&amp;#39;s the screenshot of the stacktrace:&amp;nbsp;&lt;a id="" href="https://ibb.co/CnkM198"&gt;https://ibb.co/CnkM198&lt;/a&gt;&lt;br /&gt;What registers would you like to see?&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;thank you!&lt;/p&gt;
&lt;p&gt;Marco Peli&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Unable to debug due to flashregion locked on Thingy91</title><link>https://devzone.nordicsemi.com/thread/459001?ContentTypeID=1</link><pubDate>Tue, 05 Dec 2023 14:14:28 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7140daf5-fafa-458a-b977-fc9342f44c2e</guid><dc:creator>H&amp;#229;kon Alseth</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;That assert indicates that the p_reg that goes in is problematic.&lt;/p&gt;
&lt;p&gt;When compiling with no optimization and debug optimization, the firmware will use more stacked memory. In most cases, you will have to adjust your thread stack sizes to accommodate for debug build (usually MAIN_STACK_SIZE). Is there other .conf files loaded into your project? It does not look like asserts are enabled?&lt;/p&gt;
&lt;p&gt;NRFX_ASSERT should become a &amp;quot;zephyr assert&amp;quot;:&lt;/p&gt;
&lt;p&gt;&lt;a href="https://github.com/nrfconnect/sdk-zephyr/blob/v3.4.99-ncs1/modules/hal_nordic/nrfx/nrfx_glue.h#L35"&gt;https://github.com/nrfconnect/sdk-zephyr/blob/v3.4.99-ncs1/modules/hal_nordic/nrfx/nrfx_glue.h#L35&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Could you share the callstack (backtrace) and cpu registers when this occurs?&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Kind regards,&lt;/p&gt;
&lt;p&gt;Håkon&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>