Template for C TDD that uses the cpputest framework/test harness. This template uses Makefiles instead of CMake
Find a file Use this template
2026-01-05 23:03:16 -08:00
.template_files Refactored template files 2025-12-23 14:22:47 -08:00
build created copy with generic name 2025-03-07 10:51:08 -08:00
docs Added empty dirs and hidden placeholders 2024-03-06 20:57:41 -08:00
extern Added extern dir for holding external dependencies. 2025-12-20 18:41:49 -08:00
inc Fixed GNU extension issue 2025-12-23 14:51:34 -08:00
src Updated to fill in notes/comments on the mcu. 2026-01-05 23:03:16 -08:00
tests Added new ADC test 2025-12-23 14:59:42 -08:00
.clang-format fixed cli flags 2024-08-04 09:27:15 -07:00
.clang-format-ignore Added an clang formattiing ignore file. 2025-03-08 15:38:05 -08:00
.gitignore Added tags file to list of things to ignore. 2025-12-21 19:43:41 -08:00
.gitmodules Removed the git submodule in root directory 2025-12-20 18:41:35 -08:00
CMakeLists.txt cleaned up commented out lines. 2025-12-20 19:40:47 -08:00
compile_commands.json added the compile commands symlink 2024-03-12 22:39:28 -07:00
Doxyfile Updated doxygen file to use the README.md file as the main 2025-03-26 19:24:22 -07:00
otto.sh fixed and tested otto script on FreeBSD 2025-12-22 19:27:00 -08:00
README.md Added item to todolsit. 2025-12-21 20:55:49 -08:00
riscv32-toolchain.cmake commented out lines in toolchain file. 2025-03-08 17:31:42 -08:00
setup.sh updated the build_cpputest() shell function 2024-03-06 21:47:04 -08:00

CH32v003 Cmake + CppUTest Template

Goal

Be a flexable template repo for working with ch32v003 controllers while aslo inegrating TDD scripts using Cmake.

Requirements

  • CMake
  • Sh, Bash or compatible shell
  • Make/GMake/BSDMake/etc
  • clang/gcc
  • clangd
  • CppUTest(for unit tests)
  • NewLIB/newlib-nano

Installing toolchain

FreeBSD:

sudo pkg install gawk gsed

git clone https://github.com/riscv-collab/riscv-gnu-toolchain.git
cd ./riscv-gnu-toolchain

git submodule update --init --recursive

mkdir ./build && cd ./build

# Create needed dir for the output.
mkdir /usr/local/riscv && chmod -R 0775 /usr/local/riscv

# Setup to build newlib for 32bit embedded and compressed cpus.
./configure --prefix=/usr/local/riscv --with-arch=rv32ec \
    --with-arch=rv32ec \
    --with-abi=ilp32e \
    --with-multilib
make -j4 newlib

# Some Example options below.
make -j4 build-gcc1
make -j4 build-gcc2
make -j4 build-gdb
make -j4 build-libc
make -j4 build-llvm
make -j4 build-uclibc
make -j4 build-binutils

Linux:

Pretty much the same as FreeBSD, just follow the toolchain's README.md files instructions.

TODO

  • Add ch32v003fun sources.
  • Add example blinky default main.
  • Add useful test examples.
  • Add useful mock examples.
  • Get Blinky to run on hardware.
  • Set conditional compile/linker flags?
  • Get RegEdit setup for 32bit addresses.
  • Add full test suite for Mock of RegEdit module.