<?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>query about sorted list from nrf5 SDK</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/111118/query-about-sorted-list-from-nrf5-sdk</link><description>Hi there, 
 I want to manage certain devices that have an address and a value. I would like to dynamically add and remove devices from my data structure. I believe that using a linked list would be the best choice for this task. It&amp;#39;s essential that I</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 23 May 2024 10:57:48 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/111118/query-about-sorted-list-from-nrf5-sdk" /><item><title>RE: query about sorted list from nrf5 SDK</title><link>https://devzone.nordicsemi.com/thread/485602?ContentTypeID=1</link><pubDate>Thu, 23 May 2024 10:57:48 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b4db106b-506b-41f8-88b8-f037e1b70ce5</guid><dc:creator>Hieu</dc:creator><description>&lt;p&gt;Hi Josh,&lt;/p&gt;
[quote user="J0sh1101"]Looking at the implementation of the memory manager, I feel a bit cheated, but hey, this is how things are done in embedded world. The memory manager defines memory region in the .bss section with a static variable and from this memory it returns chunks of it. I am not completely sure, but this is not how heap should be created.&amp;nbsp;[/quote]
&lt;p&gt;You are right,&amp;nbsp;it&amp;nbsp;is not real heap memory allocation, but an illusion of that created by allocating memory in a dedicated&amp;nbsp;region.&lt;/p&gt;
&lt;p&gt;Thank you for the kind words. Please feel free to close this case at your convenience &lt;span class="emoticon" data-url="https://devzone.nordicsemi.com/cfs-file/__key/system/emoji/1f642.svg" title="Slight smile"&gt;&amp;#x1f642;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Hieu&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: query about sorted list from nrf5 SDK</title><link>https://devzone.nordicsemi.com/thread/485174?ContentTypeID=1</link><pubDate>Tue, 21 May 2024 14:12:47 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ceb89406-ce63-499e-9ddd-415b58e2272b</guid><dc:creator>J0sh1101</dc:creator><description>&lt;p&gt;Hi Hieu,&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p&gt;your answer was spot on.&lt;/p&gt;
[quote userid="9456" url="~/f/nordic-q-a/111118/query-about-sorted-list-from-nrf5-sdk/483302"]There is also &lt;a href="https://infocenter.nordicsemi.com/topic/sdk_nrf5_v17.1.0/lib_mem_manager.html"&gt;the Memory Manager library&lt;/a&gt; for this. As far as I can see, there is no example for it though.[/quote]
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Looking at the implementation of the memory manager, I feel a bit cheated, but hey, this is how things are done in embedded world. The memory manager defines memory region in the .bss section with a static variable and from this memory it returns chunks of it. I am not completely sure, but this is not how heap should be created.&amp;nbsp;&lt;/p&gt;
[quote userid="9456" url="~/f/nordic-q-a/111118/query-about-sorted-list-from-nrf5-sdk/483302"]Speaking on behalf of the company is quite the pressure. I would recommend the Memory Manager library for the dynamic allocation topic.[/quote]
&lt;p&gt;I think you did a good job. Thanks!&lt;br /&gt;&lt;br /&gt;Best Regards,&lt;/p&gt;
&lt;p&gt;Josh&lt;/p&gt;
&lt;p&gt;&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: query about sorted list from nrf5 SDK</title><link>https://devzone.nordicsemi.com/thread/483302?ContentTypeID=1</link><pubDate>Tue, 14 May 2024 13:21:59 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6043226a-f347-4947-8d5b-f5944d81dbd5</guid><dc:creator>Hieu</dc:creator><description>&lt;p&gt;Hi&amp;nbsp;J0sh1101,&lt;/p&gt;
[quote user=""]Initially, I considered using the &lt;a href="https://infocenter.nordicsemi.com/topic/sdk_nrf5_v17.0.2/lib_sortlist.html"&gt;Sorted List library from the nRF5 SDK&lt;/a&gt;, but despite a thorough search, I couldn&amp;#39;t find any relevant examples in the SDK examples folder or on the web, and I also found that the online documentation was quite sparse and there seemed to be&lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/87917/bug-in-nrf_sortlist"&gt; some bugs&lt;/a&gt;, &lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/70717/infinite-loop-in-app_timer-causes-nrf-to-hang-and-triggers-watchdog-reset"&gt;link2&lt;/a&gt;. Nevertheless, I created a simple example that seems to work reasonably well.[/quote]
&lt;p&gt;It&amp;#39;s great that you have found the information about the bug. Unfortunately, the unfixed bug and absence of example have been and will remain to be the state of things.&amp;nbsp;&lt;br /&gt;This is because the nRF5 SDK is in &lt;a href="https://devzone.nordicsemi.com/nordic/nordic-blog/b/blog/posts/nrf-connect-sdk-and-nrf5-sdk-statement"&gt;maintenance mode;&lt;/a&gt;&amp;nbsp;features, examples, as well as documentation will not be updated.&lt;/p&gt;
&lt;p&gt;On this note, if you are at the very early stage of your project, we recommend using &lt;a href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/nrf/index.html"&gt;the nRF Connect SDK&lt;/a&gt; instead.&lt;/p&gt;
[quote user=""]In this implementation I would also need to deal with memory allocations. Is there an example of how should I allocate heap memory?&lt;br /&gt;Also, I&amp;#39;m curious if there are any additional examples or resources related to sorted linked lists that I may have missed.[/quote]
&lt;p&gt;There is also &lt;a href="https://infocenter.nordicsemi.com/topic/sdk_nrf5_v17.1.0/lib_mem_manager.html"&gt;the Memory Manager library&lt;/a&gt; for this. As far as I can see, there is no example for it though.&lt;/p&gt;
[quote user=""]Would Nordic recommend that I use a different library or approach?[/quote]
&lt;p&gt;Speaking on behalf of the company is quite the pressure. I would recommend the Memory Manager library for the dynamic allocation topic.&lt;/p&gt;
&lt;p&gt;For&amp;nbsp;Sorted List, I think&amp;nbsp;the current library, or any open source one would work.&lt;/p&gt;
&lt;p&gt;Hieu&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>