Go to file
Jiajie Chen 4cbc967415 Fix libnosys linkage and remove unneeded fstat & sbrk 2022-04-20 14:08:17 +08:00
BSP Fix libnosys linkage and remove unneeded fstat & sbrk 2022-04-20 14:08:17 +08:00
include Fixed memory usage report, check TXE instead of TC. 2022-03-29 22:43:47 +08:00
src Fix libnosys linkage and remove unneeded fstat & sbrk 2022-04-20 14:08:17 +08:00
.gitignore Added README.md and .gitignore. 2022-03-29 00:21:16 +08:00
CMakeLists.txt Fix libnosys linkage and remove unneeded fstat & sbrk 2022-04-20 14:08:17 +08:00
LICENSE Multiple tidying and warnings fixed, added LICENSE 2022-03-29 01:00:15 +08:00
LICENSE.wch Multiple tidying and warnings fixed, added LICENSE 2022-03-29 01:00:15 +08:00
README.md Updated README. 2022-03-29 16:19:12 +08:00
program.cfg Fix libnosys linkage and remove unneeded fstat & sbrk 2022-04-20 14:08:17 +08:00
riscv64-elf.cmake Initial commit with WCH drivers. 2022-03-29 00:08:02 +08:00
riscv64-unknown-elf.cmake Fix libnosys linkage and remove unneeded fstat & sbrk 2022-04-20 14:08:17 +08:00

README.md

Template for WCH CH32V30x series MCU

How to use

  • Write your own CMake toolchain file (see riscv64-elf.cmake for example)
  • Configure project and build as usual. (see below for a simple test)

Sample usage

mkdir build && cd build
cmake -DCMAKE_TOOLCHAIN_FILE=riscv64-elf.cmake ..
make -j${nprocs}

Notes

Startup files

There are two versions of startup assembly files, located at

  • BSP/Startup/startup_ch32v30x_D8.S
  • BSP/Startup/startup_ch32v30x_D8C.S

The first file is used for CH32V303 devices, which lacks of the following peripherals:

  • Ethernet
  • CAN2
  • USBHS
  • DVP

*** Change the startup file to the correct version for the hardware in use. ***

Compilers

These MCUs uses something called "RISC-V4F" core with Chinese documentation provided:

  • Implemented RV32IMAFC ABI

Here is the list of features proprietary or incompatible with upstream toolchain:

  • Fast IRQ handlers: uses a special attribute of interrupt, which value is WCH-Interrupt-fast