فهرست منبع

fix: 在没有定义FINSH_USING_SYMTAB时编译报错以及IPC及finsh启用时自动选择必要的功能

wdfk-prog 1 هفته پیش
والد
کامیت
5abce84ca7
4فایلهای تغییر یافته به همراه15 افزوده شده و 9 حذف شده
  1. 2 0
      components/drivers/ipc/Kconfig
  2. 1 0
      components/finsh/Kconfig
  3. 2 0
      components/finsh/finsh.h
  4. 10 9
      components/finsh/msh.c

+ 2 - 0
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

+ 1 - 0
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
 

+ 2 - 0
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 */
 
 /**

+ 10 - 9
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;
 }