Hi Andris,

Ok, thank you for the valuable information!

Martin

-------- Original Message  --------
Subject: Re: [Tinyos-help] Managing table with neighbors - dynamic 
allocation
From: András Bíró <bband...@gmail.com>
To: Martin Stehlik <stehli...@atlas.cz>
Cc: tinyos-help@millennium.berkeley.edu
Date: Monday, November 21, 2011 14:46:44

> Hi Martin,
>
> After compilation tinyos prints the ram/rom usage of tha application
> with the gnu size util (or avr-size or msp430-size, depending on your
> platform). As I mentioned earlier ram is not really precise, I usually
> leave about 10% of the memory "free" (available for stack), and I
> never had problem with that method.
>
> Andris
>
> 2011/11/21 Martin Stehlik<stehli...@atlas.cz>:
>> Hi Andris,
>>
>> Thank you. I know the overall amount of memory but I do not know how much is
>> remaining (can be used) for the table. Nevertheless, I have some idea now.
>> The main point was to ensure myself that using dynamic allocation is not
>> good method and I should avoid it.
>>
>> Thank you very much.
>> Martin
>>
>> -------- Original Message  --------
>> Subject: Re: [Tinyos-help] Managing table with neighbors - dynamic
>> allocation
>> From: András Bíró<bband...@gmail.com>
>> To: Martin Stehlik<stehli...@atlas.cz>
>> Cc: tinyos-help@millennium.berkeley.edu
>> Date: Monday, November 21, 2011 14:25:56
>>
>>> Hi Martin,
>>>
>>> The memory size should be in the datasheets. If it's not in the
>>> platform datasheet, then check the microcontroller's datasheet (it's
>>> usually about 2-10kB).
>>>
>>> Andris
>>>
>>> On Mon, Nov 21, 2011 at 2:15 PM, Martin Stehlik<stehli...@atlas.cz>
>>>   wrote:
>>>>
>>>> Hi Andris,
>>>>
>>>> Thank you for your answer! You understood correctly and I am aware of
>>>> the reason why I should not allocate the memory dynamically.
>>>>
>>>> Thus, I will probably set the size of the data at compilation-time. Is
>>>> there any method how I can find out the available amount of the hardware
>>>> memory?
>>>>
>>>> Thank you very much.
>>>> Martin
>>>>
>>>> -------- Original Message  --------
>>>> Subject: Re: [Tinyos-help] Managing table with neighbors - dynamic
>>>> allocation
>>>> From: András Bíró<bband...@gmail.com>
>>>> To: Martin Stehlik<stehli...@atlas.cz>
>>>> Cc: tinyos-help@millennium.berkeley.edu
>>>> Date: Monday, November 21, 2011 13:39:37
>>>>
>>>>> Hi Martin,
>>>>>
>>>>> If I understood correctly, the reason for not recommending dynamic
>>>>> memory in tinyos is that there's no memory protection at all. Your
>>>>> data memory grows from one side of the memory, and the stack grows
>>>>> from the other side, if they're overlap, that could cause a hardly
>>>>> understandable crash. Using dynamic memory allocation causes
>>>>> fragmentation in data memory, therefor it's unpredictable when will
>>>>> they overlap.
>>>>> So, most peaple sets the size of such data compilation-time, to the
>>>>> maximum which fits in the hardware memory (warning: the size util,
>>>>> which prints the rom/ram usage after tinyos compile is not really
>>>>> accurate, probably because it doesn't count the stack).
>>>>>
>>>>> Andris
>>>>>
>>>>> On Mon, Nov 21, 2011 at 1:13 PM, Martin Stehlik<stehli...@atlas.cz>
>>>>>   wrote:
>>>>>>
>>>>>> Hello!
>>>>>>
>>>>>> Is anyone experienced with dynamic allocation of tables (arrays) in
>>>>>> TinyOS? I need to store a table of neighbors in each of the nodes
>>>>>> containing some information like RSSI of the messages coming from the
>>>>>> neighbors etc. I do not know the number of neighbors in advance (I can
>>>>>> discover them using some "Hello" message etc. whenever). It means that
>>>>>> the table should grow dynamically once a new neighbor is discovered.
>>>>>>
>>>>>> My first idea was using structures and dynamically allocate new items
>>>>>> in
>>>>>> the list (actually an implementation of linked list). Then I read in
>>>>>> mailing list and in documentation that the usage of malloc etc. is not
>>>>>> recommended. I have also found several data structures like queue or
>>>>>> pool but they do not seem to be suitable for my purpose. I could also
>>>>>> allocate the memory statically during compile time but I am afraid it
>>>>>> would be wasting of memory and the application would not be robust for
>>>>>> high amount of neighbors.
>>>>>>
>>>>>> Can anyone suggest me some suitable and effective solution for my
>>>>>> problem?
>>>>>>
>>>>>> I will welcome any answer or suggestion very much!
>>>>>>
>>>>>> Best,
>>>>>> Martin
>>>>>> _______________________________________________
>>>>>> Tinyos-help mailing list
>>>>>> Tinyos-help@millennium.berkeley.edu
>>>>>>
>>>>>> https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help
>>>>>>
>>>> _______________________________________________
>>>> Tinyos-help mailing list
>>>> Tinyos-help@millennium.berkeley.edu
>>>> https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help
>>>>
>>
_______________________________________________
Tinyos-help mailing list
Tinyos-help@millennium.berkeley.edu
https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help

Reply via email to