Mac Tutorial: How to compile and upload the firmware of MIs eurorack modules


#1

All Mutable Instruments modules are open source and it’s project files can be found on Github. If they aren’t all analog, the modules are using either an AVR or an AMR microcontroller. To start your adventure, get the project files first:

  1. Open Terminal and enter: git clone https://github.com/pichenettes/eurorack.git

Braids, Clouds, Elements, Frames, Peaks, Streams, Tides, Yarns
The modules are using ARM microcontroller, therefore you will need to install an ARM toolchain first.

  1. Open Terminal and enter:
    1.1. ruby -e “$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)”
    1.2. brew install mpfr gmp libmpc libelf texinfo
  2. Download arm-eabi-toolchain and unzip.
  3. Open Terminal and enter:
    3.1. cd /§Path-To-arm-eabi-toolchain§/
    3.2. make install-cross
    3.3 export PATH=$HOME/arm-cs-tools/bin:$PATH
  4. Open “eurorack/stmlib/makefile.inc” and edit the value TOOLCHAIN_PATH to /Users/§username§/arm-cs-tools/

There are three ways of uploading a firmware to the modules:

  • Audio input via wav file (very slow, but no programmer is needed and it’s supported by every module).
  • FTDI (slower than JTAG, but the programmer isn’t as expensive; 10-15$; Yarns has no FTDI port)
  • JTAG (fast, but the programmer is expensive; 50-60$)

To generate wav files, you will first need to open “/eurorack/stmlib/makefile.inc” and remove -Werror from CFlags. Now you can compile the code as wav files:

  1. Open Terminal and enter:
    1.1. cd /§pathToEurorackFolder§/
    1.2. make -f /§ModuleName§/makefile wav
  2. To upload the firmware, take a look at the official manual of the respective module.

If you want to upload a firmware via FTDI, you will need to get an FTDI programmer. I can recommend FTDI friend (you will need to cut the connection between the two 5v VCC pads and solder the pads for 3v). There are a few additional first steps, before you can compile and upload code via FTDI:

  1. Download and install FTDI driver
  2. Download Pyserial and unpack the tar.gz
  3. Open Terminal and enter:
    3.1. cd /§pathToPyserialFolder§/
    3.2. sudo python setup.py install
    3.3. Enter: ls /dev/cu.*
  4. Copy the returned value that looks similar to: /dev/cu.usbserial-XXXX
  5. Open /eurorack/stmlib/makefile.inc
  6. Paste the copied value to PGM_SERIAL_PORT

Now you can compile the code and upload via FTDI:

  1. Connect FTDI friend to the 6 FTDI pins on your module (the module needs to be connected to your eurorack busboard for power).
  2. Press and hold RESET. Press SYSBOOT simultaneously, then release reset while still holding SYSBOOT.
  3. Open Terminal and enter: “cd /§pathToEurorackFolder§/”
  4. To compile: “make -f /§ModuleName§/bootloader/makefile hex”
  5. To upload: “make -f /§ModuleName§/makefile upload_combo_serial”

Branches, Edges, Grids
The modules are using AVR microcontrollers, therefore you will need to install an AVR compiler (Crosspack for Mac). You will also need a SPI AVR programmer to transfer the compiled code to your modules. The programmer must be supported by avrdude. To get a list of all supported programmers open Terminal and enter “avrdude -c asdf”. In order to upload correctly, avrdude needs to know your programmer. Open “eurorack/avrlib/makefile.mk” and edit the value PROGRAMMER to your SPI AVR programmer. The correct value can be get from the mentioned list in Terminal.

1. Open Terminal and enter: "cd /§pathToEurorackFolder§/"
2. To compile: "make -f /§ModuleName§/makefile"
3. To upload: “make -f /§ModuleName§/makefile upload”


#2

Thanks! I will try this, so that the stuff that I have working for Shruthi development under Windows doesn’t conflict with the Braids stuff. I had some environment variable issues trying to do both under Windows (on MacBook Pro), had to copy some dlls, still not convinced it’s really working well, never got oscillator_test to work, would hate to upload bad code and brick the Braids. I have an FTDI Friend on its way, so the instructions are perfect.


#3

I got pretty far. Xcode 4.6.3 is installed, Command Line Tools are installed.
Tried to compile, got this:

