1 Star 0 Fork 0

wangpeng25/riscv学习

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
CMakeLists.txt 1.38 KB
一键复制 编辑 原始数据 按行查看 历史
wp 提交于 2024-03-22 09:02 . 整理文件结构
#CMake版本,务必放在首行
cmake_minimum_required(VERSION 3.0)
#设置编译目标系统,定义系统名称,务必放在获取源文件之前,用来说明当前操作系统。
#只有这个变量被设置了,CMake才认为此时正在交叉编译,会额外设置一个变量CMAKE_CROSSCOMPLING为TRUE
set(CMAKE_SYSTEM_NAME "linux")
set(CMAKE_SYSTEM_PROCESSOR riscv)
#跳过编译链检测
set(CMAKE_C_COMPILER_FORCED TRUE) # skip compiler test
set(CMAKE_CXX_COMPILER_FORCED TRUE)
set(CMAKE_C_COMPILER "riscv64-unknown-elf-gcc")
set(CMAKE_ASM_COMPILER "riscv64-unknown-elf-gcc")
set(CMAKE_AR "riscv64-unknown-elf-ar")
set(CMAKE_OBJCOPY "riscv64-unknown-elf-objcopy")
set(CMAKE_OBJDUMP "riscv64-unknown-elf-objdump")
set(CMAKE_SIZE "riscv64-unknown-elf-size")
ENABLE_LANGUAGE(ASM)
set(LD_PATH ${CMAKE_CURRENT_SOURCE_DIR}/ld)
set(BIN_PATH ${CMAKE_CURRENT_SOURCE_DIR}/bin)
set(LINKER_SCRIPT "${LD_PATH}/link_flash_bs1.lds")
set(RISCV_MARCH rv32imc)
set(ABI ilp32)
set(ARCH_FLAGS "-march=${RISCV_MARCH} -mabi=${ABI} -mcmodel=medlow")
set(LINK_FLAGS "-Wl,-T${LINKER_SCRIPT} ${ARCH_FLAGS} -Wl,--no-relax -Wl,--gc-sections -nostartfiles --specs=nano.specs")
set(C_FLAGS "-Wall -W -g ${ARCH_FLAGS} -Wmaybe-uninitialized -ffunction-sections -fdata-sections -fno-exceptions -fno-builtin-printf -Wno-unused-function -Wno-unused-parameter -Wno-format")
project(rv VERSION 1.0)
add_subdirectory(src)
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/wangpeng25/riscv-learning.git
git@gitee.com:wangpeng25/riscv-learning.git
wangpeng25
riscv-learning
riscv学习
main

搜索帮助

0d507c66 1850385 C8b1a773 1850385