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