Skip to content

Ocanath/byte-stuffing

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

100 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Embedded Byte Stuffing Library

A minimal C library for byte stuffing, intended for use in embedded systems. Implements two framing protocols:

  • COBS (Consistent Overhead Byte Stuffing) — deterministic overhead, no sentinel byte collisions, well-suited for binary data.
  • PPP/HDLC (High-Level Data Link Control asynchronous framing) — flag-byte delimited framing as used in Point-to-Point Protocol.

Integration

Git submodule (recommended)

Add as a git submodule, then in your CMakeLists.txt:

add_subdirectory(path/to/byte-stuffing)
target_link_libraries(your_target PRIVATE cobs PPP)

CMake FetchContent (also recommended)

include(FetchContent)
FetchContent_Declare(
    byte_stuffing
    GIT_REPOSITORY https://github.com/Ocanath/byte-stuffing.git
    GIT_TAG        master
)
FetchContent_MakeAvailable(byte_stuffing)
target_link_libraries(your_target PRIVATE cobs PPP)

Direct copy

Copy the source files directly into your project and add them to your build environment.

Building

cmake -S . -B build
cmake --build build

Testing

Unit tests run via ceedling (ceedling test:all). A Python COBS implementation with pytest-based tests is also included.

About

Super simple, lightweight implementation of the byte stuffing aspect of PPP (point-to-point protocol) for use in embedded projects, in particular for communicating with a PC host over a USB-Serial adapter, or in other cases where IDLE line detection is impossible or impractical.

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors