<?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>debugging a non-secure app (with tfm)</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/89861/debugging-a-non-secure-app-with-tfm</link><description>Hi, 
 I was wondering what I need to do, or if it is even possible, to debug a non-secure app which uses TFM. 
 Running &amp;#39;west debug&amp;#39; on e.g. the blinky sample works regardless if I built it with secure or non-secure board type on an nrf9160dk. However</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 11 Nov 2025 05:21:29 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/89861/debugging-a-non-secure-app-with-tfm" /><item><title>RE: debugging a non-secure app (with tfm)</title><link>https://devzone.nordicsemi.com/thread/553899?ContentTypeID=1</link><pubDate>Tue, 11 Nov 2025 05:21:29 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1a82b8d0-bf51-49cb-aa03-8157ad0f85b3</guid><dc:creator>Monkeytronics</dc:creator><description>&lt;p&gt;Hey there, I don&amp;#39;t quite follow what the resolution was here. Could you spell it out a bit more clearly for us dullards at the back?&amp;nbsp;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I&amp;#39;ve got an app which has TFM enabled. If I debug it, it hangs at the reset_handler(). I&amp;#39;ve opened the debug console and typed in &amp;quot;-exec mon reset&amp;quot; and then continued the debug , but it just go off into nowhere land, and never reaches my main function.&amp;nbsp;&lt;br /&gt;&lt;br /&gt;This is my first project with this ecosystem, so all a bit new. Would it be valid to revert to non _ns board files disable the TFM and complete the development cycle. And then create a little script to convert the source over to use TFM? Or is this a naive notion?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: debugging a non-secure app (with tfm)</title><link>https://devzone.nordicsemi.com/thread/380572?ContentTypeID=1</link><pubDate>Mon, 08 Aug 2022 10:54:47 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:756f0744-fd2e-4de5-9cd2-a5a72794072f</guid><dc:creator>randomdude</dc:creator><description>&lt;p&gt;Dude! That was it! Actually, that was all there was to it. &lt;/p&gt;
