summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBernard Xiong <[email protected]>2021-09-02 10:03:03 +0800
committerGitHub <[email protected]>2021-09-02 10:03:03 +0800
commitc89e7e43eddade839c62d4cfc45606a03e7aab31 (patch)
treef9453504e7a740011cbf376d3cc0bc6148024980
parent42d90b9430c651c94ea7b022d321524b32a124e4 (diff)
parent1997113fbca8894dcaad75a6fa4e7b42396a4031 (diff)
Merge pull request #4976 from mysterywolf/finsh_kconfig
[finsh] finsh组件可以选择是否包含内置命令
-rw-r--r--bsp/allwinner_tina/libcpu/trap.c8
-rw-r--r--bsp/bluetrum/ab32vg1-ab-prougen/board/board.c2
-rw-r--r--bsp/dm365/platform/trap.c8
-rw-r--r--bsp/imx6sx/cortex-a9/cpu/trap.c12
-rw-r--r--bsp/qemu-vexpress-gemini/cpu/trap.c12
-rw-r--r--bsp/raspberry-pi/raspi2/cpu/trap.c12
-rw-r--r--bsp/raspberry-pi/raspi3-32/cpu/trap.c12
-rw-r--r--components/finsh/Kconfig102
-rw-r--r--components/finsh/SConscript6
-rw-r--r--components/finsh/msh.c22
-rw-r--r--libcpu/aarch64/cortex-a53/trap.c4
-rw-r--r--libcpu/aarch64/cortex-a72/trap.c4
-rw-r--r--libcpu/arm/am335x/trap.c8
-rw-r--r--libcpu/arm/arm926/trap.c8
-rw-r--r--libcpu/arm/cortex-a/trap.c12
-rw-r--r--libcpu/arm/cortex-m0/cpuport.c4
-rw-r--r--libcpu/arm/cortex-m23/cpuport.c4
-rw-r--r--libcpu/arm/cortex-m3/cpuport.c6
-rw-r--r--libcpu/arm/cortex-m33/cpuport.c4
-rw-r--r--libcpu/arm/cortex-m4/cpuport.c4
-rw-r--r--libcpu/arm/cortex-m7/cpuport.c4
-rw-r--r--libcpu/arm/cortex-r4/trap.c8
-rw-r--r--libcpu/arm/realview-a8-vmm/trap.c12
-rw-r--r--libcpu/arm/s3c24x0/trap.c8
-rw-r--r--libcpu/arm/zynqmp-r5/trap.c12
-rw-r--r--libcpu/risc-v/k210/interrupt.c4
-rw-r--r--libcpu/risc-v/virt64/interrupt.c5
-rw-r--r--libcpu/rx/cpuport.c4
-rw-r--r--src/memheap.c6
29 files changed, 174 insertions, 143 deletions
diff --git a/bsp/allwinner_tina/libcpu/trap.c b/bsp/allwinner_tina/libcpu/trap.c
index daf3501c68..2017f33759 100644
--- a/bsp/allwinner_tina/libcpu/trap.c
+++ b/bsp/allwinner_tina/libcpu/trap.c
@@ -15,7 +15,7 @@
#define INT_FIQ 0x01
extern struct rt_thread *rt_current_thread;
-#ifdef RT_USING_FINSH
+#if defined(RT_USING_FINSH) && defined(MSH_USING_BUILT_IN_COMMANDS)
extern long list_thread(void);
#endif
@@ -89,7 +89,7 @@ void rt_hw_trap_udef(struct rt_hw_register *regs)
rt_kprintf("undefined instruction\n");
rt_kprintf("thread - %s stack:\n", rt_current_thread->name);
-#ifdef RT_USING_FINSH
+#if defined(RT_USING_FINSH) && defined(MSH_USING_BUILT_IN_COMMANDS)
list_thread();
#endif
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("thread - %s stack:\n", RT_NAME_MAX, rt_current_thread->name);
-#ifdef RT_USING_FINSH
+#if defined(RT_USING_FINSH) && defined(MSH_USING_BUILT_IN_COMMANDS)
list_thread();
#endif
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("thread - %s stack:\n", RT_NAME_MAX, rt_current_thread->name);
-#ifdef RT_USING_FINSH
+#if defined(RT_USING_FINSH) && defined(MSH_USING_BUILT_IN_COMMANDS)
list_thread();
#endif
rt_hw_cpu_shutdown();
diff --git a/bsp/bluetrum/ab32vg1-ab-prougen/board/board.c b/bsp/bluetrum/ab32vg1-ab-prougen/board/board.c
index f68ec1bba8..32714f6a4d 100644
--- a/bsp/bluetrum/ab32vg1-ab-prougen/board/board.c
+++ b/bsp/bluetrum/ab32vg1-ab-prougen/board/board.c
@@ -209,7 +209,9 @@ void rt_hw_console_output(const char *str)
RT_SECTION(".irq.err")
void exception_isr(void)
{
+#if defined(RT_USING_FINSH) && defined(MSH_USING_BUILT_IN_COMMANDS)
extern long list_thread(void);
+#endif
sys_error_hook(1);
#ifdef RT_USING_CONSOLE
diff --git a/bsp/dm365/platform/trap.c b/bsp/dm365/platform/trap.c
index 5c5f0272b3..68b834b9d8 100644
--- a/bsp/dm365/platform/trap.c
+++ b/bsp/dm365/platform/trap.c
@@ -20,7 +20,7 @@
/*@{*/
extern struct rt_thread *rt_current_thread;
-#ifdef RT_USING_FINSH
+#if defined(RT_USING_FINSH) && defined(MSH_USING_BUILT_IN_COMMANDS)
extern long list_thread(void);
#endif
@@ -56,7 +56,7 @@ void rt_hw_trap_udef(struct rt_hw_register *regs)
rt_kprintf("undefined instruction\n");
rt_kprintf("thread - %s stack:\n", rt_current_thread->name);
-#ifdef RT_USING_FINSH
+#if defined(RT_USING_FINSH) && defined(MSH_USING_BUILT_IN_COMMANDS)
list_thread();
#endif
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("thread - %s stack:\n", rt_current_thread->name);
-#ifdef RT_USING_FINSH
+#if defined(RT_USING_FINSH) && defined(MSH_USING_BUILT_IN_COMMANDS)
list_thread();
#endif
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("thread - %s stack:\n", rt_current_thread->name);
-#ifdef RT_USING_FINSH
+#if defined(RT_USING_FINSH) && defined(MSH_USING_BUILT_IN_COMMANDS)
list_thread();
#endif
rt_hw_cpu_shutdown();
diff --git a/bsp/imx6sx/cortex-a9/cpu/trap.c b/bsp/imx6sx/cortex-a9/cpu/trap.c
index f3b2c26e6d..4625d1accf 100644
--- a/bsp/imx6sx/cortex-a9/cpu/trap.c
+++ b/bsp/imx6sx/cortex-a9/cpu/trap.c
@@ -17,7 +17,7 @@
#include "gic.h"
extern struct rt_thread *rt_current_thread;
-#ifdef RT_USING_FINSH
+#if defined(RT_USING_FINSH) && defined(MSH_USING_BUILT_IN_COMMANDS)
extern long list_thread(void);
#endif
@@ -49,7 +49,7 @@ void rt_hw_trap_undef(struct rt_hw_exp_stack *regs)
{
rt_kprintf("undefined instruction:\n");
rt_hw_show_register(regs);
-#ifdef RT_USING_FINSH
+#if defined(RT_USING_FINSH) && defined(MSH_USING_BUILT_IN_COMMANDS)
list_thread();
#endif
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_hw_show_register(regs);
-#ifdef RT_USING_FINSH
+#if defined(RT_USING_FINSH) && defined(MSH_USING_BUILT_IN_COMMANDS)
list_thread();
#endif
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_hw_show_register(regs);
-#ifdef RT_USING_FINSH
+#if defined(RT_USING_FINSH) && defined(MSH_USING_BUILT_IN_COMMANDS)
list_thread();
#endif
rt_hw_cpu_shutdown();
@@ -104,7 +104,7 @@ void rt_hw_trap_dabt(struct rt_hw_exp_stack *regs)
{
rt_kprintf("data abort:");
rt_hw_show_register(regs);
-#ifdef RT_USING_FINSH
+#if defined(RT_USING_FINSH) && defined(MSH_USING_BUILT_IN_COMMANDS)
list_thread();
#endif
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_hw_show_register(regs);
-#ifdef RT_USING_FINSH
+#if defined(RT_USING_FINSH) && defined(MSH_USING_BUILT_IN_COMMANDS)
list_thread();
#endif
rt_hw_cpu_shutdown();
diff --git a/bsp/qemu-vexpress-gemini/cpu/trap.c b/bsp/qemu-vexpress-gemini/cpu/trap.c
index c6ca45aee7..86eceb39cf 100644
--- a/bsp/qemu-vexpress-gemini/cpu/trap.c
+++ b/bsp/qemu-vexpress-gemini/cpu/trap.c
@@ -21,7 +21,7 @@
#include "gic.h"
extern struct rt_thread *rt_current_thread;
-#ifdef RT_USING_FINSH
+#if defined(RT_USING_FINSH) && defined(MSH_USING_BUILT_IN_COMMANDS)
extern long list_thread(void);
#endif
@@ -53,7 +53,7 @@ void rt_hw_trap_undef(struct rt_hw_exp_stack *regs)
{
rt_kprintf("undefined instruction:\n");
rt_hw_show_register(regs);
-#ifdef RT_USING_FINSH
+#if defined(RT_USING_FINSH) && defined(MSH_USING_BUILT_IN_COMMANDS)
list_thread();
#endif
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_hw_show_register(regs);
-#ifdef RT_USING_FINSH
+#if defined(RT_USING_FINSH) && defined(MSH_USING_BUILT_IN_COMMANDS)
list_thread();
#endif
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_hw_show_register(regs);
-#ifdef RT_USING_FINSH
+#if defined(RT_USING_FINSH) && defined(MSH_USING_BUILT_IN_COMMANDS)
list_thread();
#endif
rt_hw_cpu_shutdown();
@@ -108,7 +108,7 @@ void rt_hw_trap_dabt(struct rt_hw_exp_stack *regs)
{
rt_kprintf("data abort:");
rt_hw_show_register(regs);
-#ifdef RT_USING_FINSH
+#if defined(RT_USING_FINSH) && defined(MSH_USING_BUILT_IN_COMMANDS)
list_thread();
#endif
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_hw_show_register(regs);
-#ifdef RT_USING_FINSH
+#if defined(RT_USING_FINSH) && defined(MSH_USING_BUILT_IN_COMMANDS)
list_thread();
#endif
rt_hw_cpu_shutdown();
diff --git a/bsp/raspberry-pi/raspi2/cpu/trap.c b/bsp/raspberry-pi/raspi2/cpu/trap.c
index 8a1eb33c65..ef2f141546 100644
--- a/bsp/raspberry-pi/raspi2/cpu/trap.c
+++ b/bsp/raspberry-pi/raspi2/cpu/trap.c
@@ -15,7 +15,7 @@
#include "armv7.h"
extern struct rt_thread *rt_current_thread;
-#ifdef RT_USING_FINSH
+#if defined(RT_USING_FINSH) && defined(MSH_USING_BUILT_IN_COMMANDS)
extern long list_thread(void);
#endif
@@ -47,7 +47,7 @@ void rt_hw_trap_undef(struct rt_hw_exp_stack *regs)
{
rt_kprintf("undefined instruction:\n");
rt_hw_show_register(regs);
-#ifdef RT_USING_FINSH
+#if defined(RT_USING_FINSH) && defined(MSH_USING_BUILT_IN_COMMANDS)
list_thread();
#endif
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_hw_show_register(regs);
-#ifdef RT_USING_FINSH
+#if defined(RT_USING_FINSH) && defined(MSH_USING_BUILT_IN_COMMANDS)
list_thread();
#endif
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_hw_show_register(regs);
-#ifdef RT_USING_FINSH
+#if defined(RT_USING_FINSH) && defined(MSH_USING_BUILT_IN_COMMANDS)
list_thread();
#endif
rt_hw_cpu_shutdown();
@@ -102,7 +102,7 @@ void rt_hw_trap_dabt(struct rt_hw_exp_stack *regs)
{
rt_kprintf("data abort:");
rt_hw_show_register(regs);
-#ifdef RT_USING_FINSH
+#if defined(RT_USING_FINSH) && defined(MSH_USING_BUILT_IN_COMMANDS)
list_thread();
#endif
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_hw_show_register(regs);
-#ifdef RT_USING_FINSH
+#if defined(RT_USING_FINSH) && defined(MSH_USING_BUILT_IN_COMMANDS)
list_thread();
#endif
rt_hw_cpu_shutdown();
diff --git a/bsp/raspberry-pi/raspi3-32/cpu/trap.c b/bsp/raspberry-pi/raspi3-32/cpu/trap.c
index b9fa6bb1c5..3fcd16481e 100644
--- a/bsp/raspberry-pi/raspi3-32/cpu/trap.c
+++ b/bsp/raspberry-pi/raspi3-32/cpu/trap.c
@@ -18,7 +18,7 @@
#include "armv7.h"
extern struct rt_thread *rt_current_thread;
-#ifdef RT_USING_FINSH
+#if defined(RT_USING_FINSH) && defined(MSH_USING_BUILT_IN_COMMANDS)
extern long list_thread(void);
#endif
@@ -52,7 +52,7 @@ void rt_hw_trap_undef(struct rt_hw_exp_stack *regs)
{
rt_kprintf("undefined instruction:\n");
rt_hw_show_register(regs);
-#ifdef RT_USING_FINSH
+#if defined(RT_USING_FINSH) && defined(MSH_USING_BUILT_IN_COMMANDS)
list_thread();
#endif
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_hw_show_register(regs);
-#ifdef RT_USING_FINSH
+#if defined(RT_USING_FINSH) && defined(MSH_USING_BUILT_IN_COMMANDS)
list_thread();
#endif
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_hw_show_register(regs);
-#ifdef RT_USING_FINSH
+#if defined(RT_USING_FINSH) && defined(MSH_USING_BUILT_IN_COMMANDS)
list_thread();
#endif
rt_hw_cpu_shutdown();
@@ -107,7 +107,7 @@ void rt_hw_trap_dabt(struct rt_hw_exp_stack *regs)
{
rt_kprintf("data abort:");
rt_hw_show_register(regs);
-#ifdef RT_USING_FINSH
+#if defined(RT_USING_FINSH) && defined(MSH_USING_BUILT_IN_COMMANDS)
list_thread();
#endif
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_hw_show_register(regs);
-#ifdef RT_USING_FINSH
+#if defined(RT_USING_FINSH) && defined(MSH_USING_BUILT_IN_COMMANDS)
list_thread();
#endif
rt_hw_cpu_shutdown();
diff --git a/components/finsh/Kconfig b/components/finsh/Kconfig
index 637b1a30c1..cf4e673c75 100644
--- a/components/finsh/Kconfig
+++ b/components/finsh/Kconfig
@@ -11,61 +11,69 @@ config RT_USING_MSH
if RT_USING_MSH
-config FINSH_THREAD_NAME
- string "The msh thread name"
- default "tshell"
-config FINSH_USING_HISTORY
- bool "Enable command history feature"
- default y
-if FINSH_USING_HISTORY
-config FINSH_HISTORY_LINES
- int "The command history line number"
- default 5
-endif
+ config FINSH_THREAD_NAME
+ string "The msh thread name"
+ default "tshell"
-config FINSH_USING_SYMTAB
- bool "Using symbol table for commands"
- default y
+ config FINSH_THREAD_PRIORITY
+ int "The priority level value of thread"
+ default 20
-config FINSH_USING_DESCRIPTION
- bool "Keeping description in symbol table"
- default y
+ config FINSH_THREAD_STACK_SIZE
+ int "The stack size for thread"
+ default 4096
-config FINSH_ECHO_DISABLE_DEFAULT
- bool "Disable the echo mode in default"
- default n
-
-config FINSH_THREAD_PRIORITY
- int "The priority level value of thread"
- default 20
+ config FINSH_USING_HISTORY
+ bool "Enable command history feature"
+ default y
-config FINSH_THREAD_STACK_SIZE
- int "The stack size for thread"
- default 4096
+ if FINSH_USING_HISTORY
+ config FINSH_HISTORY_LINES
+ int "The command history line number"
+ default 5
+ endif
-config FINSH_CMD_SIZE
- int "The command line size for shell"
- default 80
+ config FINSH_USING_SYMTAB
+ bool "Using symbol table for commands"
+ default y
-config FINSH_USING_AUTH
- bool "shell support authentication"
- default n
+ config FINSH_CMD_SIZE
+ int "The command line size for shell"
+ default 80
-if FINSH_USING_AUTH
-config FINSH_DEFAULT_PASSWORD
- string "The default password for shell authentication"
- default "rtthread"
-config FINSH_PASSWORD_MIN
- int "The password min length"
- default 6
-config FINSH_PASSWORD_MAX
- int "The password max length"
- default RT_NAME_MAX
-endif
+ config MSH_USING_BUILT_IN_COMMANDS
+ bool "Enable built-in commands, such as list_thread"
+ default y
+
+ config FINSH_USING_DESCRIPTION
+ bool "Keeping description in symbol table"
+ default y
+
+ config FINSH_ECHO_DISABLE_DEFAULT
+ bool "Disable the echo mode in default"
+ default n
+
+ config FINSH_USING_AUTH
+ bool "shell support authentication"
+ default n
+
+ if FINSH_USING_AUTH
+ config FINSH_DEFAULT_PASSWORD
+ string "The default password for shell authentication"
+ default "rtthread"
+
+ config FINSH_PASSWORD_MIN
+ int "The password min length"
+ default 6
+
+ config FINSH_PASSWORD_MAX
+ int "The password max length"
+ default RT_NAME_MAX
+ endif
-config FINSH_ARG_MAX
- int "The number of arguments for a shell command"
- default 10
+ config FINSH_ARG_MAX
+ int "The number of arguments for a shell command"
+ default 10
endif
diff --git a/components/finsh/SConscript b/components/finsh/SConscript
index 1a6d7c8fc7..28fe02bac5 100644
--- a/components/finsh/SConscript
+++ b/components/finsh/SConscript
@@ -3,15 +3,17 @@ from building import *
cwd = GetCurrentDir()
src = Split('''
shell.c
-cmd.c
msh.c
''')
+if GetDepend('MSH_USING_BUILT_IN_COMMANDS'):
+ src += ['cmd.c']
+
if GetDepend('RT_USING_DFS'):
src += ['msh_file.c']
CPPPATH = [cwd]
-group = DefineGroup('msh', src, depend = ['RT_USING_FINSH'], CPPPATH = CPPPATH)
+group = DefineGroup('Finsh', src, depend = ['RT_USING_FINSH'], CPPPATH = CPPPATH)
Return('group')
diff --git a/components/finsh/msh.c b/components/finsh/msh.c
index 899a6567b1..86985c561c 100644
--- a/components/finsh/msh.c
+++ b/components/finsh/msh.c
@@ -54,6 +54,7 @@ int msh_help(int argc, char **argv)
}
MSH_CMD_EXPORT_ALIAS(msh_help, help, RT - Thread shell help.);
+#ifdef MSH_USING_BUILT_IN_COMMANDS
int cmd_ps(int argc, char **argv)
{
extern long list_thread(void);
@@ -77,13 +78,14 @@ int cmd_free(int argc, char **argv)
#ifdef RT_USING_MEMHEAP_AS_HEAP
list_memheap();
-#else
+#else /* RT_USING_MEMHEAP_AS_HEAP */
list_mem();
#endif
return 0;
}
MSH_CMD_EXPORT_ALIAS(cmd_free, free, Show the memory usage in the system.);
-#endif
+#endif /* RT_USING_HEAP */
+#endif /* MSH_USING_BUILT_IN_COMMANDS */
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;
}
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)
{
@@ -339,7 +341,7 @@ static int _msh_exec_lwp(char *cmd, rt_size_t length)
return 0;
}
-#endif
+#endif /* defined(RT_USING_LWP) && defined(RT_USING_DFS) */
int msh_exec(char *cmd, rt_size_t length)
{
@@ -376,15 +378,15 @@ int msh_exec(char *cmd, rt_size_t length)
{
return 0;
}
-#endif
+#endif /* RT_USING_MODULE */
#ifdef RT_USING_LWP
if (_msh_exec_lwp(cmd, length) == 0)
{
return 0;
}
-#endif
-#endif
+#endif /* RT_USING_LWP */
+#endif /* RT_USING_DFS */
/* truncate the cmd at the first space. */
{
@@ -534,7 +536,7 @@ void msh_auto_complete_path(char *path)
closedir(dir);
rt_free(full_path);
}
-#endif
+#endif /* RT_USING_DFS */
void msh_auto_complete(char *prefix)
{
@@ -575,9 +577,9 @@ void msh_auto_complete(char *prefix)
{
msh_auto_complete_path(ptr);
}
-#endif
+#endif /* RT_USING_MODULE */
}
-#endif
+#endif /* RT_USING_DFS */
/* checks in internal command */
{
diff --git a/libcpu/aarch64/cortex-a53/trap.c b/libcpu/aarch64/cortex-a53/trap.c
index ca5b6ecd44..6002713543 100644
--- a/libcpu/aarch64/cortex-a53/trap.c
+++ b/libcpu/aarch64/cortex-a53/trap.c
@@ -19,7 +19,7 @@
#endif
extern struct rt_thread *rt_current_thread;
-#ifdef RT_USING_FINSH
+#if defined(RT_USING_FINSH) && defined(MSH_USING_BUILT_IN_COMMANDS)
extern long list_thread(void);
#endif
@@ -55,7 +55,7 @@ void rt_hw_trap_error(struct rt_hw_exp_stack *regs)
{
rt_kprintf("error exception:\n");
rt_hw_show_register(regs);
-#ifdef RT_USING_FINSH
+#if defined(RT_USING_FINSH) && defined(MSH_USING_BUILT_IN_COMMANDS)
list_thread();
#endif
rt_hw_cpu_shutdown();
diff --git a/libcpu/aarch64/cortex-a72/trap.c b/libcpu/aarch64/cortex-a72/trap.c
index bd76f7717b..ba96f03a69 100644
--- a/libcpu/aarch64/cortex-a72/trap.c
+++ b/libcpu/aarch64/cortex-a72/trap.c
@@ -14,7 +14,7 @@
#include "armv8.h"
extern struct rt_thread *rt_current_thread;
-#ifdef RT_USING_FINSH
+#if defined(RT_USING_FINSH) && defined(MSH_USING_BUILT_IN_COMMANDS)
extern long list_thread(void);
#endif
@@ -50,7 +50,7 @@ void rt_hw_trap_error(struct rt_hw_exp_stack *regs)
{
rt_kprintf("error exception:\n");
rt_hw_show_register(regs);
-#ifdef RT_USING_FINSH
+#if defined(RT_USING_FINSH) && defined(MSH_USING_BUILT_IN_COMMANDS)
list_thread();
#endif
rt_hw_cpu_shutdown();
diff --git a/libcpu/arm/am335x/trap.c b/libcpu/arm/am335x/trap.c
index 7c73ce93d3..19cb31ad67 100644
--- a/libcpu/arm/am335x/trap.c
+++ b/libcpu/arm/am335x/trap.c
@@ -24,7 +24,7 @@
/*@{*/
extern struct rt_thread *rt_current_thread;
-#ifdef RT_USING_FINSH
+#if defined(RT_USING_FINSH) && defined(MSH_USING_BUILT_IN_COMMANDS)
extern long list_thread(void);
#endif
@@ -67,7 +67,7 @@ void rt_hw_trap_udef(struct rt_hw_register *regs)
rt_kprintf("undefined instruction\n");
rt_kprintf("thread %.*s stack:\n", RT_NAME_MAX, rt_current_thread->name);
-#ifdef RT_USING_FINSH
+#if defined(RT_USING_FINSH) && defined(MSH_USING_BUILT_IN_COMMANDS)
list_thread();
#endif
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("thread %.*s stack:\n", RT_NAME_MAX, rt_current_thread->name);
-#ifdef RT_USING_FINSH
+#if defined(RT_USING_FINSH) && defined(MSH_USING_BUILT_IN_COMMANDS)
list_thread();
#endif
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("thread %.*s stack:\n", RT_NAME_MAX, rt_current_thread->name);
-#ifdef RT_USING_FINSH
+#if defined(RT_USING_FINSH) && defined(MSH_USING_BUILT_IN_COMMANDS)
list_thread();
#endif
rt_hw_cpu_shutdown();
diff --git a/libcpu/arm/arm926/trap.c b/libcpu/arm/arm926/trap.c
index c364b2addd..c1b1ffe912 100644
--- a/libcpu/arm/arm926/trap.c
+++ b/libcpu/arm/arm926/trap.c
@@ -16,7 +16,7 @@
#define INT_FIQ 0x01
extern struct rt_thread *rt_current_thread;
-#ifdef RT_USING_FINSH
+#if defined(RT_USING_FINSH) && defined(MSH_USING_BUILT_IN_COMMANDS)
extern long list_thread(void);
#endif
@@ -90,7 +90,7 @@ void rt_hw_trap_udef(struct rt_hw_register *regs)
rt_kprintf("undefined instruction\n");
rt_kprintf("thread - %s stack:\n", rt_current_thread->name);
-#ifdef RT_USING_FINSH
+#if defined(RT_USING_FINSH) && defined(MSH_USING_BUILT_IN_COMMANDS)
list_thread();
#endif
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("thread - %s stack:\n", RT_NAME_MAX, rt_current_thread->name);
-#ifdef RT_USING_FINSH
+#if defined(RT_USING_FINSH) && defined(MSH_USING_BUILT_IN_COMMANDS)
list_thread();
#endif
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("thread - %s stack:\n", RT_NAME_MAX, rt_current_thread->name);
-#ifdef RT_USING_FINSH
+#if defined(RT_USING_FINSH) && defined(MSH_USING_BUILT_IN_COMMANDS)
list_thread();
#endif
rt_hw_cpu_shutdown();
diff --git a/libcpu/arm/cortex-a/trap.c b/libcpu/arm/cortex-a/trap.c
index b3efe31a64..814db418cd 100644
--- a/libcpu/arm/cortex-a/trap.c
+++ b/libcpu/arm/cortex-a/trap.c
@@ -15,7 +15,7 @@
#include "armv7.h"
#include "interrupt.h"
-#ifdef RT_USING_FINSH
+#if defined(RT_USING_FINSH) && defined(MSH_USING_BUILT_IN_COMMANDS)
extern long list_thread(void);
#endif
@@ -89,7 +89,7 @@ void rt_hw_trap_undef(struct rt_hw_exp_stack *regs)
{
rt_kprintf("undefined instruction:\n");
rt_hw_show_register(regs);
-#ifdef RT_USING_FINSH
+#if defined(RT_USING_FINSH) && defined(MSH_USING_BUILT_IN_COMMANDS)
list_thread();
#endif
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_hw_show_register(regs);
-#ifdef RT_USING_FINSH
+#if defined(RT_USING_FINSH) && defined(MSH_USING_BUILT_IN_COMMANDS)
list_thread();
#endif
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_hw_show_register(regs);
-#ifdef RT_USING_FINSH
+#if defined(RT_USING_FINSH) && defined(MSH_USING_BUILT_IN_COMMANDS)
list_thread();
#endif
rt_hw_cpu_shutdown();
@@ -165,7 +165,7 @@ void rt_hw_trap_dabt(struct rt_hw_exp_stack *regs)
{
rt_kprintf("data abort:");
rt_hw_show_register(regs);
-#ifdef RT_USING_FINSH
+#if defined(RT_USING_FINSH) && defined(MSH_USING_BUILT_IN_COMMANDS)
list_thread();
#endif
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_hw_show_register(regs);
-#ifdef RT_USING_FINSH
+#if defined(RT_USING_FINSH) && defined(MSH_USING_BUILT_IN_COMMANDS)
list_thread();
#endif
rt_hw_cpu_shutdown();
diff --git a/libcpu/arm/cortex-m0/cpuport.c b/libcpu/arm/cortex-m0/cpuport.c
index 49e15bf339..af343aa8b2 100644
--- a/libcpu/arm/cortex-m0/cpuport.c
+++ b/libcpu/arm/cortex-m0/cpuport.c
@@ -90,7 +90,9 @@ rt_uint8_t *rt_hw_stack_init(void *tentry,
return stk;
}
+#if defined(RT_USING_FINSH) && defined(MSH_USING_BUILT_IN_COMMANDS)
extern long list_thread(void);
+#endif
extern rt_thread_t rt_current_thread;
/**
* 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);
-#ifdef RT_USING_FINSH
+#if defined(RT_USING_FINSH) && defined(MSH_USING_BUILT_IN_COMMANDS)
list_thread();
#endif
diff --git a/libcpu/arm/cortex-m23/cpuport.c b/libcpu/arm/cortex-m23/cpuport.c
index d8f9b12c2c..a3b18f5f35 100644
--- a/libcpu/arm/cortex-m23/cpuport.c
+++ b/libcpu/arm/cortex-m23/cpuport.c
@@ -91,7 +91,9 @@ rt_uint8_t *rt_hw_stack_init(void *tentry,
return stk;
}
+#if defined(RT_USING_FINSH) && defined(MSH_USING_BUILT_IN_COMMANDS)
extern long list_thread(void);
+#endif
extern rt_thread_t rt_current_thread;
/**
* 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);
-#ifdef RT_USING_FINSH
+#if defined(RT_USING_FINSH) && defined(MSH_USING_BUILT_IN_COMMANDS)
list_thread();
#endif
diff --git a/libcpu/arm/cortex-m3/cpuport.c b/libcpu/arm/cortex-m3/cpuport.c
index 19c33bd7c9..d376f00424 100644
--- a/libcpu/arm/cortex-m3/cpuport.c
+++ b/libcpu/arm/cortex-m3/cpuport.c
@@ -291,7 +291,9 @@ struct exception_info
*/
void rt_hw_hard_fault_exception(struct exception_info * exception_info)
{
+#if defined(RT_USING_FINSH) && defined(MSH_USING_BUILT_IN_COMMANDS)
extern long list_thread(void);
+#endif
struct stack_frame* context = &exception_info->stack_frame;
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);
-#ifdef RT_USING_FINSH
+#if defined(RT_USING_FINSH) && defined(MSH_USING_BUILT_IN_COMMANDS)
list_thread();
-#endif /* RT_USING_FINSH */
+#endif
}
else
{
diff --git a/libcpu/arm/cortex-m33/cpuport.c b/libcpu/arm/cortex-m33/cpuport.c
index 928689d9c8..aa2325012c 100644
--- a/libcpu/arm/cortex-m33/cpuport.c
+++ b/libcpu/arm/cortex-m33/cpuport.c
@@ -373,7 +373,9 @@ struct exception_info
void rt_hw_hard_fault_exception(struct exception_info *exception_info)
{
+#if defined(RT_USING_FINSH) && defined(MSH_USING_BUILT_IN_COMMANDS)
extern long list_thread(void);
+#endif
struct exception_stack_frame *exception_stack = &exception_info->stack_frame.exception_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);
-#ifdef RT_USING_FINSH
+#if defined(RT_USING_FINSH) && defined(MSH_USING_BUILT_IN_COMMANDS)
list_thread();
#endif
}
diff --git a/libcpu/arm/cortex-m4/cpuport.c b/libcpu/arm/cortex-m4/cpuport.c
index dbc42d21cf..f24c33cf4d 100644
--- a/libcpu/arm/cortex-m4/cpuport.c
+++ b/libcpu/arm/cortex-m4/cpuport.c
@@ -370,7 +370,9 @@ struct exception_info
void rt_hw_hard_fault_exception(struct exception_info *exception_info)
{
+#if defined(RT_USING_FINSH) && defined(MSH_USING_BUILT_IN_COMMANDS)
extern long list_thread(void);
+#endif
struct exception_stack_frame *exception_stack = &exception_info->stack_frame.exception_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);
-#ifdef RT_USING_FINSH
+#if defined(RT_USING_FINSH) && defined(MSH_USING_BUILT_IN_COMMANDS)
list_thread();
#endif
}
diff --git a/libcpu/arm/cortex-m7/cpuport.c b/libcpu/arm/cortex-m7/cpuport.c
index dbc42d21cf..f24c33cf4d 100644
--- a/libcpu/arm/cortex-m7/cpuport.c
+++ b/libcpu/arm/cortex-m7/cpuport.c
@@ -370,7 +370,9 @@ struct exception_info
void rt_hw_hard_fault_exception(struct exception_info *exception_info)
{
+#if defined(RT_USING_FINSH) && defined(MSH_USING_BUILT_IN_COMMANDS)
extern long list_thread(void);
+#endif
struct exception_stack_frame *exception_stack = &exception_info->stack_frame.exception_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);
-#ifdef RT_USING_FINSH
+#if defined(RT_USING_FINSH) && defined(MSH_USING_BUILT_IN_COMMANDS)
list_thread();
#endif
}
diff --git a/libcpu/arm/cortex-r4/trap.c b/libcpu/arm/cortex-r4/trap.c
index e6c62390c1..3ff3d297c0 100644
--- a/libcpu/arm/cortex-r4/trap.c
+++ b/libcpu/arm/cortex-r4/trap.c
@@ -67,7 +67,7 @@ void rt_hw_trap_svc(struct rt_hw_exp_stack *regs)
{
rt_kprintf("software interrupt\n");
rt_hw_show_register(regs);
-#ifdef RT_USING_FINSH
+#if defined(RT_USING_FINSH) && defined(MSH_USING_BUILT_IN_COMMANDS)
list_thread();
#endif
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_hw_show_register(regs);
-#ifdef RT_USING_FINSH
+#if defined(RT_USING_FINSH) && defined(MSH_USING_BUILT_IN_COMMANDS)
list_thread();
#endif
rt_hw_cpu_shutdown();
@@ -103,7 +103,7 @@ void rt_hw_trap_dabt(struct rt_hw_exp_stack *regs)
{
rt_kprintf("Data Abort ");
rt_hw_show_register(regs);
-#ifdef RT_USING_FINSH
+#if defined(RT_USING_FINSH) && defined(MSH_USING_BUILT_IN_COMMANDS)
list_thread();
#endif
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_hw_show_register(regs);
-#ifdef RT_USING_FINSH
+#if defined(RT_USING_FINSH) && defined(MSH_USING_BUILT_IN_COMMANDS)
list_thread();
#endif
rt_hw_cpu_shutdown();
diff --git a/libcpu/arm/realview-a8-vmm/trap.c b/libcpu/arm/realview-a8-vmm/trap.c
index c6ca45aee7..86eceb39cf 100644
--- a/libcpu/arm/realview-a8-vmm/trap.c
+++ b/libcpu/arm/realview-a8-vmm/trap.c
@@ -21,7 +21,7 @@
#include "gic.h"
extern struct rt_thread *rt_current_thread;
-#ifdef RT_USING_FINSH
+#if defined(RT_USING_FINSH) && defined(MSH_USING_BUILT_IN_COMMANDS)
extern long list_thread(void);
#endif
@@ -53,7 +53,7 @@ void rt_hw_trap_undef(struct rt_hw_exp_stack *regs)
{
rt_kprintf("undefined instruction:\n");
rt_hw_show_register(regs);
-#ifdef RT_USING_FINSH
+#if defined(RT_USING_FINSH) && defined(MSH_USING_BUILT_IN_COMMANDS)
list_thread();
#endif
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_hw_show_register(regs);
-#ifdef RT_USING_FINSH
+#if defined(RT_USING_FINSH) && defined(MSH_USING_BUILT_IN_COMMANDS)
list_thread();
#endif
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_hw_show_register(regs);
-#ifdef RT_USING_FINSH
+#if defined(RT_USING_FINSH) && defined(MSH_USING_BUILT_IN_COMMANDS)
list_thread();
#endif
rt_hw_cpu_shutdown();
@@ -108,7 +108,7 @@ void rt_hw_trap_dabt(struct rt_hw_exp_stack *regs)
{
rt_kprintf("data abort:");
rt_hw_show_register(regs);
-#ifdef RT_USING_FINSH
+#if defined(RT_USING_FINSH) && defined(MSH_USING_BUILT_IN_COMMANDS)
list_thread();
#endif
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_hw_show_register(regs);
-#ifdef RT_USING_FINSH
+#if defined(RT_USING_FINSH) && defined(MSH_USING_BUILT_IN_COMMANDS)
list_thread();
#endif
rt_hw_cpu_shutdown();
diff --git a/libcpu/arm/s3c24x0/trap.c b/libcpu/arm/s3c24x0/trap.c
index f0e8a7097a..c4be806dc6 100644
--- a/libcpu/arm/s3c24x0/trap.c
+++ b/libcpu/arm/s3c24x0/trap.c
@@ -22,7 +22,7 @@
/*@{*/
extern struct rt_thread *rt_current_thread;
-#ifdef RT_USING_FINSH
+#if defined(RT_USING_FINSH) && defined(MSH_USING_BUILT_IN_COMMANDS)
extern long list_thread(void);
#endif
@@ -58,7 +58,7 @@ void rt_hw_trap_udef(struct rt_hw_register *regs)
rt_kprintf("undefined instruction\n");
rt_kprintf("thread - %s stack:\n", rt_current_thread->name);
-#ifdef RT_USING_FINSH
+#if defined(RT_USING_FINSH) && defined(MSH_USING_BUILT_IN_COMMANDS)
list_thread();
#endif
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("thread - %s stack:\n", rt_current_thread->name);
-#ifdef RT_USING_FINSH
+#if defined(RT_USING_FINSH) && defined(MSH_USING_BUILT_IN_COMMANDS)
list_thread();
#endif
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("thread - %s stack:\n", rt_current_thread->name);
-#ifdef RT_USING_FINSH
+#if defined(RT_USING_FINSH) && defined(MSH_USING_BUILT_IN_COMMANDS)
list_thread();
#endif
rt_hw_cpu_shutdown();
diff --git a/libcpu/arm/zynqmp-r5/trap.c b/libcpu/arm/zynqmp-r5/trap.c
index 64d4cbf5e8..5db5a0c01b 100644
--- a/libcpu/arm/zynqmp-r5/trap.c
+++ b/libcpu/arm/zynqmp-r5/trap.c
@@ -16,7 +16,7 @@
#include "armv7.h"
#include "interrupt.h"
-#ifdef RT_USING_FINSH
+#if defined(RT_USING_FINSH) && defined(MSH_USING_BUILT_IN_COMMANDS)
extern long list_thread(void);
#endif
@@ -48,7 +48,7 @@ void rt_hw_trap_undef(struct rt_hw_exp_stack *regs)
{
rt_kprintf("undefined instruction:\n");
rt_hw_show_register(regs);
-#ifdef RT_USING_FINSH
+#if defined(RT_USING_FINSH) && defined(MSH_USING_BUILT_IN_COMMANDS)
list_thread();
#endif
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_hw_show_register(regs);
-#ifdef RT_USING_FINSH
+#if defined(RT_USING_FINSH) && defined(MSH_USING_BUILT_IN_COMMANDS)
list_thread();
#endif
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_hw_show_register(regs);
-#ifdef RT_USING_FINSH
+#if defined(RT_USING_FINSH) && defined(MSH_USING_BUILT_IN_COMMANDS)
list_thread();
#endif
rt_hw_cpu_shutdown();
@@ -103,7 +103,7 @@ void rt_hw_trap_dabt(struct rt_hw_exp_stack *regs)
{
rt_kprintf("data abort:");
rt_hw_show_register(regs);
-#ifdef RT_USING_FINSH
+#if defined(RT_USING_FINSH) && defined(MSH_USING_BUILT_IN_COMMANDS)
list_thread();
#endif
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_hw_show_register(regs);
-#ifdef RT_USING_FINSH
+#if defined(RT_USING_FINSH) && defined(MSH_USING_BUILT_IN_COMMANDS)
list_thread();
#endif
rt_hw_cpu_shutdown();
diff --git a/libcpu/risc-v/k210/interrupt.c b/libcpu/risc-v/k210/interrupt.c
index 934acbdbf8..b5384b01ee 100644
--- a/libcpu/risc-v/k210/interrupt.c
+++ b/libcpu/risc-v/k210/interrupt.c
@@ -335,7 +335,9 @@ uintptr_t handle_trap(uintptr_t mcause, uintptr_t epc, uintptr_t * sp)
else
{
rt_thread_t tid;
+#if defined(RT_USING_FINSH) && defined(MSH_USING_BUILT_IN_COMMANDS)
extern long list_thread();
+#endif
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);
rt_kprintf("exception pc => 0x%08x\n", epc);
rt_kprintf("current thread: %.*s\n", RT_NAME_MAX, tid->name);
-#ifdef RT_USING_FINSH
+#if defined(RT_USING_FINSH) && defined(MSH_USING_BUILT_IN_COMMANDS)
list_thread();
#endif
while(1);
diff --git a/libcpu/risc-v/virt64/interrupt.c b/libcpu/risc-v/virt64/interrupt.c
index 7916be8f6f..eae0a55c96 100644
--- a/libcpu/risc-v/virt64/interrupt.c
+++ b/libcpu/risc-v/virt64/interrupt.c
@@ -212,8 +212,9 @@ void handle_trap(rt_size_t xcause,rt_size_t xtval,rt_size_t xepc,struct rt_hw_st
else
{
rt_thread_t tid;
+#if defined(RT_USING_FINSH) && defined(MSH_USING_BUILT_IN_COMMANDS)
extern long list_thread();
-
+#endif
rt_hw_interrupt_disable();
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);
rt_kprintf("exception pc => 0x%08x\n", xepc);
rt_kprintf("current thread: %.*s\n", RT_NAME_MAX, tid->name);
-#ifdef RT_USING_FINSH
+#if defined(RT_USING_FINSH) && defined(MSH_USING_BUILT_IN_COMMANDS)
list_thread();
#endif
while(1);
diff --git a/libcpu/rx/cpuport.c b/libcpu/rx/cpuport.c
index 00f9e26ba9..366569f63d 100644
--- a/libcpu/rx/cpuport.c
+++ b/libcpu/rx/cpuport.c
@@ -94,7 +94,7 @@ rt_uint8_t *rt_hw_stack_init(void *tentry, void *parameter,
return(rt_uint8_t *)stack_frame;
}
-#ifdef RT_USING_FINSH
+#if defined(RT_USING_FINSH) && defined(MSH_USING_BUILT_IN_COMMANDS)
extern void list_thread(void);
#endif
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("hard fault on thread: %s\n", rt_current_thread->name);
- #ifdef RT_USING_FINSH
+ #if defined(RT_USING_FINSH) && defined(MSH_USING_BUILT_IN_COMMANDS)
list_thread();
#endif
while (1);
diff --git a/src/memheap.c b/src/memheap.c
index d0801d721b..e09f5c4bce 100644
--- a/src/memheap.c
+++ b/src/memheap.c
@@ -730,13 +730,15 @@ int memheaptrace(void)
if (count > 0)
{
int index;
+#if defined(RT_USING_FINSH) && defined(MSH_USING_BUILT_IN_COMMANDS)
extern int list_memheap(void);
+#endif
heaps = (struct rt_memheap **)rt_malloc(sizeof(struct rt_memheap *) * count);
if (heaps == RT_NULL) return 0;
-
+#if defined(RT_USING_FINSH) && defined(MSH_USING_BUILT_IN_COMMANDS)
list_memheap();
-
+#endif
rt_kprintf("memheap header size: %d\n", RT_MEMHEAP_SIZE);
count = rt_object_get_pointers(RT_Object_Class_MemHeap, (rt_object_t *)heaps, count);
for (index = 0; index < count; index++)