中国移动学习RTT-操作一个未解之谜

MSH_CMD_EXPORT(esp8266, esp8266 module function);

#define MSH_CMD_EXPORT(command, desc)   FINSH_FUNCTION_EXPORT_CMD(command, __cmd_##command, desc)
	
#define FINSH_FUNCTION_EXPORT_CMD(name, cmd, desc)                      \
		const char __fsym_##cmd##_name[] SECTION(".rodata.name") = #cmd;    \
		const char __fsym_##cmd##_desc[] SECTION(".rodata.name") = #desc;   \
		RT_USED const struct finsh_syscall __fsym_##cmd SECTION("FSymTab")= \
		{                           \
			__fsym_##cmd##_name,    \
			__fsym_##cmd##_desc,    \
			(syscall_func)&name     \
		};
	


	上面是别人的 一句话就好 我自己试试
MSH_CMD_EXPORT(GKOSON, GKOSON module function);




void GKOSON(int argc, char *argv[])
{
    if (argc > 1)
    {
        if (!strcmp(argv[1], "hello"))
        {
		    rt_kprintf("thanks\n");
		}
        else
        {
            rt_kprintf("Unknown command. Please enter 'esp8266' for help\n");
        }
    }
    else
    {
        rt_kprintf("Usage:\n");
        rt_kprintf("GKOSON hello   	- only one function\n");
    }
}

		

 

你可能感兴趣的:(中国移动学习RTT-操作一个未解之谜)