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
current_target := shell("rustc -vV | grep \"host:\" | awk '{print $2}'")
project_name := `cargo metadata --format-version 1 --no-deps | jq -r '.packages[0].name'`
out_dir := "build/"
simulator_dir := "epsilon_simulator/"
build:
just target
cargo build --release --example device --target=thumbv7em-none-eabihf
build_simulator:
cargo build --release --example simulator
send:
cargo run --release --example device --target=thumbv7em-none-eabihf
check:
cargo build --release --example device --target=thumbv7em-none-eabihf
export:
just build
rm -rf {{out_dir}} 2>/dev/null
mkdir -p {{out_dir}}
if mv target/thumbv7em-none-eabihf/release/examples/device {{out_dir}}{{project_name}}.nwa; then \
echo -e "\n\n\033[1;92m{{project_name}} build successfully!\n\n-> $(realpath {{out_dir}}{{project_name}}.nwa)\033[0m\n"; \
else \
echo -e "\n\n\033[1;31mError: Build failed. No .nwa file found.\033[0m\n"; \
fi
[macos]
run_nwb:
./epsilon_simulator/output/release/simulator/macos/epsilon.app/Contents/MacOS/Epsilon --nwb ./target/release/examples/libsimulator.dylib
[linux]
run_nwb:
echo -e "\033[1;95mRunning simulator... (if it freezes, kill it with 'pkill epsilon.bin')\033[0m"
./epsilon_simulator/output/release/simulator/linux/epsilon.bin --nwb ./target/release/examples/libsimulator.so & # Run in background to free up terminal. If simulator freezes, kill it with `pkill epsilon.bin`.
sim jobs="1":
-git clone https://github.com/numworks/epsilon.git epsilon_simulator -b version-20 --depth 1 # Version 20, others seem incompatible
just build_simulator
if [ -d "{{simulator_dir}}" ]; then \
cd {{simulator_dir}}; \
rm -r .git 2>/dev/null;\
make PLATFORM=simulator -j {{jobs}}; \
cd ..; \
fi
just run_nwb
[confirm("This will clean the built app AND the simulator. Do you want to continue ?")]
clean:
if [ -d "{{simulator_dir}}" ]; then \
cd {{simulator_dir}}; \
make clean; \
cd ..; \
fi
cargo clean
rm -rf {{out_dir}} 2>/dev/null
[confirm("This will clean the built app AND DELETE the simulator. Do you want to continue ?")]
clear:
rm -rf {{simulator_dir}} 2>/dev/null
cargo clean
rm -rf {{out_dir}} 2>/dev/null
[confirm("This will update all dependencies to their latest versions. Do you want to continue ?")]
update:
cargo update
target:
rustup target add thumbv7em-none-eabihf