@@ -20,51 +20,38 @@ export IDF_COMPONENT_OVERWRITE_MANAGED_COMPONENTS=1
2020
2121CCACHE_ENABLE=1
2222
23- TARGET=" all"
23+ export TARGET=" all"
2424BUILD_TYPE=" all"
25- BUILD_DEBUG=" default"
2625SKIP_ENV=0
2726COPY_OUT=0
28- ARCHIVE_OUT=0
29- if [ -z $DEPLOY_OUT ]; then
30- DEPLOY_OUT=0
31- fi
27+ ARCHIVE_OUT=1
28+ DEPLOY_OUT=0
3229
3330function print_help() {
34- echo " Usage: build.sh [-s] [-n] [-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 ...]"
31+ echo " Usage: build.sh [-s] [-n] [-A <arduino_branch>] [-I <idf_branch>] [-i <idf_commit>] [-c <path>] [-t <target>] [-b <build|menuconfig|reconfigure|idf-libs|copy-bootloader|mem-variant>] [config ...]"
3532 echo " -s Skip installing/updating of ESP-IDF and all components"
3633 echo " -n Disable ccache"
3734 echo " -A Set which branch of arduino-esp32 to be used for compilation"
3835 echo " -I Set which branch of ESP-IDF to be used for compilation"
3936 echo " -i Set which commit of ESP-IDF to be used for compilation"
4037 echo " -e Archive the build to dist"
41- echo " -d Deploy the build to github arduino-esp32"
42- echo " -D Debug level to be set to ESP-IDF. One of default,none,error,warning,info,debug or verbose"
43- echo " -c Set the arduino-esp32 folder to copy the result to. ex. '$HOME /Arduino/hardware/espressif/esp32'"
4438 echo " -t Set the build target(chip) ex. 'esp32s3' or select multiple targets(chips) by separating them with comma ex. 'esp32,esp32s3,esp32c3'"
4539 echo " -b Set the build type. ex. 'build' to build the project and prepare for uploading to a board"
4640 echo " ... Specify additional configs to be applied. ex. 'qio 80m' to compile for QIO Flash@80MHz. Requires -b"
4741 exit 1
4842}
4943
50- while getopts " :A:I:i:c:t:b:D: sde" opt; do
44+ while getopts " :A:I:i:c:t:b:sde" opt; do
5145 case ${opt} in
5246 s )
5347 SKIP_ENV=1
5448 ;;
5549 n )
5650 CCACHE_ENABLE=0
5751 ;;
58- d )
59- DEPLOY_OUT=1
60- ;;
6152 e )
6253 ARCHIVE_OUT=1
6354 ;;
64- c )
65- export ESP32_ARDUINO=" $OPTARG "
66- COPY_OUT=1
67- ;;
6855 A )
6956 export AR_BRANCH=" $OPTARG "
7057 ;;
@@ -74,19 +61,16 @@ while getopts ":A:I:i:c:t:b:D:sde" opt; do
7461 i )
7562 export IDF_COMMIT=" $OPTARG "
7663 ;;
77- D )
78- BUILD_DEBUG=" $OPTARG "
79- ;;
8064 t )
8165 IFS=' ,' read -ra TARGET <<< " $OPTARG"
8266 ;;
8367 b )
8468 b=$OPTARG
85- if [ " $b " != " build" ] &&
86- [ " $b " != " menuconfig" ] &&
87- [ " $b " != " reconfigure" ] &&
88- [ " $b " != " idf-libs" ] &&
89- [ " $b " != " copy-bootloader" ] &&
69+ if [ " $b " != " build" ] &&
70+ [ " $b " != " menuconfig" ] &&
71+ [ " $b " != " reconfigure" ] &&
72+ [ " $b " != " idf-libs" ] &&
73+ [ " $b " != " copy-bootloader" ] &&
9074 [ " $b " != " mem-variant" ]; then
9175 print_help
9276 fi
@@ -111,6 +95,7 @@ export IDF_CCACHE_ENABLE=$CCACHE_ENABLE
11195echo " TARGET(s): ${TARGET[@]} "
11296
11397mkdir -p dist
98+ rm -rf dependencies.lock
11499
115100if [ $SKIP_ENV -eq 0 ]; then
116101 echo " * Installing/Updating ESP-IDF and all components..."
@@ -155,7 +140,7 @@ if [ "$BUILD_TYPE" != "all" ]; then
155140 continue
156141 fi
157142
158- configs=" configs/defconfig.common;configs/defconfig.$target ;configs/defconfig.debug_ $BUILD_DEBUG "
143+ configs=" configs/defconfig.common;configs/defconfig.$target "
159144 for defconf in ` echo " $target_json " | jq -c ' .features[]' | tr -d ' "' ` ; do
160145 configs=" $configs ;configs/defconfig.$defconf "
161146 done
178163rm -rf build sdkconfig out
179164mkdir -p " $AR_TOOLS /esp32-arduino-libs"
180165
166+ # Add release-info
167+ rm -rf release-info.txt
168+ IDF_Commit_short=$( git -C " $IDF_PATH " rev-parse --short HEAD || echo " " )
169+ AR_Commit_short=$( git -C " $AR_COMPS /arduino" rev-parse --short HEAD || echo " " )
170+ echo " Framework built from
171+ - $IDF_REPO branch [$IDF_BRANCH ](https://github.com/$IDF_REPO /tree/$IDF_BRANCH ) commit [$IDF_Commit_short ](https://github.com/$IDF_REPO /commits/$IDF_BRANCH /#:~:text=$IDF_Commit_short )
172+ - $AR_REPO branch [$AR_BRANCH ](https://github.com/$AR_REPO /tree/$AR_BRANCH ) commit [$AR_Commit_short ](https://github.com/$AR_REPO /commits/$AR_BRANCH /#:~:text=$AR_Commit_short )
173+ - Arduino lib builder branch: $GIT_BRANCH " >> release-info.txt
174+
181175# targets_count=`jq -c '.targets[] | length' configs/builds.json`
182176for target_json in ` jq -c ' .targets[]' configs/builds.json` ; do
183177 target=$( echo " $target_json " | jq -c ' .target' | tr -d ' "' )
@@ -210,7 +204,7 @@ for target_json in `jq -c '.targets[]' configs/builds.json`; do
210204 echo " * Target: $target "
211205
212206 # Build Main Configs List
213- main_configs=" configs/defconfig.common;configs/defconfig.$target ;configs/defconfig.debug_ $BUILD_DEBUG "
207+ main_configs=" configs/defconfig.common;configs/defconfig.$target "
214208 for defconf in ` echo " $target_json " | jq -c ' .features[]' | tr -d ' "' ` ; do
215209 main_configs=" $main_configs ;configs/defconfig.$defconf "
216210 done
@@ -226,19 +220,6 @@ for target_json in `jq -c '.targets[]' configs/builds.json`; do
226220 idf.py -DIDF_TARGET=" $target " -DSDKCONFIG_DEFAULTS=" $idf_libs_configs " idf-libs
227221 if [ $? -ne 0 ]; then exit 1; fi
228222
229- if [ " $target " == " esp32s3" ]; then
230- idf.py -DIDF_TARGET=" $target " -DSDKCONFIG_DEFAULTS=" $idf_libs_configs " srmodels_bin
231- if [ $? -ne 0 ]; then exit 1; fi
232- AR_SDK=" $AR_TOOLS /esp32-arduino-libs/$target "
233- # sr model.bin
234- if [ -f " build/srmodels/srmodels.bin" ]; then
235- echo " $AR_SDK /esp_sr"
236- mkdir -p " $AR_SDK /esp_sr"
237- cp -f " build/srmodels/srmodels.bin" " $AR_SDK /esp_sr/"
238- cp -f " partitions.csv" " $AR_SDK /esp_sr/"
239- fi
240- fi
241-
242223 # Build Bootloaders
243224 for boot_conf in ` echo " $target_json " | jq -c ' .bootloaders[]' ` ; do
244225 bootloader_configs=" $main_configs "
@@ -297,42 +278,33 @@ for component in `ls "$AR_MANAGED_COMPS"`; do
297278 fi
298279done
299280
300- # update package_esp32_index.template.json
301- if [ " $BUILD_TYPE " = " all" ]; then
302- echo " * Generating package_esp32_index.template.json..."
303- python3 ./tools/gen_tools_json.py -i " $IDF_PATH " -j " $AR_COMPS /arduino/package/package_esp32_index.template.json" -o " $AR_OUT /"
304- python3 ./tools/gen_tools_json.py -i " $IDF_PATH " -o " $TOOLS_JSON_OUT /"
305- if [ $? -ne 0 ]; then exit 1; fi
306- fi
281+ export IDF_COMMIT=$( git -C " $IDF_PATH " rev-parse --short HEAD)
307282
308- # Generate PlatformIO manifest file
283+ # Generate PlatformIO library manifest file
309284if [ " $BUILD_TYPE " = " all" ]; then
310- echo " * Generating PlatformIO manifest file..."
311- pushd $IDF_PATH
312- ibr=$( git describe --all 2> /dev/null)
313- ic=$( git -C " $IDF_PATH " rev-parse --short HEAD)
314- popd
315- python3 ./tools/gen_platformio_manifest.py -o " $TOOLS_JSON_OUT /" -s " $ibr " -c " $ic "
285+ python3 ./tools/gen_pio_lib_manifest.py -o " $TOOLS_JSON_OUT /" -s " v$IDF_VERSION " -c " $IDF_COMMIT "
316286 if [ $? -ne 0 ]; then exit 1; fi
317287fi
318288
319- # copy everything to arduino-esp32 installation
320- if [ $COPY_OUT -eq 1 ] && [ -d " $ESP32_ARDUINO " ]; then
321- echo " * Copying to Arduino..."
322- ./tools/copy-to-arduino.sh
323- if [ $? -ne 0 ]; then exit 1; fi
324- fi
289+ AR_VERSION=$( jq -c ' .version' " $AR_COMPS /arduino/package.json" | tr -d ' "' )
290+ AR_VERSION_UNDERSCORE=` echo " $AR_VERSION " | tr . _`
325291
326- # push changes to esp32-arduino-libs and create pull request into arduino-esp32
327- if [ $DEPLOY_OUT -eq 1 ] ; then
328- echo " * Pushing to Arduino... "
329- ./tools/push-to-arduino.sh
292+ # Generate PlatformIO framework manifest file
293+ rm -rf " $AR_ROOT /package.json "
294+ if [ " $BUILD_TYPE " = " all " ] ; then
295+ python3 ./tools/gen_pio_frmwk_manifest.py -o " $AR_ROOT / " -s " v $AR_VERSION " -c " $IDF_COMMIT "
330296 if [ $? -ne 0 ]; then exit 1; fi
331297fi
332298
299+ # Generate core_version.h
300+ rm -rf " $AR_ROOT /core_version.h"
301+ echo " #define ARDUINO_ESP32_GIT_VER 0x$AR_Commit_short
302+ #define ARDUINO_ESP32_GIT_DESC $AR_VERSION
303+ #define ARDUINO_ESP32_RELEASE_$AR_VERSION_UNDERSCORE
304+ #define ARDUINO_ESP32_RELEASE \" $AR_VERSION_UNDERSCORE \" " >> " $AR_ROOT /core_version.h"
305+
333306# archive the build
334307if [ $ARCHIVE_OUT -eq 1 ]; then
335- echo " * Archiving build..."
336308 ./tools/archive-build.sh " $TARGET "
337309 if [ $? -ne 0 ]; then exit 1; fi
338310fi
0 commit comments