MUS177-267 OpenOCD (update)

Installing OpenOCD

I have edited this document to put preferred methods of installation on the top. Also note that openocd 0.10 is required to program STM32F7 family chips.

macOS – Preferred method – homebrew

  • install Xcode and Xcode command line tools
  • install homebrew using  this command in the Terminal:
    /usr/bin/ruby -e "$(curl -fsSL"
  • install openocd using this in the Terminal:
    brew install --HEAD openocd
  • run openocd -f board/stm32f4discovery.cfg from the Terminal

Windows – Preferred method – Freddie Chopin

  • Download from
  • You will need a .7z unpacker to open the archive.
  • Place in your STMToolchain folder (not strictly necessary)
  • run openocd with options -f “board\stm32f4discovery.cfg” from Eclipse. You can do this from the Command Line, but you will need to set the MSDOS search path.

Common Bug – If you are “bounced” by openocd and have an STM32F4Discovery board

  • You probably have version MB997E of the board
  • Edit the file board/stm32f4discovery.cfg (in the openocd scripts folder) with Eclipse. If on macOS, you will have to first type Command-Shift-G in the file open box and enter /usr/local/share/openocd/scripts
  • Change the line that reads
    source [find interface/stlink-v2.cfg]


    source [find interface/stlink-v2-1.cfg]
  • Save the file and try openocd again

Common Bug – If you are “bounced” by openocd and you are running Windows

Testing – Check Telnet Connection to OpenOCD

You will be able to connect to openocd with “telnet localhost 4444″. Windows users may need to enable the Telnet Client

Other methods to install OpenOCD (not all will work on all hosts)

 Windows & macOS (precompiled OpenOCD – latest for STM32F7)

  • Download from
  • To run from command line – add bin directory to search path. macOS example – edit .bashrc:
     export PATH=$PATH:/Applications/GNU\ MCU\ Eclipse/OpenOCD/0.10.0-3-20170826-1813-dev/bin
  • Windows example – edit Control Panel:System:Advanced:Environment:Path. Append to end of path text:
    ;C:\Program Files\GNU MCU Eclipse\OpenOCD\0.10.0-3-20170826-1813-dev/bin
  • Run from Terminal (macOS) or Command Prompt (Windows)

    openocd -s "C:\Program Files\GNU MCU Eclipse\OpenOCD\0.10.0-3-20170826-1813-dev\scripts" -f "board\stm32f4discovery.cfg"


    openocd -s /Applications/GNU\ MCU\ Eclipse/OpenOCD/0.10.0-3-20170826-1813-dev/scripts -f stm32f4discovery.cfg

Windows(MSYS2 precompiled method)

  • Install MSYS2 from
  • Install OpenOCD binary for 64: pacman S mingww64x86_64openocdgit
  • -or- for 32 bit: pacman S mingww64i686openocdgit
  • Restart MSYS2
  • Enter openocd -s “/mingw64/share/openocd/scripts” -f “board/stm32f4discovery.cfg”
  • You can now connect via “telnet localhost 4444″ from another MSYS2 window
  • Connection from Eclipse uses port 3333 rather than 4444

Mus177-267 Installing Eclipse

Installing Eclipse

  • macOS and Windows are nearly the same for installation
  • neither macOS or Windows will have a Java Runtime Environment installed. Install JRE 8 from Oracle. JRE 9 does not currently work with Eclipse (without workarounds)
  • Install Eclipse Oxygen for C/C++ development
  • Older versions of Eclipse will work as well

Configure Eclipse for ARM development

Follow the guide on Camine Noviello’s blog from the text “When finished, you can launch the C:\STM32Toolchain\eclipse\eclipse.exe executable”

Skip the part about STLink and stop before “Flash the binary on the STM32Nucleo”

Now follow the blog entry on configuring OpenOCD

MUS177 MUS267 Syllabus

music 177/267 – custom programming for music – fall 2017

instructor – tom erbe –


this year we will be learning to program music software on an embedded processor. to do this we will cover 4 topics.

  1. c programming
  2. STM32F4/7 programming
  3. STM32F4/7 peripheral API (Cube)
  4. computer music/signal processing algorithms


  1. basics (basics and compilers – setting up a dev environment)
  2. ARM 1 – main(), initialization, GPIO, timers, and interrupts
  3. ARM 2 – ADC and DAC, analog connections (first assignment)
  4. dsp code 1 – amplifiers and distortion
  5. dsp code 2 – oscillators and sampling (second assignment)
  6. dsp code 3 – filters
  7. ARM 3 – high quality CODEC (final project)
  8. dsp code 3 – delay reverb
  9. ARM4 – other topics
  10. other topics

••••texts – software – hardware

  • C Primer Plus by Stephen Prata
  • Computer Music by Charles Dodge
  • DAFX by Udo Zolzer
  • ARM Cortex M4 Cookbook by Mark Fisher

Obtain either an STM32F4Discovery Board or an STM32F7Discovery. The F4 board is slightly slower and has only sound out, but should be sufficient for this class. The F7 board has a touch display and sound in and out.

STM32F407G-DISC1 $21.70

STM32F746G-DISCO $56.25

•••••my office hours

3:30 – 5 tuesday and thursday

•••••class requirements

3 projects of increasing complexity…. one is a final project. 267 students will be required to use their final project in a piece or for research.