-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathMakefile.toml
101 lines (81 loc) · 2.73 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
[config]
skip_core_tasks = true
default_to_workspace = false
[env.development]
PROFILE_NAME = "debug"
COMPILER_FLAGS = ""
[env.production]
PROFILE_NAME = "release"
COMPILER_FLAGS = "--release"
[tasks.install-llvm-tools-preview]
install_crate = { rustup_component_name = "llvm-tools-preview" }
[tasks.install-lpc-checksum]
install_crate = { crate_name = "lpc_checksum", binary = "lpc_checksum", test_arg = "--help" }
[tasks.install-cargo-binutils]
dependencies = ["install-llvm-tools-preview"]
install_crate = { crate_name = "cargo-binutils", binary = "cargo-objcopy", test_arg = "--help" }
# CUSTOM FIRMWARE RULES
[tasks.custom-firmware-build]
description = "Compiles custom-firmware"
command = "cargo"
args = ["build", "@@split(COMPILER_FLAGS, )", "--bin=custom-firmware"]
[tasks.custom-firmware]
dependencies = ["custom-firmware-build", "install-cargo-binutils"]
command = "cargo"
args = ["objcopy", "@@split(COMPILER_FLAGS, )", "--bin=custom-firmware", "--", "-O", "binary", "custom-firmware-${PROFILE_NAME}.bin"]
[tasks.custom-firmware-patch]
dependencies = ["install-lpc-checksum", "custom-firmware", "install-cargo-binutils"]
command = "lpc_checksum"
args = ["-p", "LPC11U37_501", "custom-firmware-${PROFILE_NAME}.bin"]
[tasks.custom-firmware-install]
dependencies = ["custom-firmware-patch", "install-cargo-binutils"]
command = "cp"
args = ["custom-firmware-${PROFILE_NAME}.bin", "/mnt/i/firmware.bin"]
[tasks.custom-firmware-clean]
script_runner = "@shell"
script = [
'''
rm -f custom-firmware-debug.bin
rm -f custom-firmware-release.bin
'''
]
# BOOTLOADER RULES
[tasks.bootloader-build]
dependencies = ["install-cargo-binutils"]
description = "Compiles bootloader firmware"
command = "cargo"
args = ["objcopy", "@@split(COMPILER_FLAGS, )", "--bin=bootloader", "--", "-O", "binary", "bootloader-${PROFILE_NAME}.bin"]
[tasks.bootloader-patch]
dependencies = ["install-lpc-checksum", "bootloader-build", "install-cargo-binutils"]
#command = "lpc_checksum"
#args = ["-p", "LPC11U37_501", "bootloader-${PROFILE_NAME}.bin"]
script = [
'''
lpc_checksum -p LPC11U37_501 bootloader-${PROFILE_NAME}.bin
# Insert custom version identifier.
echo BEBAFECA | xxd -r -ps | dd conv=notrunc of=bootloader-${PROFILE_NAME}.bin seek=36 bs=1
'''
]
[tasks.bootloader-clean]
script_runner = "@shell"
script = [
'''
rm -f bootloader-debug.bin
rm -f bootloader-release.bin
'''
]
# GENERIC RULES
[tasks.clean]
workspace = false
dependencies = ["custom-firmware-clean", "bootloader-clean"]
description = "Clean workspace"
command = "cargo"
args = ["clean"]
[tasks.clippy]
workspace = false
command = "cargo"
args = ["clippy"]
[tasks.build]
dependencies = ["custom-firmware-install"]
[tasks.default]
dependencies = ["build"]