mirror of https://github.com/ARMmbed/mbed-os.git
Fix Stack stats by running the test command with "-DMBED_HEAP_STATS_ENABLED=1"
In CI, I receive an mbed assert of stack stats by running the following commands. Its assert is TIMEOUT. mbed test -m RZ_A1H -t GCC_ARM -DMBED_STACK_STATS_ENABLED=1 --clean --compile mbed test -m RZ_A1H -t GCC_ARM --run -n tests-mbed_drivers-stl_features -v So, I fixed the process of related to stack stats (osThreadInfoStackMax).The Detail contents is here. https://github.com/ARMmbed/mbed-os/issues/3273#issuecomment-268407191pull/3755/head
parent
b8fccedbc8
commit
ee87e5cf57
|
@ -107,7 +107,11 @@
|
||||||
// <i> Initialize thread stack with watermark pattern for analyzing stack usage (current/maximum) in System and Thread Viewer.
|
// <i> Initialize thread stack with watermark pattern for analyzing stack usage (current/maximum) in System and Thread Viewer.
|
||||||
// <i> Enabling this option increases significantly the execution time of osThreadCreate.
|
// <i> Enabling this option increases significantly the execution time of osThreadCreate.
|
||||||
#ifndef OS_STKINIT
|
#ifndef OS_STKINIT
|
||||||
#define OS_STKINIT 0
|
#if (defined(MBED_STACK_STATS_ENABLED) && MBED_STACK_STATS_ENABLED)
|
||||||
|
#define OS_STKINIT 1
|
||||||
|
#else
|
||||||
|
#define OS_STKINIT 0
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// <o>Processor mode for thread execution
|
// <o>Processor mode for thread execution
|
||||||
|
|
|
@ -843,10 +843,27 @@ os_InRegs osEvent_type svcThreadGetInfo (osThreadId thread_id, osThreadInfo info
|
||||||
}
|
}
|
||||||
|
|
||||||
if (osThreadInfoStackMax == info) {
|
if (osThreadInfoStackMax == info) {
|
||||||
// Cortex-A RTX does not have stack init so
|
uint32_t i;
|
||||||
// the maximum stack usage cannot be obtained.
|
uint32_t *stack_ptr;
|
||||||
ret.status = osErrorResource;
|
uint32_t stack_size;
|
||||||
return osEvent_ret_status;
|
if (!(os_stackinfo & (1 << 28))) {
|
||||||
|
// Stack init must be turned on for max stack usage
|
||||||
|
ret.status = osErrorResource;
|
||||||
|
return osEvent_ret_status;
|
||||||
|
}
|
||||||
|
stack_ptr = (uint32_t*)ptcb->stack;
|
||||||
|
stack_size = ptcb->priv_stack;
|
||||||
|
if (0 == stack_size) {
|
||||||
|
// This is an OS task - always a fixed size
|
||||||
|
stack_size = os_stackinfo & 0x3FFFF;
|
||||||
|
}
|
||||||
|
for (i = 1; i <stack_size / 4; i++) {
|
||||||
|
if (stack_ptr[i] != MAGIC_PATTERN) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
ret.value.v = stack_size - i * 4;
|
||||||
|
return osEvent_ret_value;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (osThreadInfoEntry == info) {
|
if (osThreadInfoEntry == info) {
|
||||||
|
|
Loading…
Reference in New Issue