Refactor to have AVR boards exclusively at top level of repo, match convention of other board package repos.
This commit is contained in:
parent
2d4472cc3c
commit
b2c7689d22
77 changed files with 10 additions and 14954 deletions
7
.gitmodules
vendored
7
.gitmodules
vendored
|
|
@ -1,7 +0,0 @@
|
|||
[submodule "hardware/adafruit/sam"]
|
||||
path = hardware/adafruit/samd
|
||||
url = git@github.com:adafruit/ArduinoCore-samd.git
|
||||
[submodule "hardware/teeonardu"]
|
||||
path = hardware/teeonardu/avr
|
||||
url = https://github.com/adafruit/TeeOnArdu.git
|
||||
branch = 1.6.x
|
||||
68
README.md
68
README.md
|
|
@ -1,70 +1,22 @@
|
|||
# Adafruit Arduino Boards
|
||||
|
||||
Configuration and other support files to use Adafruit's boards like Trinket,
|
||||
Configuration and other support files to use Adafruit's boards like Trinket,
|
||||
Pro Trinket, Gemma, Flora, and more with the Arduino IDE. This is provided as
|
||||
a reference for modifying the Arduino IDE to support Adafruit's boards. If you
|
||||
just want to program one of Adafruit's boards you probably want one of the
|
||||
just want to program one of Adafruit's boards you probably want one of the
|
||||
preconfigured Arduino IDEs that Adafruit provides--see the learn system guide for
|
||||
your board for more details!
|
||||
|
||||
NOTE: If you want to setup the Arduino IDE to work with these boards you probably
|
||||
want to follow this guide that shows an easy method using the board manager:
|
||||
https://learn.adafruit.com/add-boards-arduino-v164/overview This repository is
|
||||
only for manually configuring Arduino to work with Adafruit's AVR boards (and for
|
||||
building new packages for the board manager).
|
||||
|
||||
These files are only compatible with the 1.6.x series of Arduino IDE and NOT the
|
||||
earlier 1.0.x series. Starting from a fresh Arduino 1.6.x IDE install navigate
|
||||
to the Arduino IDE folder and copy in files as follows:
|
||||
|
||||
- hardware/adafruit: This hiearchy of files should be copied into the hardware
|
||||
folder.
|
||||
|
||||
- hardware/tools/avr/etc/avrdude.conf: This is a customized avrdude.conf that
|
||||
should be copied directly over the hardware/tools/avr/etc/avrdude.conf file
|
||||
in the Arduino IDE. The modified configuration increases the delays when
|
||||
programming the ATtiny85 used in the Gemma and Trinket boards.
|
||||
|
||||
- drivers: This folder contains USB drivers for Windows 8, 7, and XP. The USB
|
||||
drivers should be installed when a Flora board is connected to the computer.
|
||||
earlier 1.0.x series. The contents of this repository should be cloned/copied
|
||||
into an Arduino/hardware/adafruit/avr folder.
|
||||
|
||||
NOTE: Arduino IDE version 1.6.2 has a bug with supporting external cores and
|
||||
DOES NOT work with these files. Use Arduino 1.6.3+, or an earlier version like
|
||||
1.6.1.
|
||||
|
||||
## Easy Install Scripts
|
||||
|
||||
Three shell scripts exist in the root that can simplify the creation of
|
||||
modified Arduino IDEs with Adafruit's boards. The scripts are build_linux.sh,
|
||||
build_windows.sh, and build_macosx.h and they require bash, tar, zip, and unzip
|
||||
(so they should really be run on Linux or OSX, however they have only been
|
||||
tested on Linux). Each script takes two parameters, the first it the name of
|
||||
an input file that should be the Arduino IDE download for that platform, and
|
||||
the second is the output file.
|
||||
|
||||
For example the IDE builds Adafruit publishes were built with commands like:
|
||||
|
||||
./build_linux.sh arduino-1.6.4-linux32.tar.xz adafruit-arduino-1.6.4-linux32.tar.xz
|
||||
|
||||
./build_linux.sh arduino-1.6.4-linux64.tar.xz adafruit-arduino-1.6.4-linux64.tar.xz
|
||||
|
||||
./build_windows.sh arduino-1.6.4-windows.zip adafruit-arduino-1.6.4-windows.zip
|
||||
|
||||
./build_macosx.sh arduino-1.6.4-macosx.zip adafruit-arduino-1.6.4-macosx.zip
|
||||
|
||||
## Running a Package Build
|
||||
|
||||
Run the `build_package.sh` script and enter a new version:
|
||||
```
|
||||
$ git clone git@github.com:adafruit/Adafruit_Arduino_Boards.git && cd Adafruit_Arduino_Boards
|
||||
$ git submodule init && git submodule update
|
||||
$ ./build_package.sh
|
||||
AVR VERSION: 1.4.1
|
||||
building adafruit-avr-1.4.1.tar.bz2...
|
||||
SAMD VERSION: 1.0.0
|
||||
building adafruit-samd-1.0.0.tar.bz2...
|
||||
```
|
||||
|
||||
The resulting `tar.bz2` archives will then be available in the `build/` folder along with the JSON output needed to add the new versions to the package index file in the [adafruit/arduino-board-index](https://github.com/adafruit/arduino-board-index) repo:
|
||||
|
||||
```
|
||||
├── build
|
||||
│ ├── adafruit-avr-1.4.1.tar.bz2
|
||||
│ ├── adafruit-samd-1.0.0.tar.bz2
|
||||
│ ├── avr_package.json
|
||||
│ └── samd_package.json
|
||||
```
|
||||
|
|
|
|||
|
|
@ -1,71 +0,0 @@
|
|||
#!/bin/bash
|
||||
#
|
||||
# Shell script to take a normal Arduino Linux build and create a new version
|
||||
# that has Adafruit's board built in to it.
|
||||
#
|
||||
# Takes 2 command line parameters, like:
|
||||
# ./build_linux.sh arduino-1.6.4-linux32.tar.xz adafruit-arduino-1.6.4-linux32.tar.xz
|
||||
#
|
||||
# Where the first parameter is the input file and the second parameter is the new
|
||||
# file to create. The script will decompress the input, add Adafruit's boards,
|
||||
# and compress the file back into a .tar.xz file with the output name.
|
||||
#
|
||||
set -e
|
||||
|
||||
# Location to use as a staging are for decompressing files.
|
||||
STAGING=/tmp/adafruit_boards
|
||||
# Expected extension of the input and output files.
|
||||
EXTENSION=.tar.xz
|
||||
|
||||
# Check that there are two command line parameters.
|
||||
if [[ "$#" -ne 2 ]]; then
|
||||
echo "Error! Expected an input and output file as parameters. Usage:"
|
||||
echo "./build_linux.sh <input Arduino build> <output modified Arduino build>"
|
||||
exit -1
|
||||
fi
|
||||
|
||||
echo "Building Arduino download for Linux using:"
|
||||
echo "Input: $1"
|
||||
echo "Output: $2"
|
||||
|
||||
# Check that input has expected extension.
|
||||
if [[ ! $1 == *$EXTENSION ]]; then
|
||||
echo "Error! Expected input to be of type $EXTENSION"
|
||||
exit -1
|
||||
fi
|
||||
|
||||
# Delete working area in /tmp/adafruit_boards if it exists.
|
||||
if [[ -d "$STAGING" ]]; then
|
||||
echo "Deleting temporary staging area $STAGING..."
|
||||
rm -rf --preserve-root "$STAGING"
|
||||
fi
|
||||
|
||||
# Create working area in /tmp/adafruit_boards
|
||||
mkdir -p "$STAGING"
|
||||
|
||||
# Decompress the input to the staging area.
|
||||
echo "Decompressing input..."
|
||||
tar xfC "$1" "$STAGING"
|
||||
|
||||
# Check only one subfolder exists and get is values.
|
||||
if [[ $(find "$STAGING" -maxdepth 1 -mindepth 1 -type d | wc -l) -ne 1 ]]; then
|
||||
echo "Error! Expected one subdirectory in staging area!"
|
||||
exit -1
|
||||
fi
|
||||
SUBDIR=$(find "$STAGING" -maxdepth 1 -mindepth 1 -type d -printf %f)
|
||||
|
||||
# Check a hardware subfolder exists.
|
||||
if [[ ! -d "$STAGING/$SUBDIR/hardware" ]]; then
|
||||
echo "Error! Expected hardware subfolder but could not find it!"
|
||||
exit -1
|
||||
fi
|
||||
|
||||
# Copy Adafruit boards into hardware subfolder.
|
||||
echo "Copying Adafruit boards into staging area..."
|
||||
cp -rf hardware "$STAGING/$SUBDIR"
|
||||
|
||||
# Create output archive by compressing staging area.
|
||||
echo "Compressing modified IDE..."
|
||||
tar cfJC "$2" "$STAGING" "$SUBDIR"
|
||||
|
||||
echo "Done!"
|
||||
|
|
@ -1,73 +0,0 @@
|
|||
#!/bin/bash
|
||||
#
|
||||
# Shell script to take a normal Arduino Mac OSX build and create a new version
|
||||
# that has Adafruit's board built in to it.
|
||||
#
|
||||
# Takes 2 command line parameters, like:
|
||||
# ./build_windows.sh arduino-1.6.4-macosx.zip adafruit-arduino-1.6.4-macosx.zip
|
||||
#
|
||||
# Where the first parameter is the input file and the second parameter is the new
|
||||
# file to create. The script will decompress the input, add Adafruit's boards,
|
||||
# and compress the file back into a .zip file with the output name.
|
||||
#
|
||||
set -e
|
||||
|
||||
# Location to use as a staging are for decompressing files.
|
||||
STAGING=/tmp/adafruit_boards
|
||||
# Expected extension of the input and output files.
|
||||
EXTENSION=.zip
|
||||
|
||||
# Check that there are two command line parameters.
|
||||
if [[ "$#" -ne 2 ]]; then
|
||||
echo "Error! Expected an input and output file as parameters. Usage:"
|
||||
echo "./build_windows.sh <input Arduino build> <output modified Arduino build>"
|
||||
exit -1
|
||||
fi
|
||||
|
||||
echo "Building Arduino download for Mac OSX using:"
|
||||
echo "Input: $1"
|
||||
echo "Output: $2"
|
||||
|
||||
# Check that input has expected extension.
|
||||
if [[ ! $1 == *$EXTENSION ]]; then
|
||||
echo "Error! Expected input to be of type $EXTENSION"
|
||||
exit -1
|
||||
fi
|
||||
|
||||
# Delete working area in /tmp/adafruit_boards if it exists.
|
||||
if [[ -d "$STAGING" ]]; then
|
||||
echo "Deleting temporary staging area $STAGING..."
|
||||
rm -rf --preserve-root "$STAGING"
|
||||
fi
|
||||
|
||||
# Create working area in /tmp/adafruit_boards
|
||||
mkdir -p "$STAGING"
|
||||
|
||||
# Decompress the input to the staging area.
|
||||
echo "Decompressing input..."
|
||||
unzip -qq "$1" -d "$STAGING"
|
||||
|
||||
# Check Arduino.app/Contents/Java folder exists.
|
||||
if [[ ! -d "$STAGING/Arduino.app/Contents/Java" ]]; then
|
||||
echo "Error! Expected Arduino.app/Contents/Java in staging area!"
|
||||
exit -1
|
||||
fi
|
||||
|
||||
# Check a hardware subfolder exists.
|
||||
if [[ ! -d "$STAGING/Arduino.app/Contents/Java/hardware" ]]; then
|
||||
echo "Error! Expected hardware subfolder but could not find it!"
|
||||
exit -1
|
||||
fi
|
||||
|
||||
# Copy Adafruit boards into hardware subfolder.
|
||||
echo "Copying Adafruit boards into staging area..."
|
||||
cp -rf hardware "$STAGING/Arduino.app/Contents/Java"
|
||||
|
||||
# Create output archive by compressing staging area.
|
||||
echo "Compressing modified IDE..."
|
||||
cd "$STAGING"
|
||||
zip -rqq "$2" "Arduino.app"
|
||||
cd -
|
||||
mv -f "$STAGING/$2" .
|
||||
|
||||
echo "Done!"
|
||||
280
build_package.sh
280
build_package.sh
|
|
@ -1,280 +0,0 @@
|
|||
#!/usr/bin/env bash
|
||||
#
|
||||
# The MIT License (MIT)
|
||||
#
|
||||
# Author: Todd Treece <todd@uniontownlabs.org>
|
||||
# Copyright (c) 2015 Adafruit Industries
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documentation files (the "Software"), to deal
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furnished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in all
|
||||
# copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
# SOFTWARE.
|
||||
|
||||
PACKAGE_VERSION="1.3.0"
|
||||
|
||||
# boards are served via github pages
|
||||
BOARD_DOWNLOAD_URL="https:\/\/adafruit.github.io\/arduino-board-index\/boards"
|
||||
|
||||
# get package script directory
|
||||
REPO_DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
|
||||
|
||||
read -r -d '' TEEJSON <<'EOF'
|
||||
{
|
||||
"name":"Adafruit TeeOnArdu",
|
||||
"architecture":"avr",
|
||||
"version":"PACKAGEVERSION",
|
||||
"category":"Adafruit",
|
||||
"url":"DOWNLOADURL/adafruit-teeonardu-PACKAGEVERSION.tar.bz2",
|
||||
"archiveFileName":"adafruit-teeonardu-PACKAGEVERSION.tar.bz2",
|
||||
"checksum":"SHA-256:PACKAGESHA",
|
||||
"size":"PACKAGESIZE",
|
||||
"help":{
|
||||
"online":"https://forums.adafruit.com"
|
||||
},
|
||||
"boards":[
|
||||
{
|
||||
"name":"TeeOnArdu (Leo on TeensyCore)"
|
||||
},
|
||||
{
|
||||
"name":"Flora (TeensyCore)"
|
||||
}
|
||||
],
|
||||
"toolsDependencies": []
|
||||
}
|
||||
EOF
|
||||
|
||||
read -r -d '' SAMDJSON <<'EOF'
|
||||
{
|
||||
"name":"Adafruit SAMD Boards",
|
||||
"architecture":"samd",
|
||||
"version":"PACKAGEVERSION",
|
||||
"category":"Adafruit",
|
||||
"url":"DOWNLOADURL/adafruit-samd-PACKAGEVERSION.tar.bz2",
|
||||
"archiveFileName":"adafruit-samd-PACKAGEVERSION.tar.bz2",
|
||||
"checksum":"SHA-256:PACKAGESHA",
|
||||
"size":"PACKAGESIZE",
|
||||
"help":{
|
||||
"online":"https://forums.adafruit.com"
|
||||
},
|
||||
"boards":[
|
||||
{
|
||||
"name":"Adafruit Feather M0"
|
||||
}
|
||||
],
|
||||
"toolsDependencies": [
|
||||
{
|
||||
"packager": "arduino",
|
||||
"name": "arm-none-eabi-gcc",
|
||||
"version": "4.8.3-2014q1"
|
||||
},
|
||||
{
|
||||
"packager": "arduino",
|
||||
"name": "bossac",
|
||||
"version": "1.6.1-arduino"
|
||||
},
|
||||
{
|
||||
"packager": "arduino",
|
||||
"name": "openocd",
|
||||
"version": "0.9.0-arduino"
|
||||
},
|
||||
{
|
||||
"packager": "arduino",
|
||||
"name": "CMSIS",
|
||||
"version": "4.0.0-atmel"
|
||||
}
|
||||
]
|
||||
}
|
||||
EOF
|
||||
|
||||
read -r -d '' SAMDJSON <<'EOF'
|
||||
{
|
||||
"name":"Adafruit SAMD Boards",
|
||||
"architecture":"samd",
|
||||
"version":"PACKAGEVERSION",
|
||||
"category":"Adafruit",
|
||||
"url":"DOWNLOADURL/adafruit-samd-PACKAGEVERSION.tar.bz2",
|
||||
"archiveFileName":"adafruit-samd-PACKAGEVERSION.tar.bz2",
|
||||
"checksum":"SHA-256:PACKAGESHA",
|
||||
"size":"PACKAGESIZE",
|
||||
"help":{
|
||||
"online":"https://forums.adafruit.com"
|
||||
},
|
||||
"boards":[
|
||||
{
|
||||
"name":"Adafruit Feather M0"
|
||||
}
|
||||
],
|
||||
"toolsDependencies": [
|
||||
{
|
||||
"packager": "arduino",
|
||||
"name": "arm-none-eabi-gcc",
|
||||
"version": "4.8.3-2014q1"
|
||||
},
|
||||
{
|
||||
"packager": "arduino",
|
||||
"name": "bossac",
|
||||
"version": "1.6.1-arduino"
|
||||
},
|
||||
{
|
||||
"packager": "arduino",
|
||||
"name": "openocd",
|
||||
"version": "0.9.0-arduino"
|
||||
},
|
||||
{
|
||||
"packager": "arduino",
|
||||
"name": "CMSIS",
|
||||
"version": "4.0.0-atmel"
|
||||
}
|
||||
]
|
||||
}
|
||||
EOF
|
||||
|
||||
read -r -d '' AVRJSON <<'EOF'
|
||||
{
|
||||
"name":"Adafruit AVR Boards",
|
||||
"architecture":"avr",
|
||||
"version":"PACKAGEVERSION",
|
||||
"category":"Adafruit",
|
||||
"url":"DOWNLOADURL/adafruit-avr-PACKAGEVERSION.tar.bz2",
|
||||
"archiveFileName":"adafruit-avr-PACKAGEVERSION.tar.bz2",
|
||||
"checksum":"SHA-256:PACKAGESHA",
|
||||
"size":"PACKAGESIZE",
|
||||
"help":{
|
||||
"online":"https://forums.adafruit.com"
|
||||
},
|
||||
"boards":[
|
||||
{
|
||||
"name":"Adafruit Flora"
|
||||
},
|
||||
{
|
||||
"name":"Adafruit Gemma 8MHz"
|
||||
},
|
||||
{
|
||||
"name":"Adafruit Bluefruit Micro"
|
||||
},
|
||||
{
|
||||
"name":"Adafruit Feather 32u4"
|
||||
},
|
||||
{
|
||||
"name":"Adafruit Metro"
|
||||
},
|
||||
{
|
||||
"name":"Adafruit Pro Trinket 5V/16MHz (USB)"
|
||||
},
|
||||
{
|
||||
"name":"Adafruit Pro Trinket 3V/12MHz (USB)"
|
||||
},
|
||||
{
|
||||
"name":"Adafruit Pro Trinket 5V/16MHz (FTDI)"
|
||||
},
|
||||
{
|
||||
"name":"Adafruit Pro Trinket 3V/12MHz (FTDI)"
|
||||
},
|
||||
{
|
||||
"name":"Adafruit Trinket 8MHz"
|
||||
},
|
||||
{
|
||||
"name":"Adafruit Trinket 16MHz"
|
||||
}
|
||||
],
|
||||
"toolsDependencies":[]
|
||||
}
|
||||
EOF
|
||||
|
||||
# clean build dir
|
||||
cd $REPO_DIR
|
||||
rm -r build
|
||||
mkdir build
|
||||
|
||||
function archive() {
|
||||
|
||||
# args: archive_name source_path sha_return size_return
|
||||
|
||||
local __sha=$3
|
||||
local __size=$4
|
||||
|
||||
echo "building $1.tar.bz2..."
|
||||
cd $REPO_DIR
|
||||
cp -a $2 build/$1
|
||||
cd build
|
||||
tar -jcf $1.tar.bz2 $1
|
||||
rm -r $1
|
||||
|
||||
local sha=$(openssl dgst -sha256 $1.tar.bz2 | awk '{print $2}')
|
||||
local size=$(ls -l | grep $1 | awk '{print $5}')
|
||||
|
||||
eval $__sha="'$sha'"
|
||||
eval $__size="'$size'"
|
||||
|
||||
}
|
||||
|
||||
read -p "AVR VERSION: " input
|
||||
PACKAGE_VERSION=$input
|
||||
|
||||
cd $REPO_DIR
|
||||
|
||||
#update platform version
|
||||
sed -i .bak -e "s/^version=.*/version=$PACKAGE_VERSION/" hardware/adafruit/avr/platform.txt
|
||||
|
||||
# create archives and get sha & size
|
||||
archive "adafruit-avr-$PACKAGE_VERSION" hardware/adafruit/avr PACKAGESHA PACKAGESIZE
|
||||
|
||||
cd $REPO_DIR
|
||||
|
||||
# fill in board json templatee
|
||||
echo $AVRJSON | sed -e "s/PACKAGEVERSION/$PACKAGE_VERSION/g" \
|
||||
-e "s/DOWNLOADURL/$BOARD_DOWNLOAD_URL/g" \
|
||||
-e "s/PACKAGESHA/$PACKAGESHA/g" \
|
||||
-e "s/PACKAGESIZE/$PACKAGESIZE/g" > build/avr_package.json
|
||||
|
||||
read -p "SAMD VERSION: " input
|
||||
PACKAGE_VERSION=$input
|
||||
|
||||
cd $REPO_DIR
|
||||
|
||||
#update platform version
|
||||
sed -i .bak -e "s/^version=.*/version=$PACKAGE_VERSION/" hardware/adafruit/samd/platform.txt
|
||||
sed -i .bak -e "s/^name=.*/name=Adafruit SAMD Boards/" hardware/adafruit/samd/platform.txt
|
||||
|
||||
# create archives and get sha & size
|
||||
archive "adafruit-samd-$PACKAGE_VERSION" hardware/adafruit/samd PACKAGESHA PACKAGESIZE
|
||||
|
||||
cd $REPO_DIR
|
||||
|
||||
# fill in board json templatee
|
||||
echo $SAMDJSON | sed -e "s/PACKAGEVERSION/$PACKAGE_VERSION/g" \
|
||||
-e "s/DOWNLOADURL/$BOARD_DOWNLOAD_URL/g" \
|
||||
-e "s/PACKAGESHA/$PACKAGESHA/g" \
|
||||
-e "s/PACKAGESIZE/$PACKAGESIZE/g" > build/samd_package.json
|
||||
|
||||
read -p "TeeOnArdu VERSION: " input
|
||||
PACKAGE_VERSION=$input
|
||||
|
||||
cd $REPO_DIR
|
||||
|
||||
#update platform version
|
||||
sed -i .bak -e "s/^version=.*/version=$PACKAGE_VERSION/" hardware/teeonardu/avr/platform.txt
|
||||
|
||||
# create archives and get sha & size
|
||||
archive "adafruit-teeonardu-$PACKAGE_VERSION" hardware/teeonardu/avr PACKAGESHA PACKAGESIZE
|
||||
|
||||
cd $REPO_DIR
|
||||
|
||||
# fill in board json templatee
|
||||
echo $TEEJSON | sed -e "s/PACKAGEVERSION/$PACKAGE_VERSION/g" \
|
||||
-e "s/DOWNLOADURL/$BOARD_DOWNLOAD_URL/g" \
|
||||
-e "s/PACKAGESHA/$PACKAGESHA/g" \
|
||||
-e "s/PACKAGESIZE/$PACKAGESIZE/g" > build/tee_package.json
|
||||
|
|
@ -1,81 +0,0 @@
|
|||
#!/bin/bash
|
||||
#
|
||||
# Shell script to take a normal Arduino Windows build and create a new version
|
||||
# that has Adafruit's board built in to it.
|
||||
#
|
||||
# Takes 2 command line parameters, like:
|
||||
# ./build_windows.sh arduino-1.6.4-windows.zip adafruit-arduino-1.6.4-windows.zip
|
||||
#
|
||||
# Where the first parameter is the input file and the second parameter is the new
|
||||
# file to create. The script will decompress the input, add Adafruit's boards,
|
||||
# and compress the file back into a .zip file with the output name.
|
||||
#
|
||||
set -e
|
||||
|
||||
# Location to use as a staging are for decompressing files.
|
||||
STAGING=/tmp/adafruit_boards
|
||||
# Expected extension of the input and output files.
|
||||
EXTENSION=.zip
|
||||
|
||||
# Check that there are two command line parameters.
|
||||
if [[ "$#" -ne 2 ]]; then
|
||||
echo "Error! Expected an input and output file as parameters. Usage:"
|
||||
echo "./build_windows.sh <input Arduino build> <output modified Arduino build>"
|
||||
exit -1
|
||||
fi
|
||||
|
||||
echo "Building Arduino download for Windows using:"
|
||||
echo "Input: $1"
|
||||
echo "Output: $2"
|
||||
|
||||
# Check that input has expected extension.
|
||||
if [[ ! $1 == *$EXTENSION ]]; then
|
||||
echo "Error! Expected input to be of type $EXTENSION"
|
||||
exit -1
|
||||
fi
|
||||
|
||||
# Delete working area in /tmp/adafruit_boards if it exists.
|
||||
if [[ -d "$STAGING" ]]; then
|
||||
echo "Deleting temporary staging area $STAGING..."
|
||||
rm -rf --preserve-root "$STAGING"
|
||||
fi
|
||||
|
||||
# Create working area in /tmp/adafruit_boards
|
||||
mkdir -p "$STAGING"
|
||||
|
||||
# Decompress the input to the staging area.
|
||||
echo "Decompressing input..."
|
||||
unzip -qq "$1" -d "$STAGING"
|
||||
|
||||
# Check only one subfolder exists and get is values.
|
||||
if [[ $(find "$STAGING" -maxdepth 1 -mindepth 1 -type d | wc -l) -ne 1 ]]; then
|
||||
echo "Error! Expected one subdirectory in staging area!"
|
||||
exit -1
|
||||
fi
|
||||
SUBDIR=$(find "$STAGING" -maxdepth 1 -mindepth 1 -type d -printf %f)
|
||||
|
||||
# Check a hardware subfolder exists.
|
||||
if [[ ! -d "$STAGING/$SUBDIR/hardware" ]]; then
|
||||
echo "Error! Expected hardware subfolder but could not find it!"
|
||||
exit -1
|
||||
fi
|
||||
|
||||
# Check a drivers subfolder exits.
|
||||
if [[ ! -d "$STAGING/$SUBDIR/drivers" ]]; then
|
||||
echo "Error! Expected drivers subfolder but could not find it!"
|
||||
exit -1
|
||||
fi
|
||||
|
||||
# Copy Adafruit boards into hardware subfolder.
|
||||
echo "Copying Adafruit boards and drivers into staging area..."
|
||||
cp -rf hardware "$STAGING/$SUBDIR"
|
||||
cp -rf drivers "$STAGING/$SUBDIR"
|
||||
|
||||
# Create output archive by compressing staging area.
|
||||
echo "Compressing modified IDE..."
|
||||
cd "$STAGING"
|
||||
zip -rqq "$2" "$SUBDIR"
|
||||
cd -
|
||||
mv -f "$STAGING/$2" .
|
||||
|
||||
echo "Done!"
|
||||
|
|
@ -1 +0,0 @@
|
|||
Subproject commit 83834c322d5f2e41bfde143894a2d8dfb05c5a0b
|
||||
|
|
@ -1 +0,0 @@
|
|||
Subproject commit 177e057684472728aee12c2a647a76acaefe5c84
|
||||
File diff suppressed because it is too large
Load diff
Loading…
Reference in a new issue