forked from stm32-rs/stm32-eth
-
Notifications
You must be signed in to change notification settings - Fork 0
/
run.sh
executable file
·32 lines (27 loc) · 809 Bytes
/
run.sh
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
#!/usr/bin/env bash
export PATH=~/.cargo/bin:$PATH
EXAMPLE=$1
if [[ "$EXAMPLE" = "" ]]; then
echo "Run with one of the examples:"
for f in examples/*.rs; do
fn=`basename $f | sed -e 's/.rs//'`
echo "- $fn"
done
exit 1
fi
cargo build --target=thumbv7em-none-eabihf --release \
--features="stm32f429 smoltcp-phy log smoltcp/socket-tcp smoltcp/socket-icmp smoltcp/log smoltcp/verbose" \
--example=$EXAMPLE \
|| exit 1
killall openocd
sleep 0.1
BIN=target/thumbv7em-none-eabihf/release/examples/$EXAMPLE
openocd \
-f /usr/share/openocd/scripts/interface/stlink-v2-1.cfg \
-f /usr/share/openocd/scripts/target/stm32f4x.cfg \
-c init \
-c "reset halt" \
-c "flash write_image erase $BIN" \
-c "reset run" &
sleep 3
arm-none-eabi-gdb $BIN