I am developing for several different target microcontrollers (on OS X 10.11), which requires some unique combinations of (Arduino) IDE version, library versions, USB drivers, support software, etc.
What are the pros and cons of using separate logged-in users for each environment as opposed to using Virtual Machines? Are there other methods commonly in use to separate environments, and also keep the environments archived for any legacy needs?
Update: I also have a desire to keep these environments as standard as possible: installing released components (e.g., IDE, drivers) and customizing IDE app settings, but trying to avoid source-level forks. This is for my own sanity, and to give best chance of replicating the environment in the future.
2 Answers 2
I'm yet to see evidence that there is a sound or comprehensive way to do this, so would be pleased to read better suggestions. As for why you would want to, there are a number of board support plugins/extensions that are moderately functional on some recent Arduino versions, but partially or entirely incompatible with others.
You can achieve a very limited partial version segregation by creating a new sketchbook folder for each version, which would host your libraries and hardware folders.
To get the IDE to pick this up, you could have a custom preferences file (rather than preferences.txt
) with that sketchbook location set. You can specify the file to use on the command line, for example:
/opt/arduino-1.6.8/arduino --preferences-file ~/.arduino15/alternate.txt
However, there is still quite a bit related to extra board support and similar stored in the settings folder, and at present that is hard coded to the same "Arduino15" or ".arduino15" path for all recent versions.
This hard-coding of the settings folder is implemented in the version of Platform.java
applicable to the operating system you are running under, so it is not clear how you could change this except at the source level, by modifying the jar, or by playing file-system level tricks with the operating system (process-unique mounts, etc).
-
Thanks for your helpful comments and answer. I'll wait to see if someone chimes in specifically about VMs vs. users, etc. (I haven't tried yet, so I'm not even positive if VMs will have issues of their own, but I'm hopeful). I'll also edit my question to include my desire to keep each environment as standard an install as possible (so I don't go insane keeping track of meta-customizations).pseudon– pseudon2016年05月29日 03:57:52 +00:00Commented May 29, 2016 at 3:57
-
Either distinct user ID's (with the whole installation in a user-specific directory) or VMs would probably work pretty well... sorry I skipped over that, I just don't really consider it a reasonable thing to have to resort to for everyday development.Chris Stratton– Chris Stratton2016年05月29日 05:10:05 +00:00Commented May 29, 2016 at 5:10
I ended up running arduino-buider
, available in Arduino IDE 1.6.6 and newer.
When laying out your project, put a libraries/
and hardware/
folder along side your sketch directory, like so:
YourHipProject/
Makefile
hardware/
Vendor/arch/{boards.txt,platform.txt}
libraries/
SomethingUseful/
NoIdeaHowThisWorks/
ProjectSketch/
ProjectSketch.ino
othersource.cpp
The hardware/
directory is only needed if you need support for 3rd party boards. Then, in the Makefile
:
ARDUINO_DIR ?= /opt/arduino-1.6.13 # need to set this for your environment
.PHONY: ProjectSketch
ProjectSketch:
arduino-builder -compile -verbose \
-hardware $(ARDUINO_DIR)/hardware \
-tools $(ARDUINO_DIR)/tools-builder \
-tools $(ARDUINO_DIR)/hardware/tools/avr \
-built-in-libraries $(ARDUINO_DIR)/libraries \
-hardware ./hardware \
-libraries ./libraries \
-fqbn=Vendor:arch:board \
./ProjectSketch/ProjectSketch.ino
ARDUINO_DIR
needs to point to where your Arduino is installed, be sure to set -fqbn=
correctly too.
Running make
should compile the firmware from ProjectSketch/
with the accompanying libraries and hardware definitions. Also, with verbose compile output enabled, the Arduino IDE will show you how it runs arduino-builder
.
/Applications/Arduino.app/Contents/Java/libraries
, instead of the regular libraries folder~/Documents/Arduino/libraries
.