bouffalo_flash_cube.sh 1.2 KB

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