@@ -10,7 +10,7 @@ if ! [ -x "$(command -v git)" ]; then
10
10
exit 1
11
11
fi
12
12
13
- TARGET=" all"
13
+ export TARGET=" all"
14
14
BUILD_TYPE=" all"
15
15
SKIP_ENV=0
16
16
COPY_OUT=0
@@ -20,15 +20,15 @@ if [ -z $DEPLOY_OUT ]; then
20
20
fi
21
21
22
22
function print_help() {
23
- 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 ...]"
23
+ 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
24
echo " -s Skip installing/updating of ESP-IDF and all components"
25
25
echo " -A Set which branch of arduino-esp32 to be used for compilation"
26
26
echo " -I Set which branch of ESP-IDF to be used for compilation"
27
27
echo " -i Set which commit of ESP-IDF to be used for compilation"
28
28
echo " -e Archive the build to dist"
29
29
echo " -d Deploy the build to github arduino-esp32"
30
30
echo " -c Set the arduino-esp32 folder to copy the result to. ex. '$HOME /Arduino/hardware/espressif/esp32'"
31
- echo " -t Set the build target(chip). ex. 'esp32s3'"
31
+ echo " -t Set the build target(chip) ex. 'esp32s3' or select multiple targets(chips) by separating them with comma ex. 'esp32, esp32s3,esp32c3 '"
32
32
echo " -b Set the build type. ex. 'build' to build the project and prepare for uploading to a board"
33
33
echo " ... Specify additional configs to be applied. ex. 'qio 80m' to compile for QIO Flash@80MHz. Requires -b"
34
34
exit 1
@@ -59,16 +59,16 @@ while getopts ":A:I:i:c:t:b:sde" opt; do
59
59
export IDF_COMMIT=" $OPTARG "
60
60
;;
61
61
t )
62
- TARGET= $OPTARG
62
+ IFS= ' , ' read -ra TARGET <<< " $OPTARG"
63
63
;;
64
64
b )
65
65
b=$OPTARG
66
- if [ " $b " != " build" ] &&
67
- [ " $b " != " menuconfig" ] &&
68
- [ " $b " != " reconfigure" ] &&
69
- [ " $b " != " idf_libs " ] &&
70
- [ " $b " != " copy_bootloader " ] &&
71
- [ " $b " != " mem_variant " ]; then
66
+ if [ " $b " != " build" ] &&
67
+ [ " $b " != " menuconfig" ] &&
68
+ [ " $b " != " reconfigure" ] &&
69
+ [ " $b " != " idf-libs " ] &&
70
+ [ " $b " != " copy-bootloader " ] &&
71
+ [ " $b " != " mem-variant " ]; then
72
72
print_help
73
73
fi
74
74
BUILD_TYPE=" $b "
86
86
shift $(( OPTIND - 1 ))
87
87
CONFIGS=$@
88
88
89
+ # Output the TARGET array
90
+ echo " TARGET(s): ${TARGET[@]} "
91
+
89
92
mkdir -p dist
90
93
rm -rf dependencies.lock
91
94
@@ -113,27 +116,42 @@ if [ "$BUILD_TYPE" != "all" ]; then
113
116
echo " ERROR: You need to specify target for non-default builds"
114
117
print_help
115
118
fi
116
- configs=" configs/defconfig.common;configs/defconfig.$TARGET "
117
119
118
120
# Target Features Configs
119
121
for target_json in ` jq -c ' .targets[]' configs/builds.json` ; do
120
122
target=$( echo " $target_json " | jq -c ' .target' | tr -d ' "' )
121
- if [ " $TARGET " == " $target " ]; then
122
- for defconf in ` echo " $target_json " | jq -c ' .features[]' | tr -d ' "' ` ; do
123
- configs=" $configs ;configs/defconfig.$defconf "
124
- done
123
+
124
+ # Check if $target is in the $TARGET array
125
+ target_in_array=false
126
+ for item in " ${TARGET[@]} " ; do
127
+ if [ " $item " = " $target " ]; then
128
+ target_in_array=true
129
+ break
130
+ fi
131
+ done
132
+
133
+ if [ " $target_in_array " = false ]; then
134
+ # Skip building for targets that are not in the $TARGET array
135
+ continue
125
136
fi
126
- done
137
+
138
+ configs=" configs/defconfig.common;configs/defconfig.$target "
139
+ for defconf in ` echo " $target_json " | jq -c ' .features[]' | tr -d ' "' ` ; do
140
+ configs=" $configs ;configs/defconfig.$defconf "
141
+ done
127
142
128
- # Configs From Arguments
129
- for conf in $CONFIGS ; do
130
- configs=" $configs ;configs/defconfig.$conf "
131
- done
143
+ echo " * Building for $target "
132
144
133
- echo " idf.py -DIDF_TARGET=\" $TARGET \" -DSDKCONFIG_DEFAULTS=\" $configs \" $BUILD_TYPE "
134
- rm -rf build sdkconfig
135
- idf.py -DIDF_TARGET=" $TARGET " -DSDKCONFIG_DEFAULTS=" $configs " $BUILD_TYPE
136
- if [ $? -ne 0 ]; then exit 1; fi
145
+ # Configs From Arguments
146
+ for conf in $CONFIGS ; do
147
+ configs=" $configs ;configs/defconfig.$conf "
148
+ done
149
+
150
+ echo " idf.py -DIDF_TARGET=\" $target \" -DSDKCONFIG_DEFAULTS=\" $configs \" $BUILD_TYPE "
151
+ rm -rf build sdkconfig
152
+ idf.py -DIDF_TARGET=" $target " -DSDKCONFIG_DEFAULTS=" $configs " $BUILD_TYPE
153
+ if [ $? -ne 0 ]; then exit 1; fi
154
+ done
137
155
exit 0
138
156
fi
139
157
@@ -152,8 +170,28 @@ echo "Framework built from
152
170
# targets_count=`jq -c '.targets[] | length' configs/builds.json`
153
171
for target_json in ` jq -c ' .targets[]' configs/builds.json` ; do
154
172
target=$( echo " $target_json " | jq -c ' .target' | tr -d ' "' )
173
+ target_skip=$( echo " $target_json " | jq -c ' .skip // 0' )
174
+
175
+ # Check if $target is in the $TARGET array if not "all"
176
+ if [ " $TARGET " != " all" ]; then
177
+ target_in_array=false
178
+ for item in " ${TARGET[@]} " ; do
179
+ if [ " $item " = " $target " ]; then
180
+ target_in_array=true
181
+ break
182
+ fi
183
+ done
155
184
156
- if [ " $TARGET " != " all" ] && [ " $TARGET " != " $target " ]; then
185
+ # If $target is not in the $TARGET array, skip processing
186
+ if [ " $target_in_array " = false ]; then
187
+ echo " * Skipping Target: $target "
188
+ continue
189
+ fi
190
+ fi
191
+
192
+ # Skip chips that should not be a part of the final libs
193
+ # WARNING!!! this logic needs to be updated when cron builds are split into jobs
194
+ if [ " $TARGET " = " all" ] && [ $target_skip -eq 1 ]; then
157
195
echo " * Skipping Target: $target "
158
196
continue
159
197
fi
@@ -174,7 +212,7 @@ for target_json in `jq -c '.targets[]' configs/builds.json`; do
174
212
175
213
echo " * Build IDF-Libs: $idf_libs_configs "
176
214
rm -rf build sdkconfig
177
- idf.py -DIDF_TARGET=" $target " -DSDKCONFIG_DEFAULTS=" $idf_libs_configs " idf_libs
215
+ idf.py -DIDF_TARGET=" $target " -DSDKCONFIG_DEFAULTS=" $idf_libs_configs " idf-libs
178
216
if [ $? -ne 0 ]; then exit 1; fi
179
217
180
218
# Build Bootloaders
@@ -186,7 +224,7 @@ for target_json in `jq -c '.targets[]' configs/builds.json`; do
186
224
187
225
echo " * Build BootLoader: $bootloader_configs "
188
226
rm -rf build sdkconfig
189
- idf.py -DIDF_TARGET=" $target " -DSDKCONFIG_DEFAULTS=" $bootloader_configs " copy_bootloader
227
+ idf.py -DIDF_TARGET=" $target " -DSDKCONFIG_DEFAULTS=" $bootloader_configs " copy-bootloader
190
228
if [ $? -ne 0 ]; then exit 1; fi
191
229
done
192
230
@@ -199,7 +237,7 @@ for target_json in `jq -c '.targets[]' configs/builds.json`; do
199
237
200
238
echo " * Build Memory Variant: $mem_configs "
201
239
rm -rf build sdkconfig
202
- idf.py -DIDF_TARGET=" $target " -DSDKCONFIG_DEFAULTS=" $mem_configs " mem_variant
240
+ idf.py -DIDF_TARGET=" $target " -DSDKCONFIG_DEFAULTS=" $mem_configs " mem-variant
203
241
if [ $? -ne 0 ]; then exit 1; fi
204
242
done
205
243
done
246
284
247
285
# Generate PlatformIO library manifest file
248
286
if [ " $BUILD_TYPE " = " all" ]; then
249
- python3 ./tools/gen_pio_lib_manifest.py -o " $TOOLS_JSON_OUT /" -s " $IDF_BRANCH " -c " $IDF_COMMIT "
287
+ python3 ./tools/gen_pio_lib_manifest.py -o " $TOOLS_JSON_OUT /" -s " v $IDF_VERSION " -c " $IDF_COMMIT "
250
288
if [ $? -ne 0 ]; then exit 1; fi
251
289
fi
252
290
0 commit comments