Setting up a development environment on Windows machines
Mr Roboto's tutorial
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”.
1. Download the following tools:
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 – Start—>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”).
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
git clone https://github.com/pichenettes/avril avrlib
git clone https://github.com/pichenettes/avril-firmware_tools tools
git submodule init
git submodule update
Note: the two "git clone" commands are not necessary as git submodule update should take care of it.
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! Example:
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 -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 “shruthi.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
For the MidiPal FW I couldn’t succeed with that command so i 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 —output_file build/YourOutputFileName.mid build/shruthi/shruthi.hex
- install python-2.5.4.msi (python-2.5.4.amd64.msi if you're using 64 bit windows) (get from here) to it's default destination c:\python25
- unzip arduino-1.0.1-windows.zip (get from here ) to c:\arduino
- Press Win+Pause/Break ->Advanced system settings -> Environment variables, doubleclick "path" variable and add ;c:\python25;c:\arduino\hardware\tools\avr\utils\bin to the end of it's line. (exactly all the bold text) Press Ok, Ok.
- Download avril, avril-firmware-tools and shruthi1 source archives from github, extract contents of shruthi(midipal) archive somewhere, then extract contents of avril and avril-firmware-tools archives to shruthi1\avrlib and shruthi1\tools folders respectively. Do the same for midipal.
- Open avrlib\makefile.mk in text editor and replace path variables with AVRLIB_TOOLS_PATH = C:\arduino\hardware\tools\avr\bin/ and AVRLIB_ETC_PATH = C:\arduino\hardware\tools\avr\etc/
- In the windows shell cd to shruthi folder and type "make", "make midi" or "make syx" if you need .mid/.syx files. After completing firmware compilation cd to build/shruthi1 (or build/midipal) and look for fresh firmware.
- This toolchain causes an error when building Anushri. To avoid it just add #define logf log line after extern double log(double __x) __ATTR_CONST__; in C:\arduino\hardware\tools\avr\avr\include\math.h