143 lines
4.6 KiB
TOML
143 lines
4.6 KiB
TOML
#
|
|
# SPDX-License-Identifier: BlueOak-1.0.0
|
|
#
|
|
# Copyright (c) Berkus Decker <berkus+vesper@metta.systems>
|
|
#
|
|
[tasks.build]
|
|
env = { "TARGET_FEATURES" = "" }
|
|
args = ["build", "--target=${TARGET_JSON}", "--release", "--features=${TARGET_FEATURES}"]
|
|
|
|
[tasks.expand]
|
|
env = { "TARGET_FEATURES" = "" }
|
|
args = ["expand", "--target=${TARGET_JSON}", "--release", "--features=${TARGET_FEATURES}"]
|
|
|
|
[tasks.test]
|
|
env = { "TARGET_FEATURES" = "${QEMU_FEATURES}" }
|
|
args = ["test", "--target=${TARGET_JSON}", "--features=${TARGET_FEATURES}"]
|
|
|
|
[tasks.docs]
|
|
env = { "TARGET_FEATURES" = "" }
|
|
args = ["doc", "--open", "--no-deps", "--target=${TARGET_JSON}", "--features=${TARGET_FEATURES}"]
|
|
|
|
# These tasks are written in cargo-make's own script to make it portable across platforms (no `basename` on Windows)
|
|
[tasks.kernel-binary]
|
|
script_runner = "@duckscript"
|
|
script = [
|
|
'''
|
|
cp ${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/target/${TARGET}/release/vesper ${KERNEL_ELF}
|
|
exec --fail-on-error ${OBJCOPY} %{OBJCOPY_PARAMS} ${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/target/${TARGET}/release/vesper ${KERNEL_BIN}
|
|
'''
|
|
]
|
|
|
|
[tasks.custom-binary]
|
|
script_runner = "@duckscript"
|
|
script = [
|
|
'''
|
|
binaryFile = basename ${CARGO_MAKE_TASK_ARGS}
|
|
cp ${CARGO_MAKE_TASK_ARGS} ${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/target/${binaryFile}.elf
|
|
exec --fail-on-error ${OBJCOPY} %{OBJCOPY_PARAMS} ${CARGO_MAKE_TASK_ARGS} ${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/target/${binaryFile}.bin
|
|
'''
|
|
]
|
|
|
|
[tasks.test-runner]
|
|
dependencies = ["custom-binary"]
|
|
script_runner = "@duckscript"
|
|
script = [
|
|
'''
|
|
binaryFile = basename ${CARGO_MAKE_TASK_ARGS}
|
|
exec --fail-on-error ${QEMU} %{QEMU_OPTS} %{QEMU_TESTS_OPTS} -dtb ${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/targets/bcm2710-rpi-3-b-plus.dtb -kernel ${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/target/${binaryFile}.bin
|
|
'''
|
|
]
|
|
|
|
[tasks.build-qemu]
|
|
env = { "TARGET_FEATURES" = "${QEMU_FEATURES}" }
|
|
command = "cargo"
|
|
args = ["build", "--target=${TARGET_JSON}", "--release", "--features=${TARGET_FEATURES}"]
|
|
|
|
[tasks.qemu-runner]
|
|
env = { "TARGET_FEATURES" = "${QEMU_FEATURES}" }
|
|
script = [
|
|
"${QEMU} ${QEMU_OPTS} ${QEMU_RUNNER_OPTS} -dtb ${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/targets/bcm2710-rpi-3-b-plus.dtb -kernel ${KERNEL_BIN}"
|
|
]
|
|
dependencies = ["build-qemu", "kernel-binary"]
|
|
|
|
[tasks.qemu]
|
|
extend = "qemu-runner"
|
|
env = { "QEMU_RUNNER_OPTS" = "${QEMU_SERIAL_OPTS}" }
|
|
|
|
[tasks.zellij-config]
|
|
extend = "qemu-runner"
|
|
script_runner = "@duckscript"
|
|
env = { "ZELLIJ_CONFIG_FILE" = "../emulation/zellij-config.sh" }
|
|
script = [
|
|
'''
|
|
writefile ${ZELLIJ_CONFIG_FILE} "QEMU=${QEMU}\n"
|
|
appendfile ${ZELLIJ_CONFIG_FILE} "QEMU_OPTS=\"${QEMU_OPTS}\"\n"
|
|
appendfile ${ZELLIJ_CONFIG_FILE} "QEMU_RUNNER_OPTS=${QEMU_RUNNER_OPTS}\n"
|
|
appendfile ${ZELLIJ_CONFIG_FILE} "CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY=${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}\n"
|
|
appendfile ${ZELLIJ_CONFIG_FILE} "KERNEL_BIN=${KERNEL_BIN}\n"
|
|
'''
|
|
]
|
|
install_crate = { crate_name = "zellij", binary = "zellij", test_arg = ["--help"] }
|
|
|
|
[tasks.qemu-gdb]
|
|
extend = "qemu-runner"
|
|
env = { "QEMU_RUNNER_OPTS" = "${QEMU_SERIAL_OPTS} ${QEMU_GDB_OPTS}" }
|
|
|
|
[tasks.openocd]
|
|
dependencies = ["build", "kernel-binary"]
|
|
script = [
|
|
"${OPENOCD} -f interface/jlink.cfg -f ../ocd/rpi4_target.cfg"
|
|
]
|
|
|
|
[tasks.gdb-config]
|
|
script_runner = "@duckscript"
|
|
script = [
|
|
'''
|
|
writefile ${GDB_CONNECT_FILE} "target extended-remote :5555\n"
|
|
'''
|
|
]
|
|
|
|
[tasks.gdb]
|
|
dependencies = ["build", "kernel-binary", "gdb-config"]
|
|
env = { "RUST_GDB" = "${GDB}" }
|
|
script = [
|
|
"rust-gdb -x ${GDB_CONNECT_FILE} ${KERNEL_ELF}"
|
|
]
|
|
|
|
[tasks.nm]
|
|
dependencies = ["build", "kernel-binary"]
|
|
script = [
|
|
"${NM} -- ${KERNEL_ELF} | sort"
|
|
]
|
|
#install_crate = "cargo-binutils"
|
|
|
|
[tasks.sdcard]
|
|
dependencies = ["build", "kernel-binary"]
|
|
script_runner = "@duckscript"
|
|
script = [
|
|
'''
|
|
kernelImage = basename ${KERNEL_BIN}
|
|
cp ${KERNEL_BIN} ${VOLUME}/${kernelImage}
|
|
'''
|
|
]
|
|
|
|
[tasks.sdeject]
|
|
dependencies = ["sdcard"]
|
|
script = [
|
|
"diskutil unmount ${VOLUME}"
|
|
]
|
|
|
|
[tasks.clippy]
|
|
env = { "TARGET_FEATURES" = { value = "--features=${CLIPPY_FEATURES}", condition = { env_set = ["CLIPPY_FEATURES"] } } }
|
|
command = "cargo"
|
|
args = ["clippy", "--target=${TARGET_JSON}", "@@remove-empty(TARGET_FEATURES)", "--", "-D", "warnings"]
|
|
|
|
[tasks.hopper]
|
|
dependencies = ["build", "kernel-binary"]
|
|
# The cmd line below causes a bug in hopper, see https://www.dropbox.com/s/zyw5mfx0bepcjb1/hopperv4-RAW-bug.mov?dl=0
|
|
#"hopperv4 --loader RAW --base-address 0x80000 --entrypoint 0x80000 --file-offset 0 --plugin arm --cpu aarch64 --variant generic --contains-code true --executable ${KERNEL_BIN}"
|
|
script = [
|
|
"hopperv4 --loader ELF --executable ${KERNEL_ELF}"
|
|
]
|