123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960 |
- #!/bin/bash
- export VERSION=1
- export REV=07-05-2016
- set -e
- set +x
- ESC=$(echo -en \\0033)
- BOLD="$ESC[1m"
- OFF="$ESC[0m"
- bold() {
- echo "$BOLD$1$OFF"
- }
- fail() {
- bold "$@"
- exit 1
- }
- clean() { # Clean environement
- make clean
- #rm SimpleBGC_2_40b8+bootloader.zip
- }
- bootloader() { # Build bootloader only
- make MCU=atmega328p LED_START_FLASHES=3 BAUD_RATE=115200L LED_DATA_FLASH=1 atmega328
- }
- fusion() { # Build bootloader and fusion with SimpleBGC_2.40
- unzip SimpleBGC_2_40b8.zip
- srec_cat SimpleBGC_2_40b8.hex -intel optiboot_atmega328.hex -intel -o SimpleBGC_2_40b8+bootloader.hex -intel
- zip SimpleBGC_2_40b8+bootloader.zip SimpleBGC_2_40b8+bootloader.hex
- }
- flashboot() { # Build and flash bootloader only
- avrdude -c usbasp -p atmega328p -b19200 -e -u -U lock:w:0x3f:m -U efuse:w:0x05:m -U hfuse:w:0xDC:m -U lfuse:w:0xFF:m -U flash:w:optiboot_atmega328.hex -U lock:w:0x3f:m
- }
- flashall() { # Build fusion SimpleBGC and flash
- avrdude -c usbasp -p atmega328p -b19200 -e -u -U lock:w:0x3f:m -U efuse:w:0x05:m -U hfuse:w:0xDC:m -U lfuse:w:0xFF:m -U flash:w:SimpleBGC_2_40b8+bootloader.hex -U lock:w:0x3f:m
- }
- cd "$SRC_DIR"
- case "$1" in
- clean) clean;;
- bootloader) clean ; bootloader ;;
- fusion) clean ; bootloader ; fusion ;;
- flashboot) clean ; bootloader ; flashboot ;;
- flashfusion) clean; bootloader ; fusion ; flashall ;;
- *)
- echo >&2 "${BOLD}Mosbootloader v:$VERSION rev:$REV"
- echo >&2 "${BOLD}Usage: $0 (clean | bootloader | fusion | flashboot | flashfusion)$OFF"
- echo >&2
- echo >&2 "Build actions:"
- grep "() { #" $0 | grep -v grep | sort | sed -e "s:^: :" -e "s:() { #: @:" | while read i; do
- echo " " $(eval "echo $i") | tr @ \\t
- done
- exit 1
- ;;
- esac
|