找回密码
 立即注册
查看: 423|回复: 3

推荐功能强大的shell,能和rt-thread的FinSH媲美

[复制链接]
  • 打卡等级:常住居民III
  • 打卡总天数:177
  • 最近打卡:2025-04-30 13:52:43

10

主题

134

回帖

993

积分

高级会员

积分
993
发表于 2024-10-22 13:45:17 | 显示全部楼层 |阅读模式
本帖最后由 远行的鹿 于 2024-10-22 14:11 编辑

简介:
      letter-shell是一个命令行组件,提供一套供用户在命令行调用的操作接口,主要用于调试或查看系统信息。可以使用串口、以太网、USB等方式与PC机进行通信。用户在控制终端输入命令,控制终端通过串口等方式将命令传给设备里的shell,shell会读取设备输入命令,解析并自动扫描内部函数表,寻找对应函数名,执行函数后输出回应,回应通过原路返回,将结果显示在控制终端上。

      letter-shell是C语言编写的,可以嵌入在程序中的嵌入式shell,主要面向嵌入式设备,以C语言函数为运行单位,可以通过命令行调用,运行程序中的函数。链接地址:https://github.com/NevermindZZT/letter-shell


功能:

      1. 命令自动补全
      2. 快捷键功能定义
      3. 命令权限管理
      4. 用户管理
      5. 变量支持
      6. 代理函数和参数代理解析


shell_end_line_mode.gif

README.md

27.91 KB, 下载次数: 39

详细说明

回复

使用道具 举报 送花

  • 打卡等级:以坛为家I
  • 打卡总天数:239
  • 最近打卡:2025-05-02 03:42:37

22

主题

283

回帖

905

积分

高级会员

积分
905
发表于 2024-10-22 19:02:46 来自手机 | 显示全部楼层
REMOVEUNUSED
回复

使用道具 举报 送花

  • 打卡等级:以坛为家II
  • 打卡总天数:423
  • 最近打卡:2025-05-02 07:55:56
已绑定手机

19

主题

3190

回帖

4870

积分

论坛元老

积分
4870
发表于 2024-10-22 19:49:06 来自手机 | 显示全部楼层
资源占用怎么样
回复 支持 反对

使用道具 举报 送花

  • 打卡等级:常住居民III
  • 打卡总天数:177
  • 最近打卡:2025-04-30 13:52:43

10

主题

134

回帖

993

积分

高级会员

积分
993
发表于 2024-10-23 09:19:07 | 显示全部楼层
so*** 发表于 2024-10-22 19:49
资源占用怎么样

还没有在STC单片机上使用,STC8估计够呛。它有一些全局变量会一直占有内存。
  1. typedef struct shell_def
  2. {
  3.     struct
  4.     {
  5.         const struct shell_command *user;                       /**< 当前用户 */
  6.         int activeTime;                                         /**< shell激活时间 */
  7.         char *path;                                             /**< 当前shell路径 */
  8.     #if SHELL_USING_COMPANION == 1
  9.         struct shell_companion_object *companions;              /**< 伴生对象 */
  10.     #endif
  11.     #if SHELL_KEEP_RETURN_VALUE == 1
  12.         int retVal;                                             /**< 返回值 */
  13.     #endif
  14.     } info;
  15.     struct
  16.     {
  17.         unsigned short length;                                  /**< 输入数据长度 */
  18.         unsigned short cursor;                                  /**< 当前光标位置 */
  19.         char *buffer;                                           /**< 输入缓冲 */
  20.         char *param[SHELL_PARAMETER_MAX_NUMBER];                /**< 参数 */
  21.         unsigned short bufferSize;                              /**< 输入缓冲大小 */
  22.         unsigned short paramCount;                              /**< 参数数量 */
  23.         int keyValue;                                           /**< 输入按键键值 */
  24.     } parser;
  25. #if SHELL_HISTORY_MAX_NUMBER > 0
  26.     struct
  27.     {
  28.         char *item[SHELL_HISTORY_MAX_NUMBER];                   /**< 历史记录 */
  29.         unsigned short number;                                  /**< 历史记录数 */
  30.         unsigned short record;                                  /**< 当前记录位置 */
  31.         signed short offset;                                    /**< 当前历史记录偏移 */
  32.     } history;
  33. #endif /** SHELL_HISTORY_MAX_NUMBER > 0 */
  34.     struct
  35.     {
  36.         void *base;                                             /**< 命令表基址 */
  37.         unsigned short count;                                   /**< 命令数量 */
  38.     } commandList;
  39.     struct
  40.     {
  41.         unsigned char isChecked : 1;                            /**< 密码校验通过 */
  42.         unsigned char isActive : 1;                             /**< 当前活动Shell */
  43.         unsigned char tabFlag : 1;                              /**< tab标志 */
  44.     } status;
  45.     signed short (*read)(char *, unsigned short);               /**< shell读函数 */
  46.     signed short (*write)(char *, unsigned short);              /**< shell写函数 */
  47. #if SHELL_USING_LOCK == 1
  48.     int (*lock)(struct shell_def *);                              /**< shell 加锁 */
  49.     int (*unlock)(struct shell_def *);                            /**< shell 解锁 */
  50. #endif
  51. } Shell;
复制代码
回复 支持 反对

使用道具 举报 送花

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|手机版|小黑屋|深圳国芯人工智能有限公司 ( 粤ICP备2022108929号-2 )

GMT+8, 2025-5-2 18:08 , Processed in 0.182152 second(s), 71 queries .

Powered by Discuz! X3.5

© 2001-2025 Discuz! Team.

快速回复 返回顶部 返回列表