@@ -30,7 +30,7 @@ function print_help() {
30
30
echo " -d Deploy the build to github arduino-esp32"
31
31
echo " -D Debug level to be set to ESP-IDF. One of default,none,error,warning,info,debug or verbose"
32
32
echo " -c Set the arduino-esp32 folder to copy the result to. ex. '$HOME /Arduino/hardware/espressif/esp32'"
33
- echo " -t Set the build target(chip). ex. 'esp32s3'"
33
+ echo " -t Set the build target(chip) ex. 'esp32s3' or select multiple targets(chips) by separating them with comma ex. 'esp32, esp32s3,esp32c3 '"
34
34
echo " -b Set the build type. ex. 'build' to build the project and prepare for uploading to a board"
35
35
echo " ... Specify additional configs to be applied. ex. 'qio 80m' to compile for QIO Flash@80MHz. Requires -b"
36
36
exit 1
@@ -64,7 +64,7 @@ while getopts ":A:I:i:c:t:b:D:sde" opt; do
64
64
BUILD_DEBUG=" $OPTARG "
65
65
;;
66
66
t )
67
- TARGET= $OPTARG
67
+ IFS= ' , ' read -ra TARGET <<< " $OPTARG"
68
68
;;
69
69
b )
70
70
b=$OPTARG
91
91
shift $(( OPTIND - 1 ))
92
92
CONFIGS=$@
93
93
94
+ # Output the TARGET array
95
+ echo " TARGET(s): ${TARGET[@]} "
96
+
94
97
mkdir -p dist
95
98
96
99
if [ $SKIP_ENV -eq 0 ]; then
@@ -121,27 +124,42 @@ if [ "$BUILD_TYPE" != "all" ]; then
121
124
echo " ERROR: You need to specify target for non-default builds"
122
125
print_help
123
126
fi
124
- configs=" configs/defconfig.common;configs/defconfig.$TARGET ;configs/defconfig.debug_$BUILD_DEBUG "
125
-
127
+
126
128
# Target Features Configs
127
129
for target_json in ` jq -c ' .targets[]' configs/builds.json` ; do
128
130
target=$( echo " $target_json " | jq -c ' .target' | tr -d ' "' )
129
- if [ " $TARGET " == " $target " ]; then
130
- for defconf in ` echo " $target_json " | jq -c ' .features[]' | tr -d ' "' ` ; do
131
- configs=" $configs ;configs/defconfig.$defconf "
132
- done
131
+
132
+ # Check if $target is in the $TARGET array
133
+ target_in_array=false
134
+ for item in " ${TARGET[@]} " ; do
135
+ if [ " $item " = " $target " ]; then
136
+ target_in_array=true
137
+ break
138
+ fi
139
+ done
140
+
141
+ if [ " $target_in_array " = false ]; then
142
+ # Skip building for targets that are not in the $TARGET array
143
+ continue
133
144
fi
134
- done
145
+
146
+ configs=" configs/defconfig.common;configs/defconfig.$target ;configs/defconfig.debug_$BUILD_DEBUG "
147
+ for defconf in ` echo " $target_json " | jq -c ' .features[]' | tr -d ' "' ` ; do
148
+ configs=" $configs ;configs/defconfig.$defconf "
149
+ done
135
150
136
- # Configs From Arguments
137
- for conf in $CONFIGS ; do
138
- configs=" $configs ;configs/defconfig.$conf "
139
- done
151
+ echo " * Building for $target "
140
152
141
- echo " idf.py -DIDF_TARGET=\" $TARGET \" -DSDKCONFIG_DEFAULTS=\" $configs \" $BUILD_TYPE "
142
- rm -rf build sdkconfig
143
- idf.py -DIDF_TARGET=" $TARGET " -DSDKCONFIG_DEFAULTS=" $configs " $BUILD_TYPE
144
- if [ $? -ne 0 ]; then exit 1; fi
153
+ # Configs From Arguments
154
+ for conf in $CONFIGS ; do
155
+ configs=" $configs ;configs/defconfig.$conf "
156
+ done
157
+
158
+ echo " idf.py -DIDF_TARGET=\" $target \" -DSDKCONFIG_DEFAULTS=\" $configs \" $BUILD_TYPE "
159
+ rm -rf build sdkconfig
160
+ idf.py -DIDF_TARGET=" $target " -DSDKCONFIG_DEFAULTS=" $configs " $BUILD_TYPE
161
+ if [ $? -ne 0 ]; then exit 1; fi
162
+ done
145
163
exit 0
146
164
fi
147
165
@@ -153,11 +171,23 @@ for target_json in `jq -c '.targets[]' configs/builds.json`; do
153
171
target=$( echo " $target_json " | jq -c ' .target' | tr -d ' "' )
154
172
target_skip=$( echo " $target_json " | jq -c ' .skip // 0' )
155
173
156
- if [ " $TARGET " != " all" ] && [ " $TARGET " != " $target " ]; then
157
- echo " * Skipping Target: $target "
158
- continue
159
- fi
174
+ # Check if $target is in the $TARGET array if not "all"
175
+ if [ " $TARGET " != " all" ]; then
176
+ target_in_array=false
177
+ for item in " ${TARGET[@]} " ; do
178
+ if [ " $item " = " $target " ]; then
179
+ target_in_array=true
180
+ break
181
+ fi
182
+ done
160
183
184
+ # If $target is not in the $TARGET array, skip processing
185
+ if [ " $target_in_array " = false ]; then
186
+ echo " * Skipping Target: $target "
187
+ continue
188
+ fi
189
+ fi
190
+
161
191
# Skip chips that should not be a part of the final libs
162
192
# WARNING!!! this logic needs to be updated when cron builds are split into jobs
163
193
if [ " $TARGET " = " all" ] && [ $target_skip -eq 1 ]; then
0 commit comments