stm32: Move board variant config to mpconfigboard.mk.

Rather than having the autobuild know about the particular variants, have
the mpconfigboard.mk describe them and make autobuild discover them
automatically.

Adds a "query-variants" target to stm32/Makefile to allow the set of
possible variants to be queried.

Removes pybv3 from the autobuild as this isn't use by the downloads page.

Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
This commit is contained in:
Jim Mussared 2022-08-15 16:20:40 +10:00
parent 923375380b
commit 492ba5eaf2
5 changed files with 79 additions and 21 deletions

View File

@ -37,6 +37,9 @@ include $(TOP)/extmod/extmod.mk
GIT_SUBMODULES += lib/libhydrogen lib/lwip lib/mbedtls lib/stm32lib
query-variants:
$(ECHO) "VARIANTS:" $(BOARD_VARIANTS)
LD_DIR=boards
USBDEV_DIR=usbdev
#USBHOST_DIR=usbhost

View File

@ -4,3 +4,24 @@ AF_FILE = boards/stm32f411_af.csv
LD_FILES = boards/stm32f411.ld boards/common_ifs.ld
TEXT0_ADDR = 0x08000000
TEXT1_ADDR = 0x08020000
# Provide different variants for the downloads page.
BOARD_VARIANTS += "dp thread dp-thread network"
ifeq ($(BOARD_VARIANT),"dp")
MICROPY_FLOAT_IMPL=double
endif
ifeq ($(BOARD_VARIANT),"thread")
CFLAGS += -DMICROPY_PY_THREAD=1
endif
ifeq ($(BOARD_VARIANT),"dp-thread")
MICROPY_FLOAT_IMPL=double
CFLAGS += -DMICROPY_PY_THREAD=1
endif
ifeq ($(BOARD_VARIANT),"network")
MICROPY_PY_NETWORK_WIZNET5K=5200
MICROPY_PY_CC3K=1
endif

View File

@ -14,3 +14,24 @@ endif
# MicroPython settings
MICROPY_VFS_LFS2 = 1
# Provide different variants for the downloads page.
BOARD_VARIANTS += "dp thread dp-thread network"
ifeq ($(BOARD_VARIANT),"dp")
MICROPY_FLOAT_IMPL=double
endif
ifeq ($(BOARD_VARIANT),"thread")
CFLAGS += -DMICROPY_PY_THREAD=1
endif
ifeq ($(BOARD_VARIANT),"dp-thread")
MICROPY_FLOAT_IMPL=double
CFLAGS += -DMICROPY_PY_THREAD=1
endif
ifeq ($(BOARD_VARIANT),"network")
MICROPY_PY_NETWORK_WIZNET5K=5200
MICROPY_PY_CC3K=1
endif

View File

@ -14,3 +14,24 @@ endif
# MicroPython settings
MICROPY_VFS_LFS2 = 1
# Provide different variants for the downloads page.
BOARD_VARIANTS += "dp thread dp-thread network"
ifeq ($(BOARD_VARIANT),"dp")
MICROPY_FLOAT_IMPL=double
endif
ifeq ($(BOARD_VARIANT),"thread")
CFLAGS += -DMICROPY_PY_THREAD=1
endif
ifeq ($(BOARD_VARIANT),"dp-thread")
MICROPY_FLOAT_IMPL=double
CFLAGS += -DMICROPY_PY_THREAD=1
endif
ifeq ($(BOARD_VARIANT),"network")
MICROPY_PY_NETWORK_WIZNET5K=5200
MICROPY_PY_CC3K=1
endif

View File

@ -7,12 +7,15 @@ function do_build() {
board=$2
shift
shift
echo "building $descr $board"
build_dir=/tmp/stm-build-$board
$MICROPY_AUTOBUILD_MAKE $@ BOARD=$board BUILD=$build_dir || exit 1
mv $build_dir/firmware.dfu $dest_dir/$descr$fw_tag.dfu
mv $build_dir/firmware.hex $dest_dir/$descr$fw_tag.hex
rm -rf $build_dir
for variant in `$MICROPY_AUTOBUILD_MAKE BOARD=$board query-variants | grep VARIANTS: | cut -d' ' -f2-`; do
target=$descr-$variant
echo "building $target $board"
build_dir=/tmp/stm-build-$board
$MICROPY_AUTOBUILD_MAKE $@ BOARD=$board BOARD_VARIANT=$variant BUILD=$build_dir || exit 1
mv $build_dir/firmware.dfu $dest_dir/$target$fw_tag.dfu
mv $build_dir/firmware.hex $dest_dir/$target$fw_tag.hex
rm -rf $build_dir
done
}
# check/get parameters
@ -30,18 +33,7 @@ if [ ! -r modpyb.c ]; then
exit 1
fi
# build the versions
do_build pybv3 PYBV3
do_build pybv3-network PYBV3 MICROPY_PY_NETWORK_WIZNET5K=5200 MICROPY_PY_CC3K=1
do_build pybv10-dp PYBV10 MICROPY_FLOAT_IMPL=double
do_build pybv10-thread PYBV10 CFLAGS_EXTRA='-DMICROPY_PY_THREAD=1'
do_build pybv10-dp-thread PYBV10 MICROPY_FLOAT_IMPL=double CFLAGS_EXTRA='-DMICROPY_PY_THREAD=1'
do_build pybv10-network PYBV10 MICROPY_PY_NETWORK_WIZNET5K=5200 MICROPY_PY_CC3K=1
do_build pybv11-dp PYBV11 MICROPY_FLOAT_IMPL=double
do_build pybv11-thread PYBV11 CFLAGS_EXTRA='-DMICROPY_PY_THREAD=1'
do_build pybv11-dp-thread PYBV11 MICROPY_FLOAT_IMPL=double CFLAGS_EXTRA='-DMICROPY_PY_THREAD=1'
do_build pybv11-network PYBV11 MICROPY_PY_NETWORK_WIZNET5K=5200 MICROPY_PY_CC3K=1
do_build pyblitev10-dp PYBLITEV10 MICROPY_FLOAT_IMPL=double
do_build pyblitev10-thread PYBLITEV10 CFLAGS_EXTRA='-DMICROPY_PY_THREAD=1'
do_build pyblitev10-dp-thread PYBLITEV10 MICROPY_FLOAT_IMPL=double CFLAGS_EXTRA='-DMICROPY_PY_THREAD=1'
do_build pyblitev10-network PYBLITEV10 MICROPY_PY_NETWORK_WIZNET5K=5200 MICROPY_PY_CC3K=1
# build the variants for each board
do_build pybv10 PYBV10
do_build pybv11 PYBV11
do_build pyblitev10 PYBLITEV10