Static allocation
Joel Sherrill
joel at rtems.org
Tue Sep 28 19:39:43 UTC 2021
On Tue, Sep 28, 2021 at 11:21 AM Петр Борисенко <peter at awsmtek.com> wrote:
>
> > By wanting static allocation only, you need to use the special task and queue create APIs for that and avoid services which do dynamic allocation
>
> Are we talking about some existing API? Can you provide a link for documentation?
Existing APIs. If you use rtems_task_create() the task stack will be
dynamically allocated. If you use rtems_task_construct(), you provide
the stack space and nothing is dynamically allocated.
https://docs.rtems.org/branches/master/c-user/task/directives.html#rtems-task-construct
Similar API for RTEMS message queue where you provide the pending
message buffers
https://docs.rtems.org/branches/master/c-user/message/directives.html#rtems-message-queue-construct
And you want to configure maximum numbers of each type of object so
they are pre-allocated. When you configure unlimited, there is no hard
limit, nothing is pre-allocated.
Sebastian is there any guidance in the Classic API or Users Guide
about static systems?
>
> On Tue, Sep 28, 2021, 6:33 PM Joel Sherrill <joel at rtems.org> wrote:
>>
>>
>>
>>
>> On Tue, Sep 28, 2021, 10:05 AM Петр Борисенко <peter at awsmtek.com> wrote:
>>>
>>> Seems pretty obvious, but I mean kernel. When I define a queue or a task, will it compile statically or it will get memory from heap during the initialization? @Sebastian Huber mentioned that it depends on using of UNLIMITED_OBJECTS configuration option. On
>>
>>
>> Unlimited objects is inherently dynamic memory allocation. It assumes that there are no hard limits on the number of objects created. Historically, all Classic API and POSIX API structures were allocated from the RTEMS Workspace and this lets you dynamically extend the number of objects until you run out of memory.
>>
>> Combine it with unified work area and you can allocate until all memory on your board is consumed.
>>
>> By wanting static allocation only, you need to use the special task and queue create APIs for that and avoid services which do dynamic allocation.
>>
>> --joel
>>>
>>>
>>> On Tue, Sep 28, 2021, 5:26 PM Joel Sherrill <joel at rtems.org> wrote:
>>>>
>>>>
>>>>
>>>> On Tue, Sep 28, 2021, 6:43 AM Петр Борисенко <peter at awsmtek.com> wrote:
>>>>>
>>>>> Hello!
>>>>> Is it possible to compile Rtems statically and disable memory allocation
>>>>> routines and heap?
>>>>
>>>>
>>>> No. You have to restrict your application use of APIs and services to those which do not use dynamic allocation.
>>>>
>>>> --joel
>>>>>
>>>>> _______________________________________________
>>>>> users mailing list
>>>>> users at rtems.org
>>>>> http://lists.rtems.org/mailman/listinfo/users
More information about the users
mailing list