Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Removedep #466

Open
wants to merge 2 commits into
base: next
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion script/bootstrap.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,5 @@ else
source $SCRIPTS_DIR/bootstrap/pic32.sh
source $SCRIPTS_DIR/bootstrap/devel.sh;
fi

rm -rf ./dependencies
echo "Bootstrap complete"
49 changes: 9 additions & 40 deletions script/bootstrap/arm.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,8 @@ if ! command -v arm-none-eabi-gcc >/dev/null 2>&1; then
echo "Installing GCC for ARM Embedded..."

GCC_ARM_BASENAME="gcc-arm-none-eabi-4_8-2014q2-20140609"
if [ $OS == "linux" ]; then
GCC_ARM_FILE="$GCC_ARM_BASENAME-linux.tar.bz2"
elif [ $OS == "mac" ]; then
GCC_ARM_FILE="$GCC_ARM_BASENAME-mac.tar.bz2"
elif [ $OS == "cygwin" ]; then
GCC_ARM_FILE="$GCC_ARM_BASENAME-win32.exe"
fi

GCC_ARM_FILE="$GCC_ARM_BASENAME-linux.tar.bz2"

GCC_ARM_URL="https://launchpad.net/gcc-arm-embedded/4.8/4.8-2014-q2-update/+download/$GCC_ARM_FILE"
GCC_ARM_DIR="gcc-arm-embedded"
Expand All @@ -28,48 +23,22 @@ if ! command -v arm-none-eabi-gcc >/dev/null 2>&1; then

mkdir -p $GCC_ARM_DIR
_pushd $GCC_ARM_DIR
if [ $OS == "cygwin" ]; then
chmod a+x ../$GCC_ARM_FILE
INSTALL_COMMAND="cygstart.exe ../$GCC_ARM_FILE"
PROGRAM_FILES_BASE="/cygdrive/c/"
PROGRAM_FILES="Program Files"
PROGRAM_FILES_64="Program Files (x86)"
TRAILING_DIRNAME="GNU Tools ARM Embedded/4.8 2014q2/"
GCC_INNER_DIR="$PROGRAM_FILES_BASE/$PROGRAM_FILES_64/$TRAILING_DIRNAME"
if ! test -d "$GCC_INNER_DIR"; then
GCC_INNER_DIR="$PROGRAM_FILES_BASE/$PROGRAM_FILES/$TRAILING_DIRNAME"
fi
else
GCC_INNER_DIR="gcc-arm-none-eabi-4_8-2014q2"
INSTALL_COMMAND="tar -xjf ../$GCC_ARM_FILE -C /tmp"
fi
GCC_INNER_DIR="gcc-arm-none-eabi-4_8-2014q2"
INSTALL_COMMAND="tar -xjf ../$GCC_ARM_FILE -C /tmp"

$INSTALL_COMMAND

if ! test -d "$GCC_INNER_DIR"
then
$INSTALL_COMMAND
if [ $OS == "cygwin" ]; then
echo -n "Press Enter when the GCC for ARM Embedded installer is finished"
read
else
cp -LR /tmp/$GCC_INNER_DIR .
fi
fi

if [ $OS == "cygwin" ]; then
GCC_INNER_DIR="$PROGRAM_FILES_BASE/$PROGRAM_FILES_64/$TRAILING_DIRNAME"
if ! test -d "$GCC_INNER_DIR"; then
GCC_INNER_DIR="$PROGRAM_FILES_BASE/$PROGRAM_FILES/$TRAILING_DIRNAME"
if ! test -d "$GCC_INNER_DIR"; then
die "GCC for ARM isn't installed in the expected location."
fi
fi
cp -LR /tmp/$GCC_INNER_DIR .
fi

