7

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.

pseudon
  • 171
  • 4

2 Answers2

3

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).

Chris Stratton
  • 5,411
  • 20
  • 40
3

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.

per1234
  • 4,278
  • 2
  • 23
  • 43
kzyapkov
  • 131
  • 2