From 821cf8bf42ed595381d8d02d9e82af54150b8056 Mon Sep 17 00:00:00 2001 From: vagrant Date: Thu, 24 Sep 2020 13:28:38 +0000 Subject: [PATCH] Removed dependency folder and removed unused code for multi operating system install --- script/bootstrap.sh | 2 +- script/bootstrap/arm.sh | 49 +++----------- script/bootstrap/common.sh | 98 +++++++--------------------- script/bootstrap/flashing_chipkit.sh | 83 ++--------------------- script/bootstrap/pic32.sh | 8 +-- src/Makefile | 2 +- src/platform/pic32/nvm.cpp | 2 +- src/platform/pic32/pic32.mk | 2 +- 8 files changed, 46 insertions(+), 200 deletions(-) diff --git a/script/bootstrap.sh b/script/bootstrap.sh index 1ba16c51c..86f634f1c 100755 --- a/script/bootstrap.sh +++ b/script/bootstrap.sh @@ -27,5 +27,5 @@ else source $SCRIPTS_DIR/bootstrap/pic32.sh source $SCRIPTS_DIR/bootstrap/devel.sh; fi - +rm -rf ./dependencies echo "Bootstrap complete" diff --git a/script/bootstrap/arm.sh b/script/bootstrap/arm.sh index 6804334fa..f20d3575a 100644 --- a/script/bootstrap/arm.sh +++ b/script/bootstrap/arm.sh @@ -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" @@ -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 diff --git a/script/bootstrap/common.sh b/script/bootstrap/common.sh index 727149189..65b39c5fd 100644 --- a/script/bootstrap/common.sh +++ b/script/bootstrap/common.sh @@ -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 @@ -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 } @@ -130,11 +106,7 @@ 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" @@ -142,23 +114,6 @@ if [ -z $COMMON_SOURCED ]; then 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 @@ -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 diff --git a/script/bootstrap/flashing_chipkit.sh b/script/bootstrap/flashing_chipkit.sh index b1f18d4ec..9a48123bd 100644 --- a/script/bootstrap/flashing_chipkit.sh +++ b/script/bootstrap/flashing_chipkit.sh @@ -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 @@ -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 @@ -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" diff --git a/script/bootstrap/pic32.sh b/script/bootstrap/pic32.sh index 4c53240c1..8a9c87ca5 100644 --- a/script/bootstrap/pic32.sh +++ b/script/bootstrap/pic32.sh @@ -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 @@ -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 diff --git a/src/Makefile b/src/Makefile index 579c613f9..3fdda7557 100644 --- a/src/Makefile +++ b/src/Makefile @@ -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 diff --git a/src/platform/pic32/nvm.cpp b/src/platform/pic32/nvm.cpp index 72f097b7f..a6142f8c4 100644 --- a/src/platform/pic32/nvm.cpp +++ b/src/platform/pic32/nvm.cpp @@ -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; diff --git a/src/platform/pic32/pic32.mk b/src/platform/pic32/pic32.mk index b1237e344..816c82cde 100644 --- a/src/platform/pic32/pic32.mk +++ b/src/platform/pic32/pic32.mk @@ -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)