优化获取COM口的逻辑
This commit is contained in:
parent
09dbe975ac
commit
8a5fbc1319
2
Makefile
2
Makefile
@ -51,7 +51,7 @@ main.hex: $(TARGET)
|
|||||||
|
|
||||||
flash:
|
flash:
|
||||||
-sudo chmod 777 $(COM)
|
-sudo chmod 777 $(COM)
|
||||||
-./reset_mcu.sh
|
-./reset_mcu.sh $(COM)
|
||||||
-stcgal -P stc89 -p $(COM) main.hex
|
-stcgal -P stc89 -p $(COM) main.hex
|
||||||
|
|
||||||
#led.bin:led.hex
|
#led.bin:led.hex
|
||||||
|
@ -16,9 +16,13 @@
|
|||||||
# --- ---- --- -----------
|
# --- ---- --- -----------
|
||||||
# 0.0.01 2024-07-14 Feng Bohan initial version
|
# 0.0.01 2024-07-14 Feng Bohan initial version
|
||||||
#===========================================================================
|
#===========================================================================
|
||||||
stty -F /dev/ttyUSB0 speed 9600 cs8 -parenb -cstopb raw -echo -echoe -echok -echoctl -echoke
|
if [ "$#" -ne 1 ]; then
|
||||||
|
echo "错误:此脚本需要且仅需要一个参数, 作为COM口号"
|
||||||
|
exit 1 # 使用非零状态码退出表示异常
|
||||||
|
fi
|
||||||
|
stty -F $1 speed 9600 cs8 -parenb -cstopb raw -echo -echoe -echok -echoctl -echoke
|
||||||
|
|
||||||
echo -e "RESET!" > /dev/ttyUSB0
|
echo -e "RESET!" > $1
|
||||||
|
|
||||||
|
|
||||||
#说明:
|
#说明:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user