Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
nix61
rt-thread
提交
f9a7ba05
R
rt-thread
项目概览
nix61
/
rt-thread
与 Fork 源项目一致
Fork自
RT-Thread / rt-thread
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
rt-thread
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
f9a7ba05
编写于
3月 01, 2018
作者:
B
Bernard Xiong
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[finsh] convert tab to space and split export API to finsh_api.h
上级
15fa3084
变更
20
显示空白变更内容
内联
并排
Showing
20 changed file
with
2567 addition
and
2530 deletion
+2567
-2530
components/finsh/cmd.c
components/finsh/cmd.c
+6
-6
components/finsh/finsh.h
components/finsh/finsh.h
+93
-287
components/finsh/finsh_api.h
components/finsh/finsh_api.h
+231
-0
components/finsh/finsh_error.c
components/finsh/finsh_error.c
+20
-20
components/finsh/finsh_heap.c
components/finsh/finsh_heap.c
+70
-70
components/finsh/finsh_init.c
components/finsh/finsh_init.c
+18
-18
components/finsh/finsh_node.c
components/finsh/finsh_node.c
+118
-118
components/finsh/finsh_node.h
components/finsh/finsh_node.h
+36
-36
components/finsh/finsh_ops.c
components/finsh/finsh_ops.c
+289
-289
components/finsh/finsh_parser.c
components/finsh/finsh_parser.c
+697
-697
components/finsh/finsh_token.c
components/finsh/finsh_token.c
+479
-479
components/finsh/finsh_token.h
components/finsh/finsh_token.h
+31
-31
components/finsh/finsh_var.c
components/finsh/finsh_var.c
+92
-92
components/finsh/finsh_var.h
components/finsh/finsh_var.h
+10
-10
components/finsh/finsh_vm.c
components/finsh/finsh_vm.c
+324
-324
components/finsh/finsh_vm.h
components/finsh/finsh_vm.h
+8
-8
components/finsh/msh_cmd.c
components/finsh/msh_cmd.c
+27
-27
components/finsh/shell.c
components/finsh/shell.c
+1
-1
components/finsh/symbol.c
components/finsh/symbol.c
+16
-16
include/rtthread.h
include/rtthread.h
+1
-1
未找到文件。
components/finsh/cmd.c
浏览文件 @
f9a7ba05
components/finsh/finsh.h
浏览文件 @
f9a7ba05
/*
/*
* File : finsh.h
* File : finsh.h
* This file is part of RT-Thread RTOS
* COPYRIGHT (C) 2006 - 2018, RT-Thread Development Team
* COPYRIGHT (C) 2006 - 2010, RT-Thread Development Team
*
*
* The license and distribution terms for this file may be
* This program is free software; you can redistribute it and/or modify
* found in the file LICENSE in this distribution or at
* it under the terms of the GNU General Public License as published by
* http://www.rt-thread.org/license/LICENSE
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
*
* Change Logs:
* Change Logs:
* Date Author Notes
* Date Author Notes
...
@@ -15,11 +24,7 @@
...
@@ -15,11 +24,7 @@
#define __FINSH_H__
#define __FINSH_H__
#include <rtthread.h>
#include <rtthread.h>
#include "finsh_api.h"
#if defined(_MSC_VER)
#pragma section("FSymTab$f",read)
#pragma section("VSymTab",read)
#endif
/* -- the beginning of option -- */
/* -- the beginning of option -- */
#define FINSH_NAME_MAX 16
/* max length of identifier */
#define FINSH_NAME_MAX 16
/* max length of identifier */
...
@@ -87,30 +92,14 @@
...
@@ -87,30 +92,14 @@
#define FINSH_ERROR_NULL_NODE 14
/**< Null node */
#define FINSH_ERROR_NULL_NODE 14
/**< Null node */
/*@}*/
/*@}*/
typedef
long
(
*
syscall_func
)();
/* system call table */
struct
finsh_syscall
{
const
char
*
name
;
/* the name of system call */
#if defined(FINSH_USING_DESCRIPTION) && defined(FINSH_USING_SYMTAB)
const
char
*
desc
;
/* description of system call */
#endif
syscall_func
func
;
/* the function address of system call */
};
/* system call item */
/* system call item */
struct
finsh_syscall_item
struct
finsh_syscall_item
{
{
struct
finsh_syscall_item
*
next
;
/* next item */
struct
finsh_syscall_item
*
next
;
/* next item */
struct
finsh_syscall
syscall
;
/* syscall */
struct
finsh_syscall
syscall
;
/* syscall */
};
};
extern
struct
finsh_syscall
*
_syscall_table_begin
,
*
_syscall_table_end
;
extern
struct
finsh_syscall_item
*
global_syscall_list
;
extern
struct
finsh_syscall_item
*
global_syscall_list
;
/* find out system call, which should be implemented in user program */
struct
finsh_syscall
*
finsh_syscall_lookup
(
const
char
*
name
);
/* system variable table */
/* system variable table */
struct
finsh_sysvar
struct
finsh_sysvar
{
{
...
@@ -144,189 +133,6 @@ extern struct finsh_sysvar_item* global_sysvar_list;
...
@@ -144,189 +133,6 @@ extern struct finsh_sysvar_item* global_sysvar_list;
/* find out system variable, which should be implemented in user program */
/* find out system variable, which should be implemented in user program */
struct
finsh_sysvar
*
finsh_sysvar_lookup
(
const
char
*
name
);
struct
finsh_sysvar
*
finsh_sysvar_lookup
(
const
char
*
name
);
#ifdef FINSH_USING_SYMTAB
#ifdef __TI_COMPILER_VERSION__
#define __TI_FINSH_EXPORT_FUNCTION(f) PRAGMA(DATA_SECTION(f,"FSymTab"))
#define __TI_FINSH_EXPORT_VAR(v) PRAGMA(DATA_SECTION(v,"VSymTab"))
#endif
#ifdef FINSH_USING_DESCRIPTION
#ifdef _MSC_VER
#define FINSH_FUNCTION_EXPORT_CMD(name, cmd, desc) \
const char __fsym_##cmd##_name[] = #cmd; \
const char __fsym_##cmd##_desc[] = #desc; \
__declspec(allocate("FSymTab$f")) \
const struct finsh_syscall __fsym_##cmd = \
{ \
__fsym_##cmd##_name, \
__fsym_##cmd##_desc, \
(syscall_func)&name \
};
#pragma comment(linker, "/merge:FSymTab=mytext")
#define FINSH_VAR_EXPORT(name, type, desc) \
const char __vsym_##name##_name[] = #name; \
const char __vsym_##name##_desc[] = #desc; \
__declspec(allocate("VSymTab")) \
const struct finsh_sysvar __vsym_##name = \
{ \
__vsym_##name##_name, \
__vsym_##name##_desc, \
type, \
(void*)&name \
};
#elif defined(__TI_COMPILER_VERSION__)
#define FINSH_FUNCTION_EXPORT_CMD(name, cmd, desc) \
__TI_FINSH_EXPORT_FUNCTION(__fsym_##cmd); \
const char __fsym_##cmd##_name[] = #cmd; \
const char __fsym_##cmd##_desc[] = #desc; \
const struct finsh_syscall __fsym_##cmd = \
{ \
__fsym_##cmd##_name, \
__fsym_##cmd##_desc, \
(syscall_func)&name \
};
#define FINSH_VAR_EXPORT(name, type, desc) \
__TI_FINSH_EXPORT_VAR(__vsym_##name); \
const char __vsym_##name##_name[] = #name; \
const char __vsym_##name##_desc[] = #desc; \
const struct finsh_sysvar __vsym_##name = \
{ \
__vsym_##name##_name, \
__vsym_##name##_desc, \
type, \
(void*)&name \
};
#else
#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; \
const struct finsh_syscall __fsym_##cmd SECTION("FSymTab")= \
{ \
__fsym_##cmd##_name, \
__fsym_##cmd##_desc, \
(syscall_func)&name \
};
#define FINSH_VAR_EXPORT(name, type, desc) \
const char __vsym_##name##_name[] SECTION(".rodata.name") = #name; \
const char __vsym_##name##_desc[] SECTION(".rodata.name") = #desc; \
const struct finsh_sysvar __vsym_##name SECTION("VSymTab")= \
{ \
__vsym_##name##_name, \
__vsym_##name##_desc, \
type, \
(void*)&name \
};
#endif
#else
#ifdef _MSC_VER
#define FINSH_FUNCTION_EXPORT_CMD(name, cmd, desc) \
const char __fsym_##cmd##_name[] = #cmd; \
__declspec(allocate("FSymTab$f")) \
const struct finsh_syscall __fsym_##cmd = \
{ \
__fsym_##cmd##_name, \
(syscall_func)&name \
};
#pragma comment(linker, "/merge:FSymTab=mytext")
#define FINSH_VAR_EXPORT(name, type, desc) \
const char __vsym_##name##_name[] = #name; \
__declspec(allocate("VSymTab")) const struct finsh_sysvar __vsym_##name = \
{ \
__vsym_##name##_name, \
type, \
(void*)&name \
};
#elif defined(__TI_COMPILER_VERSION__)
#define FINSH_FUNCTION_EXPORT_CMD(name, cmd, desc) \
__TI_FINSH_EXPORT_FUNCTION(__fsym_##cmd); \
const char __fsym_##cmd##_name[] = #cmd; \
const struct finsh_syscall __fsym_##cmd = \
{ \
__fsym_##cmd##_name, \
(syscall_func)&name \
};
#define FINSH_VAR_EXPORT(name, type, desc) \
__TI_FINSH_EXPORT_VAR(__vsym_##name); \
const char __vsym_##name##_name[] = #name; \
const struct finsh_sysvar __vsym_##name = \
{ \
__vsym_##name##_name, \
type, \
(void*)&name \
};
#else
#define FINSH_FUNCTION_EXPORT_CMD(name, cmd, desc) \
const char __fsym_##cmd##_name[] = #cmd; \
const struct finsh_syscall __fsym_##cmd SECTION("FSymTab")= \
{ \
__fsym_##cmd##_name, \
(syscall_func)&name \
};
#define FINSH_VAR_EXPORT(name, type, desc) \
const char __vsym_##name##_name[] = #name; \
const struct finsh_sysvar __vsym_##name SECTION("VSymTab")= \
{ \
__vsym_##name##_name, \
type, \
(void*)&name \
};
#endif
#endif
/* end of FINSH_USING_DESCRIPTION */
#endif
/* end of FINSH_USING_SYMTAB */
/**
* @ingroup finsh
*
* This macro exports a system function to finsh shell.
*
* @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)
/**
* @ingroup finsh
*
* This macro exports a system function with an alias name to finsh shell.
*
* @param name the name of function.
* @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)
/**
* @ingroup finsh
*
* This macro exports a command to module shell.
*
* @param command the name of command.
* @param desc the description of command, which will show in help.
*/
#ifdef FINSH_USING_MSH
#define MSH_CMD_EXPORT(command, desc) \
FINSH_FUNCTION_EXPORT_CMD(command, __cmd_##command, desc)
#define MSH_CMD_EXPORT_ALIAS(command, alias, desc) \
FINSH_FUNCTION_EXPORT_ALIAS(command, __cmd_##alias, desc)
#else
#define MSH_CMD_EXPORT(command, desc)
#define MSH_CMD_EXPORT_ALIAS(command, alias, desc)
#endif
struct
finsh_token
struct
finsh_token
{
{
...
...
components/finsh/finsh_api.h
0 → 100644
浏览文件 @
f9a7ba05
/*
* File : finsh_api.h
* COPYRIGHT (C) 2006 - 2018, RT-Thread Development Team
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Change Logs:
* Date Author Notes
* 2010-03-22 Bernard first version
*/
#ifndef FINSH_API_H__
#define FINSH_API_H__
#if defined(_MSC_VER)
#pragma section("FSymTab$f",read)
#pragma section("VSymTab",read)
#endif
typedef
long
(
*
syscall_func
)(
void
);
/* system call table */
struct
finsh_syscall
{
const
char
*
name
;
/* the name of system call */
#if defined(FINSH_USING_DESCRIPTION) && defined(FINSH_USING_SYMTAB)
const
char
*
desc
;
/* description of system call */
#endif
syscall_func
func
;
/* the function address of system call */
};
extern
struct
finsh_syscall
*
_syscall_table_begin
,
*
_syscall_table_end
;
/* find out system call, which should be implemented in user program */
struct
finsh_syscall
*
finsh_syscall_lookup
(
const
char
*
name
);
#ifdef FINSH_USING_SYMTAB
#ifdef __TI_COMPILER_VERSION__
#define __TI_FINSH_EXPORT_FUNCTION(f) PRAGMA(DATA_SECTION(f,"FSymTab"))
#define __TI_FINSH_EXPORT_VAR(v) PRAGMA(DATA_SECTION(v,"VSymTab"))
#endif
#ifdef FINSH_USING_DESCRIPTION
#ifdef _MSC_VER
#define FINSH_FUNCTION_EXPORT_CMD(name, cmd, desc) \
const char __fsym_##cmd##_name[] = #cmd; \
const char __fsym_##cmd##_desc[] = #desc; \
__declspec(allocate("FSymTab$f")) \
const struct finsh_syscall __fsym_##cmd = \
{ \
__fsym_##cmd##_name, \
__fsym_##cmd##_desc, \
(syscall_func)&name \
};
#pragma comment(linker, "/merge:FSymTab=mytext")
#define FINSH_VAR_EXPORT(name, type, desc) \
const char __vsym_##name##_name[] = #name; \
const char __vsym_##name##_desc[] = #desc; \
__declspec(allocate("VSymTab")) \
const struct finsh_sysvar __vsym_##name = \
{ \
__vsym_##name##_name, \
__vsym_##name##_desc, \
type, \
(void*)&name \
};
#elif defined(__TI_COMPILER_VERSION__)
#define FINSH_FUNCTION_EXPORT_CMD(name, cmd, desc) \
__TI_FINSH_EXPORT_FUNCTION(__fsym_##cmd); \
const char __fsym_##cmd##_name[] = #cmd; \
const char __fsym_##cmd##_desc[] = #desc; \
const struct finsh_syscall __fsym_##cmd = \
{ \
__fsym_##cmd##_name, \
__fsym_##cmd##_desc, \
(syscall_func)&name \
};
#define FINSH_VAR_EXPORT(name, type, desc) \
__TI_FINSH_EXPORT_VAR(__vsym_##name); \
const char __vsym_##name##_name[] = #name; \
const char __vsym_##name##_desc[] = #desc; \
const struct finsh_sysvar __vsym_##name = \
{ \
__vsym_##name##_name, \
__vsym_##name##_desc, \
type, \
(void*)&name \
};
#else
#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; \
const struct finsh_syscall __fsym_##cmd SECTION("FSymTab")= \
{ \
__fsym_##cmd##_name, \
__fsym_##cmd##_desc, \
(syscall_func)&name \
};
#define FINSH_VAR_EXPORT(name, type, desc) \
const char __vsym_##name##_name[] SECTION(".rodata.name") = #name; \
const char __vsym_##name##_desc[] SECTION(".rodata.name") = #desc; \
const struct finsh_sysvar __vsym_##name SECTION("VSymTab")= \
{ \
__vsym_##name##_name, \
__vsym_##name##_desc, \
type, \
(void*)&name \
};
#endif
#else
#ifdef _MSC_VER
#define FINSH_FUNCTION_EXPORT_CMD(name, cmd, desc) \
const char __fsym_##cmd##_name[] = #cmd; \
__declspec(allocate("FSymTab$f")) \
const struct finsh_syscall __fsym_##cmd = \
{ \
__fsym_##cmd##_name, \
(syscall_func)&name \
};
#pragma comment(linker, "/merge:FSymTab=mytext")
#define FINSH_VAR_EXPORT(name, type, desc) \
const char __vsym_##name##_name[] = #name; \
__declspec(allocate("VSymTab")) const struct finsh_sysvar __vsym_##name = \
{ \
__vsym_##name##_name, \
type, \
(void*)&name \
};
#elif defined(__TI_COMPILER_VERSION__)
#define FINSH_FUNCTION_EXPORT_CMD(name, cmd, desc) \
__TI_FINSH_EXPORT_FUNCTION(__fsym_##cmd); \
const char __fsym_##cmd##_name[] = #cmd; \
const struct finsh_syscall __fsym_##cmd = \
{ \
__fsym_##cmd##_name, \
(syscall_func)&name \
};
#define FINSH_VAR_EXPORT(name, type, desc) \
__TI_FINSH_EXPORT_VAR(__vsym_##name); \
const char __vsym_##name##_name[] = #name; \
const struct finsh_sysvar __vsym_##name = \
{ \
__vsym_##name##_name, \
type, \
(void*)&name \
};
#else
#define FINSH_FUNCTION_EXPORT_CMD(name, cmd, desc) \
const char __fsym_##cmd##_name[] = #cmd; \
const struct finsh_syscall __fsym_##cmd SECTION("FSymTab")= \
{ \
__fsym_##cmd##_name, \
(syscall_func)&name \
};
#define FINSH_VAR_EXPORT(name, type, desc) \
const char __vsym_##name##_name[] = #name; \
const struct finsh_sysvar __vsym_##name SECTION("VSymTab")= \
{ \
__vsym_##name##_name, \
type, \
(void*)&name \
};
#endif
#endif
/* end of FINSH_USING_DESCRIPTION */
#endif
/* end of FINSH_USING_SYMTAB */
/**
* @ingroup finsh
*
* This macro exports a system function to finsh shell.
*
* @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)
/**
* @ingroup finsh
*
* This macro exports a system function with an alias name to finsh shell.
*
* @param name the name of function.
* @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)
/**
* @ingroup finsh
*
* This macro exports a command to module shell.
*
* @param command the name of command.
* @param desc the description of command, which will show in help.
*/
#ifdef FINSH_USING_MSH
#define MSH_CMD_EXPORT(command, desc) \
FINSH_FUNCTION_EXPORT_CMD(command, __cmd_##command, desc)
#define MSH_CMD_EXPORT_ALIAS(command, alias, desc) \
FINSH_FUNCTION_EXPORT_ALIAS(command, __cmd_##alias, desc)
#else
#define MSH_CMD_EXPORT(command, desc)
#define MSH_CMD_EXPORT_ALIAS(command, alias, desc)
#endif
#endif
components/finsh/finsh_error.c
浏览文件 @
f9a7ba05
components/finsh/finsh_heap.c
浏览文件 @
f9a7ba05
components/finsh/finsh_init.c
浏览文件 @
f9a7ba05
components/finsh/finsh_node.c
浏览文件 @
f9a7ba05
components/finsh/finsh_node.h
浏览文件 @
f9a7ba05
components/finsh/finsh_ops.c
浏览文件 @
f9a7ba05
components/finsh/finsh_parser.c
浏览文件 @
f9a7ba05
components/finsh/finsh_token.c
浏览文件 @
f9a7ba05
components/finsh/finsh_token.h
浏览文件 @
f9a7ba05
components/finsh/finsh_var.c
浏览文件 @
f9a7ba05
components/finsh/finsh_var.h
浏览文件 @
f9a7ba05
components/finsh/finsh_vm.c
浏览文件 @
f9a7ba05
components/finsh/finsh_vm.h
浏览文件 @
f9a7ba05
components/finsh/msh_cmd.c
浏览文件 @
f9a7ba05
components/finsh/shell.c
浏览文件 @
f9a7ba05
components/finsh/symbol.c
浏览文件 @
f9a7ba05
include/rtthread.h
浏览文件 @
f9a7ba05
...
@@ -564,7 +564,7 @@ void rt_assert_handler(const char *ex, const char *func, rt_size_t line);
...
@@ -564,7 +564,7 @@ void rt_assert_handler(const char *ex, const char *func, rt_size_t line);
#endif
/* RT_DEBUG */
#endif
/* RT_DEBUG */
#ifdef RT_USING_FINSH
#ifdef RT_USING_FINSH
#include <finsh.h>
#include <finsh
_api
.h>
#endif
#endif
/**@}*/
/**@}*/
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录