# How to get firmware onto mutable modules I had the best luck with the Black Magic Probe and gdb. ## Install compiler First install the arm compiler: ``` sudo add-apt-repository ppa:team-gcc-arm-embedded/ppa sudo apt-get update sudo apt-get install gcc-arm-embedded ``` ## Compile the code Get the mutable codebase from here `https://github.com/pichenettes/eurorack` AND UPDATE THE SUBMODULES: ``` git submodule init && git submodule update ``` Then set the `TOOLCHAIN_PATH` variable in your environment as following: ``` export TOOLCHAIN_PATH=/usr/ ``` Try compiling the clouds (or whatever) firmware into a `build/clouds/clouds.hex` file using the first following command. You should probably also build the bootloader hex file as well (the second command): ``` make -f clouds/makefile make -f clouds/bootloader/makefile hex ``` If you modify anything in the source tree, you maaay need to run this: ``` touch clouds/resources/resources.py && make -f clouds/makefile resources ``` ## Install the firmware using a wave file Note: This will NOT work if the module is bricked or has a fresh STM32 micro (you built the module last night or whatever). The firmware can be updated using a wave file: ``` make -f clouds/makefile wav ``` Then follow the manual to figure it out from there: `http://mutable-instruments.net/modules/clouds/manual` ## Install the firmware using the Black Magic Probe Note: This method does NOT use the upload scripts included in the Mutable Instruments eurorack repo's Makefiles! Note: A fresh chip will turn all 4 LEDs on out of the gate. This is in contrast to what is written on the clouds open source `Firmware hacking` page. That page says that you can boot the thing into it's serial bootloader in a way that gets the LEDs to turn off. That is only the case if the module already has firmware on it as far as I can tell. My fresh module had all lights on. This is normal. One the toolchain is installed and the code and bootloader are compiled, you can hook the probe up directly to the module's JTAG header and use gdb to push the code to the module. Once you're hooked up, start up the ARM gdb and scan for the device. Note that Mutable Instruments modules need to use `monitor swdp_scan` to see the device. Follow these steps to get everything working: ``` % git clone git@github.com:pichenettes/eurorack.git % cd eurorack/ % git submodule init && git submodule update % export TOOLCHAIN_PATH=/usr/ % make -f clouds/makefile % make -f clouds/bootloader/makefile hex % arm-none-eabi-gdb [...] (gdb) monitor swdp_scan (gdb) attach 1 (gdb) set mem inaccessible-by-default off (gdb) load build/clouds_bootloader/clouds_bootloader.hex [...] (gdb) load build/clouds/clouds.hex [...] (gdb) quit ``` After running the final load, you should see the module blink through it's bootup and then turn off all of it's LEDs. Unplug the programmer, power cycle the module, and make sure it boots up by blinking it's leds! You should have a working module now! ## More notes on the Black Magic Probe: getting started: `https://github.com/blacksphere/blackmagic/wiki/Getting-Started` Useful commands (and debugging help): `https://github.com/blacksphere/blackmagic/wiki/Useful-GDB-commands`