<?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>How to reduce the code size of TF-M</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/100869/how-to-reduce-the-code-size-of-tf-m</link><description>After porting the application to sdk v2.4.0, I get the following error after compiling the code: 
 &amp;quot;opt/zephyr-sdk/arm-zephyr-eabi/bin/... /lib/gcc/arm-zephyr-eabi/12.2.0/... /... /... /... /arm-zephyr-eabi/bin/ld.bfd.exe: region `FLASH&amp;#39; overflow 47368</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 06 Jul 2023 14:29:17 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/100869/how-to-reduce-the-code-size-of-tf-m" /><item><title>RE: How to reduce the code size of TF-M</title><link>https://devzone.nordicsemi.com/thread/435029?ContentTypeID=1</link><pubDate>Thu, 06 Jul 2023 14:29:17 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0cfbbca2-f3b1-47ee-9624-3fcdaf9ebe5c</guid><dc:creator>H&amp;#229;kon Alseth</dc:creator><description>&lt;p&gt;Happy to help out, glad to hear that it worked!&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: How to reduce the code size of TF-M</title><link>https://devzone.nordicsemi.com/thread/434999?ContentTypeID=1</link><pubDate>Thu, 06 Jul 2023 13:19:18 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:77f845c0-6586-4977-b046-4737627f82f6</guid><dc:creator>Tide</dc:creator><description>&lt;p&gt;Thanks, it worked and now TF-M only takes up 191KB!&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p&gt;flash_primary (0x100000 - 1024kB):&lt;br /&gt;+--------------------------------------------------+&lt;br /&gt;| 0x0: mcuboot (0xc000 - 48kB) |&lt;br /&gt;| 0xc000: EMPTY_0 (0x4000 - 16kB) |&lt;br /&gt;+---0x10000: mcuboot_primary (0x68000 - 416kB)-----+&lt;br /&gt;+---0x10000: tfm_secure (0x30000 - 192kB)----------+&lt;br /&gt;| 0x10000: mcuboot_pad (0x200 - 512B) |&lt;br /&gt;+---0x10200: mcuboot_primary_app (0x67e00 - 415kB)-+&lt;br /&gt;| 0x10200: tfm (0x2fe00 - 191kB) |&lt;br /&gt;+---0x40000: tfm_nonsecure (0x38000 - 224kB)-------+&lt;br /&gt;| 0x40000: app (0x38000 - 224kB) |&lt;br /&gt;+--------------------------------------------------+&lt;br /&gt;| 0x78000: mcuboot_secondary (0x68000 - 416kB) |&lt;br /&gt;| 0xe0000: EMPTY_3 (0x8000 - 32kB) |&lt;br /&gt;+---0xe8000: nonsecure_storage (0x6000 - 24kB)-----+&lt;br /&gt;| 0xe8000: nvs_storage (0x6000 - 24kB) |&lt;br /&gt;+--------------------------------------------------+&lt;br /&gt;| 0xee000: EMPTY_2 (0x6000 - 24kB) |&lt;br /&gt;+---0xf4000: tfm_storage (0x8000 - 32kB)-----------+&lt;br /&gt;| 0xf4000: tfm_its (0x2000 - 8kB) |&lt;br /&gt;| 0xf6000: tfm_otp_nv_counters (0x2000 - 8kB) |&lt;br /&gt;| 0xf8000: tfm_ps (0x4000 - 16kB) |&lt;br /&gt;+--------------------------------------------------+&lt;br /&gt;| 0xfc000: EMPTY_1 (0x4000 - 16kB) |&lt;br /&gt;+--------------------------------------------------+&lt;/p&gt;
&lt;p&gt;otp (0x2f4 - 756B):&lt;br /&gt;+------------------------------+&lt;br /&gt;| 0xff8108: otp (0x2f4 - 756B) |&lt;br /&gt;+------------------------------+&lt;/p&gt;
&lt;p&gt;sram_primary (0x40000 - 256kB):&lt;br /&gt;+--------------------------------------------------+&lt;br /&gt;+---0x20000000: mcuboot_sram (0x16000 - 88kB)------+&lt;br /&gt;+---0x20000000: sram_secure (0x16000 - 88kB)-------+&lt;br /&gt;| 0x20000000: tfm_sram (0x16000 - 88kB) |&lt;br /&gt;+---0x20016000: sram_nonsecure (0x2a000 - 168kB)---+&lt;br /&gt;+---0x20016000: nrf_modem_lib_sram (0x7ce8 - 31kB)-+&lt;br /&gt;| 0x20016000: nrf_modem_lib_ctrl (0x4e8 - 1kB) |&lt;br /&gt;| 0x200164e8: nrf_modem_lib_tx (0x5800 - 22kB) |&lt;br /&gt;| 0x2001bce8: nrf_modem_lib_rx (0x2000 - 8kB) |&lt;br /&gt;+--------------------------------------------------+&lt;br /&gt;| 0x2001dce8: sram_primary (0x22318 - 136kB) |&lt;br /&gt;+--------------------------------------------------+&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to reduce the code size of TF-M</title><link>https://devzone.nordicsemi.com/thread/434913?ContentTypeID=1</link><pubDate>Thu, 06 Jul 2023 10:27:27 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0bba3829-658a-4a7c-aa9b-669e9dc30116</guid><dc:creator>H&amp;#229;kon Alseth</dc:creator><description>&lt;p&gt;Could you try setting this instead?&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;CONFIG_PM_PARTITION_SIZE_TFM=0x2FE00&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Remember to regenerate your build (ie. delete the build folder) after making such a change.&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: How to reduce the code size of TF-M</title><link>https://devzone.nordicsemi.com/thread/434911?ContentTypeID=1</link><pubDate>Thu, 06 Jul 2023 10:09:06 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d50fc389-4363-440f-8eb9-ab42a5c15537</guid><dc:creator>Tide</dc:creator><description>&lt;p&gt;Hi,&lt;br /&gt;I set prj.conf::CONFIG_TFM_PROFILE_TYPE_MEDIUM=y, just like the example you shared above, but my TF-M code size did not decrease. This is the dynamic partition generation in my project:&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p&gt;flash_primary (0x100000 - 1024kB):&lt;br /&gt;+--------------------------------------------------+&lt;br /&gt;| 0x0: mcuboot (0xc000 - 48kB) |&lt;br /&gt;| 0xc000: EMPTY_0 (0x4000 - 16kB) |&lt;br /&gt;+---0x10000: mcuboot_primary (0x68000 - 416kB)-----+&lt;br /&gt;+---0x10000: tfm_secure (0x40000 - 256kB)----------+&lt;br /&gt;| 0x10000: mcuboot_pad (0x200 - 512B) |&lt;br /&gt;+---0x10200: mcuboot_primary_app (0x67e00 - 415kB)-+&lt;br /&gt;| 0x10200: tfm (0x3fe00 - 255kB) |&lt;br /&gt;+---0x50000: tfm_nonsecure (0x28000 - 160kB)-------+&lt;br /&gt;| 0x50000: app (0x28000 - 160kB) |&lt;br /&gt;+--------------------------------------------------+&lt;br /&gt;| 0x78000: mcuboot_secondary (0x68000 - 416kB) |&lt;br /&gt;| 0xe0000: EMPTY_3 (0x8000 - 32kB) |&lt;br /&gt;+---0xe8000: nonsecure_storage (0x6000 - 24kB)-----+&lt;br /&gt;| 0xe8000: nvs_storage (0x6000 - 24kB) |&lt;br /&gt;+--------------------------------------------------+&lt;br /&gt;| 0xee000: EMPTY_2 (0x6000 - 24kB) |&lt;br /&gt;+---0xf4000: tfm_storage (0x8000 - 32kB)-----------+&lt;br /&gt;| 0xf4000: tfm_its (0x2000 - 8kB) |&lt;br /&gt;| 0xf6000: tfm_otp_nv_counters (0x2000 - 8kB) |&lt;br /&gt;| 0xf8000: tfm_ps (0x4000 - 16kB) |&lt;br /&gt;+--------------------------------------------------+&lt;br /&gt;| 0xfc000: EMPTY_1 (0x4000 - 16kB) |&lt;br /&gt;+--------------------------------------------------+&lt;/p&gt;
&lt;p&gt;otp (0x2f4 - 756B):&lt;br /&gt;+------------------------------+&lt;br /&gt;| 0xff8108: otp (0x2f4 - 756B) |&lt;br /&gt;+------------------------------+&lt;/p&gt;
&lt;p&gt;sram_primary (0x40000 - 256kB):&lt;br /&gt;+--------------------------------------------------+&lt;br /&gt;+---0x20000000: mcuboot_sram (0x16000 - 88kB)------+&lt;br /&gt;+---0x20000000: sram_secure (0x16000 - 88kB)-------+&lt;br /&gt;| 0x20000000: tfm_sram (0x16000 - 88kB) |&lt;br /&gt;+---0x20016000: sram_nonsecure (0x2a000 - 168kB)---+&lt;br /&gt;+---0x20016000: nrf_modem_lib_sram (0x7ce8 - 31kB)-+&lt;br /&gt;| 0x20016000: nrf_modem_lib_ctrl (0x4e8 - 1kB) |&lt;br /&gt;| 0x200164e8: nrf_modem_lib_tx (0x5800 - 22kB) |&lt;br /&gt;| 0x2001bce8: nrf_modem_lib_rx (0x2000 - 8kB) |&lt;br /&gt;+--------------------------------------------------+&lt;br /&gt;| 0x2001dce8: sram_primary (0x22318 - 136kB) |&lt;br /&gt;+--------------------------------------------------+&lt;br /&gt;&lt;br /&gt;And&amp;nbsp;i&amp;nbsp;still get the message that the app code size is not enough.&lt;br /&gt;&lt;br /&gt;&amp;quot;arm-zephyr-eabi/bin/ld.bfd.exe: region `FLASH&amp;#39; overflowed by 47424 bytes&amp;quot;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to reduce the code size of TF-M</title><link>https://devzone.nordicsemi.com/thread/434570?ContentTypeID=1</link><pubDate>Wed, 05 Jul 2023 02:20:25 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:102c71ec-3a07-4be5-8c96-dd89986ae00f</guid><dc:creator>Tide</dc:creator><description>&lt;p&gt;Thank you very much, I will test it and get back to you as soon as possible.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to reduce the code size of TF-M</title><link>https://devzone.nordicsemi.com/thread/434490?ContentTypeID=1</link><pubDate>Tue, 04 Jul 2023 14:16:57 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:dd9e581f-8622-4782-a1a6-3a39bdc660b4</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;I am sorry, but the task is still open internally.&lt;/p&gt;
&lt;p&gt;We have been able to set a &amp;quot;medium&amp;quot; configuration, here based on the samples/tfm/tfm_hello_world/ with a manual operation to reduce the &amp;quot;tfm&amp;quot; partition from 0x40000 -&amp;gt; 0x30000:&lt;/p&gt;
&lt;p&gt;&lt;a href="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/tfm_5F00_hello_5F00_world_5F00_medium_5F00_size_5F00_ncs240.zip"&gt;devzone.nordicsemi.com/.../tfm_5F00_hello_5F00_world_5F00_medium_5F00_size_5F00_ncs240.zip&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Please note the pm_static.yml file which statically defines the whole partition layout, as well as prj.conf::CONFIG_TFM_PROFILE_TYPE_MEDIUM=y.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Could you try this and see if this helps with the flash usage at your end as well?&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: How to reduce the code size of TF-M</title><link>https://devzone.nordicsemi.com/thread/434451?ContentTypeID=1</link><pubDate>Tue, 04 Jul 2023 11:53:28 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8df14c0c-63fc-43b5-b9d9-bc9d071d9487</guid><dc:creator>Tide</dc:creator><description>&lt;p&gt;Hi,&lt;br /&gt;Is there any progress on this issue? We urgently need tf-m that can reduce the code size.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to reduce the code size of TF-M</title><link>https://devzone.nordicsemi.com/thread/432856?ContentTypeID=1</link><pubDate>Mon, 26 Jun 2023 06:45:56 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e59b7a72-1a01-4f35-90c7-b575caea526b</guid><dc:creator>Tide</dc:creator><description>&lt;p&gt;Hi,&lt;br /&gt;&lt;br /&gt;For this issue, please sync any progress on your end to this ticket and look forward to your progress.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to reduce the code size of TF-M</title><link>https://devzone.nordicsemi.com/thread/432152?ContentTypeID=1</link><pubDate>Wed, 21 Jun 2023 01:39:41 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2dbf3afe-7946-4de1-a4a1-3db3a2e4f59a</guid><dc:creator>Tide</dc:creator><description>&lt;p&gt;Thank you for your reply and I look forward to more exciting results from you.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to reduce the code size of TF-M</title><link>https://devzone.nordicsemi.com/thread/432061?ContentTypeID=1</link><pubDate>Tue, 20 Jun 2023 14:10:05 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:48f53f7c-bbbf-40dd-bef2-012e727cf01b</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;Unfortunately, it is not trivial to configure one specific cipher support only with TFM at this time. I&amp;#39;ve tried to get it slimmed down, but ended up hitting several issues wrt. missing settings in mbedtls.&lt;/p&gt;
&lt;p&gt;I have created an internal jira ticket to improve this configuration setting.&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>