# cuteshell **Repository Path**: hu_daxia/cuteshell ## Basic Information - **Project Name**: cuteshell - **Description**: 适用于嵌入式mcu的串口shell组件 - **Primary Language**: C - **License**: MIT - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 1 - **Forks**: 0 - **Created**: 2022-01-21 - **Last Updated**: 2026-01-13 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # cuteshell ## 介绍: 适用于嵌入式MCU开发环境的shell组件,简单易用,只需要将串口接收字符和串口发送字符的接口注册进去就可以直接使用 ## 作者: bliss ## 移植说明: 1. 在shell_cfg.h文件中注册串口发送字符接口 ``` #define shellWriteChar uart0_send_byte //注册串口输出字符接口 //示例实现方式 void uart0_send_byte(const char c) { printf("%c",c); } ``` 2. 调用shell初始化函数 > shell_init(); 3. 调用命令注册函数 > shell_RegCmd("help0", (Shell_function)helpHandle0); 4. 在任务或者循环调度中调用shell回调函数,将串口接收到的字符传进去 ``` while(1) { if(USART_RX_STA&0x8000) { len=USART_RX_STA&0x3fff;//得到此次接收到的数据长度 for(t=0;t基于正点原子stm32F407串口例程的demo ## 配置说明 - 参数配置在shell_cfg.h文件中 - SHELL_HEAP_SUPPORT 是否需要自定义堆空间,当为1时会在内存中申请一块空间用于存储shell链表数据,如果已经实现malloc函数则无需使用这个静态空间 - SHELL_CMD_MAXNUM 单个命令中最大字符串个数 - SHELL_CMD_MAXLEN 单个命令中单个字符串最大字符长度 - SHELL_HEAP_SIZE shell占用静态空间大小