2021-06-21 00:56:37 -04:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
PYTHON3=python3
|
|
|
|
yaota8266=$HOME/yaota8266
|
|
|
|
|
|
|
|
# for debugging
|
|
|
|
#exec &> /tmp/esp-log-$$.txt
|
|
|
|
|
|
|
|
# function for building firmware
|
|
|
|
function do_build() {
|
|
|
|
descr=$1
|
|
|
|
board=$2
|
|
|
|
shift
|
|
|
|
shift
|
|
|
|
echo "building $descr $board"
|
2021-12-23 01:09:05 -05:00
|
|
|
build_dir=/tmp/esp8266-build-$board
|
2021-06-21 00:56:37 -04:00
|
|
|
$MICROPY_AUTOBUILD_MAKE $@ BOARD=$board BUILD=$build_dir || exit 1
|
|
|
|
mv $build_dir/firmware-combined.bin $dest_dir/$descr$fw_tag.bin
|
|
|
|
mv $build_dir/firmware.elf $dest_dir/$descr$fw_tag.elf
|
|
|
|
mv $build_dir/firmware.map $dest_dir/$descr$fw_tag.map
|
|
|
|
rm -rf $build_dir
|
|
|
|
}
|
|
|
|
|
|
|
|
function do_build_ota() {
|
|
|
|
descr=$1
|
|
|
|
board=$2
|
|
|
|
shift
|
|
|
|
shift
|
|
|
|
echo "building $descr $board"
|
2021-12-23 01:09:05 -05:00
|
|
|
build_dir=/tmp/esp8266-build-$board
|
2021-06-21 00:56:37 -04:00
|
|
|
$MICROPY_AUTOBUILD_MAKE $@ BOARD=$board BUILD=$build_dir || exit 1
|
|
|
|
cat $yaota8266/yaota8266.bin $build_dir/firmware-ota.bin > $dest_dir/$descr$fw_tag.bin
|
|
|
|
pushd $yaota8266/ota-client
|
2021-12-23 01:09:05 -05:00
|
|
|
$PYTHON3 ota_client.py sign $build_dir/firmware-ota.bin
|
2021-06-21 00:56:37 -04:00
|
|
|
popd
|
|
|
|
mv $build_dir/firmware-ota.bin.ota $dest_dir/$descr$fw_tag.ota
|
|
|
|
mv $build_dir/firmware.elf $dest_dir/$descr$fw_tag.elf
|
|
|
|
mv $build_dir/firmware.map $dest_dir/$descr$fw_tag.map
|
2021-12-23 01:09:05 -05:00
|
|
|
rm -rf $build_dir
|
2021-06-21 00:56:37 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
# check/get parameters
|
|
|
|
if [ $# != 2 ]; then
|
|
|
|
echo "usage: $0 <fw-tag> <dest-dir>"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
fw_tag=$1
|
|
|
|
dest_dir=$2
|
|
|
|
|
|
|
|
# check we are in the correct directory
|
|
|
|
if [ ! -r boards/esp8266_common.ld ]; then
|
|
|
|
echo "must be in esp8266 directory"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
# build the versions
|
|
|
|
do_build esp8266 GENERIC
|
|
|
|
do_build esp8266-512k GENERIC_512K
|
|
|
|
do_build esp8266-1m GENERIC_1M
|
2021-12-23 01:41:28 -05:00
|
|
|
do_build_ota esp8266-ota GENERIC_1M ota
|