tools/autobuild: Automatically build all esp32 boards.
Any board with a board.json file will be built. ESP32-based boards will be built using the IDF at $IDF_PATH_V42, all other MCU variants (S2, S3, C3) will be built using the IDF at $IDF_PATH_V44. Signed-off-by: Damien George <damien@micropython.org>
This commit is contained in:
parent
c613f5bb49
commit
3f589e2f39
|
@ -5,7 +5,7 @@
|
||||||
# Requirements:
|
# Requirements:
|
||||||
# - All toolchains must be in path (arm-none-eabi-gcc, xtensa-lx106-elf)
|
# - All toolchains must be in path (arm-none-eabi-gcc, xtensa-lx106-elf)
|
||||||
# - IDF_PATH_V42 must be set
|
# - IDF_PATH_V42 must be set
|
||||||
# - IDF_PATH_V43 must be set
|
# - IDF_PATH_V44 must be set
|
||||||
# - MICROPY_AUTOBUILD_MICROPYTHON_REPO must be set to location of micropython repository
|
# - MICROPY_AUTOBUILD_MICROPYTHON_REPO must be set to location of micropython repository
|
||||||
# - MICROPY_AUTOBUILD_MAKE must be set to the make command to use, eg "make -j2"
|
# - MICROPY_AUTOBUILD_MAKE must be set to the make command to use, eg "make -j2"
|
||||||
#
|
#
|
||||||
|
@ -18,8 +18,8 @@ if [ ! -d "$IDF_PATH_V42" ]; then
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ ! -d "$IDF_PATH_V43" ]; then
|
if [ ! -d "$IDF_PATH_V44" ]; then
|
||||||
echo "must set IDF_PATH_V43"
|
echo "must set IDF_PATH_V44"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -70,9 +70,8 @@ ${AUTODIR}/build-cc3200-latest.sh ${FW_TAG} ${LOCAL_FIRMWARE}
|
||||||
cd ../esp8266
|
cd ../esp8266
|
||||||
${AUTODIR}/build-esp8266-latest.sh ${FW_TAG} ${LOCAL_FIRMWARE}
|
${AUTODIR}/build-esp8266-latest.sh ${FW_TAG} ${LOCAL_FIRMWARE}
|
||||||
cd ../esp32
|
cd ../esp32
|
||||||
${AUTODIR}/build-esp32-latest.sh ${IDF_PATH_V42} ${FW_TAG} ${LOCAL_FIRMWARE}
|
(source ${IDF_PATH_V42}/export.sh && build_esp32_boards ${FW_TAG} ${LOCAL_FIRMWARE})
|
||||||
${AUTODIR}/build-esp32-latest.sh ${IDF_PATH_V43} ${FW_TAG} ${LOCAL_FIRMWARE}
|
(source ${IDF_PATH_V44}/export.sh && build_esp32_boards ${FW_TAG} ${LOCAL_FIRMWARE})
|
||||||
|
|
||||||
cd ../mimxrt
|
cd ../mimxrt
|
||||||
build_mimxrt_boards ${FW_TAG} ${LOCAL_FIRMWARE}
|
build_mimxrt_boards ${FW_TAG} ${LOCAL_FIRMWARE}
|
||||||
cd ../rp2
|
cd ../rp2
|
||||||
|
|
|
@ -6,53 +6,111 @@
|
||||||
# $ source build-boards.sh
|
# $ source build-boards.sh
|
||||||
# $ MICROPY_AUTOBUILD_MAKE=make build_rp2_boards -latest /tmp
|
# $ MICROPY_AUTOBUILD_MAKE=make build_rp2_boards -latest /tmp
|
||||||
|
|
||||||
function build_boards {
|
function build_board {
|
||||||
# check/get parameters
|
# check/get parameters
|
||||||
if [ $# -lt 4 ]; then
|
if [ $# -lt 4 ]; then
|
||||||
echo "usage: $0 <fw-tag> <dest-dir> <check-file> <exts...>"
|
echo "usage: $0 <board-json-file> <fw-tag> <dest-dir> <exts...>"
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
fw_tag=$1
|
board_json=$1
|
||||||
dest_dir=$2
|
fw_tag=$2
|
||||||
check_file=$3
|
dest_dir=$3
|
||||||
shift
|
shift
|
||||||
shift
|
shift
|
||||||
shift
|
shift
|
||||||
|
|
||||||
|
board=$(echo $board_json | awk -F '/' '{ print $2 }')
|
||||||
|
descr=$(cat $board_json | python3 -c "import json,sys; print(json.load(sys.stdin).get('id', '$board'))")
|
||||||
|
build_dir=/tmp/micropython-build-$board
|
||||||
|
|
||||||
|
echo "building $descr $board"
|
||||||
|
$MICROPY_AUTOBUILD_MAKE BOARD=$board BUILD=$build_dir && (
|
||||||
|
for ext in $@; do
|
||||||
|
dest=$dest_dir/$descr$fw_tag.$ext
|
||||||
|
if [ -r $build_dir/firmware.$ext ]; then
|
||||||
|
mv $build_dir/firmware.$ext $dest
|
||||||
|
else
|
||||||
|
# esp32 has micropython.elf and micropython.map
|
||||||
|
mv $build_dir/micropython.$ext $dest
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
)
|
||||||
|
rm -rf $build_dir
|
||||||
|
}
|
||||||
|
|
||||||
|
function build_boards {
|
||||||
|
# check/get parameters
|
||||||
|
if [ $# -lt 4 ]; then
|
||||||
|
echo "usage: $0 <check-file> <fw-tag> <dest-dir> <exts...>"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
check_file=$1
|
||||||
|
shift
|
||||||
|
|
||||||
# check we are in the correct directory
|
# check we are in the correct directory
|
||||||
if [ ! -r $check_file ]; then
|
if [ ! -r $check_file ]; then
|
||||||
echo "must be in directory containing $check_file"
|
echo "must be in directory containing $check_file"
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# build all boards that have a board.json file
|
||||||
for board_json in $(find boards/ -name board.json | sort); do
|
for board_json in $(find boards/ -name board.json | sort); do
|
||||||
board=$(echo $board_json | awk -F '/' '{ print $2 }')
|
build_board $board_json $@
|
||||||
descr=$(cat $board_json | python3 -c "import json,sys; print(json.load(sys.stdin).get('id', '$board'))")
|
done
|
||||||
build_dir=/tmp/micropython-build-$board
|
}
|
||||||
|
|
||||||
echo "building $descr $board"
|
function build_esp32_boards {
|
||||||
$MICROPY_AUTOBUILD_MAKE BOARD=$board BUILD=$build_dir && (
|
# check/get parameters
|
||||||
for ext in $@; do
|
if [ $# != 2 ]; then
|
||||||
mv $build_dir/firmware.$ext $dest_dir/$descr$fw_tag.$ext
|
echo "usage: $0 <fw-tag> <dest-dir>"
|
||||||
done
|
return 1
|
||||||
)
|
fi
|
||||||
rm -rf $build_dir
|
|
||||||
|
fw_tag=$1
|
||||||
|
dest_dir=$2
|
||||||
|
|
||||||
|
# check we are in the correct directory
|
||||||
|
if [ ! -r modesp32.c ]; then
|
||||||
|
echo "must be in esp32 directory"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# build the boards, based on the IDF version
|
||||||
|
for board_json in $(find boards/ -name board.json | sort); do
|
||||||
|
mcu=$(cat $board_json | python3 -c "import json,sys; print(json.load(sys.stdin).get('mcu', 'unknown'))")
|
||||||
|
if idf.py --version | grep -q v4.2; then
|
||||||
|
if [ $mcu = esp32 ]; then
|
||||||
|
# build standard esp32-based boards with IDF v4.2
|
||||||
|
if echo $board_json | grep -q GENERIC; then
|
||||||
|
# traditionally, GENERIC and GENERIC_SPIRAM boards used manifest_release.py
|
||||||
|
MICROPY_AUTOBUILD_MAKE="$MICROPY_AUTOBUILD_MAKE FROZEN_MANIFEST=$(pwd)/boards/manifest_release.py" build_board $board_json $fw_tag $dest_dir bin elf map
|
||||||
|
else
|
||||||
|
build_board $board_json $fw_tag $dest_dir bin elf map
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
if [ $mcu != esp32 ]; then
|
||||||
|
# build esp32-s2/s3/c3 based boards with IDF v4.4+
|
||||||
|
build_board $board_json $fw_tag $dest_dir bin elf map
|
||||||
|
fi
|
||||||
|
fi
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
function build_mimxrt_boards {
|
function build_mimxrt_boards {
|
||||||
build_boards $1 $2 modmimxrt.c bin hex
|
build_boards modmimxrt.c $1 $2 bin hex
|
||||||
}
|
}
|
||||||
|
|
||||||
function build_rp2_boards {
|
function build_rp2_boards {
|
||||||
build_boards $1 $2 modrp2.c uf2
|
build_boards modrp2.c $1 $2 uf2
|
||||||
}
|
}
|
||||||
|
|
||||||
function build_samd_boards {
|
function build_samd_boards {
|
||||||
build_boards $1 $2 samd_soc.c uf2
|
build_boards samd_soc.c $1 $2 uf2
|
||||||
}
|
}
|
||||||
|
|
||||||
function build_stm32_boards {
|
function build_stm32_boards {
|
||||||
build_boards $1 $2 modpyb.c dfu hex
|
build_boards modpyb.c $1 $2 dfu hex
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,54 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
#
|
|
||||||
# Build esp32 port
|
|
||||||
|
|
||||||
# for debugging
|
|
||||||
#exec &> /tmp/esp-log-$$.txt
|
|
||||||
|
|
||||||
# function for building firmware
|
|
||||||
function do_build() {
|
|
||||||
descr=$1
|
|
||||||
board=$2
|
|
||||||
shift
|
|
||||||
shift
|
|
||||||
echo "building $descr $board"
|
|
||||||
build_dir=/tmp/esp32-build-$board
|
|
||||||
rm -rf $build_dir # be sure we don't have anything leftover from a previous build
|
|
||||||
make $@ BOARD=$board BUILD=$build_dir || exit 1
|
|
||||||
mv $build_dir/firmware.bin $dest_dir/$descr$fw_tag.bin
|
|
||||||
mv $build_dir/micropython.elf $dest_dir/$descr$fw_tag.elf
|
|
||||||
mv $build_dir/micropython.map $dest_dir/$descr$fw_tag.map
|
|
||||||
rm -rf $build_dir
|
|
||||||
}
|
|
||||||
|
|
||||||
# check/get parameters
|
|
||||||
if [ $# != 3 ]; then
|
|
||||||
echo "usage: $0 <idf-path> <fw-tag> <dest-dir>"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
idf_path=$1
|
|
||||||
fw_tag=$2
|
|
||||||
dest_dir=$3
|
|
||||||
|
|
||||||
# check we are in the correct directory
|
|
||||||
if [ ! -r modesp32.c ]; then
|
|
||||||
echo "must be in esp32 directory"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
source $idf_path/export.sh
|
|
||||||
|
|
||||||
# build the boards, based on the IDF version
|
|
||||||
if idf.py --version | grep -q v4.2; then
|
|
||||||
do_build esp32 GENERIC FROZEN_MANIFEST=$(pwd)/boards/manifest_release.py
|
|
||||||
do_build esp32spiram GENERIC_SPIRAM FROZEN_MANIFEST=$(pwd)/boards/manifest_release.py
|
|
||||||
do_build tinypico UM_TINYPICO
|
|
||||||
do_build wesp32 SIL_WESP32
|
|
||||||
else
|
|
||||||
do_build esp32c3 GENERIC_C3
|
|
||||||
do_build esp32c3usb GENERIC_C3_USB
|
|
||||||
do_build tinys2 UM_TINYS2
|
|
||||||
do_build featherS2 UM_FEATHERS2
|
|
||||||
do_build featherS2neo UM_FEATHERS2NEO
|
|
||||||
fi
|
|
Loading…
Reference in New Issue