wip: nucleus builds!

This commit is contained in:
Berkus Decker 2023-12-10 04:40:34 +02:00
parent 7c76dbded1
commit 79f859b576
10 changed files with 95 additions and 57 deletions

View File

@ -1,7 +1,7 @@
[workspace]
members = [
"nucleus",
"machine",
"nucleus",
"bin/chainboot",
"bin/chainofcommand",
"tools/ttt"

View File

@ -63,8 +63,7 @@ cb-eject:
# Build default hw kernel
build:
cargo make build-device
cargo make kernel-binary # Should be only one command to do that, not two!
cargo make build
# Run clippy checks
clippy:

View File

@ -8,6 +8,7 @@
[config]
min_version = "0.32.0"
default_to_workspace = true
skip_core_tasks = true
[env]
DEFAULT_TARGET = "aarch64-vesper-metta"
@ -96,28 +97,33 @@ alias = "all"
dependencies = ["kernel-binary", "chainboot", "chainofcommand", "ttt"]
[tasks.xtool-modules]
workspace = false
command = "cargo"
args = ["modules", "tree"]
# Disable build in the root by default.
[tasks.build]
clear = true
workspace = false
alias = "empty"
# Run a target build with current platform configuration.
[tasks.build-target]
workspace = false
command = "cargo"
args = ["build", "@@split(PLATFORM_TARGET, )", "@@split(RUST_STD, )", "--release"]
[tasks.build-device]
workspace = false
env = { "TARGET_FEATURES" = "${TARGET_BOARD}" }
run_task = "build-target"
[tasks.build-qemu]
workspace = false
env = { "TARGET_FEATURES" = "${QEMU_FEATURES}" }
run_task = "build-target"
[tasks.qemu-runner]
workspace = false
dependencies = ["build-qemu", "kernel-binary"]
env = { "TARGET_FEATURES" = "${QEMU_FEATURES}" }
script = [
@ -128,6 +134,7 @@ script = [
]
[tasks.xtool-expand-target]
workspace = false
env = { "TARGET_FEATURES" = "" }
command = "cargo"
args = ["expand", "@@split(PLATFORM_TARGET, )", "--release"]
@ -143,6 +150,7 @@ command = "cargo"
args = ["doc", "--open", "--no-deps", "@@split(PLATFORM_TARGET, )"]
[tasks.xtool-clippy]
workspace = false
env = { "TARGET_FEATURES" = "rpi3", "CLIPPY_FEATURES" = { value = "--features=${CLIPPY_FEATURES}", condition = { env_set = ["CLIPPY_FEATURES"] } } }
command = "cargo"
args = ["clippy", "@@split(PLATFORM_TARGET, )", "@@split(RUST_STD, )", "@@remove-empty(CLIPPY_FEATURES)", "--", "--deny", "warnings", "--allow", "deprecated"]
@ -151,6 +159,7 @@ args = ["clippy", "@@split(PLATFORM_TARGET, )", "@@split(RUST_STD, )", "@@remove
## Copy and prepare a given ELF file. Convert to binary output format.
[tasks.build-custom-binary]
workspace = false
env = { "BINARY_FILE" = "${BINARY_FILE}" }
script_runner = "@duckscript"
script = [
@ -171,11 +180,13 @@ install_crate = { crate_name = "cargo-binutils", binary = "rust-objcopy", test_a
## Copy and prepare binary with tests.
[tasks.test-binary]
workspace = false
env = { "BINARY_FILE" = "${CARGO_MAKE_TASK_ARGS}" }
run_task = "custom-binary"
## Run binary with tests in QEMU.
[tasks.test-runner]
workspace = false
dependencies = ["test-binary"]
script_runner = "@duckscript"
script = [
@ -188,6 +199,7 @@ script = [
## Generate GDB startup configuration file.
[tasks.gdb-config]
workspace = false
script_runner = "@duckscript"
script = [
'''
@ -202,6 +214,7 @@ script = [
## Generate zellij configuration file.
[tasks.zellij-config]
workspace = false
dependencies = ["build-qemu", "kernel-binary"]
script_runner = "@duckscript"
env = { "ZELLIJ_CONFIG_FILE" = "${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/emulation/zellij-config.sh" }
@ -218,11 +231,13 @@ script = [
install_crate = { crate_name = "zellij", binary = "zellij", test_arg = ["--help"] }
[tasks.openocd]
workspace = false
script = [
"${OPENOCD} -f interface/jlink.cfg -f ../ocd/${TARGET_BOARD}_target.cfg"
]
[tasks.sdeject]
workspace = false
dependencies = ["sdcard"]
script = [
"diskutil ejectAll ${VOLUME}"
@ -233,74 +248,72 @@ alias = "empty"
#
# Per-workspace commands, disabled in the root by efault.
# TODO: defined only in sub-modules with workspace = false
#
# Tasks for nucleus
[tasks.build-kernel-binary]
alias = "empty"
[tasks.kernel]
alias = "empty"
#[tasks.build-kernel-binary]
#alias = "empty"
# Tasks for chainboot
[tasks.chainboot]
alias = "empty"
#[tasks.chainboot]
#alias = "empty"
# sdeject
#[tasks.cb-eject]
#alias = "empty"
# Tasks for chainofcommand
[tasks.chainofcommand]
alias = "empty"
#[tasks.chainofcommand]
#alias = "empty"
# Tasks for ttt
[tasks.ttt]
alias = "empty"
#[tasks.ttt]
#alias = "empty"
# Other tasks
[tasks.gdb]
alias = "empty"
#[tasks.gdb]
#alias = "empty"
[tasks.gdb-cb]
alias = "empty"
#[tasks.gdb-cb]
#alias = "empty"
[tasks.sdcard]
alias = "empty"
#[tasks.sdcard]
#alias = "empty"
[tasks.qemu-gdb]
alias = "empty"
#[tasks.qemu-gdb]
#alias = "empty"
[tasks.qemu-cb]
alias = "empty"
#[tasks.qemu-cb]
#alias = "empty"
[tasks.qemu-cb-gdb]
alias = "empty"
#[tasks.qemu-cb-gdb]
#alias = "empty"
[tasks.xtool-hopper]
alias = "empty"
#[tasks.xtool-hopper]
#alias = "empty"
#
#[tasks.xtool-nm]
#alias = "empty"
[tasks.xtool-nm]
alias = "empty"
#[tasks.zellij-cb]
#alias = "empty"
[tasks.zellij-cb]
alias = "empty"
#[tasks.zellij-cb-gdb]
#alias = "empty"
[tasks.zellij-cb-gdb]
alias = "empty"
[tasks.zellij-nucleus]
alias = "empty"
#[tasks.zellij-nucleus]
#alias = "empty"
## Target dependencies:
[tasks.kernel-binary]
alias = "empty"
#[tasks.kernel-binary]
#alias = "empty"
[tasks.chainboot-binary]
alias = "empty"
#[tasks.chainboot-binary]
#alias = "empty"
#
#[tasks.chainofcommand-binary]
#alias = "empty"
[tasks.chainofcommand-binary]
alias = "empty"
[tasks.ttt-binary]
alias = "empty"
#[tasks.ttt-binary]
#alias = "empty"

View File

@ -8,33 +8,41 @@
[env]
CHAINBOOT_ELF = "${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/target/${TARGET}/release/chainboot"
CHAINBOOT_BIN = "${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/target/chainboot.bin"
CARGO_MAKE_EXTEND_WORKSPACE_MAKEFILE = true
[tasks.chainboot]
workspace = false
dependencies = ["build-device", "build-kernel-binary"]
command = "echo"
args = ["\n***===***\n", "🏎️ Run the following command in your terminal:\n", "🏎️ ${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/target/debug/chainofcommand ${CHAINBOOT_SERIAL} ${CHAINBOOT_BAUD} --kernel ${KERNEL_BIN}\n", "***===***\n\n"]
[tasks.build-kernel-binary]
workspace = false
env = { "BINARY_FILE" = "${CHAINBOOT_ELF}" }
run_task = "build-custom-binary"
[tasks.zellij-cb]
workspace = false
env = { "KERNEL_BIN" = "${CHAINBOOT_BIN}", "QEMU_OPTS" = "${QEMU_OPTS} ${QEMU_DISASM_OPTS}" }
run_task = "zellij-config"
[tasks.zellij-cb-gdb]
workspace = false
env = { "KERNEL_BIN" = "${CHAINBOOT_BIN}", "QEMU_OPTS" = "${QEMU_OPTS} ${QEMU_DISASM_OPTS} ${QEMU_GDB_OPTS}", "TARGET_BOARD" = "rpi3", "TARGET_DTB" = "${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/targets/bcm2710-rpi-3-b-plus.dtb" }
run_task = "zellij-config"
[tasks.qemu-cb]
workspace = false
env = { "QEMU_RUNNER_OPTS" = "${QEMU_DISASM_OPTS} -serial pty", "KERNEL_BIN" = "${CHAINBOOT_BIN}", "TARGET_DTB" = "${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/targets/bcm2710-rpi-3-b-plus.dtb" }
extend = "qemu-runner"
[tasks.qemu-cb-gdb]
workspace = false
env = { "QEMU_RUNNER_OPTS" = "${QEMU_DISASM_OPTS} ${QEMU_GDB_OPTS} -serial pty", "KERNEL_BIN" = "${CHAINBOOT_BIN}", "TARGET_DTB" = "${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/targets/bcm2710-rpi-3-b-plus.dtb" }
extend = "qemu-runner"
[tasks.gdb-cb]
workspace = false
dependencies = ["build", "build-kernel-binary", "gdb-config"]
env = { "RUST_GDB" = "${GDB}" }
script = [
@ -42,10 +50,10 @@ script = [
]
[tasks.sdcard]
clear = true
alias = "sdcard-cb"
[tasks.sdcard-cb]
workspace = false
dependencies = ["build", "build-kernel-binary"]
script_runner = "@duckscript"
script = [

View File

@ -5,25 +5,28 @@
#
# Build chainofcommand tool
#
[env]
CARGO_MAKE_EXTEND_WORKSPACE_MAKEFILE = true
[tasks.build]
clear = true
alias = "build-coc"
[tasks.build-device]
clear = true
alias = "empty"
[tasks.build-coc]
workspace = false
command = "cargo"
args = ["build"]
[tasks.chainofcommand]
workspace = false
alias = "build-coc"
[tasks.test]
command = "cargo"
args = ["test"]
[tasks.xtool-clippy]
[tasks.xtool-clippy] # todo this should be modules-specific? or just "clippy" for workspace cmd
command = "cargo"
args = ["clippy", "--", "-D", "warnings"]

View File

@ -3,6 +3,9 @@
#
# Copyright (c) Berkus Decker <berkus+vesper@metta.systems>
#
# Build nucleus library
# Build nucleus library (machine)
#
[env]
CARGO_MAKE_EXTEND_WORKSPACE_MAKEFILE = true
# No special configuration needed.

View File

@ -2,6 +2,7 @@
#![no_main]
#![allow(stable_features)]
#![allow(incomplete_features)]
#![allow(internal_features)]
#![feature(asm_const)]
#![feature(const_option)]
#![feature(core_intrinsics)]

View File

@ -5,16 +5,19 @@
#
# Build nucleus
#
[env]
CARGO_MAKE_EXTEND_WORKSPACE_MAKEFILE = true
[tasks.build-kernel-binary]
workspace = false
dependencies = ["build-device"]
env = { "BINARY_FILE" = "${KERNEL_ELF}" }
run_task = "build-custom-binary"
[tasks.kernel]
clear = true
alias = "build-kernel-binary"
[tasks.build]
clear = true
alias = "build-kernel-binary"
[tasks.qemu]

View File

@ -10,6 +10,7 @@
#![no_std]
#![no_main]
#![allow(stable_features)]
#![allow(internal_features)]
#![feature(asm_const)]
#![feature(lazy_cell)]
#![feature(decl_macro)]

View File

@ -5,15 +5,22 @@
#
# Build ttt tool
#
[env]
CARGO_MAKE_EXTEND_WORKSPACE_MAKEFILE = true
[tasks.build]
clear = true
alias = "ttt"
disabled = true
alias = "ttt-binary"
[tasks.build-device]
alias = "ttt-binary"
[tasks.ttt]
clear = true
workspace = false
alias = "ttt-binary"
[tasks.ttt-binary]
workspace = false
env = { "TARGET_FEATURES" = "${TARGET_BOARD}" }
command = "cargo"
args = ["build", "--features=${TARGET_FEATURES}"]