cmake_cpputest_template/ch32v20x-toolchain.cmake

32 lines
851 B
CMake
Raw Normal View History

# ###############################
# CH32V20X toolchain file
# ###############################
# Specify the cross-compiler
set(CMAKE_SYSTEM_NAME Generic)
set(CMAKE_SYSTEM_VERSION 1)
set(CMAKE_SYSTEM_PROCESSOR riscv)
set(MCU ch32v203) #
set(F_CPU 144000000UL)
set(PROGRAMMER wlink)
# Define the toolchain executables
set(TRIPPLE riscv-none-elf)
set(CMAKE_C_COMPILER ${TRIPPLE}-gcc)
set(CMAKE_CXX_COMPILER ${TRIPPLE}-g++)
set(CMAKE_ASM_COMPILER ${TRIPPLE}-gcc)
set(CMAKE_LINKER ${TRIPPLE}-ld)
set(CMAKE_OBJCOPY ${TRIPPLE}-objcopy)
set(CMAKE_SIZE ${TRIPPLE}-size)
# Define compile options
set(CMAKE_C_FLAGS " -Os -mmcu=${AVR_MCU} -DF_CPU=${F_CPU}")
set(CMAKE_CXX_FLAGS "-mmcu=${AVR_MCU} -DF_CPU=${F_CPU}")
set(CMAKE_EXE_LINKER_FLAGS_INIT "-mmcu=${AVR_MCU}")
# Define the archiver and other tools
set(CMAKE_AR avr-ar)
set(CMAKE_RANLIB avr-ranlib)