Skip to content

Commit 3b2ddd6

Browse files
committed
Overall scripts edits to meetup espressif master branch.
1 parent d3fb5c9 commit 3b2ddd6

36 files changed

+1092
-125
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ components/esp-rainmaker/
1010
components/espressif__esp-dsp/
1111
components/esp-insights/
1212
components/arduino_tinyusb/tinyusb/
13+
components/tflite-micro/
1314
esp-idf/
1415
out/
1516
build/

build.sh

Lines changed: 77 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -12,32 +12,45 @@ fi
1212

1313
export TARGET="all"
1414
BUILD_TYPE="all"
15+
BUILD_DEBUG="default"
1516
SKIP_ENV=0
1617
COPY_OUT=0
1718
ARCHIVE_OUT=1
18-
DEPLOY_OUT=0
19+
if [ -z $DEPLOY_OUT ]; then
20+
DEPLOY_OUT=0
21+
fi
1922

2023
function print_help() {
21-
echo "Usage: build.sh [-s] [-A <arduino_branch>] [-I <idf_branch>] [-i <idf_commit>] [-c <path>] [-t <target>] [-b <build|menuconfig|reconfigure|idf-libs|copy-bootloader|mem-variant>] [config ...]"
24+
echo "Usage: build.sh [-s] [-A <arduino_branch>] [-I <idf_branch>] [-D <debug_level>] [-i <idf_commit>] [-c <path>] [-t <target>] [-b <build|menuconfig|reconfigure|idf-libs|copy-bootloader|mem-variant>] [config ...]"
2225
echo " -s Skip installing/updating of ESP-IDF and all components"
2326
echo " -A Set which branch of arduino-esp32 to be used for compilation"
2427
echo " -I Set which branch of ESP-IDF to be used for compilation"
2528
echo " -i Set which commit of ESP-IDF to be used for compilation"
2629
echo " -e Archive the build to dist"
30+
echo " -d Deploy the build to github arduino-esp32"
31+
echo " -D Debug level to be set to ESP-IDF. One of default,none,error,warning,info,debug or verbose"
32+
echo " -c Set the arduino-esp32 folder to copy the result to. ex. '$HOME/Arduino/hardware/espressif/esp32'"
2733
echo " -t Set the build target(chip) ex. 'esp32s3' or select multiple targets(chips) by separating them with comma ex. 'esp32,esp32s3,esp32c3'"
2834
echo " -b Set the build type. ex. 'build' to build the project and prepare for uploading to a board"
2935
echo " ... Specify additional configs to be applied. ex. 'qio 80m' to compile for QIO Flash@80MHz. Requires -b"
3036
exit 1
3137
}
3238

33-
while getopts ":A:I:i:c:t:b:sde" opt; do
39+
while getopts ":A:I:i:c:t:b:D:sde" opt; do
3440
case ${opt} in
3541
s )
3642
SKIP_ENV=1
3743
;;
44+
d )
45+
DEPLOY_OUT=1
46+
;;
3847
e )
3948
ARCHIVE_OUT=1
4049
;;
50+
c )
51+
export ESP32_ARDUINO="$OPTARG"
52+
COPY_OUT=1
53+
;;
4154
A )
4255
export AR_BRANCH="$OPTARG"
4356
;;
@@ -47,16 +60,19 @@ while getopts ":A:I:i:c:t:b:sde" opt; do
4760
i )
4861
export IDF_COMMIT="$OPTARG"
4962
;;
63+
D )
64+
BUILD_DEBUG="$OPTARG"
65+
;;
5066
t )
5167
IFS=',' read -ra TARGET <<< "$OPTARG"
5268
;;
5369
b )
5470
b=$OPTARG
55-
if [ "$b" != "build" ] &&
56-
[ "$b" != "menuconfig" ] &&
57-
[ "$b" != "reconfigure" ] &&
58-
[ "$b" != "idf-libs" ] &&
59-
[ "$b" != "copy-bootloader" ] &&
71+
if [ "$b" != "build" ] &&
72+
[ "$b" != "menuconfig" ] &&
73+
[ "$b" != "reconfigure" ] &&
74+
[ "$b" != "idf-libs" ] &&
75+
[ "$b" != "copy-bootloader" ] &&
6076
[ "$b" != "mem-variant" ]; then
6177
print_help
6278
fi
@@ -100,6 +116,10 @@ else
100116
source ./tools/config.sh
101117
fi
102118

119+
if [ -f "$AR_MANAGED_COMPS/espressif__esp-sr/.component_hash" ]; then
120+
rm -rf $AR_MANAGED_COMPS/espressif__esp-sr/.component_hash
121+
fi
122+
103123
if [ "$BUILD_TYPE" != "all" ]; then
104124
if [ "$TARGET" = "all" ]; then
105125
echo "ERROR: You need to specify target for non-default builds"
@@ -123,8 +143,8 @@ if [ "$BUILD_TYPE" != "all" ]; then
123143
# Skip building for targets that are not in the $TARGET array
124144
continue
125145
fi
126-
127-
configs="configs/defconfig.common;configs/defconfig.$target"
146+
147+
configs="configs/defconfig.common;configs/defconfig.$target;configs/defconfig.debug_$BUILD_DEBUG"
128148
for defconf in `echo "$target_json" | jq -c '.features[]' | tr -d '"'`; do
129149
configs="$configs;configs/defconfig.$defconf"
130150
done
@@ -179,7 +199,7 @@ for target_json in `jq -c '.targets[]' configs/builds.json`; do
179199
continue
180200
fi
181201
fi
182-
202+
183203
# Skip chips that should not be a part of the final libs
184204
# WARNING!!! this logic needs to be updated when cron builds are split into jobs
185205
if [ "$TARGET" = "all" ] && [ $target_skip -eq 1 ]; then
@@ -190,7 +210,7 @@ for target_json in `jq -c '.targets[]' configs/builds.json`; do
190210
echo "* Target: $target"
191211

192212
# Build Main Configs List
193-
main_configs="configs/defconfig.common;configs/defconfig.$target"
213+
main_configs="configs/defconfig.common;configs/defconfig.$target;configs/defconfig.debug_$BUILD_DEBUG"
194214
for defconf in `echo "$target_json" | jq -c '.features[]' | tr -d '"'`; do
195215
main_configs="$main_configs;configs/defconfig.$defconf"
196216
done
@@ -201,18 +221,37 @@ for target_json in `jq -c '.targets[]' configs/builds.json`; do
201221
idf_libs_configs="$idf_libs_configs;configs/defconfig.$defconf"
202222
done
203223

224+
if [ -f "$AR_MANAGED_COMPS/espressif__esp-sr/.component_hash" ]; then
225+
rm -rf $AR_MANAGED_COMPS/espressif__esp-sr/.component_hash
226+
fi
204227
echo "* Build IDF-Libs: $idf_libs_configs"
205228
rm -rf build sdkconfig
206229
idf.py -DIDF_TARGET="$target" -DSDKCONFIG_DEFAULTS="$idf_libs_configs" idf-libs
207230
if [ $? -ne 0 ]; then exit 1; fi
208231

232+
if [ "$target" == "esp32s3" ]; then
233+
idf.py -DIDF_TARGET="$target" -DSDKCONFIG_DEFAULTS="$idf_libs_configs" srmodels_bin
234+
if [ $? -ne 0 ]; then exit 1; fi
235+
AR_SDK="$AR_TOOLS/esp32-arduino-libs/$target"
236+
# sr model.bin
237+
if [ -f "build/srmodels/srmodels.bin" ]; then
238+
echo "$AR_SDK/esp_sr"
239+
mkdir -p "$AR_SDK/esp_sr"
240+
cp -f "build/srmodels/srmodels.bin" "$AR_SDK/esp_sr/"
241+
cp -f "partitions.csv" "$AR_SDK/esp_sr/"
242+
fi
243+
fi
209244
# Build Bootloaders
210245
for boot_conf in `echo "$target_json" | jq -c '.bootloaders[]'`; do
211246
bootloader_configs="$main_configs"
212247
for defconf in `echo "$boot_conf" | jq -c '.[]' | tr -d '"'`; do
213248
bootloader_configs="$bootloader_configs;configs/defconfig.$defconf";
214249
done
215250

251+
if [ -f "$AR_MANAGED_COMPS/espressif__esp-sr/.component_hash" ]; then
252+
rm -rf $AR_MANAGED_COMPS/espressif__esp-sr/.component_hash
253+
fi
254+
216255
echo "* Build BootLoader: $bootloader_configs"
217256
rm -rf build sdkconfig
218257
idf.py -DIDF_TARGET="$target" -DSDKCONFIG_DEFAULTS="$bootloader_configs" copy-bootloader
@@ -226,6 +265,9 @@ for target_json in `jq -c '.targets[]' configs/builds.json`; do
226265
mem_configs="$mem_configs;configs/defconfig.$defconf";
227266
done
228267

268+
if [ -f "$AR_MANAGED_COMPS/espressif__esp-sr/.component_hash" ]; then
269+
rm -rf $AR_MANAGED_COMPS/espressif__esp-sr/.component_hash
270+
fi
229271
echo "* Build Memory Variant: $mem_configs"
230272
rm -rf build sdkconfig
231273
idf.py -DIDF_TARGET="$target" -DSDKCONFIG_DEFAULTS="$mem_configs" mem-variant
@@ -264,23 +306,33 @@ for component in `ls "$AR_MANAGED_COMPS"`; do
264306
fi
265307
done
266308

309+
# update package_esp32_index.template.json
310+
if [ "$BUILD_TYPE" = "all" ]; then
311+
python3 ./tools/gen_tools_json.py -i "$IDF_PATH" -j "$AR_COMPS/arduino/package/package_esp32_index.template.json" -o "$AR_OUT/"
312+
python3 ./tools/gen_tools_json.py -i "$IDF_PATH" -o "$TOOLS_JSON_OUT/"
313+
if [ $? -ne 0 ]; then exit 1; fi
314+
fi
267315
export IDF_COMMIT=$(git -C "$IDF_PATH" rev-parse --short HEAD)
268316

269-
# Generate PlatformIO library manifest file
317+
# Generate PlatformIO manifest file
270318
if [ "$BUILD_TYPE" = "all" ]; then
271-
python3 ./tools/gen_pio_lib_manifest.py -o "$TOOLS_JSON_OUT/" -s "v$IDF_VERSION" -c "$IDF_COMMIT"
319+
pushd $IDF_PATH
320+
ibr=$(git describe --all --exact-match 2>/dev/null)
321+
ic=$(git -C "$IDF_PATH" rev-parse --short HEAD)
322+
popd
323+
python3 ./tools/gen_platformio_manifest.py -o "$TOOLS_JSON_OUT/" -s "$ibr" -c "$ic"
272324
if [ $? -ne 0 ]; then exit 1; fi
273325
fi
274326

327+
# copy everything to arduino-esp32 installation
328+
if [ $COPY_OUT -eq 1 ] && [ -d "$ESP32_ARDUINO" ]; then
329+
./tools/copy-to-arduino.sh
330+
if [ $? -ne 0 ]; then exit 1; fi
331+
fi
275332
AR_VERSION=$(jq -c '.version' "$AR_COMPS/arduino/package.json" | tr -d '"')
276333
AR_VERSION_UNDERSCORE=`echo "$AR_VERSION" | tr . _`
277334

278-
# Generate PlatformIO framework manifest file
279-
rm -rf "$AR_ROOT/package.json"
280-
if [ "$BUILD_TYPE" = "all" ]; then
281-
python3 ./tools/gen_pio_frmwk_manifest.py -o "$AR_ROOT/" -s "v$AR_VERSION" -c "$IDF_COMMIT"
282-
if [ $? -ne 0 ]; then exit 1; fi
283-
fi
335+
284336

285337
# Generate core_version.h
286338
rm -rf "$AR_ROOT/core_version.h"
@@ -289,6 +341,11 @@ echo "#define ARDUINO_ESP32_GIT_VER 0x$AR_Commit_short
289341
#define ARDUINO_ESP32_RELEASE_$AR_VERSION_UNDERSCORE
290342
#define ARDUINO_ESP32_RELEASE \"$AR_VERSION_UNDERSCORE\"" >> "$AR_ROOT/core_version.h"
291343

344+
# push changes to esp32-arduino-libs and create pull request into arduino-esp32
345+
if [ $DEPLOY_OUT -eq 1 ]; then
346+
./tools/push-to-arduino.sh
347+
if [ $? -ne 0 ]; then exit 1; fi
348+
fi
292349
# archive the build
293350
if [ $ARCHIVE_OUT -eq 1 ]; then
294351
./tools/archive-build.sh "$TARGET"

configs/defconfig.common

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ CONFIG_BOOTLOADER_APP_ROLLBACK_ENABLE=y
1919
CONFIG_BOOTLOADER_SKIP_VALIDATE_IN_DEEP_SLEEP=y
2020
CONFIG_BT_BLE_BLUFI_ENABLE=y
2121
CONFIG_BT_BLE_42_FEATURES_SUPPORTED=y
22-
CONFIG_BT_BTC_TASK_STACK_SIZE=8192
2322
CONFIG_BT_BTU_TASK_STACK_SIZE=8192
2423
CONFIG_BLE_MESH=y
2524
CONFIG_COMPILER_OPTIMIZATION_SIZE=y

configs/defconfig.debug_debug

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
CONFIG_BOOTLOADER_LOG_LEVEL_INFO=y
2+
CONFIG_LOG_DEFAULT_LEVEL_DEBUG=y

configs/defconfig.debug_default

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
CONFIG_BOOTLOADER_LOG_LEVEL_NONE=y
2+
CONFIG_LOG_DEFAULT_LEVEL_ERROR=y

configs/defconfig.debug_error

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
CONFIG_BOOTLOADER_LOG_LEVEL_ERROR=y
2+
CONFIG_LOG_DEFAULT_LEVEL_ERROR=y

configs/defconfig.debug_info

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
CONFIG_BOOTLOADER_LOG_LEVEL_INFO=y
2+
CONFIG_LOG_DEFAULT_LEVEL_INFO=y

configs/defconfig.debug_none

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
CONFIG_BOOTLOADER_LOG_LEVEL_NONE=y
2+
CONFIG_LOG_DEFAULT_LEVEL_NONE=y

configs/defconfig.debug_verbose

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
CONFIG_BOOTLOADER_LOG_LEVEL_INFO=y
2+
CONFIG_LOG_DEFAULT_LEVEL_VERBOSE=y

configs/defconfig.debug_warning

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
CONFIG_BOOTLOADER_LOG_LEVEL_WARN=y
2+
CONFIG_LOG_DEFAULT_LEVEL_WARN=y

configs/defconfig.dout

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
CONFIG_ESPTOOLPY_FLASHMODE_DOUT=y

configs/defconfig.esp_sr

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
CONFIG_ESPTOOLPY_FLASHSIZE_16MB=y
2+
CONFIG_PARTITION_TABLE_CUSTOM=y
3+
CONFIG_SR_WN_WN9_HIESP=y
4+
CONFIG_SR_MN_CN_NONE=y
5+
CONFIG_SR_MN_EN_MULTINET5_SINGLE_RECOGNITION_QUANT8=y
6+
CONFIG_EN_SPEECH_COMMAND_ID0=""
7+
CONFIG_EN_SPEECH_COMMAND_ID1=""
8+
CONFIG_EN_SPEECH_COMMAND_ID2=""
9+
CONFIG_EN_SPEECH_COMMAND_ID3=""
10+
CONFIG_EN_SPEECH_COMMAND_ID4=""
11+
CONFIG_EN_SPEECH_COMMAND_ID5=""
12+
CONFIG_EN_SPEECH_COMMAND_ID6=""
13+
CONFIG_EN_SPEECH_COMMAND_ID7=""
14+
CONFIG_EN_SPEECH_COMMAND_ID8=""
15+
CONFIG_EN_SPEECH_COMMAND_ID9=""
16+
CONFIG_EN_SPEECH_COMMAND_ID10=""
17+
CONFIG_EN_SPEECH_COMMAND_ID11=""
18+
CONFIG_EN_SPEECH_COMMAND_ID12=""
19+
CONFIG_EN_SPEECH_COMMAND_ID13=""
20+
CONFIG_EN_SPEECH_COMMAND_ID14=""
21+
CONFIG_EN_SPEECH_COMMAND_ID15=""
22+
CONFIG_EN_SPEECH_COMMAND_ID16=""
23+
CONFIG_EN_SPEECH_COMMAND_ID17=""
24+
CONFIG_EN_SPEECH_COMMAND_ID18=""
25+
CONFIG_EN_SPEECH_COMMAND_ID19=""
26+
CONFIG_EN_SPEECH_COMMAND_ID20=""
27+
CONFIG_EN_SPEECH_COMMAND_ID21=""
28+
CONFIG_EN_SPEECH_COMMAND_ID22=""
29+
CONFIG_EN_SPEECH_COMMAND_ID23=""
30+
CONFIG_EN_SPEECH_COMMAND_ID24=""
31+
CONFIG_EN_SPEECH_COMMAND_ID25=""
32+
CONFIG_EN_SPEECH_COMMAND_ID26=""
33+
CONFIG_EN_SPEECH_COMMAND_ID27=""
34+
CONFIG_EN_SPEECH_COMMAND_ID28=""
35+
CONFIG_EN_SPEECH_COMMAND_ID29=""
36+
CONFIG_EN_SPEECH_COMMAND_ID30=""
37+
CONFIG_EN_SPEECH_COMMAND_ID31=""

