1#/bin/sh 2CHIPNAME=$1 3PORT=$2 4 5set -e 6 7SYSTEM=`uname -s` 8TOOL_SUFFIX=-ubuntu 9echo "system: $SYSTEM" 10 11if [ $SYSTEM = "Darwin" ] 12then 13 TOOL_SUFFIX=-macos 14elif [ $SYSTEM = "Linux" ] 15then 16 TOOL_SUFFIX=-ubuntu 17else 18 TOOL_SUFFIX=.exe 19fi 20 21CONFIG_DIR=./bl60x 22if [ $CHIPNAME = 'bl602' ] 23then 24 CONFIG_DIR=./bl60x 25elif [ $CHIPNAME = 'bl616' ] 26then 27 CONFIG_DIR=./bl61x 28elif [ $CHIPNAME = 'bl702' ] 29then 30 CONFIG_DIR=./bl70x 31elif [ $CHIPNAME = 'bl808' ] 32then 33 CONFIG_DIR=./bl808 34elif [ $CHIPNAME = 'bl808-m0' ] 35then 36 CONFIG_DIR=./bl808/m0 37elif [ $CHIPNAME = 'bl808-lp' ] 38then 39 CONFIG_DIR=./bl808/lp 40elif [ $CHIPNAME = 'bl808-d0' ] 41then 42 CONFIG_DIR=./bl808/d0 43else 44 echo "chip name error" 45fi 46 47TOOL_DIR=./libraries/bl_mcu_sdk/tools/bflb_tools 48TOOL_NAME='BLFlashCommand'$TOOL_SUFFIX 49CONFIG_FILE=$CONFIG_DIR'/flash_prog_cfg.ini' 50 51if [ -f "$TOOL_DIR/bouffalo_flash_cube/$TOOL_NAME" ] 52then 53 echo "bouffalo_flash_cube exist" 54else 55 echo "bouffalo_flash_cube not exist, try download... " 56 ./$TOOL_DIR/get_bouffalo_flash_cube.sh 57fi 58 59./$TOOL_DIR/bouffalo_flash_cube/$TOOL_NAME --interface=uart --baudrate=2000000 --chipname=$CHIPNAME --config=$CONFIG_FILE --port=$PORT 60