Skip to content

Support for optionally allocating stacks separate from the heap. #262

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from

Conversation

eboling
Copy link

@eboling eboling commented Feb 12, 2021

Optional Separate Stack Allocation

Description

This change adds support for a new configuration parameter (configSUPPORT_SEPARATE_STACK_ALLOCATION), defaulted to 0, which when set will cause dynamic stack allocation to use new portable layer functions pvPortMallocStack and vPortFreeStack instead of pvPortMalloc and vPortFree. This allows a client the option of providing separate allocators for stacks and the heap.

The changes are limited to the kernel, proper. Sample allocators are not provided.

Test Steps

Compile tasks.c with the new configuration parameter set to 0 and 1, and observe the changes of calls to pvPortMalloc/vPortFree to pvPortMallocStack/vPortFreeStack.

Related Issue

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

A new configuration macro (configSUPPORT_SEPARATE_STACK_ALLOCATION)
was added to allow stack allocation calls in tasks.c to be redirected
to a new portable layer allocation function.  This allows a client to
opt to add a separate stack allocator for dynamic stack allocation.
The default is the current behavior, which is to allocate stacks with
pvPortMalloc.
@eboling eboling requested a review from a team as a code owner February 12, 2021 16:34
@@ -896,6 +896,11 @@
#define configSUPPORT_DYNAMIC_ALLOCATION 1
#endif

#ifndef configSUPPORT_SEPARATE_STACK_ALLOCATION
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please change the config parameter name to configSTACK_ALLOCATION_FROM_SEPARATE_HEAP.

@aggarg
Copy link
Member

aggarg commented Feb 12, 2021

Please add pvPortMallocStack to .github/lexicon.txt.

@aggarg
Copy link
Member

aggarg commented Feb 24, 2021

I have addressed the suggested name change and spell check failure in this PR: #267

I needed to open a separate PR because I did not have write access to https://github.com/DoverMicrosystems/FreeRTOS-Kernel.

Thank you for your contribution.

@aggarg aggarg closed this Feb 24, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants