Skip to content

Commit 545b034

Browse files
authored
[Bouffalo Lab] Update gcc toolchain and flash tool of docker image (#34621)
* [Bouffalo Lab] Update toolchain and docker image * fix restyled * only contain changes on docker image
1 parent d9376be commit 545b034

File tree

5 files changed

+51
-36
lines changed

5 files changed

+51
-36
lines changed
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
67 : [ESP32] Update esp-idf to v5.3
1+
68 : [Bouffalo Lab] Update gcc toolchain and flash tool

integrations/docker/images/stage-2/chip-build-bouffalolab/Dockerfile

+5-6
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,15 @@ ARG VERSION=1
22
FROM ghcr.io/project-chip/chip-build:${VERSION}
33
LABEL org.opencontainers.image.source https://github.com/project-chip/connectedhomeip
44

5-
RUN apt update -y \
6-
&& apt install vim -fy \
7-
&& apt clean \
8-
&& pip3 install --break-system-packages bflb-iot-tool==1.8.6 \
9-
&& : # last line
5+
RUN apt update
6+
7+
RUN apt install picocom curl -y
8+
RUN apt install netcat-traditional -y
109

1110
COPY setup.sh /tmp
1211

1312
RUN cd /tmp \
14-
&& bash setup.sh \
13+
&& bash setup.sh /opt/bouffalolab_sdk \
1514
&& rm setup.sh \
1615
&& : # last line
1716

Original file line numberDiff line numberDiff line change
@@ -1,33 +1,40 @@
11
#!/usr/bin/env bash
22

3-
set -x
43
CURRENT_DIR=$(
54
cd "$(dirname "$0")"
65
pwd
76
)
87

8+
user=$(stat -c %U "$0")
9+
910
SDK_ROOT=/opt/bouffalolab_sdk
10-
# Currently, only setup toolchain under $SDK_ROOT
11-
TOOLCHAIN_SETUP_ROOT=$SDK_ROOT/toolchain
1211

13-
TOOLCHAIN_SYMBOLIC_LINK_PATH=""
14-
git -C . rev-parse 2>/dev/null
15-
if [[ "$?" == "0" ]]; then
16-
# Examples in Bouffalo Lab IOT SDK repo expect toolchain under repo,
17-
# let's create a symbolic link to Bouffalo Lab toolchain,
18-
# if this script runs under repo
19-
TOOLCHAIN_SYMBOLIC_LINK_PATH=$CURRENT_DIR/../toolchain
12+
echo "Please input path to install toolchain, or type Enter to install under $SDK_ROOT"
13+
read TOOLCHAIN_SETUP_ROOT
14+
if [[ ${TOOLCHAIN_SETUP_ROOT} == "" ]]; then
15+
TOOLCHAIN_SETUP_ROOT=$SDK_ROOT
2016
fi
17+
echo "Toolchain will install under $TOOLCHAIN_SETUP_ROOT"
18+
flash_tool_postfix=
19+
20+
flash_tool=BouffaloLabDevCube-v1.9.0
21+
flash_tool_url=https://dev.bouffalolab.com/media/upload/download/$flash_tool.zip
22+
thead_toolchain=gcc_t-head_v2.6.1
23+
thead_toolchain_url=https://codeload.github.com/bouffalolab/toolchain_gcc_t-head_linux/zip/c4afe91cbd01bf7dce525e0d23b4219c8691e8f0
24+
thead_toolchain_unzip=toolchain_gcc_t-head_linux-c4afe91cbd01bf7dce525e0d23b4219c8691e8f0
2125

2226
if [[ "$OSTYPE" == "linux-gnu"* ]]; then
2327
toolchains_url=(
24-
"riscv/Thead_riscv/Linux_x86_64" "https://dev.bouffalolab.com/media/upload/download/toolchain_riscv_thead_linux64.zip" "toolchain_riscv_thead_linux_x86_64"
25-
"riscv/Linux" "https://dev.bouffalolab.com/media/upload/download/toolchain_riscv_sifive_linux64.zip" "toolchain_riscv_sifive_linux"
28+
"toolchain/riscv" "https://dev.bouffalolab.com/media/upload/download/toolchain_riscv_sifive_linux64.zip" Linux toolchain_riscv_sifive_linux
29+
"toolchain/t-head-riscv" "$thead_toolchain_url" "$thead_toolchain" "$thead_toolchain_unzip"
30+
"flashtool" "$flash_tool_url" "$flash_tool" ""
2631
)
32+
flash_tool_postfix=ubuntu
2733
elif [[ "$OSTYPE" == "darwin"* ]]; then
2834
toolchains_url=(
29-
"riscv/Darwin" "https://dev.bouffalolab.com/media/upload/download/toolchain_riscv_sifive_macos.zip" "toolchain_riscv_sifive_macos"
35+
"toolchain/riscv/Darwin" "https://dev.bouffalolab.com/media/upload/download/toolchain_riscv_sifive_macos.zip"
3036
)
37+
flash_tool_postfix=macos
3138
else
3239
echo "Not support for ""$OSTYPE"
3340
fi
@@ -37,30 +44,44 @@ if [ ! -d "$TOOLCHAIN_SETUP_ROOT" ]; then
3744
fi
3845
rm -rf "$TOOLCHAIN_SETUP_ROOT"/*.zip
3946

40-
for ((i = 0; i < ${#toolchains_url[@]}; i += 3)); do
47+
for ((i = 0; i < ${#toolchains_url[@]}; i += 4)); do
4148
path=${toolchains_url[i]}
4249
url=${toolchains_url[i + 1]}
43-
output=${toolchains_url[i + 2]}
50+
out=${toolchains_url[i + 2]}
51+
unzip_name=${toolchains_url[i + 3]}
52+
53+
if [ -d "$TOOLCHAIN_SETUP_ROOT/$path/$out" ]; then
54+
continue
55+
fi
56+
rm -rf "$TOOLCHAIN_SETUP_ROOT/$path"
57+
mkdir -p "$TOOLCHAIN_SETUP_ROOT/$path"
4458

4559
wget -P "$TOOLCHAIN_SETUP_ROOT"/ "$url"
4660
toolchain_zip=$(basename "$url")
61+
toolchain_zip=$(find "$TOOLCHAIN_SETUP_ROOT" -maxdepth 1 -name *"$toolchain_zip"*)
62+
toolchain_zip=$(basename "$toolchain_zip")
4763
if [ ! -f "$TOOLCHAIN_SETUP_ROOT/$toolchain_zip" ]; then
4864
exit 1
4965
fi
50-
rm -rf "$TOOLCHAIN_SETUP_ROOT/$path"
51-
mkdir -p "$TOOLCHAIN_SETUP_ROOT/$path"
52-
unzip "$TOOLCHAIN_SETUP_ROOT/$toolchain_zip" -d "$TOOLCHAIN_SETUP_ROOT/$path"
53-
mv "$TOOLCHAIN_SETUP_ROOT/$path/$output"/* "$TOOLCHAIN_SETUP_ROOT/$path"
66+
67+
unzip -q "$TOOLCHAIN_SETUP_ROOT/$toolchain_zip" -d "$TOOLCHAIN_SETUP_ROOT/$path/tmp"
68+
mv "$TOOLCHAIN_SETUP_ROOT/$path/tmp/$unzip_name" "$TOOLCHAIN_SETUP_ROOT/$path/$out"
69+
70+
rm -rf "$TOOLCHAIN_SETUP_ROOT/$path"/tmp
5471
rm -rf "$TOOLCHAIN_SETUP_ROOT/$toolchain_zip"
5572

56-
if [ -f "$TOOLCHAIN_SETUP_ROOT/$path"/chmod755.sh ]; then
57-
cd "$TOOLCHAIN_SETUP_ROOT/$path"/
73+
if [ -f "$TOOLCHAIN_SETUP_ROOT/$path"/"$out"/chmod755.sh ]; then
74+
cd "$TOOLCHAIN_SETUP_ROOT/$path"/"$out"
5875
bash chmod755.sh
5976
cd "$CURRENT_DIR"
6077
fi
6178
done
6279

63-
if [[ "$TOOLCHAIN_SYMBOLIC_LINK_PATH" != "" ]]; then
64-
rm -rf "$TOOLCHAIN_SYMBOLIC_LINK_PATH"
65-
ln -s "$TOOLCHAIN_SETUP_ROOT" "$TOOLCHAIN_SYMBOLIC_LINK_PATH"
80+
chmod +x "$TOOLCHAIN_SETUP_ROOT/flashtool/$flash_tool/BLDevCube-$flash_tool_postfix"
81+
chmod +x "$TOOLCHAIN_SETUP_ROOT/flashtool/$flash_tool/bflb_iot_tool-$flash_tool_postfix"
82+
83+
if [[ "$user" == "root" ]]; then
84+
chmod a+wr "$TOOLCHAIN_SETUP_ROOT/flashtool/$flash_tool" -R
85+
else
86+
chown "$user" "$TOOLCHAIN_SETUP_ROOT/flashtool/$flash_tool"/ -R
6687
fi

integrations/docker/images/vscode/chip-build-vscode/Dockerfile

-5
Original file line numberDiff line numberDiff line change
@@ -107,11 +107,6 @@ RUN set -x \
107107
&& rm -rf /var/lib/apt/lists/ \
108108
&& : # last line
109109

110-
# Required for the Bouffalolab platform
111-
RUN set -x \
112-
&& pip3 install --break-system-packages bflb-iot-tool==1.8.6 \
113-
&& : # last line
114-
115110
ENV PATH $PATH:/usr/lib/kotlinc/bin
116111
ENV AMEBA_PATH=/opt/ameba/ambd_sdk_with_chip_non_NDA
117112
ENV ANDROID_HOME=/opt/android/sdk

scripts/flashing/bouffalolab_firmware_utils.py

100644100755
File mode changed.

0 commit comments

Comments
 (0)