1#!/bin/bash
2
3# function for building firmware
4function do_build() {
5    descr=$1
6    board=$2
7    shift
8    shift
9    echo "building $descr $board"
10    build_dir=/tmp/cc3200-build-$board
11    $MICROPY_AUTOBUILD_MAKE $@ BTARGET=application BOARD=$board BUILD=$build_dir || exit 1
12    zip $dest_dir/$descr$fw_tag.zip $build_dir/mcuimg.bin
13    rm -rf $build_dir
14}
15
16# check/get parameters
17if [ $# != 2 ]; then
18    echo "usage: $0 <fw-tag> <dest-dir>"
19    exit 1
20fi
21
22fw_tag=$1
23dest_dir=$2
24
25# check we are in the correct directory
26if [ ! -r application.mk ]; then
27    echo "must be in cc3200 directory"
28    exit 1
29fi
30
31# build the versions
32do_build wipy WIPY
33