-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathJustfile
80 lines (64 loc) · 2.15 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
75
76
77
78
79
80
export DRONE_RUSTFLAGS := '--cfg cortexm_core="cortexm4f_r0p1" --cfg stm32_mcu="stm32l4x6"'
target := 'thumbv7em-none-eabihf'
features := ''
name := "l496_blinky"
release_bin := "target/" + target + "/release/" + name
# Install dependencies
deps:
rustup target add {{target}}
rustup component add rust-src
rustup component add rustfmt
rustup component add clippy
rustup component add llvm-tools-preview
type cargo-objdump >/dev/null || cargo +stable install cargo-binutils
type drone >/dev/null || cargo install drone
# Reformat the source code
fmt:
cargo fmt
# Check the source code for mistakes
lint:
drone env {{target}} -- cargo clippy --features "{{features}}"
# Build the binary
build:
drone env {{target}} -- cargo build --features "{{features}}" --release
# Build the documentation
doc:
drone env {{target}} -- cargo doc --features "{{features}}"
# Open the documentation in a browser
doc-open: doc
drone env {{target}} -- cargo doc --features "{{features}}" --open
# Run the tests
test:
drone env -- cargo test --features "std {{features}}"
# Display information from the binary
dump: build
drone env {{target}} -- cargo objdump --target {{target}} \
--features "{{features}}" --release --bin {{name}} -- \
--disassemble --demangle --full-contents -all-headers --syms | pager
# Display the sizes of sections inside the binary
size +args='': build
drone env {{target}} -- cargo size --target {{target}} \
--features "{{features}}" --release --bin {{name}} -- {{args}}
# Display the result of macro expansion
expand:
drone env {{target}} -- cargo rustc --target {{target}} \
--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 (the target should be running a binary with `heaptrace` feature)
heaptrace:
truncate -s0 heaptrace
drone log --reset :0:1 heaptrace:31