summaryrefslogtreecommitdiff
path: root/bsp/bouffalo_lab/bouffalo_flash_cube.sh
blob: b1a7f4fcfc7c02aab2423692eb49c8f55e096aaf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#/bin/sh
CHIPNAME=$1
PORT=$2

set -e

SYSTEM=`uname -s`
TOOL_SUFFIX=-ubuntu
echo "system: $SYSTEM"

if [ $SYSTEM = "Darwin" ]
then
    TOOL_SUFFIX=-macos
elif [ $SYSTEM = "Linux" ]
then
    TOOL_SUFFIX=-ubuntu
else
    TOOL_SUFFIX=.exe
fi

CONFIG_DIR=./bl60x
if [ $CHIPNAME = 'bl602' ]
then
    CONFIG_DIR=./bl60x
elif [ $CHIPNAME = 'bl616' ]
then
    CONFIG_DIR=./bl61x
elif [ $CHIPNAME = 'bl702' ]
then
    CONFIG_DIR=./bl70x
elif [ $CHIPNAME = 'bl808' ]
then
    CONFIG_DIR=./bl808
elif [ $CHIPNAME = 'bl808-m0' ]
then
    CONFIG_DIR=./bl808/m0
elif [ $CHIPNAME = 'bl808-lp' ]
then
    CONFIG_DIR=./bl808/lp
elif [ $CHIPNAME = 'bl808-d0' ]
then
    CONFIG_DIR=./bl808/d0
else
    echo "chip name error"
fi

TOOL_DIR=./libraries/bl_mcu_sdk/tools/bflb_tools
TOOL_NAME='BLFlashCommand'$TOOL_SUFFIX
CONFIG_FILE=$CONFIG_DIR'/flash_prog_cfg.ini'

if [ -f "$TOOL_DIR/bouffalo_flash_cube/$TOOL_NAME" ]
then
    echo "bouffalo_flash_cube exist"
else
    echo "bouffalo_flash_cube not exist, try download... "
    ./$TOOL_DIR/get_bouffalo_flash_cube.sh
fi

./$TOOL_DIR/bouffalo_flash_cube/$TOOL_NAME --interface=uart --baudrate=2000000 --chipname=$CHIPNAME --config=$CONFIG_FILE --port=$PORT