<?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>Can&amp;#39;t use CONFIG_FPROTECT=y in MCUBOOT+APP (with TFM), compilation results in &amp;quot;No fprotect backend selected.&amp;quot; CMake error</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/117584/can-t-use-config_fprotect-y-in-mcuboot-app-with-tfm-compilation-results-in-no-fprotect-backend-selected-cmake-error</link><description>Hi all, 
 I wanted to enable read/write protection for MCUBOOT partition in my firmware from the application and encountered a strange problem. The build (build system - default, device nrf9160, SDK v2.7.0) for nrf9160dk_nrf9160_ns with MCUBOOT(child</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Mon, 30 Dec 2024 07:42:46 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/117584/can-t-use-config_fprotect-y-in-mcuboot-app-with-tfm-compilation-results-in-no-fprotect-backend-selected-cmake-error" /><item><title>RE: Can't use CONFIG_FPROTECT=y in MCUBOOT+APP (with TFM), compilation results in "No fprotect backend selected." CMake error</title><link>https://devzone.nordicsemi.com/thread/516456?ContentTypeID=1</link><pubDate>Mon, 30 Dec 2024 07:42:46 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3efd668e-a457-4737-a6ce-9edbd311632e</guid><dc:creator>Sigurd Hellesvik</dc:creator><description>&lt;p&gt;The feature you are describing is what we call APPROTECT or Access Port Protection. See &lt;a href="https://docs.nordicsemi.com/bundle/ncs-latest/page/nrf/security/ap_protect.html"&gt;Enabling access port protection mechanism&lt;/a&gt;:&lt;/p&gt;
&lt;p&gt;&amp;quot;&lt;/p&gt;
&lt;p&gt;Several Nordic Semiconductor SoCs or SiPs supported in the nRF Connect SDK offer an implementation of the access port protection mechanism (AP-Protect). When enabled, this mechanism blocks the debugger from read and write access to all CPU registers and memory-mapped addresses. Accessing these registers and addresses again requires disabling the mechanism and erasing the flash.&lt;/p&gt;
&lt;p&gt;&amp;quot;&lt;/p&gt;
[quote user="valerii7"]Could you please confirm that my understanding is correct? The main purpose of the protection is to prevent the code from running on unauthorized hw ([/quote]
&lt;p&gt;If you run Access Port Protection, noone should be able to read out your fw. &lt;/p&gt;
&lt;p&gt;If you then also encrypt your DFU, people should not be able to use intercepted DFU images.&lt;/p&gt;
&lt;p&gt;I agree with your understanding.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Can't use CONFIG_FPROTECT=y in MCUBOOT+APP (with TFM), compilation results in "No fprotect backend selected." CMake error</title><link>https://devzone.nordicsemi.com/thread/516380?ContentTypeID=1</link><pubDate>Fri, 27 Dec 2024 16:09:44 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8667ffb1-aee1-440e-b275-b1615a53f03a</guid><dc:creator>valerii7</dc:creator><description>&lt;p&gt;Sigurd, thank you very much for the detailed answers, now I understand the code much better and also see how to implement the desired functionality. The FPROTECT obviously doesn&amp;#39;t fit my needs, since it&amp;#39;s not persistent (I overlooked this).&lt;/p&gt;
&lt;p&gt;One last question - I think the&amp;nbsp;UICR &amp;quot;User information configuration registers&amp;quot; could provide complete protection against firmware readout/copy via the debug interface. And, if coupled with an appropriate bootloader with encryption, could guarantee the complete protection of the firmware from copy/reuse. In this way, since FW&amp;nbsp;update files are encrypted and there is also no access via the debug interface to the internal flash (access could be reenabled only after doing a complete erase of the flash), the unencrypted code is never exposed. Could you please confirm that my understanding is correct? The main purpose of the protection is to prevent the code from running on unauthorized hw (prevention of coping the complete device).&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Can't use CONFIG_FPROTECT=y in MCUBOOT+APP (with TFM), compilation results in "No fprotect backend selected." CMake error</title><link>https://devzone.nordicsemi.com/thread/516368?ContentTypeID=1</link><pubDate>Fri, 27 Dec 2024 14:37:13 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3ea60fe1-060c-4362-b3f5-9ebb9da08c5d</guid><dc:creator>Sigurd Hellesvik</dc:creator><description>[quote user="valerii7"]1) MCUBOOT with activated&amp;nbsp;&lt;span&gt;FPROTECT&amp;nbsp;will do only write protection, I&amp;#39;m curious, why not both read and write? Is there any reason not to protect the bootloader from reading as well?&lt;/span&gt;[/quote]
&lt;p&gt;Immutability only requires write-protection. As our bootloader is open source either way, I guess it is not any real reason to read-protect it. &lt;/p&gt;
&lt;p&gt;Not read-protecting MCUboot also allows for some features such as reading bootloader version or public key from the application. Not that those features are very well supported but at least they are possible.&lt;/p&gt;
&lt;p&gt;As you can hear, there are no really definitive reasins either for or against this as far as I know.&lt;/p&gt;
[quote user="valerii7"]&lt;span&gt;2) &amp;quot;... This is why the application cannot access the SPU... &amp;quot; - that&amp;#39;s a bit confusing, AFAIK MCUBOOT also belongs to&amp;nbsp;NSPE but still has access to SPU. So why it works for mcuboot, but doesn&amp;#39;t work for the app?&lt;/span&gt;[/quote]
&lt;p&gt;No, MCUboot runs before TF-M+App. So MCUboot runs in &amp;quot;secure-only&amp;quot;. It does not have any TF-M, meanining it does not have the NSPE/SPE split =&amp;gt; MCUboot has access to everything.&lt;/p&gt;
[quote user="valerii7"]&lt;span&gt;3) &amp;quot;you would have to use nrfx libraries directly to write to the SPU.&amp;quot; - do I understand this correctly, that the proposed solution is basically to use SPU registers &amp;quot;directly&amp;quot;, without involving device tree and FPROTECT&amp;nbsp;library?&lt;/span&gt;[/quote]
&lt;p&gt;Yes. TF-M does not use Zephyr, and therefore does not have access to devicetree or FPROTECT.&lt;/p&gt;
[quote user="valerii7"]&lt;span&gt;4) one more question - would it be possible to program protection mode over SWD, without&amp;nbsp;bootloader/app code? Something like in STM32 where read/write flash protection can be enabled without any dedicated code, only through a JTAG/SWD. If yes, what would be the tool/command for that?&lt;/span&gt;[/quote]
&lt;p&gt;You can write directly to registers using SWD, so almost yes. &lt;br /&gt;However, FPROTECT is not persistent, so this would be undone upon a power cycle. &lt;/p&gt;
&lt;p&gt;An alternative to writing from TF-M would be to add custom code to MCUboot to make MCUboot protect the application+TF-M before it boots. Not entirely sure how this would work with TF-M since TF-M uses the SPU to set Secure/Non-Secure to stuff when it starts though.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Can't use CONFIG_FPROTECT=y in MCUBOOT+APP (with TFM), compilation results in "No fprotect backend selected." CMake error</title><link>https://devzone.nordicsemi.com/thread/516366?ContentTypeID=1</link><pubDate>Fri, 27 Dec 2024 14:29:23 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d7cc2179-b593-4220-b101-9fe8b21c2d12</guid><dc:creator>valerii7</dc:creator><description>&lt;p&gt;Ok, thank you for the answers. I have a couple more questions now:&lt;/p&gt;
&lt;p&gt;1) MCUBOOT with activated&amp;nbsp;&lt;span&gt;FPROTECT&amp;nbsp;will do only write protection, I&amp;#39;m curious, why not both read and write? Is there any reason not to protect the bootloader from reading as well?&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;2) &amp;quot;... This is why the application cannot access the SPU... &amp;quot; - that&amp;#39;s a bit confusing, AFAIK MCUBOOT also belongs to&amp;nbsp;NSPE but still has access to SPU. So why it works for mcuboot, but doesn&amp;#39;t work for the app?&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;3) &amp;quot;you would have to use nrfx libraries directly to write to the SPU.&amp;quot; - do I understand this correctly, that the proposed solution is basically to use SPU registers &amp;quot;directly&amp;quot;, without involving device tree and FPROTECT&amp;nbsp;library?&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;4) one more question - would it be possible to program protection mode over SWD, without&amp;nbsp;bootloader/app code? Something like in STM32 where read/write flash protection can be enabled without any dedicated code, only through a JTAG/SWD. If yes, what would be the tool/command for that?&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Best regards, Valerii&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Can't use CONFIG_FPROTECT=y in MCUBOOT+APP (with TFM), compilation results in "No fprotect backend selected." CMake error</title><link>https://devzone.nordicsemi.com/thread/516357?ContentTypeID=1</link><pubDate>Fri, 27 Dec 2024 13:50:38 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3625a376-269d-48d6-876d-88bffc3f9fdc</guid><dc:creator>Sigurd Hellesvik</dc:creator><description>[quote user="valerii7"]Not completely, it fails with the same CMake error if I add only CONFIG_FPROTECT in child_image/mcuboot.conf But if I also add CONFIG_NORDIC_SECURITY_BACKEND it will compile ok.[/quote]
&lt;p&gt;I guess that makes sense.&lt;/p&gt;
&lt;p&gt;Nice, then we got protection the bootloader it seems.&lt;/p&gt;
[quote user=""]My research showed that the device tree for NS board has no SPU,&amp;nbsp;ficr and&amp;nbsp;uicr peripherals (why??). And if I try to add these peripherals in a device tree overlay file I get following compilation errors:[/quote]
&lt;p&gt;With TF-M (_ns), your application is split in two:&lt;/p&gt;
&lt;p&gt;NSPE and SPE. See &amp;nbsp;&lt;a href="https://devzone.nordicsemi.com/nordic/nordic-blog/b/blog/posts/an-introduction-to-trusted-firmware-m-t-m"&gt;An Introduction to Trusted Firmware-M (TF-M)&lt;/a&gt; .&lt;/p&gt;
&lt;p&gt;Your Zephyr application is NSPE, while the SPE has access to the SPU. I guess that the same would be true for FICR and UICR as well.&amp;nbsp; This is why the application cannot access the SPU.&lt;/p&gt;
&lt;p&gt;To use FPROTECT from TF-M, you can for an custom secure service. See the &lt;a href="https://docs.nordicsemi.com/bundle/ncs-latest/page/nrf/samples/tfm/tfm_secure_peripheral/README.html"&gt;TF-M secure peripheral partition&lt;/a&gt; sample for how this can be done. This does not support Zephyr, so you would have to use nrfx libraries directly to write to the SPU.&lt;/p&gt;
&lt;p&gt;Did this make sense?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Can't use CONFIG_FPROTECT=y in MCUBOOT+APP (with TFM), compilation results in "No fprotect backend selected." CMake error</title><link>https://devzone.nordicsemi.com/thread/516332?ContentTypeID=1</link><pubDate>Fri, 27 Dec 2024 12:26:14 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a643668d-008a-498c-ae1e-487e5a6d3bef</guid><dc:creator>valerii7</dc:creator><description>&lt;p&gt;Not completely, it fails with the same CMake error if I add only CONFIG_FPROTECT in child_image/mcuboot.conf But if I also add CONFIG_NORDIC_SECURITY_BACKEND it will compile ok.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Can't use CONFIG_FPROTECT=y in MCUBOOT+APP (with TFM), compilation results in "No fprotect backend selected." CMake error</title><link>https://devzone.nordicsemi.com/thread/516329?ContentTypeID=1</link><pubDate>Fri, 27 Dec 2024 11:53:00 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a4191d56-4447-4cc6-b603-aa9f47328060</guid><dc:creator>Sigurd Hellesvik</dc:creator><description>[quote user="valerii7"]no, I&amp;#39;m using &amp;quot;Build system default&amp;quot; in the build configuration (I assume in the v2.7.0 SDK and toolchain this means usage of an older &amp;quot;Multi-image build&amp;quot; approach with parent and child images).[/quote]
&lt;p&gt;I have experienced that it can vary. I recommend explicitly selecting either with or without sysbuild. This way you will know for sure and we wont have to guess.&lt;/p&gt;
&lt;p&gt;Anyhow, for Multi-image builds:&lt;/p&gt;
[quote user="valerii7"]2) I want to protect my bootloader from read/write over SWD interface, I also would like to protect my application in the same way;[/quote]
&lt;p&gt;Let us start by protecting the bootloader.&lt;/p&gt;
&lt;p&gt;Then set CONFIG_FPROTECT in child_image/mcuboot.conf only.&lt;/p&gt;
&lt;p&gt;Does this work as expected?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Can't use CONFIG_FPROTECT=y in MCUBOOT+APP (with TFM), compilation results in "No fprotect backend selected." CMake error</title><link>https://devzone.nordicsemi.com/thread/516327?ContentTypeID=1</link><pubDate>Fri, 27 Dec 2024 11:49:47 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:93395adb-92e0-4362-93f7-eafd624db4d7</guid><dc:creator>valerii7</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;no, I&amp;#39;m using &amp;quot;Build system default&amp;quot; in the build configuration (I assume in the v2.7.0 SDK and toolchain this means usage of an older &amp;quot;Multi-image build&amp;quot; approach with parent and child images).&lt;/p&gt;
&lt;p&gt;Best regards, Valerii&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Can't use CONFIG_FPROTECT=y in MCUBOOT+APP (with TFM), compilation results in "No fprotect backend selected." CMake error</title><link>https://devzone.nordicsemi.com/thread/516324?ContentTypeID=1</link><pubDate>Fri, 27 Dec 2024 11:41:08 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:662727a5-9e7b-40e4-8cc2-2d85fa2f912e</guid><dc:creator>Sigurd Hellesvik</dc:creator><description>&lt;p&gt;One more question before I start answering&lt;br /&gt;Do you use Sysbuild to build your project?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Can't use CONFIG_FPROTECT=y in MCUBOOT+APP (with TFM), compilation results in "No fprotect backend selected." CMake error</title><link>https://devzone.nordicsemi.com/thread/516319?ContentTypeID=1</link><pubDate>Fri, 27 Dec 2024 11:29:48 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:75868e6c-bcc6-482d-89cd-57d584807605</guid><dc:creator>valerii7</dc:creator><description>&lt;p&gt;Hi Sigurd,&lt;/p&gt;
&lt;p&gt;1) I&amp;#39;m setting &amp;quot;CONFIG_FPROTECT=y&amp;quot; in prj.conf&lt;/p&gt;
&lt;p&gt;2) I want to protect my bootloader from read/write over SWD interface, I also would like to protect my application in the same way;&lt;/p&gt;
&lt;p&gt;3) yes, I tried with mqtt sample from Nordic (&amp;quot;C:\ncs\v2.7.0\nrf\samples\net\mqtt&amp;quot;), simple adding&amp;nbsp; &amp;quot;CONFIG_FPROTECT=y&amp;quot; into the prj.conf causes the &amp;quot;CMake Error at C:/ncs/v2.7.0/nrf/lib/fprotect/CMakeLists.txt:15 (message):&lt;br /&gt; No fprotect backend selected&amp;quot;. Adding &amp;quot;CONFIG_NORDIC_SECURITY_BACKEND=y&amp;quot; doesn&amp;#39;t help.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Best regards, Valerii&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Can't use CONFIG_FPROTECT=y in MCUBOOT+APP (with TFM), compilation results in "No fprotect backend selected." CMake error</title><link>https://devzone.nordicsemi.com/thread/516312?ContentTypeID=1</link><pubDate>Fri, 27 Dec 2024 11:09:29 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:61568c16-3922-4469-b120-e0e43b247373</guid><dc:creator>Sigurd Hellesvik</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
[quote user=""]I wanted to enable read/write protection for MCUBOOT partition in my firmware from the application [/quote]
&lt;p&gt;Which configuration do you set and where?&lt;/p&gt;
&lt;p&gt;What do you want to protect?&lt;/p&gt;
&lt;p&gt;Do you get the same issue without MCUboot?&lt;/p&gt;
&lt;p&gt;Regards,&lt;br /&gt;Sigurd Hellesvik&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>