Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,15 @@ defaults:
shell: bash

jobs:
cppcheck:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install Cppcheck
run: sudo apt-get update && sudo apt-get install -y cppcheck
- name: Cppcheck (default settings)
run: make cppcheck

mcu-ubuntu:
runs-on: ubuntu-latest
steps:
Expand Down
8 changes: 7 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,11 @@ MPU_CFLAGS = -std=c23 -Wall -Wextra -Wpedantic -Iinclude -DMEMKIT_MPU=1 -DEMBEDD
-DMEMKIT_ALLOW_HEAP=1 -DMEMKIT_ALLOW_MMAP=1
MPU_OBJS = $(BUILD)/mpu/arena.o $(BUILD)/mpu/mmap_backing.o $(BUILD)/mpu/c_api/bindings.o

CPPCHECK ?= cppcheck
CPPCHECK_DIRS = src tests examples benchmarks

.PHONY: all test_cpp test_c_api test_c_api_mpu test_c_api_extended test_cpp_mpu mcu mpu clean lib \
lib-mcu-c check-lib check-lib-mcu-c test-lib-mcu-c-link benchmark benchmark-size
lib-mcu-c check-lib check-lib-mcu-c test-lib-mcu-c-link benchmark benchmark-size cppcheck

# Freestanding MCU C API archive (no libstdc++ at link time for C customers).
MCU_C_CXXFLAGS = $(CXXFLAGS) -ffreestanding
Expand Down Expand Up @@ -241,5 +244,8 @@ $(BUILD)/mpu:
$(BUILD):
mkdir -p $(BUILD)

cppcheck:
$(CPPCHECK) --error-exitcode=1 -Iinclude $(CPPCHECK_DIRS)

clean:
rm -rf $(BUILD)
8 changes: 7 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,7 @@ make test_cpp # C++ container tests only
make test_c_api # tier-1 C API tests (MCU, 8 binaries)
make mpu # MPU: tier-2 C API tests + test_heap_arena_cpp + integration test
make lib-mcu-c # freestanding tier-1 C archive for pure-C firmware
make cppcheck # Cppcheck (default checks; requires cppcheck on PATH)
make clean
```

Expand Down Expand Up @@ -904,10 +905,15 @@ You may still `#include <vector>` directly in your own MPU code; memkit just doe

## CI

GitHub Actions (`.github/workflows/ci.yml`):
GitHub Actions (`.github/workflows/ci.yml`) runs builds, tests, and **Cppcheck** static analysis on every push and pull request to `main`:

```bash
make cppcheck # same command as the cppcheck CI job (install: apt/brew cppcheck)
```

| Job | What it runs |
|-----|----------------|
| `cppcheck` | Cppcheck (default checks) — `make cppcheck` on `src/`, `tests/`, `examples/`, `benchmarks/` |
| `mcu-ubuntu` | Clang 21 — `make all` + `lib-mcu-c` / `check-lib-mcu-c` / `test-lib-mcu-c-link` |
| `mcu-gcc-ubuntu` | GCC 14 (C++23) — `make all` + freestanding C lib targets |
| `mpu-ubuntu` | Clang 21 — `make mpu` (tier-2 C API + `test_heap_arena_cpp`) |
Expand Down
1 change: 1 addition & 0 deletions docs/GETTING_STARTED.md
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,7 @@ git clone https://github.com/NetKit-Labs/memkit.git
cd memkit
make all # MCU: lib + tests + 4 MCU examples
make mpu # MPU: tier-2 C tests + heap arena test + 2 MPU examples + integration test
make cppcheck # static analysis (Cppcheck; same as CI — install cppcheck first)
```

### CMake (in-tree)
Expand Down
Loading