From ebf06e4b0c79c2b3e196c98c684d601d744e077e Mon Sep 17 00:00:00 2001 From: fengbh <1953356163@qq.com> Date: Mon, 15 Jul 2024 01:34:57 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E8=8E=B7=E5=8F=96=E6=B3=A2?= =?UTF-8?q?=E7=89=B9=E7=8E=87=E7=9A=84=E6=96=B9=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Makefile | 7 ++++++- reset_mcu.sh | 6 +++--- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index 4fe4e70..ba8d1c5 100644 --- a/Makefile +++ b/Makefile @@ -17,6 +17,9 @@ else endif endif +# set uart baudrate +BAUD := 9600 + # set CC TOOL PACKIHX := packihx CFLAGS := -DUSE_FLOATS=1 @@ -51,9 +54,11 @@ main.hex: $(TARGET) flash: -sudo chmod 777 $(COM) - -./reset_mcu.sh $(COM) + -./reset_mcu.sh $(COM) $(BAUD) -stcgal -P stc89 -p $(COM) main.hex +com: + -minicom -D $(COM) -b $(BAUD) #led.bin:led.hex # objcopy -I ihex -O binary led.hex led.bin diff --git a/reset_mcu.sh b/reset_mcu.sh index 8c9580a..05b8a4d 100755 --- a/reset_mcu.sh +++ b/reset_mcu.sh @@ -16,11 +16,11 @@ # --- ---- --- ----------- # 0.0.01 2024-07-14 Feng Bohan initial version #=========================================================================== -if [ "$#" -ne 1 ]; then - echo "错误:此脚本需要且仅需要一个参数, 作为COM口号" +if [ "$#" -ne 2 ]; then + echo "错误:此脚本需要且仅需要2个参数, 作为COM口号和波特率。" exit 1 # 使用非零状态码退出表示异常 fi -stty -F $1 speed 9600 cs8 -parenb -cstopb raw -echo -echoe -echok -echoctl -echoke +stty -F $1 speed $2 cs8 -parenb -cstopb raw -echo -echoe -echok -echoctl -echoke echo -e "RESET!" > $1