cpu/atmega_common: make remaining RAM available as heap#10934
Merged
smlng merged 1 commit intoRIOT-OS:masterfrom Apr 15, 2019
Merged
cpu/atmega_common: make remaining RAM available as heap#10934smlng merged 1 commit intoRIOT-OS:masterfrom
smlng merged 1 commit intoRIOT-OS:masterfrom
Conversation
Fills __malloc_heap_end with the current SP before it enters thread mode to make the remaining RAM available as a heap.
f687686 to
ecb2652
Compare
2 tasks
smlng
approved these changes
Apr 15, 2019
Contributor
Author
|
@smlng Thanks |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Contribution description
This PR make the remaining RAM of AVR MCUs available as heap for
malloc/freefunctions ofavr-libc.__malloc_heap_endis set to 0 by default. Therefore,mallocchecks__brkvalagainst the SP instead of__malloc_heap_end.In thread mode, however, the SP is is always in
.datasection below__bss_endand thus below__malloc_heap_start. Since__brkvalpoints at least to__malloc_heap_start, the check always fails.This PR sets
__malloc_heap_endto the current SP before switching to thread mode. Thus,mallocchecks__brkvalagainst__malloc_heap_end.Testing procedure
Use
tests/mallocto checkmalloc/freefunctions ofavr-libc, for example: