[finsh] finsh组件可以选择是否包含内置命令

This commit is contained in:
Meco Man 2021-08-25 19:10:01 -04:00
parent bd44c1e590
commit 29828dc94f
29 changed files with 122 additions and 95 deletions

View File

@ -15,7 +15,7 @@
#define INT_FIQ 0x01 #define INT_FIQ 0x01
extern struct rt_thread *rt_current_thread; extern struct rt_thread *rt_current_thread;
#ifdef RT_USING_FINSH #if defined(RT_USING_FINSH) && defined(FINSH_USING_BUILT_IN_COMMANDS)
extern long list_thread(void); extern long list_thread(void);
#endif #endif
@ -89,7 +89,7 @@ void rt_hw_trap_udef(struct rt_hw_register *regs)
rt_kprintf("undefined instruction\n"); rt_kprintf("undefined instruction\n");
rt_kprintf("thread - %s stack:\n", rt_current_thread->name); rt_kprintf("thread - %s stack:\n", rt_current_thread->name);
#ifdef RT_USING_FINSH #if defined(RT_USING_FINSH) && defined(FINSH_USING_BUILT_IN_COMMANDS)
list_thread(); list_thread();
#endif #endif
rt_hw_cpu_shutdown(); rt_hw_cpu_shutdown();
@ -141,7 +141,7 @@ void rt_hw_trap_pabt(struct rt_hw_register *regs)
rt_kprintf("prefetch abort\n"); rt_kprintf("prefetch abort\n");
rt_kprintf("thread - %s stack:\n", RT_NAME_MAX, rt_current_thread->name); rt_kprintf("thread - %s stack:\n", RT_NAME_MAX, rt_current_thread->name);
#ifdef RT_USING_FINSH #if defined(RT_USING_FINSH) && defined(FINSH_USING_BUILT_IN_COMMANDS)
list_thread(); list_thread();
#endif #endif
rt_hw_cpu_shutdown(); rt_hw_cpu_shutdown();
@ -169,7 +169,7 @@ void rt_hw_trap_dabt(struct rt_hw_register *regs)
rt_kprintf("data abort\n"); rt_kprintf("data abort\n");
rt_kprintf("thread - %s stack:\n", RT_NAME_MAX, rt_current_thread->name); rt_kprintf("thread - %s stack:\n", RT_NAME_MAX, rt_current_thread->name);
#ifdef RT_USING_FINSH #if defined(RT_USING_FINSH) && defined(FINSH_USING_BUILT_IN_COMMANDS)
list_thread(); list_thread();
#endif #endif
rt_hw_cpu_shutdown(); rt_hw_cpu_shutdown();

View File

@ -209,7 +209,9 @@ void rt_hw_console_output(const char *str)
RT_SECTION(".irq.err") RT_SECTION(".irq.err")
void exception_isr(void) void exception_isr(void)
{ {
#if defined(RT_USING_FINSH) && defined(FINSH_USING_BUILT_IN_COMMANDS)
extern long list_thread(void); extern long list_thread(void);
#endif
sys_error_hook(1); sys_error_hook(1);
#ifdef RT_USING_CONSOLE #ifdef RT_USING_CONSOLE

View File

@ -20,7 +20,7 @@
/*@{*/ /*@{*/
extern struct rt_thread *rt_current_thread; extern struct rt_thread *rt_current_thread;
#ifdef RT_USING_FINSH #if defined(RT_USING_FINSH) && defined(FINSH_USING_BUILT_IN_COMMANDS)
extern long list_thread(void); extern long list_thread(void);
#endif #endif
@ -56,7 +56,7 @@ void rt_hw_trap_udef(struct rt_hw_register *regs)
rt_kprintf("undefined instruction\n"); rt_kprintf("undefined instruction\n");
rt_kprintf("thread - %s stack:\n", rt_current_thread->name); rt_kprintf("thread - %s stack:\n", rt_current_thread->name);
#ifdef RT_USING_FINSH #if defined(RT_USING_FINSH) && defined(FINSH_USING_BUILT_IN_COMMANDS)
list_thread(); list_thread();
#endif #endif
rt_hw_cpu_shutdown(); rt_hw_cpu_shutdown();
@ -94,7 +94,7 @@ void rt_hw_trap_pabt(struct rt_hw_register *regs)
rt_kprintf("prefetch abort\n"); rt_kprintf("prefetch abort\n");
rt_kprintf("thread - %s stack:\n", rt_current_thread->name); rt_kprintf("thread - %s stack:\n", rt_current_thread->name);
#ifdef RT_USING_FINSH #if defined(RT_USING_FINSH) && defined(FINSH_USING_BUILT_IN_COMMANDS)
list_thread(); list_thread();
#endif #endif
rt_hw_cpu_shutdown(); rt_hw_cpu_shutdown();
@ -130,7 +130,7 @@ void rt_hw_trap_dabt(struct rt_hw_register *regs)
rt_kprintf("data abort\n"); rt_kprintf("data abort\n");
rt_kprintf("thread - %s stack:\n", rt_current_thread->name); rt_kprintf("thread - %s stack:\n", rt_current_thread->name);
#ifdef RT_USING_FINSH #if defined(RT_USING_FINSH) && defined(FINSH_USING_BUILT_IN_COMMANDS)
list_thread(); list_thread();
#endif #endif
rt_hw_cpu_shutdown(); rt_hw_cpu_shutdown();

View File

@ -17,7 +17,7 @@
#include "gic.h" #include "gic.h"
extern struct rt_thread *rt_current_thread; extern struct rt_thread *rt_current_thread;
#ifdef RT_USING_FINSH #if defined(RT_USING_FINSH) && defined(FINSH_USING_BUILT_IN_COMMANDS)
extern long list_thread(void); extern long list_thread(void);
#endif #endif
@ -49,7 +49,7 @@ void rt_hw_trap_undef(struct rt_hw_exp_stack *regs)
{ {
rt_kprintf("undefined instruction:\n"); rt_kprintf("undefined instruction:\n");
rt_hw_show_register(regs); rt_hw_show_register(regs);
#ifdef RT_USING_FINSH #if defined(RT_USING_FINSH) && defined(FINSH_USING_BUILT_IN_COMMANDS)
list_thread(); list_thread();
#endif #endif
rt_hw_cpu_shutdown(); rt_hw_cpu_shutdown();
@ -68,7 +68,7 @@ void rt_hw_trap_swi(struct rt_hw_exp_stack *regs)
{ {
rt_kprintf("software interrupt:\n"); rt_kprintf("software interrupt:\n");
rt_hw_show_register(regs); rt_hw_show_register(regs);
#ifdef RT_USING_FINSH #if defined(RT_USING_FINSH) && defined(FINSH_USING_BUILT_IN_COMMANDS)
list_thread(); list_thread();
#endif #endif
rt_hw_cpu_shutdown(); rt_hw_cpu_shutdown();
@ -86,7 +86,7 @@ void rt_hw_trap_pabt(struct rt_hw_exp_stack *regs)
{ {
rt_kprintf("prefetch abort:\n"); rt_kprintf("prefetch abort:\n");
rt_hw_show_register(regs); rt_hw_show_register(regs);
#ifdef RT_USING_FINSH #if defined(RT_USING_FINSH) && defined(FINSH_USING_BUILT_IN_COMMANDS)
list_thread(); list_thread();
#endif #endif
rt_hw_cpu_shutdown(); rt_hw_cpu_shutdown();
@ -104,7 +104,7 @@ void rt_hw_trap_dabt(struct rt_hw_exp_stack *regs)
{ {
rt_kprintf("data abort:"); rt_kprintf("data abort:");
rt_hw_show_register(regs); rt_hw_show_register(regs);
#ifdef RT_USING_FINSH #if defined(RT_USING_FINSH) && defined(FINSH_USING_BUILT_IN_COMMANDS)
list_thread(); list_thread();
#endif #endif
rt_hw_cpu_shutdown(); rt_hw_cpu_shutdown();
@ -121,7 +121,7 @@ void rt_hw_trap_resv(struct rt_hw_exp_stack *regs)
{ {
rt_kprintf("reserved trap:\n"); rt_kprintf("reserved trap:\n");
rt_hw_show_register(regs); rt_hw_show_register(regs);
#ifdef RT_USING_FINSH #if defined(RT_USING_FINSH) && defined(FINSH_USING_BUILT_IN_COMMANDS)
list_thread(); list_thread();
#endif #endif
rt_hw_cpu_shutdown(); rt_hw_cpu_shutdown();

View File

@ -21,7 +21,7 @@
#include "gic.h" #include "gic.h"
extern struct rt_thread *rt_current_thread; extern struct rt_thread *rt_current_thread;
#ifdef RT_USING_FINSH #if defined(RT_USING_FINSH) && defined(FINSH_USING_BUILT_IN_COMMANDS)
extern long list_thread(void); extern long list_thread(void);
#endif #endif
@ -53,7 +53,7 @@ void rt_hw_trap_undef(struct rt_hw_exp_stack *regs)
{ {
rt_kprintf("undefined instruction:\n"); rt_kprintf("undefined instruction:\n");
rt_hw_show_register(regs); rt_hw_show_register(regs);
#ifdef RT_USING_FINSH #if defined(RT_USING_FINSH) && defined(FINSH_USING_BUILT_IN_COMMANDS)
list_thread(); list_thread();
#endif #endif
rt_hw_cpu_shutdown(); rt_hw_cpu_shutdown();
@ -72,7 +72,7 @@ void rt_hw_trap_swi(struct rt_hw_exp_stack *regs)
{ {
rt_kprintf("software interrupt:\n"); rt_kprintf("software interrupt:\n");
rt_hw_show_register(regs); rt_hw_show_register(regs);
#ifdef RT_USING_FINSH #if defined(RT_USING_FINSH) && defined(FINSH_USING_BUILT_IN_COMMANDS)
list_thread(); list_thread();
#endif #endif
rt_hw_cpu_shutdown(); rt_hw_cpu_shutdown();
@ -90,7 +90,7 @@ void rt_hw_trap_pabt(struct rt_hw_exp_stack *regs)
{ {
rt_kprintf("prefetch abort:\n"); rt_kprintf("prefetch abort:\n");
rt_hw_show_register(regs); rt_hw_show_register(regs);
#ifdef RT_USING_FINSH #if defined(RT_USING_FINSH) && defined(FINSH_USING_BUILT_IN_COMMANDS)
list_thread(); list_thread();
#endif #endif
rt_hw_cpu_shutdown(); rt_hw_cpu_shutdown();
@ -108,7 +108,7 @@ void rt_hw_trap_dabt(struct rt_hw_exp_stack *regs)
{ {
rt_kprintf("data abort:"); rt_kprintf("data abort:");
rt_hw_show_register(regs); rt_hw_show_register(regs);
#ifdef RT_USING_FINSH #if defined(RT_USING_FINSH) && defined(FINSH_USING_BUILT_IN_COMMANDS)
list_thread(); list_thread();
#endif #endif
rt_hw_cpu_shutdown(); rt_hw_cpu_shutdown();
@ -125,7 +125,7 @@ void rt_hw_trap_resv(struct rt_hw_exp_stack *regs)
{ {
rt_kprintf("reserved trap:\n"); rt_kprintf("reserved trap:\n");
rt_hw_show_register(regs); rt_hw_show_register(regs);
#ifdef RT_USING_FINSH #if defined(RT_USING_FINSH) && defined(FINSH_USING_BUILT_IN_COMMANDS)
list_thread(); list_thread();
#endif #endif
rt_hw_cpu_shutdown(); rt_hw_cpu_shutdown();

View File

@ -15,7 +15,7 @@
#include "armv7.h" #include "armv7.h"
extern struct rt_thread *rt_current_thread; extern struct rt_thread *rt_current_thread;
#ifdef RT_USING_FINSH #if defined(RT_USING_FINSH) && defined(FINSH_USING_BUILT_IN_COMMANDS)
extern long list_thread(void); extern long list_thread(void);
#endif #endif
@ -47,7 +47,7 @@ void rt_hw_trap_undef(struct rt_hw_exp_stack *regs)
{ {
rt_kprintf("undefined instruction:\n"); rt_kprintf("undefined instruction:\n");
rt_hw_show_register(regs); rt_hw_show_register(regs);
#ifdef RT_USING_FINSH #if defined(RT_USING_FINSH) && defined(FINSH_USING_BUILT_IN_COMMANDS)
list_thread(); list_thread();
#endif #endif
rt_hw_cpu_shutdown(); rt_hw_cpu_shutdown();
@ -66,7 +66,7 @@ void rt_hw_trap_swi(struct rt_hw_exp_stack *regs)
{ {
rt_kprintf("software interrupt:\n"); rt_kprintf("software interrupt:\n");
rt_hw_show_register(regs); rt_hw_show_register(regs);
#ifdef RT_USING_FINSH #if defined(RT_USING_FINSH) && defined(FINSH_USING_BUILT_IN_COMMANDS)
list_thread(); list_thread();
#endif #endif
rt_hw_cpu_shutdown(); rt_hw_cpu_shutdown();
@ -84,7 +84,7 @@ void rt_hw_trap_pabt(struct rt_hw_exp_stack *regs)
{ {
rt_kprintf("prefetch abort:\n"); rt_kprintf("prefetch abort:\n");
rt_hw_show_register(regs); rt_hw_show_register(regs);
#ifdef RT_USING_FINSH #if defined(RT_USING_FINSH) && defined(FINSH_USING_BUILT_IN_COMMANDS)
list_thread(); list_thread();
#endif #endif
rt_hw_cpu_shutdown(); rt_hw_cpu_shutdown();
@ -102,7 +102,7 @@ void rt_hw_trap_dabt(struct rt_hw_exp_stack *regs)
{ {
rt_kprintf("data abort:"); rt_kprintf("data abort:");
rt_hw_show_register(regs); rt_hw_show_register(regs);
#ifdef RT_USING_FINSH #if defined(RT_USING_FINSH) && defined(FINSH_USING_BUILT_IN_COMMANDS)
list_thread(); list_thread();
#endif #endif
rt_hw_cpu_shutdown(); rt_hw_cpu_shutdown();
@ -119,7 +119,7 @@ void rt_hw_trap_resv(struct rt_hw_exp_stack *regs)
{ {
rt_kprintf("reserved trap:\n"); rt_kprintf("reserved trap:\n");
rt_hw_show_register(regs); rt_hw_show_register(regs);
#ifdef RT_USING_FINSH #if defined(RT_USING_FINSH) && defined(FINSH_USING_BUILT_IN_COMMANDS)
list_thread(); list_thread();
#endif #endif
rt_hw_cpu_shutdown(); rt_hw_cpu_shutdown();

View File

@ -18,7 +18,7 @@
#include "armv7.h" #include "armv7.h"
extern struct rt_thread *rt_current_thread; extern struct rt_thread *rt_current_thread;
#ifdef RT_USING_FINSH #if defined(RT_USING_FINSH) && defined(FINSH_USING_BUILT_IN_COMMANDS)
extern long list_thread(void); extern long list_thread(void);
#endif #endif
@ -52,7 +52,7 @@ void rt_hw_trap_undef(struct rt_hw_exp_stack *regs)
{ {
rt_kprintf("undefined instruction:\n"); rt_kprintf("undefined instruction:\n");
rt_hw_show_register(regs); rt_hw_show_register(regs);
#ifdef RT_USING_FINSH #if defined(RT_USING_FINSH) && defined(FINSH_USING_BUILT_IN_COMMANDS)
list_thread(); list_thread();
#endif #endif
rt_hw_cpu_shutdown(); rt_hw_cpu_shutdown();
@ -71,7 +71,7 @@ void rt_hw_trap_swi(struct rt_hw_exp_stack *regs)
{ {
rt_kprintf("software interrupt:\n"); rt_kprintf("software interrupt:\n");
rt_hw_show_register(regs); rt_hw_show_register(regs);
#ifdef RT_USING_FINSH #if defined(RT_USING_FINSH) && defined(FINSH_USING_BUILT_IN_COMMANDS)
list_thread(); list_thread();
#endif #endif
rt_hw_cpu_shutdown(); rt_hw_cpu_shutdown();
@ -89,7 +89,7 @@ void rt_hw_trap_pabt(struct rt_hw_exp_stack *regs)
{ {
rt_kprintf("prefetch abort:\n"); rt_kprintf("prefetch abort:\n");
rt_hw_show_register(regs); rt_hw_show_register(regs);
#ifdef RT_USING_FINSH #if defined(RT_USING_FINSH) && defined(FINSH_USING_BUILT_IN_COMMANDS)
list_thread(); list_thread();
#endif #endif
rt_hw_cpu_shutdown(); rt_hw_cpu_shutdown();
@ -107,7 +107,7 @@ void rt_hw_trap_dabt(struct rt_hw_exp_stack *regs)
{ {
rt_kprintf("data abort:"); rt_kprintf("data abort:");
rt_hw_show_register(regs); rt_hw_show_register(regs);
#ifdef RT_USING_FINSH #if defined(RT_USING_FINSH) && defined(FINSH_USING_BUILT_IN_COMMANDS)
list_thread(); list_thread();
#endif #endif
rt_hw_cpu_shutdown(); rt_hw_cpu_shutdown();
@ -124,7 +124,7 @@ void rt_hw_trap_resv(struct rt_hw_exp_stack *regs)
{ {
rt_kprintf("reserved trap:\n"); rt_kprintf("reserved trap:\n");
rt_hw_show_register(regs); rt_hw_show_register(regs);
#ifdef RT_USING_FINSH #if defined(RT_USING_FINSH) && defined(FINSH_USING_BUILT_IN_COMMANDS)
list_thread(); list_thread();
#endif #endif
rt_hw_cpu_shutdown(); rt_hw_cpu_shutdown();

View File

@ -31,6 +31,10 @@ config FINSH_USING_DESCRIPTION
bool "Keeping description in symbol table" bool "Keeping description in symbol table"
default y default y
config FINSH_USING_BUILT_IN_COMMANDS
bool "Enable built-in commands, such as list_thread"
default y
config FINSH_ECHO_DISABLE_DEFAULT config FINSH_ECHO_DISABLE_DEFAULT
bool "Disable the echo mode in default" bool "Disable the echo mode in default"
default n default n

View File

@ -3,10 +3,12 @@ from building import *
cwd = GetCurrentDir() cwd = GetCurrentDir()
src = Split(''' src = Split('''
shell.c shell.c
cmd.c
msh.c msh.c
''') ''')
if GetDepend('FINSH_USING_BUILT_IN_COMMANDS'):
src += ['cmd.c']
if GetDepend('RT_USING_DFS'): if GetDepend('RT_USING_DFS'):
src += ['msh_file.c'] src += ['msh_file.c']

View File

@ -54,6 +54,7 @@ int msh_help(int argc, char **argv)
} }
MSH_CMD_EXPORT_ALIAS(msh_help, help, RT - Thread shell help.); MSH_CMD_EXPORT_ALIAS(msh_help, help, RT - Thread shell help.);
#ifdef FINSH_USING_BUILT_IN_COMMANDS
int cmd_ps(int argc, char **argv) int cmd_ps(int argc, char **argv)
{ {
extern long list_thread(void); extern long list_thread(void);
@ -77,13 +78,14 @@ int cmd_free(int argc, char **argv)
#ifdef RT_USING_MEMHEAP_AS_HEAP #ifdef RT_USING_MEMHEAP_AS_HEAP
list_memheap(); list_memheap();
#else #else /* RT_USING_MEMHEAP_AS_HEAP */
list_mem(); list_mem();
#endif #endif
return 0; return 0;
} }
MSH_CMD_EXPORT_ALIAS(cmd_free, free, Show the memory usage in the system.); MSH_CMD_EXPORT_ALIAS(cmd_free, free, Show the memory usage in the system.);
#endif #endif /* RT_USING_HEAP */
#endif /* FINSH_USING_BUILT_IN_COMMANDS */
static int msh_split(char *cmd, rt_size_t length, char *argv[FINSH_ARG_MAX]) static int msh_split(char *cmd, rt_size_t length, char *argv[FINSH_ARG_MAX])
{ {
@ -270,7 +272,7 @@ int system(const char *command)
return ret; return ret;
} }
RTM_EXPORT(system); RTM_EXPORT(system);
#endif #endif /* defined(RT_USING_MODULE) && defined(RT_USING_DFS) */
static int _msh_exec_cmd(char *cmd, rt_size_t length, int *retp) static int _msh_exec_cmd(char *cmd, rt_size_t length, int *retp)
{ {
@ -339,7 +341,7 @@ static int _msh_exec_lwp(char *cmd, rt_size_t length)
return 0; return 0;
} }
#endif #endif /* defined(RT_USING_LWP) && defined(RT_USING_DFS) */
int msh_exec(char *cmd, rt_size_t length) int msh_exec(char *cmd, rt_size_t length)
{ {
@ -376,15 +378,15 @@ int msh_exec(char *cmd, rt_size_t length)
{ {
return 0; return 0;
} }
#endif #endif /* RT_USING_MODULE */
#ifdef RT_USING_LWP #ifdef RT_USING_LWP
if (_msh_exec_lwp(cmd, length) == 0) if (_msh_exec_lwp(cmd, length) == 0)
{ {
return 0; return 0;
} }
#endif #endif /* RT_USING_LWP */
#endif #endif /* RT_USING_DFS */
/* truncate the cmd at the first space. */ /* truncate the cmd at the first space. */
{ {
@ -534,7 +536,7 @@ void msh_auto_complete_path(char *path)
closedir(dir); closedir(dir);
rt_free(full_path); rt_free(full_path);
} }
#endif #endif /* RT_USING_DFS */
void msh_auto_complete(char *prefix) void msh_auto_complete(char *prefix)
{ {
@ -575,9 +577,9 @@ void msh_auto_complete(char *prefix)
{ {
msh_auto_complete_path(ptr); msh_auto_complete_path(ptr);
} }
#endif #endif /* RT_USING_MODULE */
} }
#endif #endif /* RT_USING_DFS */
/* checks in internal command */ /* checks in internal command */
{ {

View File

@ -19,7 +19,7 @@
#endif #endif
extern struct rt_thread *rt_current_thread; extern struct rt_thread *rt_current_thread;
#ifdef RT_USING_FINSH #if defined(RT_USING_FINSH) && defined(FINSH_USING_BUILT_IN_COMMANDS)
extern long list_thread(void); extern long list_thread(void);
#endif #endif
@ -55,7 +55,7 @@ void rt_hw_trap_error(struct rt_hw_exp_stack *regs)
{ {
rt_kprintf("error exception:\n"); rt_kprintf("error exception:\n");
rt_hw_show_register(regs); rt_hw_show_register(regs);
#ifdef RT_USING_FINSH #if defined(RT_USING_FINSH) && defined(FINSH_USING_BUILT_IN_COMMANDS)
list_thread(); list_thread();
#endif #endif
rt_hw_cpu_shutdown(); rt_hw_cpu_shutdown();

View File

@ -14,7 +14,7 @@
#include "armv8.h" #include "armv8.h"
extern struct rt_thread *rt_current_thread; extern struct rt_thread *rt_current_thread;
#ifdef RT_USING_FINSH #if defined(RT_USING_FINSH) && defined(FINSH_USING_BUILT_IN_COMMANDS)
extern long list_thread(void); extern long list_thread(void);
#endif #endif
@ -50,7 +50,7 @@ void rt_hw_trap_error(struct rt_hw_exp_stack *regs)
{ {
rt_kprintf("error exception:\n"); rt_kprintf("error exception:\n");
rt_hw_show_register(regs); rt_hw_show_register(regs);
#ifdef RT_USING_FINSH #if defined(RT_USING_FINSH) && defined(FINSH_USING_BUILT_IN_COMMANDS)
list_thread(); list_thread();
#endif #endif
rt_hw_cpu_shutdown(); rt_hw_cpu_shutdown();

View File

@ -24,7 +24,7 @@
/*@{*/ /*@{*/
extern struct rt_thread *rt_current_thread; extern struct rt_thread *rt_current_thread;
#ifdef RT_USING_FINSH #if defined(RT_USING_FINSH) && defined(FINSH_USING_BUILT_IN_COMMANDS)
extern long list_thread(void); extern long list_thread(void);
#endif #endif
@ -67,7 +67,7 @@ void rt_hw_trap_udef(struct rt_hw_register *regs)
rt_kprintf("undefined instruction\n"); rt_kprintf("undefined instruction\n");
rt_kprintf("thread %.*s stack:\n", RT_NAME_MAX, rt_current_thread->name); rt_kprintf("thread %.*s stack:\n", RT_NAME_MAX, rt_current_thread->name);
#ifdef RT_USING_FINSH #if defined(RT_USING_FINSH) && defined(FINSH_USING_BUILT_IN_COMMANDS)
list_thread(); list_thread();
#endif #endif
rt_hw_cpu_shutdown(); rt_hw_cpu_shutdown();
@ -105,7 +105,7 @@ void rt_hw_trap_pabt(struct rt_hw_register *regs)
rt_kprintf("prefetch abort\n"); rt_kprintf("prefetch abort\n");
rt_kprintf("thread %.*s stack:\n", RT_NAME_MAX, rt_current_thread->name); rt_kprintf("thread %.*s stack:\n", RT_NAME_MAX, rt_current_thread->name);
#ifdef RT_USING_FINSH #if defined(RT_USING_FINSH) && defined(FINSH_USING_BUILT_IN_COMMANDS)
list_thread(); list_thread();
#endif #endif
rt_hw_cpu_shutdown(); rt_hw_cpu_shutdown();
@ -133,7 +133,7 @@ void rt_hw_trap_dabt(struct rt_hw_register *regs)
rt_kprintf("data abort\n"); rt_kprintf("data abort\n");
rt_kprintf("thread %.*s stack:\n", RT_NAME_MAX, rt_current_thread->name); rt_kprintf("thread %.*s stack:\n", RT_NAME_MAX, rt_current_thread->name);
#ifdef RT_USING_FINSH #if defined(RT_USING_FINSH) && defined(FINSH_USING_BUILT_IN_COMMANDS)
list_thread(); list_thread();
#endif #endif
rt_hw_cpu_shutdown(); rt_hw_cpu_shutdown();

View File

@ -16,7 +16,7 @@
#define INT_FIQ 0x01 #define INT_FIQ 0x01
extern struct rt_thread *rt_current_thread; extern struct rt_thread *rt_current_thread;
#ifdef RT_USING_FINSH #if defined(RT_USING_FINSH) && defined(FINSH_USING_BUILT_IN_COMMANDS)
extern long list_thread(void); extern long list_thread(void);
#endif #endif
@ -90,7 +90,7 @@ void rt_hw_trap_udef(struct rt_hw_register *regs)
rt_kprintf("undefined instruction\n"); rt_kprintf("undefined instruction\n");
rt_kprintf("thread - %s stack:\n", rt_current_thread->name); rt_kprintf("thread - %s stack:\n", rt_current_thread->name);
#ifdef RT_USING_FINSH #if defined(RT_USING_FINSH) && defined(FINSH_USING_BUILT_IN_COMMANDS)
list_thread(); list_thread();
#endif #endif
rt_hw_cpu_shutdown(); rt_hw_cpu_shutdown();
@ -142,7 +142,7 @@ void rt_hw_trap_pabt(struct rt_hw_register *regs)
rt_kprintf("prefetch abort\n"); rt_kprintf("prefetch abort\n");
rt_kprintf("thread - %s stack:\n", RT_NAME_MAX, rt_current_thread->name); rt_kprintf("thread - %s stack:\n", RT_NAME_MAX, rt_current_thread->name);
#ifdef RT_USING_FINSH #if defined(RT_USING_FINSH) && defined(FINSH_USING_BUILT_IN_COMMANDS)
list_thread(); list_thread();
#endif #endif
rt_hw_cpu_shutdown(); rt_hw_cpu_shutdown();
@ -170,7 +170,7 @@ void rt_hw_trap_dabt(struct rt_hw_register *regs)
rt_kprintf("data abort\n"); rt_kprintf("data abort\n");
rt_kprintf("thread - %s stack:\n", RT_NAME_MAX, rt_current_thread->name); rt_kprintf("thread - %s stack:\n", RT_NAME_MAX, rt_current_thread->name);
#ifdef RT_USING_FINSH #if defined(RT_USING_FINSH) && defined(FINSH_USING_BUILT_IN_COMMANDS)
list_thread(); list_thread();
#endif #endif
rt_hw_cpu_shutdown(); rt_hw_cpu_shutdown();

View File

@ -15,7 +15,7 @@
#include "armv7.h" #include "armv7.h"
#include "interrupt.h" #include "interrupt.h"
#ifdef RT_USING_FINSH #if defined(RT_USING_FINSH) && defined(FINSH_USING_BUILT_IN_COMMANDS)
extern long list_thread(void); extern long list_thread(void);
#endif #endif
@ -89,7 +89,7 @@ void rt_hw_trap_undef(struct rt_hw_exp_stack *regs)
{ {
rt_kprintf("undefined instruction:\n"); rt_kprintf("undefined instruction:\n");
rt_hw_show_register(regs); rt_hw_show_register(regs);
#ifdef RT_USING_FINSH #if defined(RT_USING_FINSH) && defined(FINSH_USING_BUILT_IN_COMMANDS)
list_thread(); list_thread();
#endif #endif
rt_hw_cpu_shutdown(); rt_hw_cpu_shutdown();
@ -115,7 +115,7 @@ void rt_hw_trap_swi(struct rt_hw_exp_stack *regs)
{ {
rt_kprintf("software interrupt:\n"); rt_kprintf("software interrupt:\n");
rt_hw_show_register(regs); rt_hw_show_register(regs);
#ifdef RT_USING_FINSH #if defined(RT_USING_FINSH) && defined(FINSH_USING_BUILT_IN_COMMANDS)
list_thread(); list_thread();
#endif #endif
rt_hw_cpu_shutdown(); rt_hw_cpu_shutdown();
@ -140,7 +140,7 @@ void rt_hw_trap_pabt(struct rt_hw_exp_stack *regs)
{ {
rt_kprintf("prefetch abort:\n"); rt_kprintf("prefetch abort:\n");
rt_hw_show_register(regs); rt_hw_show_register(regs);
#ifdef RT_USING_FINSH #if defined(RT_USING_FINSH) && defined(FINSH_USING_BUILT_IN_COMMANDS)
list_thread(); list_thread();
#endif #endif
rt_hw_cpu_shutdown(); rt_hw_cpu_shutdown();
@ -165,7 +165,7 @@ void rt_hw_trap_dabt(struct rt_hw_exp_stack *regs)
{ {
rt_kprintf("data abort:"); rt_kprintf("data abort:");
rt_hw_show_register(regs); rt_hw_show_register(regs);
#ifdef RT_USING_FINSH #if defined(RT_USING_FINSH) && defined(FINSH_USING_BUILT_IN_COMMANDS)
list_thread(); list_thread();
#endif #endif
rt_hw_cpu_shutdown(); rt_hw_cpu_shutdown();
@ -189,7 +189,7 @@ void rt_hw_trap_resv(struct rt_hw_exp_stack *regs)
{ {
rt_kprintf("reserved trap:\n"); rt_kprintf("reserved trap:\n");
rt_hw_show_register(regs); rt_hw_show_register(regs);
#ifdef RT_USING_FINSH #if defined(RT_USING_FINSH) && defined(FINSH_USING_BUILT_IN_COMMANDS)
list_thread(); list_thread();
#endif #endif
rt_hw_cpu_shutdown(); rt_hw_cpu_shutdown();

View File

@ -90,7 +90,9 @@ rt_uint8_t *rt_hw_stack_init(void *tentry,
return stk; return stk;
} }
#if defined(RT_USING_FINSH) && defined(FINSH_USING_BUILT_IN_COMMANDS)
extern long list_thread(void); extern long list_thread(void);
#endif
extern rt_thread_t rt_current_thread; extern rt_thread_t rt_current_thread;
/** /**
* fault exception handling * fault exception handling
@ -108,7 +110,7 @@ void rt_hw_hard_fault_exception(struct exception_stack_frame *contex)
rt_kprintf("hard fault on thread: %s\n", rt_current_thread->name); rt_kprintf("hard fault on thread: %s\n", rt_current_thread->name);
#ifdef RT_USING_FINSH #if defined(RT_USING_FINSH) && defined(FINSH_USING_BUILT_IN_COMMANDS)
list_thread(); list_thread();
#endif #endif

View File

@ -91,7 +91,9 @@ rt_uint8_t *rt_hw_stack_init(void *tentry,
return stk; return stk;
} }
#if defined(RT_USING_FINSH) && defined(FINSH_USING_BUILT_IN_COMMANDS)
extern long list_thread(void); extern long list_thread(void);
#endif
extern rt_thread_t rt_current_thread; extern rt_thread_t rt_current_thread;
/** /**
* fault exception handling * fault exception handling
@ -109,7 +111,7 @@ void rt_hw_hard_fault_exception(struct exception_stack_frame *contex)
rt_kprintf("hard fault on thread: %s\n", rt_current_thread->name); rt_kprintf("hard fault on thread: %s\n", rt_current_thread->name);
#ifdef RT_USING_FINSH #if defined(RT_USING_FINSH) && defined(FINSH_USING_BUILT_IN_COMMANDS)
list_thread(); list_thread();
#endif #endif

View File

@ -291,7 +291,9 @@ struct exception_info
*/ */
void rt_hw_hard_fault_exception(struct exception_info * exception_info) void rt_hw_hard_fault_exception(struct exception_info * exception_info)
{ {
#if defined(RT_USING_FINSH) && defined(FINSH_USING_BUILT_IN_COMMANDS)
extern long list_thread(void); extern long list_thread(void);
#endif
struct stack_frame* context = &exception_info->stack_frame; struct stack_frame* context = &exception_info->stack_frame;
if (rt_exception_hook != RT_NULL) if (rt_exception_hook != RT_NULL)
@ -325,9 +327,9 @@ void rt_hw_hard_fault_exception(struct exception_info * exception_info)
{ {
rt_kprintf("hard fault on thread: %s\r\n\r\n", rt_thread_self()->name); rt_kprintf("hard fault on thread: %s\r\n\r\n", rt_thread_self()->name);
#ifdef RT_USING_FINSH #if defined(RT_USING_FINSH) && defined(FINSH_USING_BUILT_IN_COMMANDS)
list_thread(); list_thread();
#endif /* RT_USING_FINSH */ #endif
} }
else else
{ {

View File

@ -373,7 +373,9 @@ struct exception_info
void rt_hw_hard_fault_exception(struct exception_info *exception_info) void rt_hw_hard_fault_exception(struct exception_info *exception_info)
{ {
#if defined(RT_USING_FINSH) && defined(FINSH_USING_BUILT_IN_COMMANDS)
extern long list_thread(void); extern long list_thread(void);
#endif
struct exception_stack_frame *exception_stack = &exception_info->stack_frame.exception_stack_frame; struct exception_stack_frame *exception_stack = &exception_info->stack_frame.exception_stack_frame;
struct stack_frame *context = &exception_info->stack_frame; struct stack_frame *context = &exception_info->stack_frame;
@ -407,7 +409,7 @@ void rt_hw_hard_fault_exception(struct exception_info *exception_info)
{ {
rt_kprintf("hard fault on thread: %s\r\n\r\n", rt_thread_self()->name); rt_kprintf("hard fault on thread: %s\r\n\r\n", rt_thread_self()->name);
#ifdef RT_USING_FINSH #if defined(RT_USING_FINSH) && defined(FINSH_USING_BUILT_IN_COMMANDS)
list_thread(); list_thread();
#endif #endif
} }

View File

@ -370,7 +370,9 @@ struct exception_info
void rt_hw_hard_fault_exception(struct exception_info *exception_info) void rt_hw_hard_fault_exception(struct exception_info *exception_info)
{ {
#if defined(RT_USING_FINSH) && defined(FINSH_USING_BUILT_IN_COMMANDS)
extern long list_thread(void); extern long list_thread(void);
#endif
struct exception_stack_frame *exception_stack = &exception_info->stack_frame.exception_stack_frame; struct exception_stack_frame *exception_stack = &exception_info->stack_frame.exception_stack_frame;
struct stack_frame *context = &exception_info->stack_frame; struct stack_frame *context = &exception_info->stack_frame;
@ -404,7 +406,7 @@ void rt_hw_hard_fault_exception(struct exception_info *exception_info)
{ {
rt_kprintf("hard fault on thread: %s\r\n\r\n", rt_thread_self()->name); rt_kprintf("hard fault on thread: %s\r\n\r\n", rt_thread_self()->name);
#ifdef RT_USING_FINSH #if defined(RT_USING_FINSH) && defined(FINSH_USING_BUILT_IN_COMMANDS)
list_thread(); list_thread();
#endif #endif
} }

View File

@ -370,7 +370,9 @@ struct exception_info
void rt_hw_hard_fault_exception(struct exception_info *exception_info) void rt_hw_hard_fault_exception(struct exception_info *exception_info)
{ {
#if defined(RT_USING_FINSH) && defined(FINSH_USING_BUILT_IN_COMMANDS)
extern long list_thread(void); extern long list_thread(void);
#endif
struct exception_stack_frame *exception_stack = &exception_info->stack_frame.exception_stack_frame; struct exception_stack_frame *exception_stack = &exception_info->stack_frame.exception_stack_frame;
struct stack_frame *context = &exception_info->stack_frame; struct stack_frame *context = &exception_info->stack_frame;
@ -404,7 +406,7 @@ void rt_hw_hard_fault_exception(struct exception_info *exception_info)
{ {
rt_kprintf("hard fault on thread: %s\r\n\r\n", rt_thread_self()->name); rt_kprintf("hard fault on thread: %s\r\n\r\n", rt_thread_self()->name);
#ifdef RT_USING_FINSH #if defined(RT_USING_FINSH) && defined(FINSH_USING_BUILT_IN_COMMANDS)
list_thread(); list_thread();
#endif #endif
} }

View File

@ -67,7 +67,7 @@ void rt_hw_trap_svc(struct rt_hw_exp_stack *regs)
{ {
rt_kprintf("software interrupt\n"); rt_kprintf("software interrupt\n");
rt_hw_show_register(regs); rt_hw_show_register(regs);
#ifdef RT_USING_FINSH #if defined(RT_USING_FINSH) && defined(FINSH_USING_BUILT_IN_COMMANDS)
list_thread(); list_thread();
#endif #endif
rt_hw_cpu_shutdown(); rt_hw_cpu_shutdown();
@ -85,7 +85,7 @@ void rt_hw_trap_pabt(struct rt_hw_exp_stack *regs)
{ {
rt_kprintf("prefetch abort\n"); rt_kprintf("prefetch abort\n");
rt_hw_show_register(regs); rt_hw_show_register(regs);
#ifdef RT_USING_FINSH #if defined(RT_USING_FINSH) && defined(FINSH_USING_BUILT_IN_COMMANDS)
list_thread(); list_thread();
#endif #endif
rt_hw_cpu_shutdown(); rt_hw_cpu_shutdown();
@ -103,7 +103,7 @@ void rt_hw_trap_dabt(struct rt_hw_exp_stack *regs)
{ {
rt_kprintf("Data Abort "); rt_kprintf("Data Abort ");
rt_hw_show_register(regs); rt_hw_show_register(regs);
#ifdef RT_USING_FINSH #if defined(RT_USING_FINSH) && defined(FINSH_USING_BUILT_IN_COMMANDS)
list_thread(); list_thread();
#endif #endif
rt_hw_cpu_shutdown(); rt_hw_cpu_shutdown();
@ -120,7 +120,7 @@ void rt_hw_trap_resv(struct rt_hw_exp_stack *regs)
{ {
rt_kprintf("Reserved trap\n"); rt_kprintf("Reserved trap\n");
rt_hw_show_register(regs); rt_hw_show_register(regs);
#ifdef RT_USING_FINSH #if defined(RT_USING_FINSH) && defined(FINSH_USING_BUILT_IN_COMMANDS)
list_thread(); list_thread();
#endif #endif
rt_hw_cpu_shutdown(); rt_hw_cpu_shutdown();

View File

@ -21,7 +21,7 @@
#include "gic.h" #include "gic.h"
extern struct rt_thread *rt_current_thread; extern struct rt_thread *rt_current_thread;
#ifdef RT_USING_FINSH #if defined(RT_USING_FINSH) && defined(FINSH_USING_BUILT_IN_COMMANDS)
extern long list_thread(void); extern long list_thread(void);
#endif #endif
@ -53,7 +53,7 @@ void rt_hw_trap_undef(struct rt_hw_exp_stack *regs)
{ {
rt_kprintf("undefined instruction:\n"); rt_kprintf("undefined instruction:\n");
rt_hw_show_register(regs); rt_hw_show_register(regs);
#ifdef RT_USING_FINSH #if defined(RT_USING_FINSH) && defined(FINSH_USING_BUILT_IN_COMMANDS)
list_thread(); list_thread();
#endif #endif
rt_hw_cpu_shutdown(); rt_hw_cpu_shutdown();
@ -72,7 +72,7 @@ void rt_hw_trap_swi(struct rt_hw_exp_stack *regs)
{ {
rt_kprintf("software interrupt:\n"); rt_kprintf("software interrupt:\n");
rt_hw_show_register(regs); rt_hw_show_register(regs);
#ifdef RT_USING_FINSH #if defined(RT_USING_FINSH) && defined(FINSH_USING_BUILT_IN_COMMANDS)
list_thread(); list_thread();
#endif #endif
rt_hw_cpu_shutdown(); rt_hw_cpu_shutdown();
@ -90,7 +90,7 @@ void rt_hw_trap_pabt(struct rt_hw_exp_stack *regs)
{ {
rt_kprintf("prefetch abort:\n"); rt_kprintf("prefetch abort:\n");
rt_hw_show_register(regs); rt_hw_show_register(regs);
#ifdef RT_USING_FINSH #if defined(RT_USING_FINSH) && defined(FINSH_USING_BUILT_IN_COMMANDS)
list_thread(); list_thread();
#endif #endif
rt_hw_cpu_shutdown(); rt_hw_cpu_shutdown();
@ -108,7 +108,7 @@ void rt_hw_trap_dabt(struct rt_hw_exp_stack *regs)
{ {
rt_kprintf("data abort:"); rt_kprintf("data abort:");
rt_hw_show_register(regs); rt_hw_show_register(regs);
#ifdef RT_USING_FINSH #if defined(RT_USING_FINSH) && defined(FINSH_USING_BUILT_IN_COMMANDS)
list_thread(); list_thread();
#endif #endif
rt_hw_cpu_shutdown(); rt_hw_cpu_shutdown();
@ -125,7 +125,7 @@ void rt_hw_trap_resv(struct rt_hw_exp_stack *regs)
{ {
rt_kprintf("reserved trap:\n"); rt_kprintf("reserved trap:\n");
rt_hw_show_register(regs); rt_hw_show_register(regs);
#ifdef RT_USING_FINSH #if defined(RT_USING_FINSH) && defined(FINSH_USING_BUILT_IN_COMMANDS)
list_thread(); list_thread();
#endif #endif
rt_hw_cpu_shutdown(); rt_hw_cpu_shutdown();

View File

@ -22,7 +22,7 @@
/*@{*/ /*@{*/
extern struct rt_thread *rt_current_thread; extern struct rt_thread *rt_current_thread;
#ifdef RT_USING_FINSH #if defined(RT_USING_FINSH) && defined(FINSH_USING_BUILT_IN_COMMANDS)
extern long list_thread(void); extern long list_thread(void);
#endif #endif
@ -58,7 +58,7 @@ void rt_hw_trap_udef(struct rt_hw_register *regs)
rt_kprintf("undefined instruction\n"); rt_kprintf("undefined instruction\n");
rt_kprintf("thread - %s stack:\n", rt_current_thread->name); rt_kprintf("thread - %s stack:\n", rt_current_thread->name);
#ifdef RT_USING_FINSH #if defined(RT_USING_FINSH) && defined(FINSH_USING_BUILT_IN_COMMANDS)
list_thread(); list_thread();
#endif #endif
rt_hw_cpu_shutdown(); rt_hw_cpu_shutdown();
@ -96,7 +96,7 @@ void rt_hw_trap_pabt(struct rt_hw_register *regs)
rt_kprintf("prefetch abort\n"); rt_kprintf("prefetch abort\n");
rt_kprintf("thread - %s stack:\n", rt_current_thread->name); rt_kprintf("thread - %s stack:\n", rt_current_thread->name);
#ifdef RT_USING_FINSH #if defined(RT_USING_FINSH) && defined(FINSH_USING_BUILT_IN_COMMANDS)
list_thread(); list_thread();
#endif #endif
rt_hw_cpu_shutdown(); rt_hw_cpu_shutdown();
@ -117,7 +117,7 @@ void rt_hw_trap_dabt(struct rt_hw_register *regs)
rt_kprintf("data abort\n"); rt_kprintf("data abort\n");
rt_kprintf("thread - %s stack:\n", rt_current_thread->name); rt_kprintf("thread - %s stack:\n", rt_current_thread->name);
#ifdef RT_USING_FINSH #if defined(RT_USING_FINSH) && defined(FINSH_USING_BUILT_IN_COMMANDS)
list_thread(); list_thread();
#endif #endif
rt_hw_cpu_shutdown(); rt_hw_cpu_shutdown();

View File

@ -16,7 +16,7 @@
#include "armv7.h" #include "armv7.h"
#include "interrupt.h" #include "interrupt.h"
#ifdef RT_USING_FINSH #if defined(RT_USING_FINSH) && defined(FINSH_USING_BUILT_IN_COMMANDS)
extern long list_thread(void); extern long list_thread(void);
#endif #endif
@ -48,7 +48,7 @@ void rt_hw_trap_undef(struct rt_hw_exp_stack *regs)
{ {
rt_kprintf("undefined instruction:\n"); rt_kprintf("undefined instruction:\n");
rt_hw_show_register(regs); rt_hw_show_register(regs);
#ifdef RT_USING_FINSH #if defined(RT_USING_FINSH) && defined(FINSH_USING_BUILT_IN_COMMANDS)
list_thread(); list_thread();
#endif #endif
rt_hw_cpu_shutdown(); rt_hw_cpu_shutdown();
@ -67,7 +67,7 @@ void rt_hw_trap_swi(struct rt_hw_exp_stack *regs)
{ {
rt_kprintf("software interrupt:\n"); rt_kprintf("software interrupt:\n");
rt_hw_show_register(regs); rt_hw_show_register(regs);
#ifdef RT_USING_FINSH #if defined(RT_USING_FINSH) && defined(FINSH_USING_BUILT_IN_COMMANDS)
list_thread(); list_thread();
#endif #endif
rt_hw_cpu_shutdown(); rt_hw_cpu_shutdown();
@ -85,7 +85,7 @@ void rt_hw_trap_pabt(struct rt_hw_exp_stack *regs)
{ {
rt_kprintf("prefetch abort:\n"); rt_kprintf("prefetch abort:\n");
rt_hw_show_register(regs); rt_hw_show_register(regs);
#ifdef RT_USING_FINSH #if defined(RT_USING_FINSH) && defined(FINSH_USING_BUILT_IN_COMMANDS)
list_thread(); list_thread();
#endif #endif
rt_hw_cpu_shutdown(); rt_hw_cpu_shutdown();
@ -103,7 +103,7 @@ void rt_hw_trap_dabt(struct rt_hw_exp_stack *regs)
{ {
rt_kprintf("data abort:"); rt_kprintf("data abort:");
rt_hw_show_register(regs); rt_hw_show_register(regs);
#ifdef RT_USING_FINSH #if defined(RT_USING_FINSH) && defined(FINSH_USING_BUILT_IN_COMMANDS)
list_thread(); list_thread();
#endif #endif
rt_hw_cpu_shutdown(); rt_hw_cpu_shutdown();
@ -120,7 +120,7 @@ void rt_hw_trap_resv(struct rt_hw_exp_stack *regs)
{ {
rt_kprintf("reserved trap:\n"); rt_kprintf("reserved trap:\n");
rt_hw_show_register(regs); rt_hw_show_register(regs);
#ifdef RT_USING_FINSH #if defined(RT_USING_FINSH) && defined(FINSH_USING_BUILT_IN_COMMANDS)
list_thread(); list_thread();
#endif #endif
rt_hw_cpu_shutdown(); rt_hw_cpu_shutdown();

View File

@ -335,7 +335,9 @@ uintptr_t handle_trap(uintptr_t mcause, uintptr_t epc, uintptr_t * sp)
else else
{ {
rt_thread_t tid; rt_thread_t tid;
#if defined(RT_USING_FINSH) && defined(FINSH_USING_BUILT_IN_COMMANDS)
extern long list_thread(); extern long list_thread();
#endif
rt_hw_interrupt_disable(); rt_hw_interrupt_disable();
@ -387,7 +389,7 @@ uintptr_t handle_trap(uintptr_t mcause, uintptr_t epc, uintptr_t * sp)
print_stack_frame(sp); print_stack_frame(sp);
rt_kprintf("exception pc => 0x%08x\n", epc); rt_kprintf("exception pc => 0x%08x\n", epc);
rt_kprintf("current thread: %.*s\n", RT_NAME_MAX, tid->name); rt_kprintf("current thread: %.*s\n", RT_NAME_MAX, tid->name);
#ifdef RT_USING_FINSH #if defined(RT_USING_FINSH) && defined(FINSH_USING_BUILT_IN_COMMANDS)
list_thread(); list_thread();
#endif #endif
while(1); while(1);

View File

@ -212,8 +212,9 @@ void handle_trap(rt_size_t xcause,rt_size_t xtval,rt_size_t xepc,struct rt_hw_st
else else
{ {
rt_thread_t tid; rt_thread_t tid;
#if defined(RT_USING_FINSH) && defined(FINSH_USING_BUILT_IN_COMMANDS)
extern long list_thread(); extern long list_thread();
#endif
rt_hw_interrupt_disable(); rt_hw_interrupt_disable();
rt_kprintf("xcause = %08x,xtval = %08x,xepc = %08x\n", xcause, xtval, xepc); rt_kprintf("xcause = %08x,xtval = %08x,xepc = %08x\n", xcause, xtval, xepc);
@ -265,7 +266,7 @@ void handle_trap(rt_size_t xcause,rt_size_t xtval,rt_size_t xepc,struct rt_hw_st
dump_regs(sp); dump_regs(sp);
rt_kprintf("exception pc => 0x%08x\n", xepc); rt_kprintf("exception pc => 0x%08x\n", xepc);
rt_kprintf("current thread: %.*s\n", RT_NAME_MAX, tid->name); rt_kprintf("current thread: %.*s\n", RT_NAME_MAX, tid->name);
#ifdef RT_USING_FINSH #if defined(RT_USING_FINSH) && defined(FINSH_USING_BUILT_IN_COMMANDS)
list_thread(); list_thread();
#endif #endif
while(1); while(1);

View File

@ -94,7 +94,7 @@ rt_uint8_t *rt_hw_stack_init(void *tentry, void *parameter,
return(rt_uint8_t *)stack_frame; return(rt_uint8_t *)stack_frame;
} }
#ifdef RT_USING_FINSH #if defined(RT_USING_FINSH) && defined(FINSH_USING_BUILT_IN_COMMANDS)
extern void list_thread(void); extern void list_thread(void);
#endif #endif
extern rt_thread_t rt_current_thread; extern rt_thread_t rt_current_thread;
@ -130,7 +130,7 @@ void rt_hw_hard_fault_exception(struct stack_frame* exception_contex)
rt_kprintf("acclo: 0x%08x\n", exception_contex->ACCLO); rt_kprintf("acclo: 0x%08x\n", exception_contex->ACCLO);
} }
rt_kprintf("hard fault on thread: %s\n", rt_current_thread->name); rt_kprintf("hard fault on thread: %s\n", rt_current_thread->name);
#ifdef RT_USING_FINSH #if defined(RT_USING_FINSH) && defined(FINSH_USING_BUILT_IN_COMMANDS)
list_thread(); list_thread();
#endif #endif
while (1); while (1);

View File

@ -730,13 +730,15 @@ int memheaptrace(void)
if (count > 0) if (count > 0)
{ {
int index; int index;
#if defined(RT_USING_FINSH) && defined(FINSH_USING_BUILT_IN_COMMANDS)
extern int list_memheap(void); extern int list_memheap(void);
#endif
heaps = (struct rt_memheap **)rt_malloc(sizeof(struct rt_memheap *) * count); heaps = (struct rt_memheap **)rt_malloc(sizeof(struct rt_memheap *) * count);
if (heaps == RT_NULL) return 0; if (heaps == RT_NULL) return 0;
#if defined(RT_USING_FINSH) && defined(FINSH_USING_BUILT_IN_COMMANDS)
list_memheap(); list_memheap();
#endif
rt_kprintf("memheap header size: %d\n", RT_MEMHEAP_SIZE); rt_kprintf("memheap header size: %d\n", RT_MEMHEAP_SIZE);
count = rt_object_get_pointers(RT_Object_Class_MemHeap, (rt_object_t *)heaps, count); count = rt_object_get_pointers(RT_Object_Class_MemHeap, (rt_object_t *)heaps, count);
for (index = 0; index < count; index++) for (index = 0; index < count; index++)