1
0
mirror of https://github.com/rcore-os/rCore.git synced 2024-11-22 08:06:17 +04:00

Change build target to riscv32ia_unknown_none

This commit is contained in:
WangRunji 2018-07-06 01:24:35 +08:00
parent f571db5076
commit 37564cb9fd
4 changed files with 45 additions and 4 deletions

View File

@ -38,7 +38,7 @@ simple-filesystem = { git = "https://github.com/wangrunji0408/SimpleFileSystem-R
bit-allocator = { path = "crate/bit-allocator" }
ucore-memory = { path = "crate/memory" }
[target.riscv32i-unknown-none.dependencies]
[target.riscv32-blog_os.dependencies]
riscv = { path = "crate/riscv" }
bbl = { path = "crate/bbl" }

View File

@ -13,9 +13,6 @@ arch ?= riscv32
kernel := build/kernel-$(arch).bin
iso := build/os-$(arch).iso
target ?= $(arch)-blog_os
ifeq ($(arch), riscv32)
target := riscv32i-unknown-none
endif
mode ?= debug
rust_lib := target/$(target)/$(mode)/librust_ucore.a

View File

@ -7,6 +7,20 @@
具体配置过程详见[Dockerfile](../riscv-env/Dockerfile)
## Rust-RISCV
### 目标指令集RISCV32IA
target: riscv32ia_unknown_none
由于工具链二进制版本尚未内置`riscv32ia_unknown_none`的target因此需提供配置文件`riscv32-blog_os.json`。
为什么要用原子指令扩展?
RustOS依赖的库中大部分都使用了Rust核心库的原子操作core::sync::atomic
如果目标指令集不支持原子操作,会导致无法编译。
## BootLoader
参考[bbl-ucore](https://github.com/ring00/bbl-ucore)及后续的[ucore_os_lab for RISCV32](https://github.com/chyyuu/ucore_os_lab/tree/riscv32-priv-1.10),使用[bbl](https://github.com/riscv/riscv-pk.git)作为BootLoader。

30
riscv32-blog_os.json Normal file
View File

@ -0,0 +1,30 @@
{
"llvm-target": "riscv32",
"data-layout": "e-m:e-p:32:32-i64:64-n32-S128",
"target-endian": "little",
"target-pointer-width": "32",
"target-c-int-width": "32",
"os": "none",
"arch": "riscv",
"cpu": "generic-rv32",
"features": "+a",
"max-atomic-width": "32",
"linker": "ld.lld",
"linker-flavor": "ld",
"executables": true,
"panic-strategy": "abort",
"relocation-model": "static",
"abi-blacklist": [
"cdecl",
"stdcall",
"fastcall",
"vectorcall",
"thiscall",
"aapcs",
"win64",
"sysv64",
"ptx-kernel",
"msp430-interrupt",
"x86-interrupt"
]
}