From 8a5fbc13197be420bd8bcf4c7c10f31c9a99d83f Mon Sep 17 00:00:00 2001 From: fengbh <1953356163@qq.com> Date: Mon, 15 Jul 2024 01:01:03 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E8=8E=B7=E5=8F=96COM?= =?UTF-8?q?=E5=8F=A3=E7=9A=84=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Makefile | 2 +- reset_mcu.sh | 8 ++++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 835f768..4fe4e70 100644 --- a/Makefile +++ b/Makefile @@ -51,7 +51,7 @@ main.hex: $(TARGET) flash: -sudo chmod 777 $(COM) - -./reset_mcu.sh + -./reset_mcu.sh $(COM) -stcgal -P stc89 -p $(COM) main.hex #led.bin:led.hex diff --git a/reset_mcu.sh b/reset_mcu.sh index 9ea07fa..8c9580a 100755 --- a/reset_mcu.sh +++ b/reset_mcu.sh @@ -16,9 +16,13 @@ # --- ---- --- ----------- # 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 #说明: