-
Notifications
You must be signed in to change notification settings - Fork 0
/
Justfile
74 lines (58 loc) · 1.79 KB
/
Justfile
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
features := ''
name := `basename "$(pwd)"`
target := `drone print target 2>/dev/null || echo ""`
release_bin := "target/" + target + "/release/" + name
# Install dependencies
deps:
type cargo-objdump >/dev/null || cargo +stable install cargo-binutils
type drone >/dev/null || cargo install drone
rustup target add $(drone print target)
# Reformat the source code
fmt:
cargo fmt
# Check the source code for mistakes
lint:
cargo clippy --features "{{features}}"
# Build the binary
build:
cargo build --features "{{features}}" --release
# Build the documentation
doc:
cargo doc --features "{{features}}"
# Open the documentation in a browser
doc-open: doc
cargo doc --features "{{features}}" --open
# Run the tests
test:
cargo test --features "std {{features}}" \
--target=$(rustc --version --verbose | sed -n '/host/{s/.*: //;p}')
# Display information from the binary
dump: build
cargo objdump --features "{{features}}" --release --bin {{name}} -- \
--disassemble --demangle --full-contents --all-headers --syms \
| pager
# Display the sizes of sections inside the binary
size +args='': build
cargo size --features "{{features}}" --release --bin {{name}} -- {{args}}
# Display the result of macro expansion
expand:
cargo rustc --features "{{features}}" --lib -- -Z unstable-options --pretty=expanded
# Assert the reset signal
reset:
drone reset
# Write the binary to ROM
flash: build
drone flash {{release_bin}}
# Run a GDB session
gdb:
drone gdb {{release_bin}} --reset
# Run a GDB session as a backend for a debugger GUI or an IDE
@gdb-mi:
drone gdb {{release_bin}} --reset -i=mi -- -nx
# Capture the log output
log:
drone log --reset :0:1
# Record `heaptrace` file (`trace_port` option in `heap!` macro should be enabled)
heaptrace:
truncate -s0 heaptrace
drone log --reset :0:1 heaptrace:31