Template for C TDD that uses the cpputest framework/test harness. This template uses Makefiles instead of CMake
Find a file Use this template
2025-03-06 18:02:29 -08:00
.template_files fixed issue with external linkage of "C" files 2024-03-20 16:10:10 -07:00
build
cpputest@c3625dc668
docs
inc Added headers 2025-03-06 17:49:29 -08:00
mocks
src Added blink source and compiler options 2025-03-06 17:50:09 -08:00
tests Added comment for automation use. 2024-03-18 19:30:40 -07:00
.clang-format fixed cli flags 2024-08-04 09:27:15 -07:00
.gitignore
.gitmodules
CMakeLists.txt changed standard options and version number to semantic versioning 2025-03-06 17:50:24 -08:00
compile_commands.json
Doxyfile
otto.sh Updated the otto.sh script 2025-03-06 17:50:38 -08:00
README.md Updated the instructions for FreeBSD systems. 2025-03-06 17:59:05 -08:00
riscv32-toolchain.cmake Added compiler and newlib info for linux systems. 2025-03-06 18:02:29 -08:00
setup.sh

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 NewLib finding/functionality
  • Add NewLib-nano finding/functionality
  • Add ch32v003fun sources.
  • Add example blinky default main.
  • Add useful test examples.
  • Add useful mock examples.
  • Get Blinky to run on hardware.