Search Posts

Nucleo STM32F103 dev board with built in STlinkV2-1 programmer


1. GNU ARM Tool Chain
2. IDE Eclipse
3. STmicro libraries
4. GDB Serve

1. GNU ARM Tool Chain
$ sudo add-apt-repository ppa:terry.guo/gcc-arm-embedded
(if using 14.04 follow extras steps when adding PPA)
$ sudo apt-get update
$ sudo apt-get install gcc-arm-none-eabi
if 64bit, we need 32-bit libs
$ sudo apt-get install lib32z1 lib32ncurses5 lib32bz2-1.0

2. Eclipse IDE & ARM plugin 
Verify Java version is 1.7 or newer
$ java -version
Choose IDE for C/C++ for 32 / 64 bit
Extract and run $ ./eclipse
Add c++ dev tools
Help → Install New Software > releases
Select ‘Luna’ eclipse release
Group by category > programming languages > C/C++ dev tools
Add ARM plugin
Help → Install New Software > releases

3. STmicro libraries 
template makefile compile environment:
git clone git://

4. GDB Server
GDB Server – debugging – ST link is not native compatible with Linux however, it’s been reverse engineered:
git clone git://
$ sudo apt-get install libusb-1.0
$ sudo apt-get install autoreconf
$ cd stlink
$ ./
$ ./configure
$ make
$ sudo cp 49-stlinkv2-1.rules /etc/udev/rules.d
$ sudo udevadm control –reload-rules
$ sudo udevadm trigger
$ sudo ./st-util

GUI – QSTLink2
$ sudo add-apt-repository ppa:fpoussin/ppa
$ sudo apt-get install qstlink2
To flash code to the board…

Binary Flash 
./st-flash write blinky.bin 0x8000000

ELF Executable Linkable Format
1. Start ST-link server on port 4242
$ ./st-util #check ST link is connected ok
$ ./st-util 4242 /dev/stlink
2. Start GDB and connect to ST-link server on port 4242
start an instance of arm-noneeabi-gdb
in a separate window and execute the following
$ arm-none-eabi-gdb BlinkingLights.elf
$(gdb) target extended-remote :4242
$(gdb) load
$(gdb) continue

Serial Output 
Nucleo board serial output can be viewed by opening serial port /dev/ttyACM0

Getting started wtih Eclipse
1. Select new C++ project for STMF10x project
2. Check through default options
3. select blinky example
4. in BlinkLed.h change port number to be ‘0’ for A and pin number to be 5 (on the necleo board the LED is on A5)
5. Click build
6. .elf file is now in the debug folder

Leave a Reply

Your email address will not be published. Required fields are marked *