forked from mynameisdaniil/stm32vldiscovery-linux-template
-
Notifications
You must be signed in to change notification settings - Fork 0
/
flashing_stm32vldiscovery.sh
executable file
·53 lines (47 loc) · 1.84 KB
/
flashing_stm32vldiscovery.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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#!/bin/sh
if [ ! -e /etc/udev/rules.d/10-stlink.rules ]; then
echo "stlink udev rule not found in folder with \
udev rules!"
echo "Please take ./stlink/10-stlink.rules and \
put it to corresponding folder."
echo "After that execute: 'udevadm control --reload-rules'"
exit 1
fi
if [ ! -e /etc/modprobe.d/stlink.modprobe.conf ]; then
echo "stlink.modprobe.conf not found in /etc/modprobe.d!"
echo "Please take ./stlink/stlink.modprobe.conf and put \
it to corresponding folder."
exit 1
fi
# Check - is sg module loaded. If not load it. If error - exit.
lsmod | grep -q sg
if [ "$?" -ne "0" ]; then
echo "sg module not loaded - loading it..."
sudo modprobe sg
if [ "$?" -ne "0" ]; then
echo "Error loading module sg!"
echo "Try to recompile you kernel with \
option 'CONFIG_CHR_DEV_SG=m'."
echo "You may find it in 'Device Drivers' -> \
'SCSI' drivers"
exit 1
fi
fi
make -C ./stlink/build
if [ "$?" -ne "0" ]; then
echo "May be you do not installed libsgutils2 \
development files?"
echo "For Ubuntu users: try 'sudo apt-get-install libsgutils2-dev'"
echo "For Gentoo users: try 'sudo emerge sg3-utils'"
exit 1
fi
echo "*****************************************************************"
echo "* Starting GDB server... *"
echo "* For connect to it - run GDB in another console and: *"
echo "* (gdb) target remote :1234 *"
echo "* For load ELF to STM32VLDiscovery *"
echo "* (gdb) load $1 *"
echo "* Note: please use arm-none-eabi-gdb unstead of x86 targeted *"
echo "* gdb! *"
echo "*****************************************************************"
sudo ./stlink/build/st-util 1234 /dev/stlink