12
12
13
13
TARGET=" all"
14
14
BUILD_TYPE=" all"
15
+ BUILD_DEBUG=" default"
15
16
SKIP_ENV=0
16
17
COPY_OUT=0
17
18
ARCHIVE_OUT=0
@@ -20,21 +21,22 @@ if [ -z $DEPLOY_OUT ]; then
20
21
fi
21
22
22
23
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 ...]"
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 ...]"
24
25
echo " -s Skip installing/updating of ESP-IDF and all components"
25
26
echo " -A Set which branch of arduino-esp32 to be used for compilation"
26
27
echo " -I Set which branch of ESP-IDF to be used for compilation"
27
28
echo " -i Set which commit of ESP-IDF to be used for compilation"
28
29
echo " -e Archive the build to dist"
29
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"
30
32
echo " -c Set the arduino-esp32 folder to copy the result to. ex. '$HOME /Arduino/hardware/espressif/esp32'"
31
33
echo " -t Set the build target(chip). ex. 'esp32s3'"
32
34
echo " -b Set the build type. ex. 'build' to build the project and prepare for uploading to a board"
33
35
echo " ... Specify additional configs to be applied. ex. 'qio 80m' to compile for QIO Flash@80MHz. Requires -b"
34
36
exit 1
35
37
}
36
38
37
- while getopts " :A:I:i:c:t:b:sde" opt; do
39
+ while getopts " :A:I:i:c:t:b:D: sde" opt; do
38
40
case ${opt} in
39
41
s )
40
42
SKIP_ENV=1
@@ -58,6 +60,9 @@ while getopts ":A:I:i:c:t:b:sde" opt; do
58
60
i )
59
61
export IDF_COMMIT=" $OPTARG "
60
62
;;
63
+ D )
64
+ BUILD_DEBUG=" $OPTARG "
65
+ ;;
61
66
t )
62
67
TARGET=$OPTARG
63
68
;;
@@ -107,16 +112,16 @@ else
107
112
source ./tools/config.sh
108
113
fi
109
114
110
- if [ -f " ./managed_components /espressif__esp-sr/.component_hash" ]; then
111
- rm -rf ./managed_components /espressif__esp-sr/.component_hash
115
+ if [ -f " $AR_MANAGED_COMPS /espressif__esp-sr/.component_hash" ]; then
116
+ rm -rf $AR_MANAGED_COMPS /espressif__esp-sr/.component_hash
112
117
fi
113
118
114
119
if [ " $BUILD_TYPE " != " all" ]; then
115
120
if [ " $TARGET " = " all" ]; then
116
121
echo " ERROR: You need to specify target for non-default builds"
117
122
print_help
118
123
fi
119
- configs=" configs/defconfig.common;configs/defconfig.$TARGET "
124
+ configs=" configs/defconfig.common;configs/defconfig.$TARGET ;configs/defconfig.debug_ $BUILD_DEBUG "
120
125
121
126
# Target Features Configs
122
127
for target_json in ` jq -c ' .targets[]' configs/builds.json` ; do
@@ -141,19 +146,7 @@ if [ "$BUILD_TYPE" != "all" ]; then
141
146
fi
142
147
143
148
rm -rf build sdkconfig out
144
-
145
- # Add components version info
146
- mkdir -p " $AR_TOOLS /esp32-arduino-libs" && rm -rf version.txt && rm -rf " $AR_TOOLS /esp32-arduino-libs/versions.txt"
147
- component_version=" esp-idf: " $( git -C " $IDF_PATH " symbolic-ref --short HEAD || git -C " $IDF_PATH " tag --points-at HEAD) " " $( git -C " $IDF_PATH " rev-parse --short HEAD)
148
- echo $component_version >> version.txt && echo $component_version >> " $AR_TOOLS /esp32-arduino-libs/versions.txt"
149
- for component in ` ls " $AR_COMPS " ` ; do
150
- if [ -d " $AR_COMPS /$component /.git" ] || [ -d " $AR_COMPS /$component /.github" ]; then
151
- component_version=" $component : " $( git -C " $AR_COMPS /$component " symbolic-ref --short HEAD || git -C " $AR_COMPS /$component " tag --points-at HEAD) " " $( git -C " $AR_COMPS /$component " rev-parse --short HEAD)
152
- echo $component_version >> version.txt && echo $component_version >> " $AR_TOOLS /esp32-arduino-libs/versions.txt"
153
- fi
154
- done
155
- component_version=" tinyusb: " $( git -C " $AR_COMPS /arduino_tinyusb/tinyusb" symbolic-ref --short HEAD || git -C " $AR_COMPS /arduino_tinyusb/tinyusb" tag --points-at HEAD) " " $( git -C " $AR_COMPS /arduino_tinyusb/tinyusb" rev-parse --short HEAD)
156
- echo $component_version >> version.txt && echo $component_version >> " $AR_TOOLS /esp32-arduino-libs/versions.txt"
149
+ mkdir -p " $AR_TOOLS /esp32-arduino-libs"
157
150
158
151
# targets_count=`jq -c '.targets[] | length' configs/builds.json`
159
152
for target_json in ` jq -c ' .targets[]' configs/builds.json` ; do
@@ -175,7 +168,7 @@ for target_json in `jq -c '.targets[]' configs/builds.json`; do
175
168
echo " * Target: $target "
176
169
177
170
# Build Main Configs List
178
- main_configs=" configs/defconfig.common;configs/defconfig.$target "
171
+ main_configs=" configs/defconfig.common;configs/defconfig.$target ;configs/defconfig.debug_ $BUILD_DEBUG "
179
172
for defconf in ` echo " $target_json " | jq -c ' .features[]' | tr -d ' "' ` ; do
180
173
main_configs=" $main_configs ;configs/defconfig.$defconf "
181
174
done
@@ -186,8 +179,8 @@ for target_json in `jq -c '.targets[]' configs/builds.json`; do
186
179
idf_libs_configs=" $idf_libs_configs ;configs/defconfig.$defconf "
187
180
done
188
181
189
- if [ -f " ./managed_components /espressif__esp-sr/.component_hash" ]; then
190
- rm -rf ./managed_components /espressif__esp-sr/.component_hash
182
+ if [ -f " $AR_MANAGED_COMPS /espressif__esp-sr/.component_hash" ]; then
183
+ rm -rf $AR_MANAGED_COMPS /espressif__esp-sr/.component_hash
191
184
fi
192
185
193
186
echo " * Build IDF-Libs: $idf_libs_configs "
@@ -215,8 +208,8 @@ for target_json in `jq -c '.targets[]' configs/builds.json`; do
215
208
bootloader_configs=" $bootloader_configs ;configs/defconfig.$defconf " ;
216
209
done
217
210
218
- if [ -f " ./managed_components /espressif__esp-sr/.component_hash" ]; then
219
- rm -rf ./managed_components /espressif__esp-sr/.component_hash
211
+ if [ -f " $AR_MANAGED_COMPS /espressif__esp-sr/.component_hash" ]; then
212
+ rm -rf $AR_MANAGED_COMPS /espressif__esp-sr/.component_hash
220
213
fi
221
214
222
215
echo " * Build BootLoader: $bootloader_configs "
@@ -232,8 +225,8 @@ for target_json in `jq -c '.targets[]' configs/builds.json`; do
232
225
mem_configs=" $mem_configs ;configs/defconfig.$defconf " ;
233
226
done
234
227
235
- if [ -f " ./managed_components /espressif__esp-sr/.component_hash" ]; then
236
- rm -rf ./managed_components /espressif__esp-sr/.component_hash
228
+ if [ -f " $AR_MANAGED_COMPS /espressif__esp-sr/.component_hash" ]; then
229
+ rm -rf $AR_MANAGED_COMPS /espressif__esp-sr/.component_hash
237
230
fi
238
231
239
232
echo " * Build Memory Variant: $mem_configs "
@@ -243,6 +236,37 @@ for target_json in `jq -c '.targets[]' configs/builds.json`; do
243
236
done
244
237
done
245
238
239
+ #
240
+ # Add components version info
241
+ #
242
+ rm -rf " $AR_TOOLS /esp32-arduino-libs/versions.txt"
243
+ # The lib-builder version
244
+ component_version=" lib-builder: " $( git -C " $AR_ROOT " symbolic-ref --short HEAD || git -C " $AR_ROOT " tag --points-at HEAD) " " $( git -C " $AR_ROOT " rev-parse --short HEAD)
245
+ echo $component_version >> " $AR_TOOLS /esp32-arduino-libs/versions.txt"
246
+ # ESP-IDF version
247
+ component_version=" esp-idf: " $( git -C " $IDF_PATH " symbolic-ref --short HEAD || git -C " $IDF_PATH " tag --points-at HEAD) " " $( git -C " $IDF_PATH " rev-parse --short HEAD)
248
+ echo $component_version >> " $AR_TOOLS /esp32-arduino-libs/versions.txt"
249
+ # components version
250
+ for component in ` ls " $AR_COMPS " ` ; do
251
+ if [ -d " $AR_COMPS /$component /.git" ]; then
252
+ component_version=" $component : " $( git -C " $AR_COMPS /$component " symbolic-ref --short HEAD || git -C " $AR_COMPS /$component " tag --points-at HEAD) " " $( git -C " $AR_COMPS /$component " rev-parse --short HEAD)
253
+ echo $component_version >> " $AR_TOOLS /esp32-arduino-libs/versions.txt"
254
+ fi
255
+ done
256
+ # TinyUSB version
257
+ component_version=" tinyusb: " $( git -C " $AR_COMPS /arduino_tinyusb/tinyusb" symbolic-ref --short HEAD || git -C " $AR_COMPS /arduino_tinyusb/tinyusb" tag --points-at HEAD) " " $( git -C " $AR_COMPS /arduino_tinyusb/tinyusb" rev-parse --short HEAD)
258
+ echo $component_version >> " $AR_TOOLS /esp32-arduino-libs/versions.txt"
259
+ # managed components version
260
+ for component in ` ls " $AR_MANAGED_COMPS " ` ; do
261
+ if [ -d " $AR_MANAGED_COMPS /$component /.git" ]; then
262
+ component_version=" $component : " $( git -C " $AR_MANAGED_COMPS /$component " symbolic-ref --short HEAD || git -C " $AR_MANAGED_COMPS /$component " tag --points-at HEAD) " " $( git -C " $AR_MANAGED_COMPS /$component " rev-parse --short HEAD)
263
+ echo $component_version >> " $AR_TOOLS /esp32-arduino-libs/versions.txt"
264
+ elif [ -f " $AR_MANAGED_COMPS /$component /idf_component.yml" ]; then
265
+ component_version=" $component : " $( cat " $AR_MANAGED_COMPS /$component /idf_component.yml" | grep " ^version: " | cut -d ' ' -f 2)
266
+ echo $component_version >> " $AR_TOOLS /esp32-arduino-libs/versions.txt"
267
+ fi
268
+ done
269
+
246
270
# update package_esp32_index.template.json
247
271
if [ " $BUILD_TYPE " = " all" ]; then
248
272
python3 ./tools/gen_tools_json.py -i " $IDF_PATH " -j " $AR_COMPS /arduino/package/package_esp32_index.template.json" -o " $AR_OUT /"
0 commit comments