This small HowTo will show you how to compile the firmware for a Mutable Instruments device. The description is valid for the Shruthi-1 as well as for the MidiPal device. In the examples below I’m referencing the Shruthi firmware. If you want to create the MidiPal firmware just replace the references to Shruthi-1 and shruthi by “midipal”.
I know that there are already some threads and small articles on the webpage/forum but i couldn’t see and complete description showing all steps one by one, and also mentioning all the traps you might have to expect.
REMARK: At the moment there seems to be a problem with the code as an error during the compilation for the function “UpdateLedsTask()” shows up. Unfortunately this is nothing i can fix. Anyway, the MidiPal FW compilation just works perfect.
O.K., here we go:
1. Download the following tools:
- WinAVR - http://sourceforge.net/projects/winavr/files/WinAVR/20100110/WinAVR-20100110-install.exe/download
- git - http://msysgit.googlecode.com/files/Git-1.7.11-preview20120704.exe
- Python 2.7 - http://www.python.org/ftp/python/2.7.3/python-2.7.3.amd64.msi
- numpy library (numpy-MKL-1.6.2.win-amd64-py2.7.exe) for Python - http://www.lfd.uci.edu/~gohlke/pythonlibs/#numpy
- mingw make version 3.82 - http://mingw-and-ndk.googlecode.com/files/make.exe
2. Install the tools on your PC. See the comments below for further details.
- Install WinAVR wherever you like and let the installation routine add the pathnames to the Windows PATH. After the installation has been finished replace the file named “make” in the WinAVR\\utils\\bin directory with the one you downloaded in the first step. If you want you can rename the original file so that you can go back to version 3.81 if needed.
- git: When being asked for the PATH envrionment settings by the installer, choice the second option (“Run Git from Windows command prompt”).
- As the Windows Explorer integration it’s enough to choose “Git Bash Here” only.
- Python: You don’t have to install the test tools or the documentation if you are not interested in any further Python development.
- As the Python installation does not change the Windows path you have to do it manually.In Windows go to
>Control Panel->System- >Advanced System settings->Environment variables
- In the “Sytem variables” section double click on the “Path” variable. At the end enter the path to your Python installation (i.e. “C:\\Program Files\\Python”).
- Last but not least install the numpy library. Should be straightforward without any further parameters to be changed.
3. Create a directory on your disk where you will put in your code (like c:\\Projects\\MutableInstruments).
4. Start a windows command line prompt in that directory (you can Shift-click on the directory in your Windows explorer and select the “command line here”-option).
5. Clone the repository and activate it by typing in the following commands:
- git clone https://github.com/pichenettes/shruthi-1
- cd shruthi-1
- git clone https://github.com/pichenettes/avril avrlib
- git clone https://github.com/pichenettes/avril-firmware_tools tools
- git submodule init
- git submodule update
6. Go into the ./avrlib directory and edit the “makefile.mk” file with an editor of your choice.
Look for the following entries:
Replace them both with the Windows path to the “bin” directory of your WinAVR installation. IT IS VERY IMPORTANT to put a slash “/” at the end of the path name, NOT a backslash!
AVRLIB_TOOLS_PATH = C:\\PROGRA~1\\WinAVR\\bin/
As you can see YOU HAVE TO REPLACE PATHNAMES WITH SPACES by using the windows 8.3 naming (you can always check which name is being used by calling “dir /X” from the commandline).
7. Go back into the shruthi-1 directory and start the WinAVR shell by running “sh”.
Then run the following command (the -d option is for showing detailed information only; you can leave it out later):
make -d -f shruthi/makefile
8. If everything goes well a new directory “build” with a subdirectory “shruthi” will be created. Here you will find a file called “shruthi1.hex” which contains the new firmware.
9. Now you can use the python converter to create a .syx or .mid file out of this. For the Shruthi Firmware it should be O.K. to run the following command (still using the sh shell!):
make -d -f shruthi/makefile midi
make -d -f shruthi/makefile syx
In any case you have problems with this procedure you can also converted it manually:
a) Exit the sh shell by typing “exit”.
b) You should still be in the root directory of your repository.
c) Now run the following command:
python tools\\hex2sysex\\hex2sysex.py build\\shruthi1\\shruthi1.hex --syx --output_file build\\YourOutputFileName.syx
and for the MidiPal use this command:
python tools\\hex2sysex\\hex2sysex.py build\\shruthi1\\shruthi1.hex --page_size 64 --device_id 3 --syx --output_file build\\YourOutputFileName.syx
So that’s all. I hope this helps the community so that we can see even more interesting firmware changes and additions for the Shruthi and the MidiPal.
Thanks to Olivier for making all of his fantastic code available to the public!