check if the requested memory is really available in _sbrk_r#1782
check if the requested memory is really available in _sbrk_r#1782benpicco merged 3 commits intoRIOT-OS:masterfrom
Conversation
There was a problem hiding this comment.
Assuming that length(ram) is a multiple of 8, try
. = ALIGN(8);
_sheap = .;
. = LENGTH(ram);
_eheap = .;
Then see the .map file whether the results are correct.
There was a problem hiding this comment.
What is the + 4 for?
|
ping? |
tests/malloc/main.c
Outdated
|
Safe for the style issues I guess this PR is fine. |
f915f9f to
e6382e3
Compare
|
Anything in the .map files I should watch out for? |
|
Only if the position of |
looks sane imo |
|
Please rebase. ACK probably |
|
Should I revert 81dea36 and replace it with this more generic way, or should I just drop the cc2538 part from this patch? |
|
like so - can you please test if this is allright @hexluthor ? |
|
Kicked Travis, because the errors seemed unrelated to the PR. |
cpu/cc2538/Makefile.include
Outdated
I'd say yes, use your variant for cc2538, too. |
|
2895002 seems to work ok on my cc2538dk. Feel free to clobber my sbrk() changes in cpu/cc2538. |
|
so ack? |
|
ACK |
|
Needs fixup for spark-core. |
…vailable." This reverts commit 81dea36.
597b78b to
f41d9ba
Compare
|
Travis is happy 😄 |
cpu/sam3x8e/sam3x8e_linkerscript.ld
Outdated
|
ACK, put a newline there, and merge at will. |
|
Ok |
check if the requested memory is really available in _sbrk_r
Most RIOT ports do not check whether the memory returned by
_sbrk_ractually exists, lpc1768 is the notable exception.For it and all other newlib using ports, heap comes after the stack and occupies the remaining available RAM, so it's only necessary to check whether the heap pointer would exceed the physical range.
I've also re-added an old test that causes a hard fault without the patch (because it eventually tries to allocate memory that doesn't exist), but works as intended with the patch, even free works (due to newlib magic).