百科.dev
全部条目在线工具AI 编程趋势榜开源项目技术资讯提交条目
登录
< 返回工具列表
M

microshell

> 开发工具
开源

MicroShell 是一款专为嵌入式裸机系统设计的轻量级纯 C 实现的 shell 模拟器。

361 stars0 点赞0 次浏览
访问官网GitHub

工具介绍

MicroShell 是一款专为嵌入式裸机系统设计的轻量级纯 C 实现的 shell 模拟器。

MicroShell

Lightweight pure C implementation of virtual shell, compatible with VT100 terminal. Support root tree, run-time mounting paths, global commands, and much more. Works out-of-the-box on Arduino-compatible boards. Dedicated for bare-metal embedded systems. Thanks to the asynchronous architecture it does not block operations and can be easily implemented even on small microcontrollers with relatively small resources.

Project Homepage
LIVE DEMO 0) { *ch = Serial.read(); return 1; } return 0; }

// non-blocking write interface static int ush_write(struct ush_object *self, char ch) { // should be implemented as a FIFO return (Serial.write(ch) == 1); }

// I/O interface descriptor static const struct ush_io_interface ush_iface = { .read = ush_read, .write = ush_write, };


Define shell descriptor and shell instance:

```c
// working buffers allocations (size could be customized)
#define BUF_IN_SIZE    32
#define BUF_OUT_SIZE   32
#define PATH_MAX_SIZE  32

static char ush_in_buf[BUF_IN_SIZE];
static char ush_out_buf[BUF_OUT_SIZE];

// microshell instance handler
static struct ush_object ush;

// microshell descriptor
static const struct ush_descriptor ush_desc = {
    .io = &ush_iface,                           // I/O interface pointer
    .input_buffer = ush_in_buf,                 // working input buffer
    .input_buffer_size = sizeof(ush_in_buf),    // working input buffer size
    .output_buffer = ush_out_buf,               // working output buffer
    .output_buffer_size = sizeof(ush_out_buf),  // working output buffer size
    .path_max_length = PATH_MAX_SIZE,           // path maximum length (stack)
    .hostname = "arduino",                      // hostname (in prompt)
};

// root directory handler
static struct ush_node_object root;

Setup and run:

c
void setup()
{
    // initialize I/O interface
    Serial.begin(115200UL);

    // initialize microshell instance
    ush_init(&ush, &ush_desc);

    // mount root directory (root must be first)
    ush_node_mount(&ush, "/", &root, NULL, 0);

    // mount other directories here
    // ...
}

void loop()
{
    // non-blocking microshell service
    ush_service(&ush);

    // do other non-blocking stuff here
    // ...
}

Contribution

If You want to contribute this project - excellent! Fork it, make bugs, and send a PR :)
If You want to support me in developing this project - please donate!\

Issues· 0 开放

查看全部 Issues在 GitHub 打开

暂无开放 Issues,或尚未同步最近议题。

> 标签

Carduinobashcliembedded

暂无评论,来聊聊你的看法吧

> 工具信息

发布日期2026年8月1日
最后更新2026年9月17日
分类开发工具
定价开源

> 相关工具

V
VS Code
流行的开源代码编辑器
G
Git
分布式版本控制系统
V
Vite
下一代前端构建工具