Skip to content

Commit 4c489e6

Browse files
committed
RTOS: Thread: Fix how free stack is calculated
1 parent 505beb7 commit 4c489e6

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

rtos/Thread.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,7 @@ uint32_t Thread::free_stack() {
240240

241241
if (_tid != NULL) {
242242
os_thread_t *thread = (os_thread_t *)_tid;
243-
size = (uint32_t)thread->stack_mem - thread->sp;
243+
size = (uint32_t)thread->sp - (uint32_t)thread->stack_mem;
244244
}
245245

246246
_mutex.unlock();

0 commit comments

Comments
 (0)