configs/defconfig.qout

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
CONFIG_ESPTOOLPY_FLASHMODE_QOUT=y

main/Kconfig.projbuild

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,16 @@ config LIB_BUILDER_FLASHFREQ
1010
string
1111
default "120m" if ESPTOOLPY_FLASHFREQ_120M
1212
default "80m" if ESPTOOLPY_FLASHFREQ_80M
13-
default "60m" if ESPTOOLPY_FLASHFREQ_60M
1413
default "64m" if ESPTOOLPY_FLASHFREQ_64M
14+
default "60m" if ESPTOOLPY_FLASHFREQ_60M
15+
1516
default "40m" if ESPTOOLPY_FLASHFREQ_40M
1617
default "32m" if ESPTOOLPY_FLASHFREQ_32M
1718
default "30m" if ESPTOOLPY_FLASHFREQ_30M
1819
default "26m" if ESPTOOLPY_FLASHFREQ_26M
1920
default "20m" if ESPTOOLPY_FLASHFREQ_20M
2021
default "16m" if ESPTOOLPY_FLASHFREQ_16M
21-
default "15m" if ESPTOOLPY_FLASHFREQ_15M
22+
2223

2324
config LIB_BUILDER_COMPILE
2425
bool

main/idf_component.yml

Lines changed: 61 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,65 @@
11
dependencies:
22
# Required IDF version
33
idf: ">=5.1"
4-
espressif/esp-dsp:
5-
version: "^1.4.12"
4+
espressif/esp32-camera:
5+
version: "master"
6+
git: https://github.com/espressif/esp32-camera.git
7+
require: public
68
rules:
7-
- if: "target in [esp32s3, esp32]"
9+
- if: "target in [esp32, esp32s2, esp32s3]"
10+
espressif/esp-tflite-micro:
11+
version: ">=1.2.0"
12+
require: public
13+
rules:
14+
- if: "target not in [esp32c2]"
15+
espressif/esp-dl:
16+
version: "master"
17+
git: https://github.com/espressif/esp-dl.git
18+
require: public
19+
rules:
20+
- if: "target in [esp32s3, esp32s2, esp32]"
21+
espressif/esp-sr:
22+
version: ">=1.4.2"
23+
rules:
24+
- if: "target in [esp32s3]"
25+
26+
# esp-sr: "^1.3.1"
27+
# esp32-camera: "^2.0.4"
28+
# esp-dl:
29+
# git: https://github.com/espressif/esp-dl.git
30+
# espressif/esp_rainmaker:
31+
# path: components/esp_rainmaker
32+
# git: https://github.com/espressif/esp-rainmaker.git
33+
34+
# # Defining a dependency from the registry:
35+
# # https://components.espressif.com/component/example/cmp
36+
# example/cmp: "^3.3.3" # Automatically update minor releases
37+
#
38+
# # Other ways to define dependencies
39+
#
40+
# # For components maintained by Espressif only name can be used.
41+
# # Same as `espressif/cmp`
42+
# component: "~1.0.0" # Automatically update bugfix releases
43+
#
44+
# # Or in a longer form with extra parameters
45+
# component2:
46+
# version: ">=2.0.0"
47+
#
48+
# # For transient dependencies `public` flag can be set.
49+
# # `public` flag doesn't have an effect for the `main` component.
50+
# # All dependencies of `main` are public by default.
51+
# public: true
52+
#
53+
# # For components hosted on non-default registry:
54+
# service_url: "https://componentregistry.company.com"
55+
#
56+
# # For components in git repository:
57+
# test_component:
58+
# path: test_component
59+
# git: ssh://git@gitlab.com/user/components.git
60+
#
61+
# # For test projects during component development
62+
# # components can be used from a local directory
63+
# # with relative or absolute path
64+
# some_local_component:
65+
# path: ../../projects/component

0 commit comments

Comments
 (0)