diff options
| author | Bernard Xiong <[email protected]> | 2018-11-11 15:56:02 +0800 |
|---|---|---|
| committer | Bernard Xiong <[email protected]> | 2018-11-11 15:56:02 +0800 |
| commit | 00a655ac1c24d3707a5af376ec756e42406cd6bb (patch) | |
| tree | 408adf7686ed80dda45bac17b622e2d36fe4d18a /components/finsh | |
| parent | c7a85df1cd19a4c2e1d37483f713ad67dcf4b55f (diff) | |
[Kernel] Add ARCH_CPU_STACK_GROWS_UPWARD option
Diffstat (limited to 'components/finsh')
| -rw-r--r-- | components/finsh/cmd.c | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/components/finsh/cmd.c b/components/finsh/cmd.c index a97ef3caab..c66f72e650 100644 --- a/components/finsh/cmd.c +++ b/components/finsh/cmd.c @@ -101,16 +101,28 @@ static long _list_thread(struct rt_list_node *list) else if (stat == RT_THREAD_INIT) rt_kprintf(" init "); else if (stat == RT_THREAD_CLOSE) rt_kprintf(" close "); +#if defined(ARCH_CPU_STACK_GROWS_UPWARD) + ptr = (rt_uint8_t *)thread->stack_addr + thread->stack_size; + while (*ptr == '#')ptr --; + + rt_kprintf(" 0x%08x 0x%08x %02d%% 0x%08x %03d\n", + ((rt_uint32_t)thread->sp - (rt_uint32_t)thread->stack_addr), + thread->stack_size, + ((rt_uint32_t)ptr - (rt_uint32_t)thread->stack_addr) * 100 / thread->stack_size, + thread->remaining_tick, + thread->error); +#else ptr = (rt_uint8_t *)thread->stack_addr; while (*ptr == '#')ptr ++; rt_kprintf(" 0x%08x 0x%08x %02d%% 0x%08x %03d\n", - thread->stack_size + ((rt_uint32_t)thread->stack_addr - (rt_uint32_t)thread->sp), + (thread->stack_size + (rt_uint32_t)thread->stack_addr - (rt_uint32_t)thread->sp), thread->stack_size, - (thread->stack_size - ((rt_uint32_t) ptr - (rt_uint32_t) thread->stack_addr)) * 100 + (thread->stack_size + (rt_uint32_t)thread->stack_addr - (rt_uint32_t) ptr) * 100 / thread->stack_size, thread->remaining_tick, thread->error); +#endif } return 0; |
