CH32 Environment Setup
The RISC-V toolchain situation for the CH32 series is quite chaotic. The following two options are recommended:
- The official riscv-wch-elf bundled with MRS: Supports WCH's rv32imafcxw extended instruction set, but has incomplete C++ standard library support, making it incompatible with libraries like Eigen.
- Upstream riscv32-unknown-elf: Does not support WCH's extended instruction set, but provides complete C++ standard library support. Needs to be built manually and is currently not supported on Windows.
For quick compilation, you can use the Docker image provided by this project.
CMake Configuration
An additional option needs to be configured: LIBXR_CH32_CONFIG_FILE
, which specifies the path to the CH32 peripheral library configuration file, such as: ch32v30x_conf.h
.
set(LIBXR_SYSTEM FreeRTOS)
set(LIBXR_DRIVER ch)
set(LIBXR_CH32_CONFIG_FILE "ch32v30x_conf.h")
add_subdirectory(libxr)
...