Skip to content

Commit 5abce84

Browse files
wdfk-progRbb666
authored andcommitted
fix: 在没有定义FINSH_USING_SYMTAB时编译报错以及IPC及finsh启用时自动选择必要的功能
1 parent 893ae7d commit 5abce84

File tree

4 files changed

+15
-9
lines changed

4 files changed

+15
-9
lines changed

components/drivers/ipc/Kconfig

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
menuconfig RT_USING_DEVICE_IPC
22
bool "Using device drivers IPC"
33
default y
4+
select RT_USING_MUTEX
5+
select RT_USING_SEMAPHORE
46

57
if RT_USING_DEVICE_IPC
68
config RT_UNAMED_PIPE_NUMBER

components/finsh/Kconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ menuconfig RT_USING_MSH
22
bool "MSH: command shell"
33
default n if RT_USING_NANO
44
default y
5+
select RT_USING_SEMAPHORE
56

67
if RT_USING_MSH
78

components/finsh/finsh.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,8 @@ typedef long (*syscall_func)(void);
8888
};
8989

9090
#endif /* _MSC_VER */
91+
#else
92+
#define MSH_FUNCTION_EXPORT_CMD(name, cmd, desc, opt)
9193
#endif /* FINSH_USING_SYMTAB */
9294

9395
/**

components/finsh/msh.c

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -37,17 +37,18 @@ static int msh_help(int argc, char **argv)
3737
rt_kprintf("RT-Thread shell commands:\n");
3838
{
3939
struct finsh_syscall *index;
40-
40+
#if defined(FINSH_USING_SYMTAB)
4141
for (index = _syscall_table_begin;
4242
index < _syscall_table_end;
4343
FINSH_NEXT_SYSCALL(index))
4444
{
45-
#if defined(FINSH_USING_DESCRIPTION) && defined(FINSH_USING_SYMTAB)
45+
#if defined(FINSH_USING_DESCRIPTION)
4646
rt_kprintf("%-16s - %s\n", index->name, index->desc);
4747
#else
4848
rt_kprintf("%s ", index->name);
49-
#endif
49+
#endif /* FINSH_USING_DESCRIPTION */
5050
}
51+
#endif /* FINSH_USING_SYMTAB */
5152
}
5253
rt_kprintf("\n");
5354

@@ -231,7 +232,7 @@ static cmd_function_t msh_get_cmd(char *cmd, int size)
231232
{
232233
struct finsh_syscall *index;
233234
cmd_function_t cmd_func = RT_NULL;
234-
235+
#if defined(FINSH_USING_SYMTAB)
235236
for (index = _syscall_table_begin;
236237
index < _syscall_table_end;
237238
FINSH_NEXT_SYSCALL(index))
@@ -243,7 +244,7 @@ static cmd_function_t msh_get_cmd(char *cmd, int size)
243244
break;
244245
}
245246
}
246-
247+
#endif /* FINSH_USING_SYMTAB */
247248
return cmd_func;
248249
}
249250

@@ -814,7 +815,7 @@ void msh_auto_complete(char *prefix)
814815
#endif /* RT_USING_MODULE */
815816
}
816817
#endif /* DFS_USING_POSIX */
817-
818+
#if defined(FINSH_USING_SYMTAB)
818819
/* checks in internal command */
819820
{
820821
for (index = _syscall_table_begin; index < _syscall_table_end; FINSH_NEXT_SYSCALL(index))
@@ -839,7 +840,7 @@ void msh_auto_complete(char *prefix)
839840
}
840841
}
841842
}
842-
843+
#endif /* FINSH_USING_SYMTAB */
843844
/* auto complete string */
844845
if (name_ptr != NULL)
845846
{
@@ -866,7 +867,7 @@ static msh_cmd_opt_t *msh_get_cmd_opt(char *opt_str)
866867
{
867868
len = strlen(opt_str);
868869
}
869-
870+
#if defined(FINSH_USING_SYMTAB)
870871
for (index = _syscall_table_begin;
871872
index < _syscall_table_end;
872873
FINSH_NEXT_SYSCALL(index))
@@ -877,7 +878,7 @@ static msh_cmd_opt_t *msh_get_cmd_opt(char *opt_str)
877878
break;
878879
}
879880
}
880-
881+
#endif /* FINSH_USING_SYMTAB */
881882
return opt;
882883
}
883884

0 commit comments

Comments
 (0)