cortexm_common: Fix isr_stack_usage
Refactor and add multiply by word size to get the usage in number of bytes instead of in number of words. Verified implementation by manual memory inspection in GDB.
This commit is contained in:
parent
4c91121372
commit
cb19a4c709
@ -257,10 +257,14 @@ void thread_arch_stack_print(void)
|
|||||||
/* This function returns the number of bytes used on the ISR stack */
|
/* This function returns the number of bytes used on the ISR stack */
|
||||||
int thread_arch_isr_stack_usage(void)
|
int thread_arch_isr_stack_usage(void)
|
||||||
{
|
{
|
||||||
uint32_t *ptr = &_sstack;
|
uint32_t *ptr = &_sstack;
|
||||||
|
|
||||||
while (*(ptr++) == STACK_CANARY_WORD) {}
|
while(((*ptr) == STACK_CANARY_WORD) && (ptr < &_estack)) {
|
||||||
return (ISR_STACKSIZE - (ptr - &_sstack));
|
++ptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
ptrdiff_t num_used_words = &_estack - ptr;
|
||||||
|
return num_used_words * sizeof(*ptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
__attribute__((naked)) void NORETURN thread_arch_start_threading(void)
|
__attribute__((naked)) void NORETURN thread_arch_start_threading(void)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user