echo "Copying GCC binaries to local dependencies folder..."
# If running Vagrant in Windows, these dependency files are accessed via
# network share through Vagrant/Virtualbox, and symlinks are not
# supported. We use the -L flag to dereference links while copying.
cp -LR "$GCC_INNER_DIR"/* .
sudo cp -LR "$GCC_INNER_DIR"/* /


LIBLTO_SYMLINK="$GCC_INNER_DIR/lib/gcc/arm-none-eabi/4.8.4/liblto_plugin.so"
if ! test -e $LIBLTO_SYMLINK; then
Expand Down
98 changes: 23 additions & 75 deletions script/bootstrap/common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -37,33 +37,25 @@ if [ -z $COMMON_SOURCED ]; then
DISTRO=`lsb_release -si`
fi


die() {
echo >&2 "${bldred}$@${txtrst}"
exit 1
}

_cygwin_error() {
echo
echo "${bldred}Missing \"$1\"${txtrst} - run the Cygwin installer again and select the base package set:"
echo " $CYGWIN_PACKAGES"
echo "After installing the packages, re-run this bootstrap script."
die
}

if ! command -v tput >/dev/null 2>&1; then
if [ $OS == "cygwin" ]; then
echo "OPTIONAL: Install the \"ncurses\" package in Cygwin to get colored shell output"
fi
if [ $OS == "linux" ]; then
echo "Sane build distro"
else
set +e
# These exit with 1 when provisioning in a Vagrant box...?
txtrst=$(tput sgr0) # reset
bldred=${txtbld}$(tput setaf 1)
bldgreen=${txtbld}$(tput setaf 2)
set -e
die "Compiling the VI firmware from a $OS prompt is not \
supported - see the docs for the recommended approach"
fi

set +e
# These exit with 1 when provisioning in a Vagrant box...?
txtrst=$(tput sgr0) # reset
bldred=${txtbld}$(tput setaf 1)
bldgreen=${txtbld}$(tput setaf 2)
set -e


_pushd() {
pushd $1 > /dev/null
Expand All @@ -81,30 +73,14 @@ if [ -z $COMMON_SOURCED ]; then
}

_install() {
if [ $OS == "cygwin" ]; then
_cygwin_error $1
elif [ $OS == "mac" ]; then
# brew exists with 1 if it's already installed
set +e
brew install $1
set -e

if [ -z $DISTRO ]; then
echo
echo "Missing $1 - install it using your distro's package manager or build from source"
_wait
else
if [ -z $DISTRO ]; then
echo
echo "Missing $1 - install it using your distro's package manager or build from source"
_wait
else
if [ $DISTRO == "arch" ]; then
$SUDO_CMD pacman -S $1
elif [ $DISTRO == "Ubuntu" ]; then
$SUDO_CMD apt-get update -qq -y
$SUDO_CMD apt install -y $1
else
echo
echo "Missing $1 - install it using your distro's package manager or build from source"
_wait
fi
fi
$SUDO_CMD apt-get update -qq -y
$SUDO_CMD apt install -y $1
fi
}

Expand All @@ -130,35 +106,14 @@ if [ -z $COMMON_SOURCED ]; then
fi

if ! command -v curl >/dev/null 2>&1; then
if [ $OS == "cygwin" ]; then
_cygwin_error "curl"
else
_install curl
fi
_install curl
fi

echo "Storing all downloaded dependencies in the \"dependencies\" folder"

DEPENDENCIES_FOLDER="dependencies"
mkdir -p $DEPENDENCIES_FOLDER


if [ $OS == "windows" ]; then
die "Compiling the VI firmware from a Windows prompt is not \
supported - see the docs for the recommended approach"
fi

if [ $OS == "cygwin" ]; then
# TODO need a warning colored promp
die "Compiling the VI firmware from a Cigwin prompt is not \
supported - see the docs for the recommended approach"
fi

if [ $OS == "mac" ]; then
die "Compiling the VI firmware from a MacOS prompt is not \
supported - see the docs for the recommended approach"
fi

if [ $OS == "linux" ] && [ -z $VAGRANT ] && [ -z $CI ]; then
echo "It looks like you're developing in Linux. We recommend \
using Vagrant to compile the VI firmware. Ubuntu and Arch Linux are
Expand All @@ -173,21 +128,14 @@ pre-configured Vagrant environment. See the docs for more information."


if ! command -v make >/dev/null 2>&1; then
if [ $DISTRO == "arch" ]; then
_install "base-devel"
elif [ $DISTRO == "Ubuntu" ]; then
_install "build-essential"
fi
_install "build-essential"
fi

if [ $DISTRO == "Ubuntu" ] && [ $ARCH == "x86_64" ]; then
_install "libc6-i386"
fi
_install "libc6-i386"

if ! command -v g++ >/dev/null 2>&1; then
if [ $DISTRO == "Ubuntu" ]; then
_install "g++"
fi
_install "g++"
_install "check"
fi


Expand Down
83 changes: 7 additions & 76 deletions script/bootstrap/flashing_chipkit.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,44 +4,6 @@ source $BOOTSTRAP_DIR/common.sh

## FTDI library for programming chipKIT

if [ $OS == "cygwin" ] || [ $OS == "mac" ]; then

if [ $OS == "cygwin" ]; then
FTDI_DRIVER_FILE="DM20824_Setup.exe"
FTDI_DRIVER_URL="http://www.ftdichip.com/Drivers/CDM/$FTDI_DRIVER_FILE"
INSTALLED_FTDI_PATH="/cygdrive/c/Windows/System32/DriverStore/FileRepository"
INSTALLED_FTDI_FILE="ftser2k.sys"
elif [ $OS == "mac" ]; then
FTDI_DRIVER_FILE="FTDIUSBSerialDriver_v2_2_18.dmg"
FTDI_DRIVER_URL="http://www.ftdichip.com/Drivers/VCP/MacOSX/$FTDI_DRIVER_FILE"
INSTALLED_FTDI_PATH=/System/Library/Extensions/FTDIUSBSerialDriver.kext/Contents/
INSTALLED_FTDI_FILE=Info.plist
fi

_pushd $DEPENDENCIES_FOLDER
if ! test -e $FTDI_DRIVER_FILE
then
echo "Downloading FTDI USB driver..."
download $FTDI_DRIVER_URL $FTDI_DRIVER_FILE
fi

if [ -z "$(find $INSTALLED_FTDI_PATH -name $INSTALLED_FTDI_FILE | head -n 1)" ]; then

if [ $OS == "cygwin" ]; then
chmod a+x $FTDI_DRIVER_FILE
cygstart.exe $FTDI_DRIVER_FILE
echo -n "Press Enter when the FTDI USB driver installer is finished"
read
elif [ $OS == "mac" ]; then
hdiutil attach $FTDI_DRIVER_FILE
FTDI_VOLUME="/Volumes/FTDIUSBSerialDriver_v2_2_18"
$SUDO_CMD installer -pkg $FTDI_VOLUME/FTDIUSBSerialDriver_10_4_10_5_10_6_10_7.mpkg -target /
hdiutil detach $FTDI_VOLUME
fi
fi
_popd
fi

if ! command -v unzip >/dev/null 2>&1; then
_install "unzip"
fi
Expand All @@ -51,19 +13,9 @@ if [ -z "$MPIDE_DIR" ] || ! test -e $MPIDE_DIR || [ $OS == "cygwin" ]; then
echo "Installing MPIDE to get avrdude for flashing chipKIT Max32 platform"

MPIDE_BUILD=20140821
if [ $OS == "cygwin" ]; then
MPIDE_BASENAME="mpide-0023-windows-$MPIDE_BUILD"
MPIDE_FILE="$MPIDE_BASENAME".zip
EXTRACT_COMMAND="unzip -q"
elif [ $OS == "mac" ]; then
MPIDE_BASENAME=mpide-0023-macosx-$MPIDE_BUILD
MPIDE_FILE="$MPIDE_BASENAME".dmg.zip
EXTRACT_COMMAND="unzip -q"
else
MPIDE_BASENAME=mpide-0023-linux64-20140821
MPIDE_FILE="$MPIDE_BASENAME".tgz
EXTRACT_COMMAND="tar -xzf"
fi
MPIDE_BASENAME=mpide-0023-linux64-20140821
MPIDE_FILE="$MPIDE_BASENAME".tgz
EXTRACT_COMMAND="tar -xzf"

MPIDE_URL=http://chipkit.s3.amazonaws.com/builds/$MPIDE_FILE

Expand All @@ -76,37 +28,16 @@ if [ -z "$MPIDE_DIR" ] || ! test -e $MPIDE_DIR || [ $OS == "cygwin" ]; then

if ! test -d $MPIDE_BASENAME
then
echo "Installing MPIDE to local folder..."
echo "Installing MPIDE to system..."
$EXTRACT_COMMAND $MPIDE_FILE
if [ $OS == "mac" ]; then
hdiutil attach $MPIDE_FILE
cp -R /Volumes/Mpide/Mpide.app/Contents/Resources/Java $MPIDE_BASENAME
hdiutil detach /Volumes/Mpide
fi
rm -rf mpide
cp -R $MPIDE_BASENAME mpide
sudo cp -R $MPIDE_BASENAME /usr/lib/mpide
rm -rf $MPIDE_BASENAME
rm -rf $MPIDE_FILE
echo "MPIDE installed"
fi

if [ $OS == "cygwin" ]; then
chmod a+x mpide/hardware/pic32/compiler/pic32-tools/bin/*
chmod a+x -R mpide/hardware/pic32/compiler/pic32-tools/pic32mx/
chmod a+x mpide/*.dll
chmod a+x mpide/hardware/tools/avr/bin/*
fi
_popd

fi

if [ $OS == "linux" ] && [ $ARCH == "x86_64" ]; then
if [ $DISTRO == "arch" ]; then
echo "Make sure lib32-libusb-compat and lib32-readline are installed from the AUR"
elif [ $DISTRO == "Ubuntu" ]; then
# TODO figure out what is neccessary from a fresh build
echo ""
fi

fi

echo
echo "${bldgreen}chipKIT flashing dependencies installed.$txtrst"
8 changes: 3 additions & 5 deletions script/bootstrap/pic32.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,16 @@ then
download $CHIPKIT_LIBRARY_DOWNLOAD_URL $CHIPKIT_ZIP_FILE $NOT_SECURE
echo "Extracting CHIPKit"
unzip -q $CHIPKIT_ZIP_FILE
rm -rf $CHIPKIT_ZIP_FILE
fi
_popd

_pushd src/libs
for LIBRARY in chipKITUSBDevice chipKITCAN chipKITEthernet; do
echo "Installing chipKIT library $LIBRARY..."
cp -R ../../dependencies/libraries/$LIBRARY .
sudo cp -R ../../dependencies/libraries/$LIBRARY /usr/lib/chipkit
done
rm -rf ../../dependencies/libraries
_popd

### Patch libraries to avoid problems in case sensitive operating systems
Expand All @@ -46,10 +48,6 @@ _popd

echo "Patching case-sensitivity bugs in chipKIT libraries..."

if [ $OS == "cygwin" ] && ! [ -e /usr/bin/patch ]; then
_cygwin_error "patchutils"
fi

# If the patch is already applied, patch will error out, so disable quit on
# error temporarily
set +e
Expand Down
2 changes: 1 addition & 1 deletion src/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ show_separator = $(info -------------------------)

BASE_TARGET = vi-firmware
OBJDIR_ROOT = build
DEPENDENCIES_FOLDER = ../dependencies
DEPENDENCIES_FOLDER = /usr/lib
OBJDIR = $(OBJDIR_ROOT)

# 0 or 1
Expand Down
2 changes: 1 addition & 1 deletion src/platform/pic32/nvm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#include "telit_he910.h"
extern "C"
{
#include "flash.h"
#include "/usr/lib/mpide/hardware/pic32/libraries/EEPROM/utility/flash.h"
}

using openxc::config::getConfiguration;
Expand Down
2 changes: 1 addition & 1 deletion src/platform/pic32/pic32.mk
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ ifeq ($(NETWORK), 1)
ARDUINO_LIBS += chipKITEthernet chipKITEthernet/utility
endif

DEPENDENCIES_MPIDE_DIR = $(DEPENDENCIES_FOLDER)/mpide
DEPENDENCIES_MPIDE_DIR = /usr/lib/mpide

OSTYPE := $(shell uname)
ifneq ($(OSTYPE),Darwin)
Expand Down