cpu/msp430_common: set top of heap for sbrk#10943
Merged
jcarrano merged 1 commit intoRIOT-OS:masterfrom Mar 21, 2019
Merged
Conversation
This was referenced Feb 5, 2019
jcarrano
approved these changes
Mar 12, 2019
Contributor
jcarrano
left a comment
There was a problem hiding this comment.
I tested it in IOTLAB. It works fine. I'd like to have STACK_EXTRA explained a little, though.
Contributor
Author
|
@jcarrano Thank you for testing it. |
Contributor
|
Oh, and by the way, I'm working on revamping the malloc tests. It's going to take a while since I'm taking it as a chance to try out some new testing infrastructure PRs. |
Contributor
|
Squash and merge it. |
Set __heap_end to current SP before entering thread mode to make the remaining RAM available as heap for module oneway_malloc.
2daa715 to
55f4331
Compare
Contributor
Author
|
@jcarrano Squashed, but merge shouldn't be done by the author. |
Contributor
Author
|
@jcarrano Don't forget to merge 😉 |
Contributor
|
@gschorcht sorry, I forgot!!! |
Contributor
Author
|
Thanks, no problem. |
2 tasks
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
MSP430 uses the module 'oneway_malloc' to provide the
mallocfunction. The implementedsbrkfunction always checks whether the current break valuecur_breakis less than the SP. However, sincecur_breakstarts above the.bsssection while SP in thread mode is always in thread stacks in.bsssection, this check always fails andmallocdoes not work.This PR fixes this problem by setting a variable
__heap_endin thestartupfunction to the current position of SP immediately before entering the thread mode.sbrkthen checkscur_breakvalue against this__heap_endvariable.The changes of this PR require 10 additional bytes of ROM and 2 additional bytes of RAM.
Testing procedure
Use
tests/mallocwith the current master and the changes in this PR to verify the differences, for example:With current master,
tests/mallocdoesn't work at all and gives no output. With the changes in this PR,mallocfunction works.freealways fails since it is not implemented inoneway_malloc.Issues/PRs references
This PR is prerequisite for PR #10944.