-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmake.sh
executable file
·42 lines (39 loc) · 1.1 KB
/
make.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
#!/bin/bash
set -e
DOCKER_IMAGE=wpinshih/esp8266
ESP_HOME=/opt/Espressif
ESP_WORK_DIR="$ESP_HOME/esp-open-rtos/src/$(basename $PWD)"
ESP_PORT="/dev/tty.SLAB_USBtoUART"
# ESP_PORT="/dev/tty.usbserial"
# ESP_PORT="/dev/tty.usbserial-00000000"
# ESP_PORT="/dev/tty.wchusbserial14110"
# ESP_PORT="/dev/tty.usbserial-1420"
# PARAMS="$PARAMS -it --rm"
PARAMS="$PARAMS --rm"
PARAMS="$PARAMS -v $PWD:$ESP_WORK_DIR"
PARAMS="$PARAMS -w $ESP_WORK_DIR"
# PARAMS="$PARAMS --device=/dev/tty.SLAB_USBtoUART:/dev/USB0:rwm"
if [[ "$@" == "flash" ]]
then
make flash ESPPORT=$ESP_PORT
elif [[ "$@" == "gdb" ]]
then
eval docker run $PARAMS $DOCKER_IMAGE xtensa-lx106-elf-gdb -x gdbcmds -b 115200
elif [[ "$@" == "debug" ]]
then
# eval docker run $PARAMS $DOCKER_IMAGE make clean
eval docker run $PARAMS $DOCKER_IMAGE make
str=$(screen -ls | grep tty)
array=$(echo $str|tr "." "\n")
echo $str
for V in $array
do
if [ $V -gt 0 ]
then screen -S $V -X quit
fi
done
make flash ESPPORT=$ESP_PORT
screen $ESP_PORT 115200
else
eval docker run $PARAMS $DOCKER_IMAGE make $@
fi