[package]
name = "rcore"
version = "0.1.0"
edition = "2018"
authors = [
    "WangRunji <wangrunji0408@163.com>",
    "Ben Pig Chu <benpichu@gmail.com>",
    "dzy <daizy15@mails.tsinghua.edu.cn>",
    "equation314 <equation618@gmail.com>",
    "cfgbd <cfgbdv@163.com>",
    "koumingyang <1761674434@qq.com>",
    "lcy1996 <992195697@qq.com>",
    "chenqiuhao <haohao0924@126.com>",
    "maoyuchaxue <wangjt15@mails.tsinghua.edu.cn>",
    "Jiajie Chen <jiegec@qq.com>",
    "chyyuu <yuchen@mail.tsinghua.edu.cn>"
]

[features]
# Disable paging (for riscv)
no_mmu = []
# Kernel in M-mode (for riscv)
m_mode = ["no_mmu"]
# Page table sv39 or sv48 (for riscv64)
sv39 = []
board_u540 = ["sv39"]
# (for aarch64 RaspberryPi3)
nographic = []
board_raspi3 = ["bcm2837", "link_user"]
raspi3_use_generic_timer = ["bcm2837/use_generic_timer"]
# (for riscv64)
board_k210 = ["m_mode"]
# Hard link user program
link_user = []

[profile.dev]
# MUST >= 1 : Enable RVO to avoid stack overflow
opt-level = 1

[profile.release]
debug = true

[dependencies]
log = "0.4"
spin = "0.5"
once = "0.3"
xmas-elf = "0.6"
bitflags = "1.0"
bit_field = "0.9"
volatile = "0.2"
linked_list_allocator = "0.6"
device_tree = { git = "https://github.com/jiegec/device_tree-rs" }
lazy_static = { version = "1.2", features = ["spin_no_std"] }
smoltcp = { version = "0.5.0", default-features = false, features = ["alloc", "log", "proto-ipv4", "proto-igmp", "socket-icmp", "socket-udp", "socket-tcp", "socket-raw"] }
bit-allocator = { path = "../crate/bit-allocator" }
rcore-memory = { path = "../crate/memory" }
rcore-thread = { path = "../crate/thread" }
rcore-fs = { git = "https://github.com/wangrunji0408/rcore-fs", branch = "sefs" }
rcore-fs-sfs = { git = "https://github.com/wangrunji0408/rcore-fs", branch = "sefs" }

[target.'cfg(target_arch = "x86_64")'.dependencies]
bootloader = { git = "https://github.com/wangrunji0408/bootloader" }
apic = { git = "https://github.com/wangrunji0408/APIC-Rust" }
x86_64 = "0.4"
raw-cpuid = "6.0"
uart_16550 = "0.1"
pc-keyboard = "0.5"

[target.'cfg(any(target_arch = "riscv32", target_arch = "riscv64"))'.dependencies]
riscv = { git = "https://github.com/riscv-and-rust-and-decaf/riscv" }
bbl = { path = "../crate/bbl" }

[target.'cfg(target_arch = "aarch64")'.dependencies]
aarch64 = { git = "https://github.com/equation314/aarch64" }
bcm2837 = { git = "https://github.com/equation314/bcm2837", optional = true }

[package.metadata.bootimage]
default-target = "targets/x86_64.json"
output = "target/x86_64/bootimage.bin"
minimum-image-size = 0      # The minimum output file size (in MiB)
# The command invoked on `bootimage run`
# (the "{}" will be replaced with the path to the bootable disk image)
run-command = ["qemu-system-x86_64",
    "-drive", "format=raw,file={}",
    # TODO: use SFSIMG environment variable
    "-drive", "format=raw,file=../user/img/ucore-i386-pic.img,media=disk,cache=writeback",
    "-serial", "mon:stdio",
    "-device", "isa-debug-exit",
    "-smp", "4"
]

[build-dependencies]
cc = "1.0"
