Skip to content

C/C++ embedded project template with CMake, Unity & CppUTest for unit testing, strict warnings, static analysis, coverage, GitHub Actions CI, and optional cross-compilation for ARM MCUs.

License

Notifications You must be signed in to change notification settings

brahimab8/embedded-c-cpp-template

Repository files navigation

Embedded C/C++ Template

C/C++ embedded project template with a focus on code quality, testing, and portability. Suitable for host-based development (Linux) and extendable to ARM Cortex-M targets.

Features

  • CMake-based build system with Makefile wrapper
  • Unity test framework integration for C
  • Strict compiler warnings and hardened build flags
  • Static analysis with clang-tidy and cppcheck on core library
  • Code formatting with clang-format
  • Code coverage with gcov/lcov and HTML report generation
  • GitHub Actions CI for build, test, analysis, and coverage
  • C++ test framework integration (CppUTest)
  • Cross-compilation support for ARM Cortex-M (toolchains + firmware dir)

Requirements

  • Linux or WSL environment
  • CMake 3.20+
  • GCC or Clang toolchain
  • Tools: clang-tidy, clang-format, cppcheck, lcov, git

Quick Start

  • Clone and enter the project:

    git clone https://github.com/brahimab8/embedded-c-cpp-template
    cd embedded-c-cpp-template
  • Build and run tests:

    make
    make test
  • Optional targets:

    • make analyze → static analysis (clang-tidy, cppcheck)
    • make coverage-html → coverage report (coverage/index.html)
    • make format → format sources
    • make clean → remove build artifacts

Project Structure

├── include/          # Public headers
├── src/              # Source files
├── tests/c/          # Unity-based tests (host)
├── third_party/unity # External dependency (submodule)
└── .github/workflows # CI configuration

License

MIT License. See LICENSE.

About

C/C++ embedded project template with CMake, Unity & CppUTest for unit testing, strict warnings, static analysis, coverage, GitHub Actions CI, and optional cross-compilation for ARM MCUs.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published