-
Notifications
You must be signed in to change notification settings - Fork 3k
Heap and main thread stack checking #2367
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
Conversation
/morph test |
@mbed-bot: TEST HOST_OSES=windows |
[Build 769] |
/morph test |
Result: FAILUREYour command has finished executing! Here's what you wrote!
Outputmbed Build Number: 599 Test failed! |
Result: FAILUREYour command has finished executing! Here's what you wrote!
Outputmbed Build Number: 601 Test failed! |
@c1728p9 Test looks ok, false failure 👍 |
Commit 4055d08 looks good. How did you test this? |
4055d08
to
09c98a3
Compare
/morph test |
@mbed-bot: TEST HOST_OSES=windows |
[Build 783] |
Result: FAILUREYour command has finished executing! Here's what you wrote!
Outputmbed Build Number: 614 Build failed! |
/morph test |
@mbed-bot: TEST HOST_OSES=windows |
@@ -714,3 +726,34 @@ extern "C" void __env_unlock( struct _reent *_r ) | |||
#endif | |||
|
|||
} // namespace mbed | |||
|
|||
void* operator new(std::size_t count) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nitpick:
void* operator new(std::size_t count)
void *operator new(std::size_t count)
void* operator new[](std::size_t count)
void *operator new[](std::size_t count)
void operator delete(void* ptr)
void operator delete(void *ptr)
void operator delete[](void* ptr)
void operator delete[](void *ptr)
[Build 785] |
Result: FAILUREYour command has finished executing! Here's what you wrote!
Outputmbed Build Number: 616 Test failed! |
ff8f789
to
66bc6a2
Compare
/morph test |
@mbed-bot: TEST HOST_OSES=windows |
Result: FAILUREYour command has finished executing! Here's what you wrote!
Outputmbed Build Number: 617 Test failed! |
[Build 787] |
Please refrain from adding non-relevant commits (targets changes), that could be a separate patch. Can you please fix formatting of |
@@ -0,0 +1,218 @@ | |||
#include <stdio.h> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this file should contain license on the top, please add it
+1 for consolidating stack and heap, and enabling checking for the main thread. Tests fail for cfstore (2 errors there, for 2 targets and only GCC_ARM), I dont think its related to this changeset. @simonqhughes Any pointers? |
@0xc0170 Pretty sure he made that target patch so the test would pass (it previously failed due to the other changes in this PR). So I think that's justified. |
Set well defined limits for the heap and configure GCC and ARMCC to correctly check these. IAR already correctly checked its heap. This also statically declares the main thread stack in IAR so the linker is responsible for its placement. This must be statically declared since the majority of IAR .icf files make no guarantees where free space is located. For GCC_ARM and ARM the main thread stack is placed inside the heap and the heap size is adjusted to account for this.
Decrease the main stack size for the nrf51 so there is more heap space available.
When new or new[] fails to allocate space trigger an error.
With the latest K64F linker file the initial stack is out of sync with INITIAL_SP when uVisor is not present. This patch removes the incorrect declaration.
Since the heap and stack are no longer shared, stack checking on the main thread can be turned back on. This allows stack overflows on the main thread to be caught quickly.
Test the following components of the heap and stacks: -Heap, Interrupt stack and thread stack are at the expected locations -Entire range of main stack can be used without corrupting memory -Entire heap can be used -Heap limit is properly enforced and returns NULL when out of of memory
Decrease the interrupt stack of the NUC472 from 12KB to 8KB. This frees up enough space to allow the core tests to run.
Set the initial stack pointer to the end of ram so it matches INITIAL_SP defined in RTX_CM_lib.h.
The config store tests use more than 2K of the interrupt stack, causing an overflow. This patch bumps the K64F interrupt stack size to 4K for ARMCC and GCC. The IAR interrupt stack is left untouched since it is 32K.
66bc6a2
to
1d2d9bd
Compare
/morph test |
@mbed-bot: TEST HOST_OSES=windows |
[Build 789] |
Result: FAILUREYour command has finished executing! Here's what you wrote!
Outputmbed Build Number: 622 Test Cleanup failed! |
Interesting error (Test Cleanup), looking into it now. But tests all passed 👍 |
@mbed-bot: TEST HOST_OSES=windows |
[Build 791] |
Turn on main thread stack checking. This PR is on top of #2319