-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile.toml
More file actions
130 lines (122 loc) · 3.26 KB
/
Makefile.toml
File metadata and controls
130 lines (122 loc) · 3.26 KB
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
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
[tasks.install-llvm-tools]
install_crate = { rustup_component_name = "llvm-tools" }
[tasks.flip-link]
install_crate = { crate_name = "flip-link", binary = "flip-link", test_arg = [
"-h",
] }
[tasks.objcopy-central]
install_crate = { crate_name = "cargo-binutils", binary = "cargo", test_arg = [
"objcopy",
"--help",
] }
command = "cargo"
args = [
"objcopy",
"--release",
"--bin",
"central",
"--",
"-O",
"ihex",
"rmk-lily58-keyboard-central.hex",
]
dependencies = ["install-llvm-tools", "flip-link"]
[tasks.objcopy-peripheral]
install_crate = { crate_name = "cargo-binutils", binary = "cargo", test_arg = [
"objcopy",
"--help",
] }
command = "cargo"
args = [
"objcopy",
"--release",
"--bin",
"peripheral",
"--",
"-O",
"ihex",
"rmk-lily58-keyboard-peripheral.hex",
]
dependencies = ["install-llvm-tools", "flip-link"]
[tasks.uf2-central]
install_crate = { crate_name = "cargo-hex-to-uf2", binary = "cargo", test_arg = [
"hex-to-uf2",
"--help",
] }
command = "cargo"
args = [
"hex-to-uf2",
"--input-path",
"rmk-lily58-keyboard-central.hex",
"--output-path",
"rmk-lily58-keyboard-central.uf2",
"--family",
"nrf52840",
]
dependencies = ["objcopy-central"]
[tasks.uf2-peripheral]
install_crate = { crate_name = "cargo-hex-to-uf2", binary = "cargo", test_arg = [
"hex-to-uf2",
"--help",
] }
command = "cargo"
args = [
"hex-to-uf2",
"--input-path",
"rmk-lily58-keyboard-peripheral.hex",
"--output-path",
"rmk-lily58-keyboard-peripheral.uf2",
"--family",
"nrf52840",
]
dependencies = ["objcopy-peripheral"]
[tasks.uf2]
dependencies = ["uf2-central", "uf2-peripheral"]
[tasks.central-flash]
description = "Mount, copy, and flash the central UF2 file to the nRF device via sudo (alternative entrypoint)"
script = [
'''
set -e
DEVICE=$(lsblk -o NAME,LABEL | grep -i NICENANO | awk '{print $1}' | head -n1)
if [ -z "$DEVICE" ]; then
echo "NICENANO device not found. Please insert the device and try again."
exit 1
fi
DEV_PATH="/dev/$DEVICE"
MOUNT_POINT="/mnt/nicenano-uf2"
sudo mkdir -p "$MOUNT_POINT"
if ! mount | grep -q "$MOUNT_POINT"; then
sudo mount "$DEV_PATH" "$MOUNT_POINT"
fi
echo "Flashing rmk-lily58-keyboard-central.uf2 to $MOUNT_POINT"
sudo cp rmk-lily58-keyboard-central.uf2 "$MOUNT_POINT/"
sync
echo "Flash complete."
sudo umount "$MOUNT_POINT"
''',
]
dependencies = ["uf2-central"]
[tasks.peripheral-flash]
description = "Mount, copy, and flash the peripheral UF2 file to the nRF device via sudo"
script = [
'''
set -e
DEVICE=$(lsblk -o NAME,LABEL | grep -i NICENANO | awk '{print $1}' | head -n1)
if [ -z "$DEVICE" ]; then
echo "NICENANO device not found. Please insert the device and try again."
exit 1
fi
DEV_PATH="/dev/$DEVICE"
MOUNT_POINT="/mnt/nicenano-uf2"
sudo mkdir -p "$MOUNT_POINT"
if ! mount | grep -q "$MOUNT_POINT"; then
sudo mount "$DEV_PATH" "$MOUNT_POINT"
fi
echo "Flashing rmk-lily58-keyboard-peripheral.uf2 to $MOUNT_POINT"
sudo cp rmk-lily58-keyboard-peripheral.uf2 "$MOUNT_POINT/"
sync
echo "Flash complete."
sudo umount "$MOUNT_POINT"
''',
]
dependencies = ["uf2-peripheral"]