summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorwdfk-prog <[email protected]>2025-09-02 17:35:02 +0800
committerR b b666 <[email protected]>2025-09-04 21:42:10 +0800
commit5abce84ca74bf0672356393adba34a898cf16aee (patch)
treed0471256070bc27288f5d945c4837abbb1740de3
parent893ae7d7ba4daecfe4732cb51db8f140dc7211ff (diff)
fix: 在没有定义FINSH_USING_SYMTAB时编译报错以及IPC及finsh启用时自动选择必要的功能
-rw-r--r--components/drivers/ipc/Kconfig2
-rw-r--r--components/finsh/Kconfig1
-rw-r--r--components/finsh/finsh.h2
-rw-r--r--components/finsh/msh.c19
4 files changed, 15 insertions, 9 deletions
diff --git a/components/drivers/ipc/Kconfig b/components/drivers/ipc/Kconfig
index 4c3765ec21..e0411d29b4 100644
--- a/components/drivers/ipc/Kconfig
+++ b/components/drivers/ipc/Kconfig
@@ -1,6 +1,8 @@
menuconfig RT_USING_DEVICE_IPC
bool "Using device drivers IPC"
default y
+ select RT_USING_MUTEX
+ select RT_USING_SEMAPHORE
if RT_USING_DEVICE_IPC
config RT_UNAMED_PIPE_NUMBER
diff --git a/components/finsh/Kconfig b/components/finsh/Kconfig
index c99ce6a8d5..f7ccc70762 100644
--- a/components/finsh/Kconfig
+++ b/components/finsh/Kconfig
@@ -2,6 +2,7 @@ menuconfig RT_USING_MSH
bool "MSH: command shell"
default n if RT_USING_NANO
default y
+ select RT_USING_SEMAPHORE
if RT_USING_MSH
diff --git a/components/finsh/finsh.h b/components/finsh/finsh.h
index d9ddec5983..a40d1b3ed9 100644
--- a/components/finsh/finsh.h
+++ b/components/finsh/finsh.h
@@ -88,6 +88,8 @@ typedef long (*syscall_func)(void);
};
#endif /* _MSC_VER */
+#else
+#define MSH_FUNCTION_EXPORT_CMD(name, cmd, desc, opt)
#endif /* FINSH_USING_SYMTAB */
/**
diff --git a/components/finsh/msh.c b/components/finsh/msh.c
index d8586e54a4..505f97f4ad 100644
--- a/components/finsh/msh.c
+++ b/components/finsh/msh.c
@@ -37,17 +37,18 @@ static int msh_help(int argc, char **argv)
rt_kprintf("RT-Thread shell commands:\n");
{
struct finsh_syscall *index;
-
+#if defined(FINSH_USING_SYMTAB)
for (index = _syscall_table_begin;
index < _syscall_table_end;
FINSH_NEXT_SYSCALL(index))
{
-#if defined(FINSH_USING_DESCRIPTION) && defined(FINSH_USING_SYMTAB)
+#if defined(FINSH_USING_DESCRIPTION)
rt_kprintf("%-16s - %s\n", index->name, index->desc);
#else
rt_kprintf("%s ", index->name);
-#endif
+#endif /* FINSH_USING_DESCRIPTION */
}
+#endif /* FINSH_USING_SYMTAB */
}
rt_kprintf("\n");
@@ -231,7 +232,7 @@ static cmd_function_t msh_get_cmd(char *cmd, int size)
{
struct finsh_syscall *index;
cmd_function_t cmd_func = RT_NULL;
-
+#if defined(FINSH_USING_SYMTAB)
for (index = _syscall_table_begin;
index < _syscall_table_end;
FINSH_NEXT_SYSCALL(index))
@@ -243,7 +244,7 @@ static cmd_function_t msh_get_cmd(char *cmd, int size)
break;
}
}
-
+#endif /* FINSH_USING_SYMTAB */
return cmd_func;
}
@@ -814,7 +815,7 @@ void msh_auto_complete(char *prefix)
#endif /* RT_USING_MODULE */
}
#endif /* DFS_USING_POSIX */
-
+#if defined(FINSH_USING_SYMTAB)
/* checks in internal command */
{
for (index = _syscall_table_begin; index < _syscall_table_end; FINSH_NEXT_SYSCALL(index))
@@ -839,7 +840,7 @@ void msh_auto_complete(char *prefix)
}
}
}
-
+#endif /* FINSH_USING_SYMTAB */
/* auto complete string */
if (name_ptr != NULL)
{
@@ -866,7 +867,7 @@ static msh_cmd_opt_t *msh_get_cmd_opt(char *opt_str)
{
len = strlen(opt_str);
}
-
+#if defined(FINSH_USING_SYMTAB)
for (index = _syscall_table_begin;
index < _syscall_table_end;
FINSH_NEXT_SYSCALL(index))
@@ -877,7 +878,7 @@ static msh_cmd_opt_t *msh_get_cmd_opt(char *opt_str)
break;
}
}
-
+#endif /* FINSH_USING_SYMTAB */
return opt;
}