Skip to content

Releases: Awesome-Embedded-Learning-Studio/bareline

V1.0.0 Bareline的第一个版本发布!

21 Jun 13:59

Choose a tag to compare

v1.0.0 — 首个正式发布 🎉

Bareline —— 零开销、header-only 的 C++23 嵌入式 shell 库。面向裸机(Cortex-M 级 MCU):无堆分配、无异常、无 RTTI,命令在编译期注册。

v1.0.0 在 v0.1 的核心 shell 之上,首次提供真机落地的完整示例(STM32F103C8 固件 + host PC demo),修正了 ARM 工具链,并标记公共 API 稳定。

🎬 Demo

STM32F103C8(Blue Pill)真机 · bareline shell @ USART1 / 115200

STM32 demo

host PC · stdin/stdout 交互式 shell

Host demo

🆕 v1.0.0 新增

真机固件示例 — example/stm32/

bareline shell 跑在 STM32F103C8 真机(USART1),取代手写命令分派:

  • 自包含 CMake:可 cd example/stm32 && cmake -B build,也可作为 bareline 子目录
  • OpenOCD 烧录 / 调试flash / erase 目标 + .vscode/launch.json + chmod_usb.sh(WSL2 USB 授权)
  • zeros_io 桥接 + cooked 输入层:本地回显 / 退格 / ANSI 转义过滤 / CRLF 归一化
  • 7.3 KB flash / 512 B bssnm 确认无异常 / RTTI / 堆符号
  • vendoring STM32CubeF1 v1.8.7(全量子模块)

host PC demo — example/main.cpp

命令与 STM32 对齐:ledon / ledoff / clear + echo / add / greet,启动欢迎语 BareLine host shell ready

工具链 / 构建

  • 修复 arm-none-eabi.cmake:C flags 移除 C++ 专用的 -fno-rtti / -fno-exceptions(此前会让任何 ARM C 源在 -Werror 下编译失败)
  • example/stm32 自包含,支持独立 cmake 构建

🧱 核心(继承自 v0.1,已审查稳定)

  • 行输入:归一化 \n / \r\n / \r,lone-CR 跨行字节正确进入下一行
  • 分词:零拷贝 string_view token,UTF-8 安全
  • 编译期命令command<Name, Func, Help> + command_list
  • 双分派:fold-expression(≤8 条)或 constexpr FNV-1a 哈希,二次 name 校验防碰撞
  • 内建命令help / version / statstat 关闭时零开销)
  • 后端抽象IOAble concept + zeros_io(回调适配)+ mocked_io(测试)
  • 错误上报expected<int, Error>,shell 自身不打印
  • 体积:Cortex-M3 上完整 shell 管道约 968 字节 text

🔧 构建

# hosted(含 Catch2 测试)
cmake -B build -G Ninja -DBARELINE_BUILD_TEST=ON -DBARELINE_BUILD_EXAMPLE=ON
cmake --build build && ctest --test-dir build --output-on-failure

# STM32 固件(独立构建)
cd example/stm32
cmake -B build --toolchain ../../cmake/toolchains/arm-none-eabi.cmake
cmake --build build

工具链:GCC / Clang(hosted)+ arm-none-eabi-g++(Cortex-M3)。

⚠️ 已知行为
io::readline 在后端 EOF 时阻塞(为裸机 shell 设计,假设后端总会送来换行);host demo 用 Ctrl-C 退出。详见 io::readline 的 @note

📦 安装
header-only:拷贝 include/bareline/,或 CMake add_subdirectory + target_link_libraries(your_target bareline)。

需要 C++23。克隆后 git submodule update --init --recursive(STM32CubeF1 / Catch2)。


v1.0.0 — Initial Official Release 🎉

Bareline — A zero-overhead, header-only C++23 embedded shell library. Designed for bare-metal environments (Cortex-M class MCUs): no heap allocation, no exceptions, no RTTI, and compile-time command registration.

Building upon the core shell from v0.1, v1.0.0 introduces complete, real-hardware examples (STM32F103C8 firmware + host PC demo), fixes ARM toolchain issues, and marks the public API as stable.

🎬 Demo

STM32F103C8 (Blue Pill) Hardware · bareline shell @ USART1 / 115200

STM32 demo

Host PC · stdin/stdout interactive shell

Host demo

Bare-metal firmware example — example/stm32/

bareline shell running on actual STM32F103C8 hardware (via USART1), replacing manual command dispatching:

  • Self-contained CMake: Supports cd example/stm32 && cmake -B build or integration as a bareline subdirectory.
  • OpenOCD flashing/debugging: Includes flash/erase targets, .vscode/launch.json, and chmod_usb.sh (for WSL2 USB authorization).
  • zeros_io bridging + cooked input layer: Features local echo, backspace handling, ANSI escape filtering, and CRLF normalization.
  • Footprint: 7.3 KB Flash / 512 B BSS; verified via nm to be free of exceptions, RTTI, or heap-related symbols.
  • Vendored dependency: STM32CubeF1 v1.8.7 (full submodule).

Host PC demo — example/main.cpp

Command set aligned with the STM32 example: ledon, ledoff, clear, echo, add, and greet; includes startup message: "BareLine host shell ready". ### Toolchain / Build

  • Fix arm-none-eabi.cmake: Removed C++-specific -fno-rtti / -fno-exceptions from C flags (previously caused ARM C source compilation to fail under -Werror).
  • example/stm32 is self-contained and supports standalone cmake builds.

🧱 Core (Inherited from v0.1, stability verified)

  • Line Input: Normalizes \n / \r\n / \r; handles lone-CR correctly by passing trailing bytes to the next line.
  • Tokenization: Zero-copy string_view tokens; UTF-8 safe.
  • Compile-time Commands: command<Name, Func, Help> + command_list.
  • Double Dispatch: Fold-expressions (up to 8 items) or constexpr FNV-1a hashing; secondary name verification prevents collisions.
  • Built-in Commands: help / version / stat (stat incurs zero overhead when disabled).
  • Backend Abstraction: IOAble concept + zeros_io (callback adapter) + mocked_io (for testing).
  • Error Reporting: Uses expected<int, Error>; the shell itself does not print errors.
  • Size: Full shell pipeline occupies approx. 968 bytes of text segment on Cortex-M3.

🔧 Build

# Hosted (includes Catch2 tests)
cmake -B build -G Ninja -DBARELINE_BUILD_TEST=ON -DBARELINE_BUILD_EXAMPLE=ON
cmake --build build && ctest --test-dir build --output-on-failure

# STM32 Firmware (standalone build)
cd example/stm32
cmake -B build --toolchain ../../cmake/toolchains/arm-none-eabi.cmake
cmake --build build

Toolchains: GCC / Clang (hosted) + arm-none-eabi-g++ (Cortex-M3). ⚠️ Known Behavior
io::readline blocks upon backend EOF (designed for bare-metal shells, assuming the backend always provides a newline); use Ctrl-C to exit the host demo. See the @note for io::readline for details.

📦 Installation
Header-only: Copy include/bareline/, or use CMake with add_subdirectory and target_link_libraries(your_target bareline).

Requires C++23. After cloning, run git submodule update --init --recursive (for STM32CubeF1 / Catch2).