2021-06-21 05:56:37 +01:00
|
|
|
#!/bin/bash
|
|
|
|
#
|
|
|
|
# Build firmware for ports.
|
|
|
|
#
|
|
|
|
# Requirements:
|
|
|
|
# - All toolchains must be in path (arm-none-eabi-gcc, xtensa-lx106-elf)
|
2023-06-23 06:51:23 +01:00
|
|
|
# - IDF_PATH_V50 must be set
|
2021-06-21 05:56:37 +01:00
|
|
|
# - 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"
|
|
|
|
#
|
|
|
|
# Optional settings:
|
|
|
|
# - MICROPY_AUTOBUILD_REMOTE_MACHINE can be set to a remote ssh machine to copy files to
|
|
|
|
# - MICROPY_AUTOBUILD_REMOTE_DIR can be set to destination directory on remote machine
|
|
|
|
|
2023-06-23 06:51:23 +01:00
|
|
|
if [ ! -d "$IDF_PATH_V50" ]; then
|
|
|
|
echo "must set IDF_PATH_V50"
|
2021-06-21 05:56:37 +01:00
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ ! -d "$MICROPY_AUTOBUILD_MICROPYTHON_REPO" ]; then
|
|
|
|
echo "must set MICROPY_AUTOBUILD_MICROPYTHON_REPO"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ -z "$MICROPY_AUTOBUILD_MAKE" ]; then
|
|
|
|
echo "must set MICROPY_AUTOBUILD_MAKE"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
########################################
|
|
|
|
# Initialisation
|
|
|
|
|
|
|
|
# get directory of this script for access to other build scripts
|
|
|
|
AUTODIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
|
|
|
|
|
2021-11-05 00:02:30 +00:00
|
|
|
# source additional functions
|
|
|
|
source ${AUTODIR}/build-boards.sh
|
|
|
|
|
2021-06-21 05:56:37 +01:00
|
|
|
# make local directory to put firmware
|
|
|
|
LOCAL_FIRMWARE=/tmp/autobuild-firmware-$$
|
|
|
|
mkdir -p ${LOCAL_FIRMWARE}
|
|
|
|
|
|
|
|
# get latest MicroPython
|
|
|
|
git -C ${MICROPY_AUTOBUILD_MICROPYTHON_REPO} pull
|
|
|
|
git -C ${MICROPY_AUTOBUILD_MICROPYTHON_REPO} submodule update --init
|
|
|
|
git -C ${MICROPY_AUTOBUILD_MICROPYTHON_REPO}/lib/pico-sdk submodule update --init
|
|
|
|
|
|
|
|
########################################
|
|
|
|
# Build all firmware
|
|
|
|
|
|
|
|
pushd ${MICROPY_AUTOBUILD_MICROPYTHON_REPO}
|
|
|
|
|
|
|
|
# build cross compiler
|
|
|
|
make -C mpy-cross
|
|
|
|
|
|
|
|
# make the firmware tag
|
|
|
|
FW_DATE=$(date '+%Y%m%d')
|
|
|
|
FW_GIT="$(git describe --dirty || echo unknown)"
|
|
|
|
FW_TAG="-$FW_DATE-unstable-$FW_GIT"
|
|
|
|
|
|
|
|
# build new firmware
|
2021-11-21 03:54:55 +00:00
|
|
|
cd ports/cc3200
|
2021-06-21 05:56:37 +01:00
|
|
|
${AUTODIR}/build-cc3200-latest.sh ${FW_TAG} ${LOCAL_FIRMWARE}
|
|
|
|
cd ../esp8266
|
2023-08-15 15:51:37 +01:00
|
|
|
build_esp8266_boards ${FW_TAG} ${LOCAL_FIRMWARE}
|
2021-06-21 05:56:37 +01:00
|
|
|
cd ../esp32
|
2023-06-23 06:51:23 +01:00
|
|
|
(source ${IDF_PATH_V50}/export.sh && build_esp32_boards ${FW_TAG} ${LOCAL_FIRMWARE})
|
2021-06-23 20:18:45 +01:00
|
|
|
cd ../mimxrt
|
2021-11-05 00:02:30 +00:00
|
|
|
build_mimxrt_boards ${FW_TAG} ${LOCAL_FIRMWARE}
|
2022-07-12 21:48:39 +01:00
|
|
|
cd ../nrf
|
|
|
|
build_nrf_boards ${FW_TAG} ${LOCAL_FIRMWARE}
|
2022-05-06 09:15:21 +01:00
|
|
|
cd ../renesas-ra
|
|
|
|
build_renesas_ra_boards ${FW_TAG} ${LOCAL_FIRMWARE}
|
2021-11-05 00:02:30 +00:00
|
|
|
cd ../rp2
|
|
|
|
build_rp2_boards ${FW_TAG} ${LOCAL_FIRMWARE}
|
|
|
|
cd ../samd
|
|
|
|
build_samd_boards ${FW_TAG} ${LOCAL_FIRMWARE}
|
2021-11-21 03:54:55 +00:00
|
|
|
cd ../stm32
|
|
|
|
build_stm32_boards ${FW_TAG} ${LOCAL_FIRMWARE}
|
2021-06-21 05:56:37 +01:00
|
|
|
|
|
|
|
popd
|
|
|
|
|
|
|
|
########################################
|
|
|
|
# Copy firmware to remote machine
|
|
|
|
|
|
|
|
if [ -z "$MICROPY_AUTOBUILD_REMOTE_MACHINE" -o -z "$MICROPY_AUTOBUILD_REMOTE_DIR" ]; then
|
|
|
|
echo "No remote given, leaving firmware in ${LOCAL_FIRMWARE}"
|
|
|
|
exit 0
|
|
|
|
fi
|
|
|
|
|
|
|
|
# copy new firmware to remote machine
|
|
|
|
scp ${LOCAL_FIRMWARE}/* ${MICROPY_AUTOBUILD_REMOTE_MACHINE}:${MICROPY_AUTOBUILD_REMOTE_DIR}/
|
|
|
|
|
|
|
|
# remove old firmware
|
|
|
|
${AUTODIR}/remove_old_firmware.py ${MICROPY_AUTOBUILD_REMOTE_MACHINE} ${MICROPY_AUTOBUILD_REMOTE_DIR}
|
|
|
|
|
|
|
|
########################################
|
|
|
|
# Clean up
|
|
|
|
|
|
|
|
/bin/rm -v ${LOCAL_FIRMWARE}/*
|
|
|
|
/bin/rmdir ${LOCAL_FIRMWARE}
|