#! /bin/bash # Detect attached pyboard variant build and deploy # Assumes only one device attached and that this will appear as /dev/pyboard (udev rule) # requires pyb_check # Also requires the pyboard.py utility to be on the path (micropython/tools/pyboard.py) MPDEVICE='/dev/pyboard' # Determine board type BOARD=$(pyb_check $MPDEVICE) # Check for user override of frozen directory if [ $FROZEN_DIR ] then echo Frozen modules located in $FROZEN_DIR else FROZEN_DIR='modules' fi if [ $BOARD ] then echo Building for $BOARD cd $MPDIR/ports/stm32 if [ $# -eq 1 ] && [ $1 = "--clean" ] then make BOARD=$BOARD clean fi if make -j 8 BOARD=$BOARD FROZEN_MPY_DIR=$FROZEN_DIR FROZEN_MANIFEST= && pyb_boot $MPDEVICE then sleep 1 make PYTHON=python3 BOARD=$BOARD FROZEN_MPY_DIR=$FROZEN_DIR FROZEN_MANIFEST= deploy else echo Build failure fi cd - else echo Incorrect board type fi