esp8266: Add board variant support.

This merges the existing GENERIC, GENERIC_1M, and GENERIC_512k boards
into variants of the new ESP8266_GENERIC board (renamed from GENERIC so
as not to clash with other ports).

Also moves the generation of the "OTA" variant (previously generated by
autobuild/build-esp8266-latest.sh) into the variant.

Following the convention established for the WEACTSTUDIO rp2 board, the
names of the variants are FLASH_1M and FLASH_512K (but rename the .ld files
to use MiB and kiB).

Updates autobuild to build esp8266 firmware the same way as other ports.
This requires renaming the output from firmware-combined.bin to just
firmware.bin.

This work was funded through GitHub Sponsors.

Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
This commit is contained in:
Jim Mussared
2023-08-16 00:51:37 +10:00
parent aa23698119
commit ef03ca8bf2
28 changed files with 179 additions and 201 deletions

View File

@@ -62,7 +62,7 @@ FW_TAG="-$FW_DATE-unstable-$FW_GIT"
cd ports/cc3200
${AUTODIR}/build-cc3200-latest.sh ${FW_TAG} ${LOCAL_FIRMWARE}
cd ../esp8266
${AUTODIR}/build-esp8266-latest.sh ${FW_TAG} ${LOCAL_FIRMWARE}
build_esp8266_boards ${FW_TAG} ${LOCAL_FIRMWARE}
cd ../esp32
(source ${IDF_PATH_V50}/export.sh && build_esp32_boards ${FW_TAG} ${LOCAL_FIRMWARE})
cd ../mimxrt

View File

@@ -92,6 +92,10 @@ function build_esp32_boards {
build_boards modesp32.c $1 $2 bin elf map uf2 app-bin
}
function build_esp8266_boards {
build_boards modesp.c $1 $2 bin elf map
}
function build_mimxrt_boards {
build_boards modmimxrt.c $1 $2 bin hex
}

View File

@@ -1,61 +0,0 @@
#!/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"
build_dir=/tmp/esp8266-build-$board
$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"
build_dir=/tmp/esp8266-build-$board
$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
$PYTHON3 ota_client.py sign $build_dir/firmware-ota.bin
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
rm -rf $build_dir
}
# 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
do_build_ota esp8266-ota GENERIC_1M ota