Openocd meets a NUCLEO-F030R8 board

[Edit: newer versions of openocd (0.8) support the stlink-v2-1 on the nucleo board without the changes described below]

STMicroelectronics recently announced a new line of mbed compatible development boards at a great price (~$10.32).  The four “NUCLEO” boards support a range of Cortex M0, M3, low power M3, and an M4 STM32 chips with more boards to come in the future (see announcement link below). This post assumes you are used to working with the STM32FX Discovery boards and openocd. Knowing how to build openocd from source wouldn’t hurt either.

New Features

I snapped up one of the NUCLEO-F030 Cortex-M0 boards before they all disappeared from and it arrived with the UPS man yesterday.  These boards combine a programming device with a target user chip. The new firmware on the programming side of the NUCLEO board adds some long sought after missing features from the normal Discovery STLink-V2 versions. The NUCLEO board presents itself as a a composite USB device.  In addition to the normal STLink-V2 interface, added are a CDC ACM device and a Mass Storage Device. The CDC ACM device shows up as a Serial Virtual COM Port and the Mass Storage Device provides drag and drop firmware loading to the target MCU.

Issues with openocd

The first thing I did was boot up windows even though my main operating system is linux.  The device shows up as a removable disk drive with one file named mbed.htm. Opening that file with a browser takes you to the login page. I created a userid and noticed that the first thing they want you to do is to upgrade the firmware on the NUCLEO board.  I installed the new firmware and then rebooted into linux. I was hoping that I would be able to use the stock openocd with some minor configuration file changes. Unfortunately that didn’t happen. The new firmware shows up with a different VID/PID and the USB endpoint addresses have changed.

Let’s fix openocd

The new NUCLEO composite USB device has a new VID:PID combo 0483:374b . I noticed that the STLink-V2 portion of the device appeared to be very similar to the standard STLink-V2 one only differing in the endpoint addresses. I crossed my fingers and made the following simple modifications to the openocd source and recompiled. In addition, I created two new configuration files that describe the board and its interface, nucleo.cfg and a stlink-v2-1.cfg. I was happily surprised when I fired up openocd and it worked on the first shot.

This patch applied to the openocd github source code changes the stlnk_usb.c code so it works only with the nucleo board:


Create a new configuration file for the NUCLEO-F030R8 board:


and also a new interface file with the proper VID/PID for the stlink-v2-1 firmware:


How to run it:

With those changes in place, compile and install openocd and copy the config files into the destination scripts directory. Execute openocd and see if it finds your board and connects to it. In one window run:

in another window use arm-none-eabi-gdb to connect to the openocd gdb server:


If all is well, openocd will start up, connect to your NUCLEO board and then allow a gdb client to interact with it.

Good Luck!

Links – NUCLEO announcement – openocd source – online ARM compiler and framework collaboration site – NUCLEO-F030R8 board

Leave a Comment