<?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>garbage collection</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/47677/garbage-collection</link><description>I need to run gc because I get rc =FDS_ERR_NO_SPACE_IN_FLASH. 
 So I run gc simple as written in https://infocenter.nordicsemi.com/topic/com.nordic.infocenter.sdk5.v15.3.0/lib_fds_functionality.html?cp=5_1_3_55_1_2#lib_fds_functionality_gc 
 I just write</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 28 May 2019 13:02:33 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/47677/garbage-collection" /><item><title>RE: garbage collection</title><link>https://devzone.nordicsemi.com/thread/189652?ContentTypeID=1</link><pubDate>Tue, 28 May 2019 13:02:33 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6c449635-293d-4007-a599-deac420a435d</guid><dc:creator>Simonr</dc:creator><description>&lt;p&gt;Hi Bar&lt;/p&gt;
&lt;p&gt;Sorry, but I&amp;#39;ll need you to describe what exactly your project is supposed to do and how to set it up correctly, as it will take an immense amount of time to get into it as is. Step by step would be best. And still, tell me if you want this case set to private!&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Simon&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: garbage collection</title><link>https://devzone.nordicsemi.com/thread/189650?ContentTypeID=1</link><pubDate>Tue, 28 May 2019 12:57:53 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:301350d8-c59d-4358-8e16-99be2d769dd9</guid><dc:creator>Bar</dc:creator><description>&lt;p&gt;I did anther test.&lt;/p&gt;
&lt;p&gt;Every time before and after fds_gc I active fds_stat(&amp;amp;stat); , and compare the statistic in state.&lt;/p&gt;
&lt;p&gt;I actrive the function in this way:&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;em&gt;&lt;strong&gt;rc = fds_stat(&amp;amp;stat); // TEST TEST TEST to see if gc work&lt;/strong&gt;&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;&lt;em&gt;&lt;strong&gt;&amp;nbsp;rc = fds_gc();&lt;/strong&gt;&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;&lt;em&gt;&lt;strong&gt;&amp;nbsp;rc = fds_stat(&amp;amp;stat); // TEST TEST TEST to see if gc work&lt;/strong&gt;&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;When it wasn&amp;#39;t on the limit of the FLASH the &lt;strong&gt;gc&lt;/strong&gt; work fine and if there was dirty record it&amp;nbsp;remove them.&lt;/p&gt;
&lt;p&gt;But when I get to&amp;nbsp;rc == FDS_ERR_NO_SPACE_IN_FLASH and try the same I get before the &lt;strong&gt;gc&lt;/strong&gt; this statistic:&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;pages_available= 0x3&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;open_records= 0x0&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;valid_records= 0x56&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;dirty_records=0x55&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;words_used= 0x07FA&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;largest_contig=0x4&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;freeable_words=0x03F5&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;corruption=false&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;But there it go to hardfault.&lt;/p&gt;
&lt;p&gt;The number looks logical because for ease record I update it in the past, and there is still free words.&lt;/p&gt;
&lt;p&gt;Is this give any clue?&lt;/p&gt;
&lt;p&gt;Bar.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: garbage collection</title><link>https://devzone.nordicsemi.com/thread/189545?ContentTypeID=1</link><pubDate>Tue, 28 May 2019 09:35:51 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b91b7174-69c8-4718-8a57-d904fee76a4c</guid><dc:creator>Bar</dc:creator><description>&lt;p&gt;Hi&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I play with the&amp;nbsp;&lt;span&gt;FDS_VIRTUAL_PAGE_SIZE (1024/2048)and FDS_VIRTUAL_PAGES(3/6) but it just expend the write area before get to the gc. The gc crass when get to the execute.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;I attach a link to the whole project&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="https://drive.google.com/open?id=1wMrGyR6BABrZEiQG8R0lDPVpJIehySsT"&gt;https://drive.google.com/open?id=1wMrGyR6BABrZEiQG8R0lDPVpJIehySsT&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;The fail get&amp;nbsp;around written list 85. Then when go to fds_gc&lt;/p&gt;
&lt;p&gt;Bar&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: garbage collection</title><link>https://devzone.nordicsemi.com/thread/189475?ContentTypeID=1</link><pubDate>Tue, 28 May 2019 07:42:13 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:58896827-6594-47d4-b05f-bf4f4df41553</guid><dc:creator>Simonr</dc:creator><description>&lt;p&gt;Hello Bar&lt;/p&gt;
&lt;p&gt;Then, what have you set FDS_VIRTUAL_PAGE_SIZE and FDS_VIRTUAL_PAGES as? Remember that these values should add up with the actual amount of needed flash pages and flash page size.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;If you&amp;#39;d like, you can send me your project so that I can try to debug it from my side, as I&amp;#39;m still unsure what exactly is causing this hard fault of yours. If you don&amp;#39;t want to share your project publicly on DevZone I can set this case to private so that only Nordic engineers will be able to see it.&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Simon&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: garbage collection</title><link>https://devzone.nordicsemi.com/thread/189364?ContentTypeID=1</link><pubDate>Mon, 27 May 2019 13:52:21 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c1a00ec7-d1ec-4ca2-a4e6-06c4fd84356b</guid><dc:creator>Bar</dc:creator><description>&lt;p&gt;I do all of this on the DK PCA10056.&lt;/p&gt;
&lt;p&gt;&lt;span&gt;FDS_VIRTUAL_PAGE_SIZE tand FDS_VIRTUAL_PAGES&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;I read it on this post&amp;nbsp;&lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/25923/fds-gc-seems-not-to-work"&gt;https://devzone.nordicsemi.com/f/nordic-q-a/25923/fds-gc-seems-not-to-work&lt;/a&gt;&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: garbage collection</title><link>https://devzone.nordicsemi.com/thread/189352?ContentTypeID=1</link><pubDate>Mon, 27 May 2019 13:27:22 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9db2cc00-c386-4fc4-b1c0-a40bf7d6d1e3</guid><dc:creator>Bar</dc:creator><description>&lt;p&gt;O.K.&lt;/p&gt;
&lt;p&gt;I do today a lot of fine tuning and adapt to do the FDS_gc() exactly as run in&amp;nbsp;&lt;span&gt;ble_app_gatts_c example.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;But the some result. It&amp;nbsp;send the full FLASH event and trigger the FDS_gc() but on the queue handling it fail to hardfault. From my previous&amp;nbsp;experience&amp;nbsp;I know it concern to memory leakage because to small &amp;quot;room&amp;quot; for one of the operation.&amp;nbsp;maybe the gc need more space (each file I made is 2K) to make the job. Which defines I can &amp;quot;play&amp;quot; with and there meaning?&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: garbage collection</title><link>https://devzone.nordicsemi.com/thread/189351?ContentTypeID=1</link><pubDate>Mon, 27 May 2019 13:25:33 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:af45a608-78f2-4642-ac5c-1f3d675d72fa</guid><dc:creator>Simonr</dc:creator><description>&lt;p&gt;Hi Bar&lt;/p&gt;
&lt;p&gt;Are you using a development kit or a custom board? And would it be possible to recreate on a development kit? Also, what do you mean by virtual flash?&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Simon&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: garbage collection</title><link>https://devzone.nordicsemi.com/thread/189264?ContentTypeID=1</link><pubDate>Mon, 27 May 2019 10:09:54 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:baea95fc-5dff-41be-a392-430d0d1594d1</guid><dc:creator>Bar</dc:creator><description>&lt;p&gt;Hello Simon.&lt;/p&gt;
&lt;p&gt;I trigger the gc when I get&amp;nbsp;FDS_ERR_NO_SPACE_IN_FLASH.&lt;/p&gt;
&lt;p&gt;I don&amp;#39;t get any error when go into the gc itself until I get to gc_execute(uint32_t prev_ret) and then with no ERROR it go to hardfault.&lt;/p&gt;
&lt;p&gt;Maybe it concern the size of the virtual FLASH I give? I read some issue about it and I see all use peer management also it must use for the ble. I take an example of using peer management, and I try to implement it in my work also I need to add a lot of files because I don&amp;#39;t use it for ble purpose.&amp;nbsp; Do you see it will help use the peer or I can do it without this? I will look aty the example you take about and see if I can find something I forget.&lt;/p&gt;
&lt;p&gt;Bar.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: garbage collection</title><link>https://devzone.nordicsemi.com/thread/189217?ContentTypeID=1</link><pubDate>Mon, 27 May 2019 07:57:49 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:254479ef-59f2-4812-af99-95a0920f3bf7</guid><dc:creator>Simonr</dc:creator><description>&lt;p&gt;Hi Bar&lt;/p&gt;
&lt;p&gt;How exactly do you trigger the gc? Do you get any kind of error code so we can see what exactly goes wrong? The fds_gc() function is implemented in the ble_app_gatts_c example, so you could look at that and see if you understand more. You also have to make sure that fds.c and fds.h is included in your project.&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Simon&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: garbage collection</title><link>https://devzone.nordicsemi.com/thread/189142?ContentTypeID=1</link><pubDate>Sun, 26 May 2019 09:42:42 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7e69b967-fa13-4b69-8f2b-ad94de56ca6e</guid><dc:creator>Bar</dc:creator><description>&lt;p&gt;I use this part&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;strong&gt; err_code = fds_gc();&lt;/strong&gt;&lt;br /&gt;&lt;strong&gt; if (err_code == FDS_ERR_BUSY || err_code == FDS_ERR_NO_SPACE_IN_QUEUES)&lt;/strong&gt;&lt;br /&gt;&lt;strong&gt; {&lt;/strong&gt;&lt;br /&gt;&lt;strong&gt; // Retry.&lt;/strong&gt;&lt;br /&gt;&lt;strong&gt; }&lt;/strong&gt;&lt;br /&gt;&lt;strong&gt; else&lt;/strong&gt;&lt;br /&gt;&lt;strong&gt; {&lt;/strong&gt;&lt;br /&gt;&lt;strong&gt; APP_ERROR_CHECK(err_code);&lt;/strong&gt;&lt;br /&gt;&lt;strong&gt; }&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;But still go to hard fault when use it .&lt;/p&gt;
&lt;p&gt;Is there a stack size or any pre init for the gc that I miss?&lt;/p&gt;
&lt;p&gt;Bar.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: garbage collection</title><link>https://devzone.nordicsemi.com/thread/189137?ContentTypeID=1</link><pubDate>Sun, 26 May 2019 05:42:54 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f8f91ec5-6140-491c-8dd1-216d65e40a83</guid><dc:creator>Bar</dc:creator><description>&lt;p&gt;thanks Simon.&lt;/p&gt;
&lt;p&gt;But what active it?&lt;/p&gt;
&lt;p&gt;I1. which action trigger this case?&lt;/p&gt;
&lt;p&gt;If written to the FLASH trigger this function it will be too late, because I can&amp;#39;t make the writing again.&lt;/p&gt;
&lt;p&gt;2. Where I include (init) this handler in my program ?&lt;/p&gt;
&lt;p&gt;3. What is the difference, between my written and this one?&lt;/p&gt;
&lt;p&gt;4. What can I do with the retry? if I still do fds_gc(); I can endup with endless loop?&lt;/p&gt;
&lt;p&gt;Bar.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: garbage collection</title><link>https://devzone.nordicsemi.com/thread/188947?ContentTypeID=1</link><pubDate>Fri, 24 May 2019 06:43:10 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1c112ed9-976f-4c0d-af6a-0b22779c560c</guid><dc:creator>Simonr</dc:creator><description>&lt;p&gt;Hi Bar&lt;/p&gt;
&lt;p&gt;Something like this function should suffice (This function uses the peer manager):&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt; case PM_EVT_STORAGE_FULL:
        {
            // Run garbage collection on the flash.
            err_code = fds_gc();
            if (err_code == FDS_ERR_BUSY || err_code == FDS_ERR_NO_SPACE_IN_QUEUES)
            {
                // Retry.
            }
            else
            {
                APP_ERROR_CHECK(err_code);
            }&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Simon&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>