Disable FINSH_FUNCTION_EXPORT

This commit is contained in:
马志远 2021-08-23 18:37:58 +08:00
parent 221da7f464
commit 8a1e6c01ac
6 changed files with 18 additions and 23 deletions

View File

@ -138,5 +138,5 @@ static void reboot(uint8_t argc, char **argv)
{
rt_hw_cpu_reset();
}
FINSH_FUNCTION_EXPORT_ALIAS(reboot, __cmd_reboot, Reboot System);
MSH_CMD_EXPORT(reboot, Reboot System);
#endif /* RT_USING_FINSH */

View File

@ -138,6 +138,6 @@ static void reboot(uint8_t argc, char **argv)
{
rt_hw_cpu_reset();
}
FINSH_FUNCTION_EXPORT_ALIAS(reboot, __cmd_reboot, Reboot System);
MSH_CMD_EXPORT(reboot, Reboot System);
#endif /* RT_USING_FINSH */

View File

@ -25,7 +25,7 @@ static void reboot(uint8_t argc, char **argv)
{
rt_hw_cpu_reset();
}
FINSH_FUNCTION_EXPORT_ALIAS(reboot, __cmd_reboot, Reboot System);
MSH_CMD_EXPORT(reboot, Reboot System);
#endif /* RT_USING_FINSH */
/* SysTick configuration */

View File

@ -255,7 +255,7 @@ static void reboot(uint8_t argc, char **argv)
{
rt_hw_cpu_reset();
}
FINSH_FUNCTION_EXPORT_ALIAS(reboot, __cmd_reboot, Reboot System);
MSH_CMD_EXPORT(reboot, Reboot System);
#endif /* RT_USING_FINSH */
/*@}*/

View File

@ -23,7 +23,7 @@ typedef long (*syscall_func)(void);
#endif
#ifdef FINSH_USING_DESCRIPTION
#ifdef _MSC_VER
#define FINSH_FUNCTION_EXPORT_CMD(name, cmd, desc) \
#define MSH_FUNCTION_EXPORT_CMD(name, cmd, desc) \
const char __fsym_##cmd##_name[] = #cmd; \
const char __fsym_##cmd##_desc[] = #desc; \
__declspec(allocate("FSymTab$f")) \
@ -36,7 +36,7 @@ typedef long (*syscall_func)(void);
#pragma comment(linker, "/merge:FSymTab=mytext")
#elif defined(__TI_COMPILER_VERSION__)
#define FINSH_FUNCTION_EXPORT_CMD(name, cmd, desc) \
#define MSH_FUNCTION_EXPORT_CMD(name, cmd, desc) \
__TI_FINSH_EXPORT_FUNCTION(__fsym_##cmd); \
const char __fsym_##cmd##_name[] = #cmd; \
const char __fsym_##cmd##_desc[] = #desc; \
@ -48,7 +48,7 @@ typedef long (*syscall_func)(void);
};
#else
#define FINSH_FUNCTION_EXPORT_CMD(name, cmd, desc) \
#define MSH_FUNCTION_EXPORT_CMD(name, cmd, desc) \
const char __fsym_##cmd##_name[] RT_SECTION(".rodata.name") = #cmd; \
const char __fsym_##cmd##_desc[] RT_SECTION(".rodata.name") = #desc; \
RT_USED const struct finsh_syscall __fsym_##cmd RT_SECTION("FSymTab")= \
@ -61,7 +61,7 @@ typedef long (*syscall_func)(void);
#endif
#else
#ifdef _MSC_VER
#define FINSH_FUNCTION_EXPORT_CMD(name, cmd, desc) \
#define MSH_FUNCTION_EXPORT_CMD(name, cmd, desc) \
const char __fsym_##cmd##_name[] = #cmd; \
__declspec(allocate("FSymTab$f")) \
const struct finsh_syscall __fsym_##cmd = \
@ -72,7 +72,7 @@ typedef long (*syscall_func)(void);
#pragma comment(linker, "/merge:FSymTab=mytext")
#elif defined(__TI_COMPILER_VERSION__)
#define FINSH_FUNCTION_EXPORT_CMD(name, cmd, desc) \
#define MSH_FUNCTION_EXPORT_CMD(name, cmd, desc) \
__TI_FINSH_EXPORT_FUNCTION(__fsym_##cmd); \
const char __fsym_##cmd##_name[] = #cmd; \
const struct finsh_syscall __fsym_##cmd = \
@ -82,7 +82,7 @@ typedef long (*syscall_func)(void);
};
#else
#define FINSH_FUNCTION_EXPORT_CMD(name, cmd, desc) \
#define MSH_FUNCTION_EXPORT_CMD(name, cmd, desc) \
const char __fsym_##cmd##_name[] = #cmd; \
RT_USED const struct finsh_syscall __fsym_##cmd RT_SECTION("FSymTab")= \
{ \
@ -102,8 +102,7 @@ typedef long (*syscall_func)(void);
* @param name the name of function.
* @param desc the description of function, which will show in help.
*/
#define FINSH_FUNCTION_EXPORT(name, desc) \
FINSH_FUNCTION_EXPORT_CMD(name, name, desc)
#define FINSH_FUNCTION_EXPORT(name, desc)
/**
* @ingroup finsh
@ -114,8 +113,7 @@ typedef long (*syscall_func)(void);
* @param alias the alias name of function.
* @param desc the description of function, which will show in help.
*/
#define FINSH_FUNCTION_EXPORT_ALIAS(name, alias, desc) \
FINSH_FUNCTION_EXPORT_CMD(name, alias, desc)
#define FINSH_FUNCTION_EXPORT_ALIAS(name, alias, desc)
/**
* @ingroup finsh
@ -126,9 +124,9 @@ typedef long (*syscall_func)(void);
* @param desc the description of command, which will show in help.
*/
#define MSH_CMD_EXPORT(command, desc) \
FINSH_FUNCTION_EXPORT_CMD(command, __cmd_##command, desc)
MSH_FUNCTION_EXPORT_CMD(command, command, desc)
#define MSH_CMD_EXPORT_ALIAS(command, alias, desc) \
FINSH_FUNCTION_EXPORT_ALIAS(command, __cmd_##alias, desc)
MSH_FUNCTION_EXPORT_CMD(command, alias, desc)
/* system call table */
struct finsh_syscall

View File

@ -41,11 +41,10 @@ int msh_help(int argc, char **argv)
index < _syscall_table_end;
FINSH_NEXT_SYSCALL(index))
{
if (strncmp(index->name, "__cmd_", 6) != 0) continue;
#if defined(FINSH_USING_DESCRIPTION) && defined(FINSH_USING_SYMTAB)
rt_kprintf("%-16s - %s\n", &index->name[6], index->desc);
rt_kprintf("%-16s - %s\n", index->name, index->desc);
#else
rt_kprintf("%s ", &index->name[6]);
rt_kprintf("%s ", index->name);
#endif
}
}
@ -174,10 +173,8 @@ static cmd_function_t msh_get_cmd(char *cmd, int size)
index < _syscall_table_end;
FINSH_NEXT_SYSCALL(index))
{
if (strncmp(index->name, "__cmd_", 6) != 0) continue;
if (strncmp(&index->name[6], cmd, size) == 0 &&
index->name[6 + size] == '\0')
if (strncmp(index->name, cmd, size) == 0 &&
index->name[size] == '\0')
{
cmd_func = (cmd_function_t)index->func;
break;