<?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 usage of examples (bare metal vs FreeRTOS based)</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/54641/flash-usage-of-examples-bare-metal-vs-freertos-based</link><description>I&amp;#39;m working with nRF52832 and playing around with some peripheral examples from SDK 16.0. 
 The FreeRTOS based heart rate sensor example ( ble_app_hrs_freertos) seems to work nice out of the box and I&amp;#39;ve done some small modifications to it, no problem</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 05 Dec 2019 11:48:10 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/54641/flash-usage-of-examples-bare-metal-vs-freertos-based" /><item><title>RE: Flash usage of examples (bare metal vs FreeRTOS based)</title><link>https://devzone.nordicsemi.com/thread/223872?ContentTypeID=1</link><pubDate>Thu, 05 Dec 2019 11:48:10 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e5cfd98b-09cf-40e7-8ee9-20af34986b50</guid><dc:creator>Susheel Nuguru</dc:creator><description>&lt;p&gt;Unfortunately, the documentation is very thin in this context.&lt;/p&gt;
&lt;p&gt;But all the changes are focussed in 5.3.0_59ac345\external\freertos\portable\CMSIS\nrf52 files.&lt;/p&gt;
&lt;p&gt;The changes in priorities, use of PSP instead of MSP. rtc tick handler to update FreeRTOS ticks for the time softdevice kept CPU to itself are some of the changes you can see in these files.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Flash usage of examples (bare metal vs FreeRTOS based)</title><link>https://devzone.nordicsemi.com/thread/223858?ContentTypeID=1</link><pubDate>Thu, 05 Dec 2019 11:25:56 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b32825f9-f149-447c-9067-1d06c837e2ec</guid><dc:creator>TylerD</dc:creator><description>&lt;p&gt;Is there any more information somewhere (infocenter? appnotes?) on how the FreeRTOS and&amp;nbsp;softdevice are&amp;nbsp;married&amp;nbsp;to work with each other? I would like to learn in more detail how it&amp;nbsp;works.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Flash usage of examples (bare metal vs FreeRTOS based)</title><link>https://devzone.nordicsemi.com/thread/223857?ContentTypeID=1</link><pubDate>Thu, 05 Dec 2019 11:19:30 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:36491f22-1327-4d5d-93bd-3eb323829729</guid><dc:creator>Susheel Nuguru</dc:creator><description>[quote user="TylerD"]The FreeRTOS footprint&amp;nbsp;is a&amp;nbsp;totally separate issue. It has nothing to do with sdk_config.h. Quoted from FreeRTOS[/quote]
&lt;p&gt;The FreeRTOS port that you get in our SDK is a bit different than a normal FreeRTOS port you use on the baremetal.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;The FreeRTOS port we give, is different in a way that it is designed to work as an application and not as an privilaged kernel. This is because the FreeRTOS port need to work along side the softdevice and in our BLE stack, softdevice resources and execution has the highest priority over others.&lt;/p&gt;
&lt;p&gt;In terms of footprint, all the FreeRTOS files are compiled into the application. So when you see the footprint big, it is not necessarily being contributed by just freertos files but due to other inclusion of libraries and drivers that are enabled from sdk_config.h but not used&amp;nbsp; Enablign peripherals will cause them to be linked into the hex file&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Flash usage of examples (bare metal vs FreeRTOS based)</title><link>https://devzone.nordicsemi.com/thread/223846?ContentTypeID=1</link><pubDate>Thu, 05 Dec 2019 10:37:41 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5065c226-f74b-42c5-8c41-6a9b0a6aa56c</guid><dc:creator>TylerD</dc:creator><description>&lt;p&gt;OK, I understand I need to dig through the sdk_config.h and remove unnecessary stuff. The challenge is that the config file is HUGE and I was looking for some pointers where to start.&lt;/p&gt;
&lt;p&gt;The FreeRTOS footprint&amp;nbsp;is a&amp;nbsp;totally separate issue. It has nothing to do with sdk_config.h. Quoted from FreeRTOS FAQ:&amp;nbsp;&lt;a href="https://www.freertos.org/FAQMem.html#ROMUse"&gt;https://www.freertos.org/FAQMem.html#ROMUse&lt;/a&gt;&amp;nbsp;-&amp;gt;&lt;/p&gt;
&lt;p&gt;&amp;quot;&lt;span&gt;The RTOS kernel itself required about 5 to 10 KBytes of ROM space&amp;quot;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Assuming the RTOS takes ~10kB, the HRS sample app&amp;nbsp;with&amp;nbsp;logging disabled would then be around 60kB. Therefore I guess I need to concentrate on trying to optimize the BLE app and remove unused features one by one.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Flash usage of examples (bare metal vs FreeRTOS based)</title><link>https://devzone.nordicsemi.com/thread/223804?ContentTypeID=1</link><pubDate>Thu, 05 Dec 2019 09:19:16 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d159ee59-02b0-4b96-b618-c9a11205d38b</guid><dc:creator>Susheel Nuguru</dc:creator><description>&lt;p&gt;I would highly recommend you to understand the sdk_config.h file. This knowledge is quite useful for you in the future, so it will be a good investment in time. After that disable all those things that are not needed in your project. When you start to think about the best performance/lowest power/smallest foot print, then you need to have control on these variables and select them accordingly.&amp;nbsp;&lt;/p&gt;
[quote user="TylerD"]1) What settings should I be looking at to optimize the flash consumed by FreeRTOS[/quote]
&lt;p&gt;&amp;nbsp;The flash size directly is impacted by what features are included in your project. By default we add all the drivers and libraries into your project and hope/expect that you select their inclusion wisely by enabling or disabling them in sdk_config.h file.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Please start to disable the things in sdk_config that you think are definitely not needed in your production version. I am sure you will get&amp;nbsp; better results. It is quite hard from our perspective to suggest what to disable and what to keep enabled. Since these are given as template example for making this functionality work and leaving the footprint engineering to the experts like you by selecting them from sdk_config.h&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Flash usage of examples (bare metal vs FreeRTOS based)</title><link>https://devzone.nordicsemi.com/thread/223787?ContentTypeID=1</link><pubDate>Thu, 05 Dec 2019 08:27:11 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:aeffe40d-54ad-4325-bce1-e7bc152998b0</guid><dc:creator>TylerD</dc:creator><description>&lt;p&gt;Thanks for the tip.&amp;nbsp;Changing NRF_LOG_ENABLED to 0 made the flash footprint ~31kB smaller. This is a good start.&lt;/p&gt;
&lt;p&gt;After disabling log, the size of the HRS sample app is still 70+ kB which&amp;nbsp;seems a bit large, considering it is a very simple app. Is there perhaps some other options that I may need to adjust?&lt;/p&gt;
&lt;p&gt;The 70kB app size is not a showstopper as such.&amp;nbsp;However, I am in the process of setting up the&amp;nbsp;template for a project that will go into production use eventually and I would like to strip off all the unnecessary fat from the project right from the start (instead of trying to shave it off few days before the deadline...)&lt;/p&gt;
&lt;p&gt;This project is FreeRTOS based and the OS obviously adds some bulk to the image. So basically I have two follow-up questions:&lt;/p&gt;
&lt;p&gt;1) What settings should I be looking at to optimize the flash consumed by FreeRTOS&lt;/p&gt;
&lt;p&gt;2) How to minimize the footprint of the BLE application itself (excluding the OS)&lt;/p&gt;
&lt;p&gt;Regarding question 2: the&amp;nbsp;softdevice is a fixed binary&amp;nbsp;with fixed size, so that cannot be optimized.&amp;nbsp;I&amp;#39;m new to Nordic BLE stack so it&amp;#39;s a bit unclear how I can optimize my app footprint, considering that I only need a (relatively small) subset of the features that are available in the s132 stack. If there are some appnotes, blogs etc on this topic then please let me know.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Flash usage of examples (bare metal vs FreeRTOS based)</title><link>https://devzone.nordicsemi.com/thread/223777?ContentTypeID=1</link><pubDate>Thu, 05 Dec 2019 07:53:51 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2e884dd8-7ffd-4a6c-97ca-489a5032e34f</guid><dc:creator>Susheel Nuguru</dc:creator><description>&lt;p&gt;sorry for the late reply. Seems like you are including NRF_LOG_ENABLED in your sdk_config.h file. That would increase a log of foot print. This also makes the BACKEDEND (seems uart in your case) included which includes uart libraries and drivers&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Flash usage of examples (bare metal vs FreeRTOS based)</title><link>https://devzone.nordicsemi.com/thread/222424?ContentTypeID=1</link><pubDate>Wed, 27 Nov 2019 15:18:43 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ab06ffd9-aa13-4dfb-b38d-e1321afbe24e</guid><dc:creator>TylerD</dc:creator><description>&lt;p&gt;Any comments? It&amp;#39;s been a week and I doubt that I&amp;#39;m the only one experimenting with the FreeRTOS based example for nRF52. Is it normal for the simple HRS app to be &amp;gt; 100kB in size??&lt;/p&gt;
&lt;p&gt;I&amp;#39;m relatively new to Nordic parts so don&amp;#39;t know exactly what to expect...&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Flash usage of examples (bare metal vs FreeRTOS based)</title><link>https://devzone.nordicsemi.com/thread/221129?ContentTypeID=1</link><pubDate>Wed, 20 Nov 2019 15:01:28 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:23f3f17a-e31e-4cef-a36d-09a1502d0855</guid><dc:creator>TylerD</dc:creator><description>&lt;p&gt;Some more info: I tried to get detailed breakdown of the flash usage by running command&lt;/p&gt;
&lt;p&gt;nm&amp;nbsp;ble_app_hrs_freertos_pca10040_s132.elf --print-size --size-sort --radix=d&lt;/p&gt;
&lt;p&gt;The output is attached as text file (sorted by size in descending order, including only flash objects).&lt;/p&gt;
&lt;p&gt;&lt;a href="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/sizes.txt"&gt;devzone.nordicsemi.com/.../sizes.txt&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Sum of the sizes is around 95 kB and this was generated from the original FreeRTOS HRS example from SDK 16.0.0, built for devkit pca10040.&lt;/p&gt;
&lt;p&gt;I can&amp;#39;t spot from the list any obvious things that would be consuming lots of flash. There&amp;#39;s just a very long list of small stuff that eventually creates a rather big image.&lt;/p&gt;
&lt;p&gt;Should I be looking into compiler/linker settings? Possibly the linker is not dropping unused functions but keeping everything which would explain why the resulting image is a bit bloated. Any ideas?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>