diff options
Diffstat (limited to '')
| -rwxr-xr-x | bin/build.sh | 31 | ||||
| -rwxr-xr-x | bin/dfp-install.sh | 36 |
2 files changed, 54 insertions, 13 deletions
diff --git a/bin/build.sh b/bin/build.sh index 8743260..50f93b7 100755 --- a/bin/build.sh +++ b/bin/build.sh @@ -13,6 +13,9 @@ if [ -z "$1" ]; then exit fi +# repo root dir +BASEDIR=$(dirname $(dirname "$0")) + TARGET=$1 ; shift UI=$(basename $TARGET .h) MODEL=$(dirname $TARGET) @@ -24,24 +27,26 @@ MODEL_NUMBER=$(head -1 $MODEL/model) # figure out the MCU type and set some vars eval $( bin/detect-mcu.sh "$TARGET" ) -# TODO: add support for AVR DD -# give a more useful error message when AVR DFP is needed but not installed -# (Atmel ATtiny device family pack, for attiny1616 support) -# http://packs.download.atmel.com/ -#if [ -z "$ATTINY_DFP" ]; then export ATTINY_DFP=~/avr/attiny_dfp ; fi -SERIES1=' 416 417 816 817 1616 1617 3216 3217 ' -if [[ $SERIES1 =~ " $ATTINY " ]]; then - if [ -z "$ATTINY_DFP" ]; then - echo "ATtiny$ATTINY support requires Atmel attiny device family pack." - echo "More info is in /README under tiny1616 support." - exit 1 - fi +# detect and enable a relevant Atmel DFP +if [[ $MCUNAME =~ "attiny" ]]; then + DFPPATH=$BASEDIR/arch/dfp/attiny +elif [[ $MCUNAME =~ "avr" && $MCUNAME =~ "dd" ]]; then + DFPPATH=$BASEDIR/arch/dfp/avrdd +else + echo "Unrecognized MCU type: '$MCUNAME'" + exit 1 +fi +# ensure the DFP files exist +if [ ! -d "$DFPPATH" ]; then + echo "Atmel DFP files not found: '$DFPPATH'" + echo "Install DFP files with './make dfp'" + exit 1 fi export CC=avr-gcc export CPP=avr-cpp export OBJCOPY=avr-objcopy -export DFPFLAGS="-B $ATTINY_DFP/gcc/dev/$MCUNAME/ -I $ATTINY_DFP/include/" +export DFPFLAGS="-B $DFPPATH/gcc/dev/$MCUNAME/ -I $DFPPATH/include/" # TODO: include $user/ first so it can override other stuff INCLUDES="-I ui -I hw -I. -I.. -I../.. -I../../.." export CFLAGS=" -Wall -g -Os -mmcu=$MCUNAME -c -std=gnu99 -fgnu89-inline -fwhole-program $MCUFLAGS $INCLUDES -fshort-enums $DFPFLAGS" diff --git a/bin/dfp-install.sh b/bin/dfp-install.sh new file mode 100755 index 0000000..a73c4d5 --- /dev/null +++ b/bin/dfp-install.sh @@ -0,0 +1,36 @@ +#!/bin/sh +# Atmel DFP download/install/setup script +# Copyright (C) 2023 Selene ToyKeeper +# SPDX-License-Identifier: GPL-3.0-or-later + +set -e + +V_ATTINY='2.0.368' +V_AVRDD='2.2.253' +F_ATTINY="Atmel.ATtiny_DFP.${V_ATTINY}.atpack" +F_AVRDD="Atmel.AVR-Dx_DFP.${V_AVRDD}.atpack" + +cd arch + +# make the base DFP dir +mkdir -p dfp +cd dfp + +# download the zipped pack files if they don't exist yet +mkdir -p zip +cd zip +[ ! -f "${F_ATTINY}" ] && wget "http://packs.download.atmel.com/${F_ATTINY}" +[ ! -f "${F_AVRDD}" ] && wget "http://packs.download.atmel.com/${F_AVRDD}" + +# extract the packs +# attiny +cd .. +mkdir -p attiny +cd attiny +unzip "../zip/${F_ATTINY}" +# avrdd +cd .. +mkdir -p avrdd +cd avrdd +unzip "../zip/${F_AVRDD}" + |
