1212
1313TARGET=" all"
1414BUILD_TYPE=" all"
15+ BUILD_DEBUG=" default"
1516SKIP_ENV=0
1617COPY_OUT=0
1718ARCHIVE_OUT=0
@@ -20,21 +21,22 @@ if [ -z $DEPLOY_OUT ]; then
2021fi
2122
2223function 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 ...]"
2425 echo " -s Skip installing/updating of ESP-IDF and all components"
2526 echo " -A Set which branch of arduino-esp32 to be used for compilation"
2627 echo " -I Set which branch of ESP-IDF to be used for compilation"
2728 echo " -i Set which commit of ESP-IDF to be used for compilation"
2829 echo " -e Archive the build to dist"
2930 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"
3032 echo " -c Set the arduino-esp32 folder to copy the result to. ex. '$HOME /Arduino/hardware/espressif/esp32'"
3133 echo " -t Set the build target(chip). ex. 'esp32s3'"
3234 echo " -b Set the build type. ex. 'build' to build the project and prepare for uploading to a board"
3335 echo " ... Specify additional configs to be applied. ex. 'qio 80m' to compile for QIO Flash@80MHz. Requires -b"
3436 exit 1
3537}
3638
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
3840 case ${opt} in
3941 s )
4042 SKIP_ENV=1
@@ -58,6 +60,9 @@ while getopts ":A:I:i:c:t:b:sde" opt; do
5860 i )
5961 export IDF_COMMIT=" $OPTARG "
6062 ;;
63+ D )
64+ BUILD_DEBUG=" $OPTARG "
65+ ;;
6166 t )
6267 TARGET=$OPTARG
6368 ;;
@@ -107,16 +112,16 @@ else
107112 source ./tools/config.sh
108113fi
109114
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
112117fi
113118
114119if [ " $BUILD_TYPE " != " all" ]; then
115120 if [ " $TARGET " = " all" ]; then
116121 echo " ERROR: You need to specify target for non-default builds"
117122 print_help
118123 fi
119- configs=" configs/defconfig.common;configs/defconfig.$TARGET "
124+ configs=" configs/defconfig.common;configs/defconfig.$TARGET ;configs/defconfig.debug_ $BUILD_DEBUG "
120125
121126 # Target Features Configs
122127 for target_json in ` jq -c ' .targets[]' configs/builds.json` ; do
@@ -141,19 +146,7 @@ if [ "$BUILD_TYPE" != "all" ]; then
141146fi
142147
143148rm -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"
157150
158151# targets_count=`jq -c '.targets[] | length' configs/builds.json`
159152for 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
175168 echo " * Target: $target "
176169
177170 # 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 "
179172 for defconf in ` echo " $target_json " | jq -c ' .features[]' | tr -d ' "' ` ; do
180173 main_configs=" $main_configs ;configs/defconfig.$defconf "
181174 done
@@ -186,8 +179,8 @@ for target_json in `jq -c '.targets[]' configs/builds.json`; do
186179 idf_libs_configs=" $idf_libs_configs ;configs/defconfig.$defconf "
187180 done
188181
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
191184 fi
192185
193186 echo " * Build IDF-Libs: $idf_libs_configs "
@@ -215,8 +208,8 @@ for target_json in `jq -c '.targets[]' configs/builds.json`; do
215208 bootloader_configs=" $bootloader_configs ;configs/defconfig.$defconf " ;
216209 done
217210
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
220213 fi
221214
222215 echo " * Build BootLoader: $bootloader_configs "
@@ -232,8 +225,8 @@ for target_json in `jq -c '.targets[]' configs/builds.json`; do
232225 mem_configs=" $mem_configs ;configs/defconfig.$defconf " ;
233226 done
234227
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
237230 fi
238231
239232 echo " * Build Memory Variant: $mem_configs "
@@ -243,6 +236,37 @@ for target_json in `jq -c '.targets[]' configs/builds.json`; do
243236 done
244237done
245238
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+
246270# update package_esp32_index.template.json
247271if [ " $BUILD_TYPE " = " all" ]; then
248272 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