I tried to comment out with # the value I used with my Windows build for TOOLCHAIN_PATH, that was way not happy. I deleted that line, leaving just the TOOLCHAIN_PATH that I want, now the compile works. Seems weird.


#4

Got Oscillator Test to work, had to find the right combination of settings to get audio. It’s really handy having this little test app to try things out before uploading code. Try this for a test bell sound…


#5

Now I’m trying to upload code to Braids with an AdaFruit FTDI Friend, and I get this:
Robert-Hedins-MacBook-Pro:eurorack-master rhedin$ make -f braids/makefile upload_combo_serial
make: ***** No rule to make target `build/braids_bootloader/braids_bootloader.hex’, needed by `build/braids/braids_bootloader_combo.bin’. Stop.

Any ideas? Thanks!


#6

Try make -f braids/bootloader/makefile hex


#7

Oh, that did something, thanks, I’ll test further when I get back from Donny and Marie live. :slight_smile:


#8

You obviously need to create the hex file first :slight_smile: I forgot to add it to the tutorial. Sorry. :confused:

I added a tutorial for compiling the other firmwares.


#9

Now I get this:
Robert-Hedins-MacBook-Pro:eurorack-master rhedin$ make -f braids/makefile upload_combo_serial
python stmlib/programming/serial/stm32loader.py \\
-p /dev/cu.usbserial-AM01QYF3 \\
-b 1152000 \\
-e \\
-w build/braids/braids_bootloader_combo.bin -v
Traceback (most recent call last):
File “stmlib/programming/serial/stm32loader.py”, line 27, in
import serial
ImportError: No module named serial
make: ***** [upload_combo_serial] Error 1


#10

Ups, sorry. Forgot one more step. You need to install pySerial. Download it here , unpack it, cd into the folder and enter: sudo python setup.py install
(I went through the same hurdles :wink:


#11

OK, now it works. Not the fastest update, seemed to take over two minutes, but it works. And I have the monophonic PLUK that I wanted. :slight_smile:


#12

Two minutes? I think it took 30 seconds for me. But I could be wrong… Can’t test it again, because… you know… :smiley:


#13

I connected the TFDI Friend ground to ground and didn’t reroute the other wires anywhere different.
These are my other settings from makefile.inc:
PGM_SERIAL_PORT = /dev/cu.usbserial-AM01QYF3
PGM_SERIAL_BAUD_RATE = 1152000
PGM_SERIAL_VERIFY = -v


#14

i already fail at 2.: ruby -e “$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)
it says:

-e:1: Invalid char `\\342’ in expression
-e:1: Invalid char `\\200’ in expression
-e:1: Invalid char `\\234’ in expression

i thought, it might be some funny sign in there because i copied this line from your post.
when i put a " sign instead of the “ copyed from your post, it enter ruby, but the “brew install…” does nothing. i tryed “brew help” and “brew search”, but they also don’t work.

i am on osx 10.7.5
any help is appreciated.
sorry for beeing such a bloody n00b when it comes to this stuff :frowning:


#15

You are missing the closing quote around the curl command expression. It should be

ruby -e “$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)”

Ah, the closing quote is missing from the instructions above, too. And it looks like a typographic opening quote in the instructions, instead of a normal double quote. Try again with the line I just provided. Maybe flocked can correct the line in the original post.

OS X 10.7.5 is pretty ancient…


#16

thanks a lot!
seems like something i should have figured out myself.

jeah. 10.7.5 is kind of ancient like my whole mac…

turns out i also need gcc (and probably a bunch of other stuff) first. i’ll try to go on getting this to work and probably bother you guys again later, when i get stuck again :slight_smile:


#17

Easiest way to get gcc etc is to install Xcode (which is free), with the optional command line tools. It might be easier if you upgrade OS X to the latest version that will run on your Mac. I’m using Mavericks (10.9.2, the latest) and the toolchain was straightforward to install and the code built without any errors the first time.


#18

success!
i only needed the Xcode command line tools.


#19

Step 2 has now changed to:
ruby -e “$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)”


#20

Anyone able to help on a OSX issue

No rule to make target `stmlib/makefile.inc’

It would appear cloning from the main repo, it can’t clone the sub repos.