2016-11-26 14:03:24 +00:00
|
|
|
#! /bin/bash
|
2016-11-27 13:49:44 +00:00
|
|
|
# Detect attached pyboard variant build and deploy
|
|
|
|
# Assumes only one device attached and that this will appear as /dev/pyboard (udev rule)
|
2016-11-26 14:03:24 +00:00
|
|
|
# requires pyb_check
|
2016-11-27 13:49:44 +00:00
|
|
|
# Also requires the pyboard.py utility to be on the path (micropython/tools/pyboard.py)
|
2016-11-26 14:03:24 +00:00
|
|
|
|
2016-12-01 17:21:11 +00:00
|
|
|
MPDEVICE='/dev/pyboard'
|
|
|
|
|
|
|
|
# Determine board type
|
2016-11-26 14:03:24 +00:00
|
|
|
BOARD=""
|
2016-12-01 17:21:11 +00:00
|
|
|
if pyb_check $MPDEVICE PYBV11
|
2016-11-26 14:03:24 +00:00
|
|
|
then
|
|
|
|
BOARD="PYBV11"
|
|
|
|
fi
|
2016-12-01 17:21:11 +00:00
|
|
|
if pyb_check $MPDEVICE PYBV10
|
2016-11-26 14:03:24 +00:00
|
|
|
then
|
|
|
|
BOARD="PYBV10"
|
|
|
|
fi
|
2016-12-01 17:21:11 +00:00
|
|
|
if pyb_check $MPDEVICE PYBLITEV10
|
2016-11-26 14:03:24 +00:00
|
|
|
then
|
|
|
|
BOARD="PYBLITEV10"
|
|
|
|
fi
|
2016-11-27 13:49:44 +00:00
|
|
|
echo Building for $BOARD
|
2016-11-26 14:03:24 +00:00
|
|
|
|
2016-12-01 17:21:11 +00:00
|
|
|
# Check for user override of frozen directory
|
|
|
|
if [ $FROZEN_DIR ]
|
|
|
|
then
|
|
|
|
echo Frozen modules located in $FROZEN_DIR
|
|
|
|
else
|
|
|
|
FROZEN_DIR='modules'
|
|
|
|
fi
|
|
|
|
|
2016-11-26 14:03:24 +00:00
|
|
|
if [ $BOARD ]
|
|
|
|
then
|
2017-09-08 10:27:41 +00:00
|
|
|
cd $MPDIR/ports/stm32
|
2016-11-26 14:03:24 +00:00
|
|
|
if [ $# -eq 1 ] && [ $1 = "--clean" ]
|
|
|
|
then
|
|
|
|
make BOARD=$BOARD clean
|
|
|
|
fi
|
2016-12-01 17:21:11 +00:00
|
|
|
if make -j 8 BOARD=$BOARD FROZEN_MPY_DIR=$FROZEN_DIR && pyb_boot $MPDEVICE
|
2016-11-26 14:03:24 +00:00
|
|
|
then
|
|
|
|
sleep 1
|
2016-12-01 17:21:11 +00:00
|
|
|
make BOARD=$BOARD deploy
|
2016-11-26 14:03:24 +00:00
|
|
|
cd -
|
|
|
|
sleep 1
|
|
|
|
rshell
|
|
|
|
else
|
|
|
|
echo Build failure
|
|
|
|
fi
|
|
|
|
else
|
|
|
|
echo Incorrect board type
|
|
|
|
fi
|
|
|
|
|