From 196bdf060b06e895d3d591bdb208cd657391a63e Mon Sep 17 00:00:00 2001 From: Tiffany Chiang Date: Wed, 31 Jan 2018 21:16:58 -0800 Subject: [PATCH] Hibike/mac flash (#493) --- hibike/Arduino-Makefile/Arduino.mk | 11 +++++-- hibike/Makefile | 2 +- hibike/mac_setup.sh | 53 ++++++++++++++++++++++++++++++ 3 files changed, 63 insertions(+), 3 deletions(-) create mode 100755 hibike/mac_setup.sh diff --git a/hibike/Arduino-Makefile/Arduino.mk b/hibike/Arduino-Makefile/Arduino.mk index f0966414..d9764ff0 100644 --- a/hibike/Arduino-Makefile/Arduino.mk +++ b/hibike/Arduino-Makefile/Arduino.mk @@ -47,8 +47,12 @@ # # On the Mac you might want to set: # -# ARDUINO_DIR = /Applications/Arduino.app/Contents/Resources/Java -# ARDMK_DIR = /usr/local + # ARDUINO_DIR = /Applications/Arduino.app/Contents/Java + # AVR_TOOLS_DIR = ${ARDUINO_DIR}/hardware/tools/avr + # AVRDUDE_CONF = $(AVR_TOOLS_DIR)/etc/avrdude.conf + # AVRDUDE = ${AVR_TOOLS_DIR}/bin/avrdude + # MONITOR_PORT = /dev/tty.usbmodem* + # # On Linux, you might prefer: # @@ -397,10 +401,12 @@ ifndef NM_NAME NM_NAME = avr-nm endif + ifndef AVR_TOOLS_DIR BUNDLED_AVR_TOOLS_DIR := $(call dir_if_exists,$(ARDUINO_DIR)/hardware/tools/avr) + ifdef BUNDLED_AVR_TOOLS_DIR AVR_TOOLS_DIR = $(BUNDLED_AVR_TOOLS_DIR) $(call show_config_variable,AVR_TOOLS_DIR,[BUNDLED],(in Arduino distribution)) @@ -467,6 +473,7 @@ endif ARDUINO_LIB_PATH = $(ARDUINO_DIR)/libraries $(call show_config_variable,ARDUINO_LIB_PATH,[COMPUTED],(from ARDUINO_DIR)) + # 1.5.x platform dependent libs path ifndef ARDUINO_PLATFORM_LIB_PATH ifeq ($(shell expr $(ARDUINO_VERSION) '>' 150), 1) diff --git a/hibike/Makefile b/hibike/Makefile index ab107876..302f0249 100644 --- a/hibike/Makefile +++ b/hibike/Makefile @@ -75,7 +75,7 @@ LOCAL_CPP_SRCS := $(wildcard $(PROJECT_DIR)/devices/$(DEVICE)/*.cpp) ### MONITOR_PORT ### The port your board is connected to. Using an '*' tries all the ports and finds the right one. -MONITOR_PORT = /dev/ttyACM* +# MONITOR_PORT = /dev/ttyACM* ### Don't touch this CURRENT_DIR = $(shell basename $(CURDIR)) diff --git a/hibike/mac_setup.sh b/hibike/mac_setup.sh new file mode 100755 index 00000000..2e90d7dc --- /dev/null +++ b/hibike/mac_setup.sh @@ -0,0 +1,53 @@ +#!/bin/bash +# THIS FILE ASSUMES YOU HAVE HOMEBREW AND X-CODE INSTALLED ON YOUR MAC. + +if [[ "$(id -u)" == "0" ]]; then + echo "Please run without sudo permissions." + exit 1 +fi + +deps=("make" "gcc" "gcc-avr" "arduino-mk" "python3-pip") + +if ! type make >/dev/null 2>&1 || ! type gcc >/dev/null 2>&1; then + echo "Install x-code on your mac!" + exit 1 +fi + +if ! type avr-gcc >/dev/null 2>&1; then + echo "Installing avr-gcc: Warning, install will take a long time." + brew tap osx-cross/avr + brew install avr-gcc +fi + +if [[ $(brew list | grep -c arduino-mk) == 0 ]]; then + echo" Installing arduino-mk: Warning, install will take a long time." + # add tap + brew tap sudar/arduino-mk + # to install the last stable release + brew install arduino-mk + # to install the development version + brew install --HEAD arduino-mk +fi + +if ! type pip3 >/dev/null 2>&1; then + brew install python3 +fi + + +if ! command -v pipenv &> /dev/null; then + pip3 install pipenv +fi + +pipenv install --dev +pip3 install serial +echo "All dependencies installed." + +echo "Next steps: download Arduino 1.8.1 (should have Arduino.app in Applications folder), python should map to python3 or you will get an error." + +echo " ARDUINO_DIR = /Applications/Arduino.app/Contents/Java + AVR_TOOLS_DIR = \${ARDUINO_DIR}/hardware/tools/avr + AVRDUDE_CONF = \$(AVR_TOOLS_DIR)/etc/avrdude.conf + AVRDUDE = \${AVR_TOOLS_DIR}/bin/avrdude + MONITOR_PORT = /dev/tty.usbmodem* +" |cat - Arduino-Makefile/Arduino.mk > /tmp/out && mv /tmp/out Arduino-Makefile/Arduino.mk +