-
Notifications
You must be signed in to change notification settings - Fork 21
Expand file tree
/
Copy pathjustfile
More file actions
226 lines (195 loc) · 9.76 KB
/
justfile
File metadata and controls
226 lines (195 loc) · 9.76 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
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
# The rust-embedded/aarch32 Just file
#
# You need to install `just` from https://github.com/casey/just to use
# this file
# We only need this for some targets but we set it globally to avoid
# dependencies like proc-macro2 from being rebuilt
export RUSTC_BOOTSTRAP := "1"
# If you run with `just --set v 1` then we make cargo run in verbose mode
v := "0"
verbose := if v == "1" { "--verbose" } else { "" }
nightly := "nightly-2026-02-26"
# Our default target. It does everything that you might want to do pre-checkin.
check: build-all build-all-examples fmt-check clippy-examples clippy-targets clippy-host test
# Cleans up all the target folders
clean:
# The cross-compiled workspace
cargo clean
# The host-compiled helper library
cd arm-targets && cargo clean
# The cross-compiled examples
cd examples/versatileab && cargo clean
rm -rf examples/versatileab/target-d32
cd examples/mps3-an536 && cargo clean
rm -rf examples/mps3-an536/target-d32
cd examples/mps3-an536-smp && cargo clean
rm -rf examples/mps3-an536-smp/target-d32
# Builds our workspace for all targets
build-all: \
build-arm-targets \
(build-tier3-no-atomics "armv4t-none-eabi") \
(build-tier3-no-atomics "thumbv4t-none-eabi") \
(build-tier3-no-atomics "armv5te-none-eabi") \
(build-tier3-no-atomics "thumbv5te-none-eabi") \
(build-tier3-no-atomics "armv6-none-eabi") \
(build-tier3-no-atomics "thumbv6-none-eabi") \
(build-tier3-no-atomics "armv6-none-eabihf") \
(build-tier2 "armv7r-none-eabi") \
(build-tier3 "thumbv7r-none-eabi") \
(build-tier2 "armv7r-none-eabihf") \
(build-tier3 "thumbv7r-none-eabihf") \
(build-tier2 "armv7a-none-eabi") \
(build-tier3 "thumbv7a-none-eabi") \
(build-tier2 "armv7a-none-eabihf") \
(build-tier3 "thumbv7a-none-eabihf") \
(build-tier2 "armv8r-none-eabihf") \
(build-tier3 "thumbv8r-none-eabihf") \
# Build the arm-targets library
build-arm-targets:
cd arm-targets && cargo build {{verbose}}
# Builds our workspace with various features, building core from source, but skipping anything that requires atomics
build-tier3-no-atomics target:
cargo +{{nightly}} build --target {{target}} -Zbuild-std=core {{verbose}}
cargo +{{nightly}} build --target {{target}} -Zbuild-std=core --features "serde, defmt, critical-section-single-core, check-asm" {{verbose}}
# Builds our workspace with various features, building core from source
build-tier3 target:
cargo +{{nightly}} build --target {{target}} -Zbuild-std=core {{verbose}}
cargo +{{nightly}} build --target {{target}} -Zbuild-std=core --features "serde, defmt, critical-section-multi-core, check-asm" {{verbose}}
cargo +{{nightly}} build --target {{target}} -Zbuild-std=core --features "serde, defmt, critical-section-single-core, check-asm" {{verbose}}
# Builds our workspace with various features
build-tier2 target:
cargo build --target {{target}} {{verbose}}
cargo build --target {{target}} --features "serde, defmt, critical-section-multi-core, check-asm" {{verbose}}
cargo build --target {{target}} --features "serde, defmt, critical-section-single-core, check-asm" {{verbose}}
# Builds our examples for each target, which also builds our cross-compiled workspace
build-all-examples: \
(build-versatileab-tier3 "armv4t-none-eabi") \
(build-versatileab-tier3 "thumbv4t-none-eabi") \
(build-versatileab-tier3 "armv5te-none-eabi") \
(build-versatileab-tier3 "thumbv5te-none-eabi") \
(build-versatileab-tier3 "armv6-none-eabi") \
(build-versatileab-tier3 "armv6-none-eabihf") \
(build-versatileab-tier2 "armv7r-none-eabi") \
(build-versatileab-tier3 "thumbv7r-none-eabi") \
(build-versatileab-tier2 "armv7r-none-eabihf") \
(build-versatileab-tier3 "thumbv7r-none-eabihf") \
(build-versatileab-tier2 "armv7a-none-eabi") \
(build-versatileab-tier3 "thumbv7a-none-eabi") \
(build-versatileab-tier2 "armv7a-none-eabihf") \
(build-versatileab-tier3 "thumbv7a-none-eabihf") \
(build-mps3-tier2 "armv8r-none-eabihf") \
(build-mps3-tier3 "thumbv8r-none-eabihf") \
# (build-versatileab-tier3 "thumbv6-none-eabi") \
# Builds the Versatile AB examples, building core from source
build-versatileab-tier3 target:
cd examples/versatileab && cargo build --target={{target}} -Zbuild-std=core {{verbose}}
# Builds the Versatile AB examples, assuming core has been prebuilt
build-versatileab-tier2 target:
cd examples/versatileab && cargo build --target={{target}} {{verbose}}
# Builds the MPS3-AN536 examples, building core from source
build-mps3-tier3 target:
cd examples/mps3-an536 && cargo build --target={{target}} -Zbuild-std=core {{verbose}}
# Builds the MPS3-AN536 examples, assuming core has been prebuilt
build-mps3-tier2 target:
cd examples/mps3-an536 && cargo build --target={{target}} {{verbose}}
# Formats all the code
fmt:
# The cross-compiled workspace
cargo fmt {{verbose}}
# The host-compiled helper library
cd arm-targets && cargo fmt {{verbose}}
# The cross-compiled examples cargo fmt
cd examples/versatileab && cargo fmt {{verbose}}
cd examples/mps3-an536 && cargo fmt {{verbose}}
# Checks all the code is formatted
fmt-check:
# The cross-compiled workspace
cargo fmt --check
# The host-compiled helper library
cd arm-targets && cargo fmt --check {{verbose}}
# The cross-compiled examples cargo fmt
cd examples/versatileab && cargo fmt --check {{verbose}}
cd examples/mps3-an536 && cargo fmt --check {{verbose}}
# Checks all the cross-compiled workspace passes the clippy lints
clippy-targets: \
(clippy-target "armv7r-none-eabi") \
(clippy-target "armv7r-none-eabihf") \
(clippy-target "armv7a-none-eabi") \
(clippy-target "armv7a-none-eabihf") \
(clippy-target "armv8r-none-eabihf") \
# Checks all the cross-compiled workspace passes the clippy lints
clippy-target target:
cargo clippy --target={{target}} {{verbose}}
# Checks the examples pass the clippy lints
clippy-examples:
cd examples/versatileab && cargo clippy --target=armv7r-none-eabi {{verbose}}
cd examples/mps3-an536 && cargo clippy --target=armv8r-none-eabihf {{verbose}}
# Checks the host code passes the clippy lints
clippy-host:
# The cross-compiled workspace
cargo clippy {{verbose}}
# The host-compiled helper library
cd arm-targets && cargo clippy {{verbose}}
# Run all the tests
test: test-cargo test-qemu
# Run the unit tests with cargo
test-cargo:
# The cross-compiled workspace
cargo test {{verbose}}
# The host-compiled helper library
cd arm-targets && cargo test {{verbose}}
# Run the integration tests in QEMU
test-qemu: test-qemu-v4t test-qemu-v5te test-qemu-v6 test-qemu-v7a test-qemu-v7r test-qemu-v8r test-qemu-v8r-smp
test-qemu-v4t:
#!/bin/bash
FAIL=0
./tests.sh examples/versatileab armv4t-none-eabi -Zbuild-std=core {{verbose}} --release || FAIL=1
./tests.sh examples/versatileab thumbv4t-none-eabi -Zbuild-std=core {{verbose}} --release || FAIL=1
if [ "${FAIL}" == "1" ]; then exit 1; fi
test-qemu-v5te:
#!/bin/bash
FAIL=0
./tests.sh examples/versatileab armv5te-none-eabi -Zbuild-std=core {{verbose}} --release || FAIL=1
./tests.sh examples/versatileab thumbv5te-none-eabi -Zbuild-std=core {{verbose}} --release || FAIL=1
if [ "${FAIL}" == "1" ]; then exit 1; fi
test-qemu-v6:
#!/bin/bash
FAIL=0
./tests.sh examples/versatileab armv6-none-eabi -Zbuild-std=core {{verbose}} --release || FAIL=1
./tests.sh examples/versatileab armv6-none-eabihf -Zbuild-std=core {{verbose}} --release || FAIL=1
./tests.sh examples/versatileab thumbv6-none-eabi -Zbuild-std=core {{verbose}} --release || FAIL=1
if [ "${FAIL}" == "1" ]; then exit 1; fi
test-qemu-v7a:
#!/bin/bash
FAIL=0
./tests.sh examples/versatileab armv7a-none-eabi {{verbose}} --release || FAIL=1
./tests.sh examples/versatileab thumbv7a-none-eabi -Zbuild-std=core {{verbose}} --release || FAIL=1
./tests.sh examples/versatileab armv7a-none-eabihf {{verbose}} --release || FAIL=1
./tests.sh examples/versatileab thumbv7a-none-eabihf -Zbuild-std=core {{verbose}} --release || FAIL=1
RUSTFLAGS=-Ctarget-feature=+d32 ./tests.sh examples/versatileab armv7a-none-eabihf --features=fpu-d32 --target-dir=target-d32 {{verbose}} --release || FAIL=1
RUSTFLAGS=-Ctarget-feature=+d32 ./tests.sh examples/versatileab thumbv7a-none-eabihf -Zbuild-std=core --features=fpu-d32 --target-dir=target-d32 {{verbose}} --release || FAIL=1
if [ "${FAIL}" == "1" ]; then exit 1; fi
test-qemu-v7r:
#!/bin/bash
FAIL=0
./tests.sh examples/versatileab armv7r-none-eabi {{verbose}} --release || FAIL=1
./tests.sh examples/versatileab thumbv7r-none-eabi -Zbuild-std=core {{verbose}} --release || FAIL=1
./tests.sh examples/versatileab armv7r-none-eabihf {{verbose}} --release || FAIL=1
./tests.sh examples/versatileab thumbv7r-none-eabihf -Zbuild-std=core {{verbose}} --release || FAIL=1
if [ "${FAIL}" == "1" ]; then exit 1; fi
test-qemu-v8r:
#!/bin/bash
FAIL=0
./tests.sh examples/mps3-an536 armv8r-none-eabihf {{verbose}} --release || FAIL=1
./tests.sh examples/mps3-an536 thumbv8r-none-eabihf -Zbuild-std=core {{verbose}} --release || FAIL=1
RUSTFLAGS=-Ctarget-cpu=cortex-r52 ./tests.sh examples/mps3-an536 armv8r-none-eabihf --features=fpu-d32 --target-dir=target-d32 {{verbose}} --release || FAIL=1
RUSTFLAGS=-Ctarget-cpu=cortex-r52 ./tests.sh examples/mps3-an536 thumbv8r-none-eabihf -Zbuild-std=core --features=fpu-d32 --target-dir=target-d32 {{verbose}} --release || FAIL=1
if [ "${FAIL}" == "1" ]; then exit 1; fi
test-qemu-v8r-smp:
#!/bin/bash
FAIL=0
./tests.sh examples/mps3-an536-smp armv8r-none-eabihf {{verbose}} --release || FAIL=1
./tests.sh examples/mps3-an536-smp thumbv8r-none-eabihf -Zbuild-std=core {{verbose}} --release || FAIL=1
RUSTFLAGS=-Ctarget-cpu=cortex-r52 ./tests.sh examples/mps3-an536-smp armv8r-none-eabihf --features=fpu-d32 --target-dir=target-d32 {{verbose}} --release || FAIL=1
RUSTFLAGS=-Ctarget-cpu=cortex-r52 ./tests.sh examples/mps3-an536-smp thumbv8r-none-eabihf -Zbuild-std=core --features=fpu-d32 --target-dir=target-d32 {{verbose}} --release || FAIL=1
if [ "${FAIL}" == "1" ]; then exit 1; fi