mirror of
https://github.com/ArduPilot/ardupilot
synced 2025-01-09 17:38:32 -04:00
HAL_ChibiOS: added a debug function for showing stack free
this can be enabled when needed to investigate stack space remaining
This commit is contained in:
parent
010cd71ab6
commit
bb2e7a189f
@ -58,3 +58,22 @@ void dma_flush(const void *buf, uint32_t size)
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
#if CH_DBG_ENABLE_STACK_CHECK == TRUE
|
||||
void show_stack_usage(void)
|
||||
{
|
||||
thread_t *tp;
|
||||
|
||||
tp = chRegFirstThread();
|
||||
do {
|
||||
uint32_t stklimit = (uint32_t)tp->wabase;
|
||||
uint8_t *p = (uint8_t *)tp->wabase;
|
||||
while (*p == CH_DBG_STACK_FILL_VALUE) {
|
||||
p++;
|
||||
}
|
||||
uint32_t stack_left = ((uint32_t)p) - stklimit;
|
||||
printf("%s %u\n", tp->name, stack_left);
|
||||
tp = chRegNextThread(tp);
|
||||
} while (tp != NULL);
|
||||
}
|
||||
#endif
|
||||
|
@ -32,6 +32,11 @@ void dma_invalidate(void *buf, uint32_t size);
|
||||
*/
|
||||
void dma_flush(const void *buf, uint32_t size);
|
||||
|
||||
#if CH_DBG_ENABLE_STACK_CHECK == TRUE
|
||||
// print stack usage
|
||||
void show_stack_usage(void);
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user