Skip to content

Use thread-safe memory manager using C runtime (Newlib) #10

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

Merged
merged 5 commits into from
Oct 16, 2018

Conversation

fpistm
Copy link
Member

@fpistm fpistm commented Oct 12, 2018

Based on Dave Nadler works:
http://www.nadler.com/embedded/newlibAndFreeRTOS.html
and @ppescher suggestions in #9.

This new heap implementation will be used by default.

This also update default config to use linker definition:

#define configMINIMAL_STACK_SIZE          ((uint16_t)((uint32_t)&_Min_Stack_Size/8))
#define configTOTAL_HEAP_SIZE             ((size_t)(&_estack - _Min_Stack_Size - &_end))

This PR fix #8 and #9.

Use STM32 linker and FreeRTOS config definitions.

Signed-off-by: Frederic.Pillon <[email protected]>
By default, the heap_useNewlib.c will be used.
As suggested by @ppescher, use -1 as the number of heap implementations
might grow in future versions.

Signed-off-by: Frederic.Pillon <[email protected]>
@fpistm fpistm added the enhancement New feature or request label Oct 12, 2018
@fpistm fpistm self-assigned this Oct 12, 2018
@rayozzie
Copy link

I've tested these fixes on the Nucleo-L432KC, and they work perfectly. It would be helpful to get them released.

(I should tell you that initially I thought that the fix didn't work. But as it turned out, my code was hitting a newlib _sbrk corruption issue. This issue is apparently fixed but needs to filter downstream. Specifically - the fix was committed to newlib in May/June of 2018 by Jeff Johnston. Apparently this must filter down into the ARM GNU toolchain. I can only hope that the upcoming end-of-year release includes the _sbrk newlib fix.)

In any case, this is a great change and thank you for doing this work!

configTOTAL_HEAP_SIZE could be not constant

Signed-off-by: Frederic.Pillon <[email protected]>
@fpistm fpistm merged commit 9c03660 into stm32duino:master Oct 16, 2018
@fpistm fpistm deleted the newlib branch October 16, 2018 07:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

nucleo-l432kc
2 participants