-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathMakefile.toml
107 lines (93 loc) · 3.13 KB
/
Makefile.toml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
# General cargo-make configuration.
[config]
skip_core_tasks = true
min_version = "0.22.0"
default_to_workspace = false
# Environment variables needed thorough the build.
[env]
# Common path for Mirage build targets.
RUST_TARGET_PATH = "${CARGO_MAKE_WORKING_DIRECTORY}/targets"
# The build target pertaining to the BPMP (ARM7TDMI).
MIRAGE_ARM_TARGET = "armv4t-mirage-eabi"
# The build target pertaining to the CCPLEX (Cortex-A57).
MIRAGE_AARCH64_TARGET = "aarch64-mirage-none"
# Configuration for debug builds.
[env.development]
PROFILE_NAME = "debug"
COMPILER_FLAGS = "--all-features"
# Configuration for release builds.
[env.production]
PROFILE_NAME = "release"
COMPILER_FLAGS = "--release"
# rustup component add rust-src; Required by cargo-xbuild.
[tasks.install-rust-src]
install_crate = { rustup_component_name = "rust-src" }
# rustup-component add llvm-tools-preview; Required by cargo-binutils.
[tasks.install-llvm-tools-preview]
install_crate = { rustup_component_name = "llvm-tools-preview" }
# Installs the cargo-objcopy binary from the cargo-binutils crate.
[tasks.install-cargo-binutils]
dependencies = ["install-llvm-tools-preview"]
install_crate = { crate_name = "cargo-binutils", binary = "cargo-objcopy", test_arg = "--help" }
install_crate_args = ["--git", "https://github.com/roblabla/cargo-binutils", "--branch", "cargo-metadata"]
# Installs cargo-xbuild.
[tasks.install-cargo-xbuild]
dependencies = ["install-rust-src"]
install_crate = { crate_name = "cargo-xbuild", binary = "cargo", test_arg = ["xbuild", "--help"], min_version = "0.5.14" }
# Copies the linker script for the bootstrap to the project root.
[tasks.bootstrap-linker]
script_runner = "@shell"
script = [
'''
cp linker-scripts/bootstrap.ld link.T
'''
]
# Builds the bootstrap ELF.
[tasks.bootstrap-elf-build]
description = "Compiles the bootstrap for the BPMP processor."
env = { "RUSTFLAGS" = "--sysroot ${CARGO_MAKE_WORKING_DIRECTORY}/target/sysroot" }
dependencies = ["bootstrap-linker", "install-cargo-xbuild"]
command = "cargo"
args = [
"xbuild",
"--target=${MIRAGE_ARM_TARGET}",
"--package=mirage-bootstrap",
"@@split(COMPILER_FLAGS, )"
]
# Compiles the bootstrap in .bin format, to be used as an RCM payload.
[tasks.bootstrap]
description = "Compiles the bootstrap as an RCM payload."
env = { "RUSTFLAGS" = "--sysroot ${CARGO_MAKE_WORKING_DIRECTORY}/target/sysroot" }
dependencies = ["bootstrap-elf-build", "install-cargo-binutils"]
command = "cargo"
args = [
"objcopy",
"--target=${MIRAGE_ARM_TARGET}",
"--bin=mirage-bootstrap",
"@@split(COMPILER_FLAGS, )",
"--",
"-O",
"binary",
"mirage-bootstrap.bin"
]
# Cleans up the bootstrap build junk.
[tasks.bootstrap-clean]
script_runner = "@shell"
script = [
'''
rm -f link.T mirage-bootstrap.bin
'''
]
# Builds the entire Mirage project.
[tasks.mirage-build]
description = "Builds the entire Mirage project."
dependencies = ["bootstrap"]
# General cleanup task.
[tasks.clean]
description = "Cleans up after the boostrap build."
dependencies = ["bootstrap-clean"]
command = "cargo"
args = ["clean"]
# The default task is a full project build.
[tasks.default]
run_task = "mirage-build"