<?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>Flash size constraints</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/81179/flash-size-constraints</link><description>Hi, 
 I am working with nRF52833 DK with nRF Connect SDK. All was going great until I had to add a GNU GSL library. I need it because I need matrix multiplications with complex numbers and eigen decomposition of matrices. When I added the the library</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 04 Nov 2021 14:50:23 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/81179/flash-size-constraints" /><item><title>RE: Flash size constraints</title><link>https://devzone.nordicsemi.com/thread/337529?ContentTypeID=1</link><pubDate>Thu, 04 Nov 2021 14:50:23 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5d434f01-6a09-4012-9503-985374f9afff</guid><dc:creator>ovrebekk</dc:creator><description>&lt;p&gt;Hi&amp;nbsp;&lt;/p&gt;
&lt;p&gt;If that is the case the GNU GSL library alone needs more than 400kB of flash...&lt;/p&gt;
&lt;p&gt;I asked for some input from the software developers, but they didn&amp;#39;t have any good suggestions either. The linker should remove any unused functions automatically, so if it still doesn&amp;#39;t fit in flash there isn&amp;#39;t much you can do.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;The &amp;#39;simple&amp;#39; solution is to get an nRF52840DK or an nRF5340DK.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Theoretically it is possible to run code directly from the external flash chip on the DK, and I will do some checking internally to see if it is possible to configure a project in the nRF Connect SDK to do this.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Best regards&lt;br /&gt;Torbjørn&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Flash size constraints</title><link>https://devzone.nordicsemi.com/thread/337251?ContentTypeID=1</link><pubDate>Wed, 03 Nov 2021 11:52:26 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:432bf3e6-9265-4163-bcfe-f9d6d7c8b763</guid><dc:creator>Ales</dc:creator><description>[quote userid="2116" url="~/f/nordic-q-a/81179/flash-size-constraints/337236#337236"]You could try to set CONFIG_SIZE_OPTIMIZATIONS in your project configuration, as described &lt;a href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/1.0.0/zephyr/reference/kconfig/CONFIG_SIZE_OPTIMIZATIONS.html"&gt;here&lt;/a&gt;.[/quote]
&lt;p&gt;Thanks for that. Unfortunately this method did not show any effect on size of code in my example.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Here is the output with commented function calls for GNU GSL:&lt;/p&gt;
&lt;p&gt;&lt;img src="https://devzone.nordicsemi.com/resized-image/__size/320x240/__key/communityserver-discussions-components-files/4/pastedimage1635938038380v1.png" alt=" " /&gt;&lt;/p&gt;
&lt;p&gt;In case I include the library than this output is not present as errors are displayed. In this case I get error &amp;quot;region `FLASH&amp;#39; overflowed by 10800 bytes&amp;quot;.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Flash size constraints</title><link>https://devzone.nordicsemi.com/thread/337236?ContentTypeID=1</link><pubDate>Wed, 03 Nov 2021 10:33:08 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:04b9744d-6c80-4808-b217-2fb5ff5705b5</guid><dc:creator>ovrebekk</dc:creator><description>&lt;p&gt;Hi Ales&lt;/p&gt;
[quote user="Ales"]&amp;nbsp;As I know -O can have number of possible optimization. -Os is suppose to be optimize for size. Can I include this one? Or is it possible to remove debug information to reduce size?[/quote]
&lt;p&gt;You could try to set CONFIG_SIZE_OPTIMIZATIONS in your project configuration, as described &lt;a href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/1.0.0/zephyr/reference/kconfig/CONFIG_SIZE_OPTIMIZATIONS.html"&gt;here&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;This should ensure that the optimization is set for size.&amp;nbsp;&lt;/p&gt;
[quote user="Ales"]Can you please tell me where can I check that?[/quote]
&lt;p&gt;I think the easiest way is to check the build output before you enable the GLS library, and then check it again after.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;When you have built a project you should see a report of the total RAM and flash consumption, similar to this:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;[9/9] Linking C executable zephyr\zephyr.elf
Memory region         Used Size  Region Size  %age Used
           FLASH:      197400 B         1 MB     18.83%
            SRAM:       46605 B       256 KB     17.78%
        IDT_LIST:          0 GB         2 KB      0.00%&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Best regards&lt;br /&gt;Torbjørn&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Flash size constraints</title><link>https://devzone.nordicsemi.com/thread/337016?ContentTypeID=1</link><pubDate>Tue, 02 Nov 2021 09:41:27 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b2ede2a2-d4c3-4875-a5b1-917dfec189dd</guid><dc:creator>Ales</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;first of all thanks for suggestions.&lt;/p&gt;
&lt;p&gt;1.&lt;/p&gt;
[quote userid="2116" url="~/f/nordic-q-a/81179/flash-size-constraints/336811#336811"]-O is enabled by default, so you don&amp;#39;t have to do anything in order to set this parameter.&amp;nbsp;[/quote]
&lt;p&gt;&amp;nbsp;As I know -O can have number of possible optimization. -Os is suppose to be optimize for size. Can I include this one? Or is it possible to remove debug information to reduce size?&lt;/p&gt;
&lt;p&gt;2.&amp;nbsp;&lt;/p&gt;
[quote userid="2116" url="~/f/nordic-q-a/81179/flash-size-constraints/336811#336811"]I assume you have checked that there are no alternative libraries that could do the job, such as &lt;a href="https://docs.zephyrproject.org/latest/reference/kconfig/CONFIG_CMSIS_DSP_MATRIX.html"&gt;this one&lt;/a&gt;, or &lt;a href="https://github.com/zephyrproject-rtos/zscilib"&gt;this one&lt;/a&gt;?[/quote]
&lt;p&gt;&amp;nbsp; -&amp;nbsp; (first link) as I know a uC with DSP is needed which nRF52833 does not support.&lt;/p&gt;
&lt;p&gt;&amp;nbsp; -&amp;nbsp; (second link) I looked at zscilib but it does not support multiplications on matrices with complex values (only real)&lt;/p&gt;
&lt;p&gt;3.&lt;/p&gt;
[quote userid="2116" url="~/f/nordic-q-a/81179/flash-size-constraints/336811#336811"]Can you let me know what the flash usage of the GNU GSL library alone is, when you build the code?[/quote]
&lt;p&gt;Can you please tell me where can I check that?&lt;/p&gt;
&lt;p&gt;4.&lt;/p&gt;
[quote userid="2116" url="~/f/nordic-q-a/81179/flash-size-constraints/336811#336811"]Maybe you can share the .map file with me?[/quote]
&lt;p&gt;&lt;a href="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/1464.zephyr.map"&gt;devzone.nordicsemi.com/.../1464.zephyr.map&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Flash size constraints</title><link>https://devzone.nordicsemi.com/thread/336811?ContentTypeID=1</link><pubDate>Mon, 01 Nov 2021 09:55:59 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9ad8bda9-7300-4dcf-9748-d34916069b74</guid><dc:creator>ovrebekk</dc:creator><description>&lt;p&gt;Hi Ales&lt;/p&gt;
&lt;p&gt;-O is enabled by default, so you don&amp;#39;t have to do anything in order to set this parameter.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I assume you have checked that there are no alternative libraries that could do the job, such as &lt;a href="https://docs.zephyrproject.org/latest/reference/kconfig/CONFIG_CMSIS_DSP_MATRIX.html"&gt;this one&lt;/a&gt;, or &lt;a href="https://github.com/zephyrproject-rtos/zscilib"&gt;this one&lt;/a&gt;?&lt;/p&gt;
&lt;p&gt;Can you let me know what the flash usage of the GNU GSL library alone is, when you build the code?&lt;/p&gt;
&lt;p&gt;Maybe you can share the .map file with me?&lt;/p&gt;
&lt;p&gt;Best regards&lt;br /&gt;Torbjørn&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Flash size constraints</title><link>https://devzone.nordicsemi.com/thread/336377?ContentTypeID=1</link><pubDate>Thu, 28 Oct 2021 09:08:48 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9ee31853-39d7-4a5d-9a30-451209353dc9</guid><dc:creator>Ales</dc:creator><description>&lt;p&gt;I noticed that screenshot of GSL functions in zephyr.map was not provided so I add it below.&lt;/p&gt;
&lt;p&gt;&lt;img src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/pastedimage1635412100540v1.png" alt=" " /&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>