&lt;p&gt;Thank you so much!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: debugging a non-secure app (with tfm)</title><link>https://devzone.nordicsemi.com/thread/380551?ContentTypeID=1</link><pubDate>Mon, 08 Aug 2022 09:28:01 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:01c6933b-3eef-429a-9ebf-12c95ad645e9</guid><dc:creator>dejans</dc:creator><description>&lt;p&gt;Hi,&amp;nbsp;&lt;br /&gt;&lt;br /&gt;The reset is done inside &amp;quot;west debug&amp;quot;, after the breakpoint is set. First, you have &amp;quot;break main&amp;quot; and &amp;quot;continue&amp;quot;, followed by &amp;quot;mon reset&amp;quot; and &amp;quot;continue&amp;quot;, it should break into main.&lt;br /&gt;&lt;br /&gt;Best regards,&lt;br /&gt;Dejan&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: debugging a non-secure app (with tfm)</title><link>https://devzone.nordicsemi.com/thread/380380?ContentTypeID=1</link><pubDate>Fri, 05 Aug 2022 12:39:26 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:29220c82-ac09-42fc-ba35-eeb2ce2272f0</guid><dc:creator>randomdude</dc:creator><description>&lt;p&gt;I&amp;#39;ve switched to Zephyr toolchain version 0.14.1, but It makes no difference.&lt;/p&gt;
[quote userid="111786" url="~/f/nordic-q-a/89861/debugging-a-non-secure-app-with-tfm/377338"]Crypto sample requires target reset.[/quote]
&lt;p&gt;What exactly did you mean by that? Do I have to reset the target manually? If so, when and how? I thought, the target reset would be executed automatically by whatever &amp;#39;west flash&amp;#39; or &amp;#39;west debug&amp;#39; did behind the scenes.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: debugging a non-secure app (with tfm)</title><link>https://devzone.nordicsemi.com/thread/379934?ContentTypeID=1</link><pubDate>Wed, 03 Aug 2022 13:38:38 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a442a3f8-622e-49a3-882b-6f633c8ec4a9</guid><dc:creator>dejans</dc:creator><description>&lt;p&gt;Hi,&lt;br /&gt;&lt;br /&gt;The toolchain provided by Zephyr is set of tools to help in building and debugging. You should use Zephyr toolchain version 0.14.1 instead of 0.14.2.&lt;br /&gt;&lt;br /&gt;Best regards,&lt;br /&gt;Dejan&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: debugging a non-secure app (with tfm)</title><link>https://devzone.nordicsemi.com/thread/379893?ContentTypeID=1</link><pubDate>Wed, 03 Aug 2022 11:33:15 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3820dfcb-371b-439e-a8bc-fffaa77f23e7</guid><dc:creator>randomdude</dc:creator><description>&lt;p&gt;Still not sure about the terminology. As I understand it, there are two parts to Zephyr. The Zephyr-RTOS source files which are shipped with the nrf connect SDK, and the toolchain, which gets installed in /opt or ~, or wherever. I was using the Zephyr SDK that comes with the nrf connect SDK from the main branch and zephyr toolchain 0.14.2.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: debugging a non-secure app (with tfm)</title><link>https://devzone.nordicsemi.com/thread/379805?ContentTypeID=1</link><pubDate>Wed, 03 Aug 2022 07:28:31 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:690842c5-0eed-475e-ad40-d9a7dd683d2e</guid><dc:creator>dejans</dc:creator><description>&lt;p&gt;Hi,&lt;br /&gt;&lt;br /&gt;I am referring to psa_crypto sample. Which Zephyr version did you use when building your sample?&lt;br /&gt;&lt;br /&gt;Best regards,&lt;br /&gt;Dejan&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: debugging a non-secure app (with tfm)</title><link>https://devzone.nordicsemi.com/thread/379759?ContentTypeID=1</link><pubDate>Tue, 02 Aug 2022 15:36:08 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:47e7baf1-4e23-4c35-856f-93e248c68a86</guid><dc:creator>randomdude</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;which crypto sample are you referring to, exactly? I have done a fresh install of the main branch of the nrf connect SDK and built the psa_crypto sample in zephyr/samples/tfm_integration, but debugging still fails the same way it did before.&lt;/p&gt;
&lt;p&gt;One thing I didn&amp;#39;t realize before is that I was using two different zephyr flavors, vanilla and the one that comes with the nrf connect SDK. Not sure if that makes much of a difference in this case, though.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: debugging a non-secure app (with tfm)</title><link>https://devzone.nordicsemi.com/thread/377338?ContentTypeID=1</link><pubDate>Mon, 18 Jul 2022 07:39:40 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9d414269-6dcc-4a62-855d-f198dbb60f83</guid><dc:creator>dejans</dc:creator><description>&lt;p&gt;Hi,&lt;br /&gt;&lt;br /&gt;You could now test the crypto sample from the main branch with build command &amp;quot;west build -b nrf9160dk_nrf9160_ns@your_revision_number&amp;quot;, where your_revision_number is revision number of the board. Crypto sample requires target reset.&lt;br /&gt;&lt;br /&gt;Best regards,&lt;br /&gt;Dejan&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: debugging a non-secure app (with tfm)</title><link>https://devzone.nordicsemi.com/thread/377002?ContentTypeID=1</link><pubDate>Thu, 14 Jul 2022 13:51:53 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:66a5447c-9b5c-473e-a372-391aad8253d2</guid><dc:creator>dejans</dc:creator><description>&lt;p&gt;Hi,&lt;br /&gt;&lt;br /&gt;I have asked internally. I&amp;#39;ll get back to you during next week when I get new information.&lt;br /&gt;&lt;br /&gt;Best regards,&lt;br /&gt;Dejan&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: debugging a non-secure app (with tfm)</title><link>https://devzone.nordicsemi.com/thread/376811?ContentTypeID=1</link><pubDate>Wed, 13 Jul 2022 14:30:05 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0e27c189-a752-4953-8e66-781f52c0e3ca</guid><dc:creator>randomdude</dc:creator><description>&lt;p&gt;I added the symbols you suggested, but regrettably it didn&amp;#39;t help that much. Anything else I might me missing?&lt;/p&gt;
&lt;p&gt;&lt;a href="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/debug_5F00_psa_5F00_sample_5F00_3.1.0_5F00_with_5F00_tfm_5F00_symbols.txt"&gt;devzone.nordicsemi.com/.../debug_5F00_psa_5F00_sample_5F00_3.1.0_5F00_with_5F00_tfm_5F00_symbols.txt&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: debugging a non-secure app (with tfm)</title><link>https://devzone.nordicsemi.com/thread/376777?ContentTypeID=1</link><pubDate>Wed, 13 Jul 2022 12:05:33 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9fcb0ca6-f011-419d-91d3-e8b8985590f3</guid><dc:creator>dejans</dc:creator><description>&lt;p&gt;Hi,&lt;br /&gt;&lt;br /&gt;The reason that debugging was successful with Zephyr 2.7.99 is that &amp;quot;west debug&amp;quot; only adds symbols for Zephyr application, but not for TF-M. Blinky application with Zephyr 2.7.99 _ns worked well as it uses SPM instead of TF-M. If you want to add TF-M application to the &amp;quot;west debug&amp;quot;, you would need to create a file called &amp;quot;.gdbinit&amp;quot; and add TF-M elf file there, as shown below&lt;br /&gt;&lt;br /&gt;&lt;pre class="ui-code" data-mode="text"&gt;add-symbol-file build/tfm/bin/tfm_s.elf&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Unfortunately, this addition of TF-M elf file is currently not supported in west, but it is expected to be supported in one of the future versions of west.&lt;br /&gt;&lt;br /&gt;You could consider using Zephyr 3.1.99 when it reaches main or use available upmerge pull requests shown below&lt;br /&gt;&lt;a href="https://github.com/nrfconnect/sdk-nrf/pull/8056"&gt;https://github.com/nrfconnect/sdk-nrf/pull/8056&lt;/a&gt;&lt;br /&gt;&lt;a href="https://github.com/nrfconnect/sdk-zephyr/pull/838"&gt;https://github.com/nrfconnect/sdk-zephyr/pull/838&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Best regards,&lt;br /&gt;Dejan&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: debugging a non-secure app (with tfm)</title><link>https://devzone.nordicsemi.com/thread/376660?ContentTypeID=1</link><pubDate>Tue, 12 Jul 2022 16:19:11 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1e55fc07-cbe5-4606-8618-94370ea356ec</guid><dc:creator>randomdude</dc:creator><description>&lt;p&gt;I have attached gdb session logs for the following scenarios:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;blinky built with zephyr 3.1.0 w/o ns --&amp;gt; works&lt;/li&gt;
&lt;li&gt;blinky built with zephyr 3.1.0 with ns --&amp;gt; hangs on the first &amp;quot;continue&amp;quot;&lt;/li&gt;
&lt;li&gt;blinky built with zephyr 2.7.99 with ns --&amp;gt; works&lt;/li&gt;
&lt;li&gt;psa_crypto sample built with zephyr 3.1.0 (ns mandatory) --&amp;gt; jumps to unknown memory&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;The main difference (apart from the memory locations) I spotted was that the psa_crypto sample and the 3.1.0-ns-blinky use tfm, while the 2.7.99-ns-blinky uses spm, and the blinky built without the &amp;#39;_ns&amp;#39; uses neither.&lt;/p&gt;
&lt;p&gt;So the plot thickens. All this points to my earlier suspicion that it might not be possible at all to debug a tfm application beyond the bootloader.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/debug_5F00_blinky_5F00_3.1.0.txt"&gt;devzone.nordicsemi.com/.../debug_5F00_blinky_5F00_3.1.0.txt&lt;/a&gt;&lt;a href="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/debug_5F00_blinky_5F00_ns_5F00_2.7.99_2D00_ncs_2D00_1.txt"&gt;devzone.nordicsemi.com/.../debug_5F00_blinky_5F00_ns_5F00_2.7.99_2D00_ncs_2D00_1.txt&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/debug_5F00_blinky_5F00_ns_5F00_3.1.0.txt"&gt;devzone.nordicsemi.com/.../debug_5F00_blinky_5F00_ns_5F00_3.1.0.txt&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/debug_5F00_psa_5F00_sample_5F00_3.1.0.txt"&gt;devzone.nordicsemi.com/.../debug_5F00_psa_5F00_sample_5F00_3.1.0.txt&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: debugging a non-secure app (with tfm)</title><link>https://devzone.nordicsemi.com/thread/376637?ContentTypeID=1</link><pubDate>Tue, 12 Jul 2022 13:38:32 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:987f9aa7-7e97-4609-9a0d-a05394c4da8d</guid><dc:creator>dejans</dc:creator><description>&lt;p&gt;Hi,&lt;br /&gt;&lt;br /&gt;Can you show how do you run &amp;quot;west debug&amp;quot; command? &lt;br /&gt;Can you show the differences when running &amp;quot;west debug&amp;quot; with blinky and psa_crypto?&lt;br /&gt;&lt;br /&gt;Best regards,&lt;br /&gt;Dejan&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>