1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2025-12-25 06:23:53 +01:00

Merge pull request #5558 from gebart/pr/cortexm-isr-stack-usage

cortexm_common: Fix isr_stack usage count
This commit is contained in:
Joakim Nohlgård 2016-06-23 08:48:44 +02:00 committed by GitHub
commit edaa5bb7a8

View File

@ -257,10 +257,14 @@ void thread_arch_stack_print(void)
/* This function returns the number of bytes used on the ISR stack */
int thread_arch_isr_stack_usage(void)
{
uint32_t *ptr = &_sstack;
uint32_t *ptr = &_sstack;
while (*(ptr++) == STACK_CANARY_WORD) {}
return (ISR_STACKSIZE - (ptr - &_sstack));
while(((*ptr) == STACK_CANARY_WORD) && (ptr < &_estack)) {
++ptr;
}
ptrdiff_t num_used_words = &_estack - ptr;
return num_used_words * sizeof(*ptr);
}
__attribute__((naked)) void NORETURN thread_arch_start_threading(void)