@@ -20,15 +20,16 @@ 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
+ echo " -D Debug level to be set to ESP-IDF. One of default,none,error,warning,info,debug or verbose"
30
31
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'"
32
+ echo " -t Set the build target(chip) ex. 'esp32s3' or select multiple targets(chips) by separating them with comma ex. 'esp32, esp32s3,esp32c3 '"
32
33
echo " -b Set the build type. ex. 'build' to build the project and prepare for uploading to a board"
33
34
echo " ... Specify additional configs to be applied. ex. 'qio 80m' to compile for QIO Flash@80MHz. Requires -b"
34
35
exit 1
@@ -59,16 +60,16 @@ while getopts ":A:I:i:c:t:b:sde" opt; do
59
60
export IDF_COMMIT=" $OPTARG "
60
61
;;
61
62
t )
62
- TARGET= $OPTARG
63
+ IFS= ' , ' read -ra TARGET <<< " $OPTARG"
63
64
;;
64
65
b )
65
66
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
67
+ if [ " $b " != " build" ] &&
68
+ [ " $b " != " menuconfig" ] &&
69
+ [ " $b " != " reconfigure" ] &&
70
+ [ " $b " != " idf-libs " ] &&
71
+ [ " $b " != " copy-bootloader " ] &&
72
+ [ " $b " != " mem-variant " ]; then
72
73
print_help
73
74
fi
74
75
BUILD_TYPE=" $b "
86
87
shift $(( OPTIND - 1 ))
87
88
CONFIGS=$@
88
89
90
+ # Output the TARGET array
91
+ echo " TARGET(s): ${TARGET[@]} "
92
+
89
93
mkdir -p dist
90
94
rm -rf dependencies.lock
91
95
@@ -113,27 +117,42 @@ if [ "$BUILD_TYPE" != "all" ]; then
113
117
echo " ERROR: You need to specify target for non-default builds"
114
118
print_help
115
119
fi
116
- configs=" configs/defconfig.common;configs/defconfig.$TARGET "
117
120
118
121
# Target Features Configs
119
122
for target_json in ` jq -c ' .targets[]' configs/builds.json` ; do
120
123
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
124
+
125
+ # Check if $target is in the $TARGET array
126
+ target_in_array=false
127
+ for item in " ${TARGET[@]} " ; do
128
+ if [ " $item " = " $target " ]; then
129
+ target_in_array=true
130
+ break
131
+ fi
132
+ done
133
+
134
+ if [ " $target_in_array " = false ]; then
135
+ # Skip building for targets that are not in the $TARGET array
136
+ continue
125
137
fi
126
- done
138
+
139
+ configs=" configs/defconfig.common;configs/defconfig.$target ;configs/defconfig.debug_$BUILD_DEBUG "
140
+ for defconf in ` echo " $target_json " | jq -c ' .features[]' | tr -d ' "' ` ; do
141
+ configs=" $configs ;configs/defconfig.$defconf "
142
+ done
127
143
128
- # Configs From Arguments
129
- for conf in $CONFIGS ; do
130
- configs=" $configs ;configs/defconfig.$conf "
131
- done
144
+ echo " * Building for $target "
132
145
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
146
+ # Configs From Arguments
147
+ for conf in $CONFIGS ; do
148
+ configs=" $configs ;configs/defconfig.$conf "
149
+ done
150
+
151
+ echo " idf.py -DIDF_TARGET=\" $target \" -DSDKCONFIG_DEFAULTS=\" $configs \" $BUILD_TYPE "
152
+ rm -rf build sdkconfig
153
+ idf.py -DIDF_TARGET=" $target " -DSDKCONFIG_DEFAULTS=" $configs " $BUILD_TYPE
154
+ if [ $? -ne 0 ]; then exit 1; fi
155
+ done
137
156
exit 0
138
157
fi
139
158
@@ -152,16 +171,36 @@ echo "Framework built from
152
171
# targets_count=`jq -c '.targets[] | length' configs/builds.json`
153
172
for target_json in ` jq -c ' .targets[]' configs/builds.json` ; do
154
173
target=$( echo " $target_json " | jq -c ' .target' | tr -d ' "' )
174
+ target_skip=$( echo " $target_json " | jq -c ' .skip // 0' )
175
+
176
+ # Check if $target is in the $TARGET array if not "all"
177
+ if [ " $TARGET " != " all" ]; then
178
+ target_in_array=false
179
+ for item in " ${TARGET[@]} " ; do
180
+ if [ " $item " = " $target " ]; then
181
+ target_in_array=true
182
+ break
183
+ fi
184
+ done
155
185
156
- if [ " $TARGET " != " all" ] && [ " $TARGET " != " $target " ]; then
186
+ # If $target is not in the $TARGET array, skip processing
187
+ if [ " $target_in_array " = false ]; then
188
+ echo " * Skipping Target: $target "
189
+ continue
190
+ fi
191
+ fi
192
+
193
+ # Skip chips that should not be a part of the final libs
194
+ # WARNING!!! this logic needs to be updated when cron builds are split into jobs
195
+ if [ " $TARGET " = " all" ] && [ $target_skip -eq 1 ]; then
157
196
echo " * Skipping Target: $target "
158
197
continue
159
198
fi
160
199
161
200
echo " * Target: $target "
162
201
163
202
# Build Main Configs List
164
- main_configs=" configs/defconfig.common;configs/defconfig.$target "
203
+ main_configs=" configs/defconfig.common;configs/defconfig.$target ;configs/defconfig.debug_ $BUILD_DEBUG "
165
204
for defconf in ` echo " $target_json " | jq -c ' .features[]' | tr -d ' "' ` ; do
166
205
main_configs=" $main_configs ;configs/defconfig.$defconf "
167
206
done
@@ -174,7 +213,7 @@ for target_json in `jq -c '.targets[]' configs/builds.json`; do
174
213
175
214
echo " * Build IDF-Libs: $idf_libs_configs "
176
215
rm -rf build sdkconfig
177
- idf.py -DIDF_TARGET=" $target " -DSDKCONFIG_DEFAULTS=" $idf_libs_configs " idf_libs
216
+ idf.py -DIDF_TARGET=" $target " -DSDKCONFIG_DEFAULTS=" $idf_libs_configs " idf-libs
178
217
if [ $? -ne 0 ]; then exit 1; fi
179
218
180
219
# Build Bootloaders
@@ -186,7 +225,7 @@ for target_json in `jq -c '.targets[]' configs/builds.json`; do
186
225
187
226
echo " * Build BootLoader: $bootloader_configs "
188
227
rm -rf build sdkconfig
189
- idf.py -DIDF_TARGET=" $target " -DSDKCONFIG_DEFAULTS=" $bootloader_configs " copy_bootloader
228
+ idf.py -DIDF_TARGET=" $target " -DSDKCONFIG_DEFAULTS=" $bootloader_configs " copy-bootloader
190
229
if [ $? -ne 0 ]; then exit 1; fi
191
230
done
192
231
@@ -199,7 +238,7 @@ for target_json in `jq -c '.targets[]' configs/builds.json`; do
199
238
200
239
echo " * Build Memory Variant: $mem_configs "
201
240
rm -rf build sdkconfig
202
- idf.py -DIDF_TARGET=" $target " -DSDKCONFIG_DEFAULTS=" $mem_configs " mem_variant
241
+ idf.py -DIDF_TARGET=" $target " -DSDKCONFIG_DEFAULTS=" $mem_configs " mem-variant
203
242
if [ $? -ne 0 ]; then exit 1; fi
204
243
done
205
244
done
0 commit comments