Firmwares/fpga_spn/toolchain-rv32.cmake

33 lines
1.6 KiB
CMake

set(CMAKE_SYSTEM_NAME Linux)
set(CMAKE_SYSTEM_VERSION 1)
set(CMAKE_SYSTEM_PROCESSOR riscv)
set(TOOLCHAIN_DIR /opt/riscv/tools)
set(ARCHITECTURE riscv64-unknown-elf)
set(CMAKE_C_COMPILER ${ARCHITECTURE}-gcc
set(CMAKE_CXX_COMPILER ${ARCHITECTURE}-g++
set(RISCV_LINUX_SYSROOT /opt/riscv/tools CACHE PATH "RISC-V cross compilation system root") # search path for the cross compile toolchain
set(CMAKE_CXX_FLAGS "" CACHE STRING "c++ flags")
set(CMAKE_C_FLAGS "" CACHE STRING "c flags")
set(CMAKE_SHARED_LINKER_FLAGS "" CACHE STRING "shared linker flags")
set(CMAKE_MODULE_LINKER_FLAGS "" CACHE STRING "module linker flags")
set(CMAKE_EXE_LINKER_FLAGS "" CACHE STRING "executable linker flags")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=rv32imac -mabi=ilp32")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -march=rv32imac -mabi=ilp32")
#set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS}")
#set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS}")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -march=rv32imac -mabi=ilp32")
set(COMPILER_IS_RV32 "1") #flags for the CMakeList.txt
#add_definitions(-D_ARM_TEGRA3) # C/C++ preprocessor macro, which will be used in many many files
set(CMAKE_FIND_ROOT_PATH ${TOOLCHAIN_DIR}/${ARCHITECTURE})
include_directories(${TOOLCHAIN_DIR}/${ARCHITECTURE}/include)
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)