A.Quarter.To.Seven

Some of Stef's Stuff

STM32 development with open source tools

by Stefano on 2014.04.30, no comments

Want create site? Find Free WordPress Themes and plugins.


The STM32VL Discovery board is a cheap and effective kit to start developing on ARM MCUs. It is  based on the STM32 F1 family and features an onboard ST-LINK V1 programmer/debugger (both JTAG and SWD are supported). See More on the official pages ST-LINK  and ST-LINK/V2.

In the following notes an how-to setup:

  • the Eclipse IDE and the GNU ARM Eclipse plugin
  • the GNU ARM toolchain
  • the ST-LINK V1/V2 USB drivers
  • the ST-LINK utility (to flash the MCU)

Eclipse IDE

Everything is done on a MacBookPro 13″ running OSX 10.9.2 Mavericks. Eclipse – currently in its 4.3.2 release, Kepler – must be installed and on top of that

from the Kepler update repository, and

from the GNU ARM Eclipse Plugin update site.

 

GNU ARM toolchain

To build a project from source an ARM toolchain is required: the GNU Tools for ARM Embedded Processor is the toolset of choice (or see other options and even build it). It is available for download here

The following steps can be performed on OS X.

  • download the latest OS X install tarball file
  • locate the file (usually in the $HOME/Downloads folder)
  • decide on a location to install the toolchain; the recommended folder is /usr/local
  • unpack the archive in the destination folder

  • the result should be a folder like /usr/local/gcc-arm-none-eabi-4_8-2013q4
  • test if the compiler is functional

DO NOT add the toolchain path to the user or system path!

The complete toolchain documentation is available in the …/share/doc/pdf/ folder.

If you’ll ever need to remove the toolchain, just remove the /usr/local/gcc-arm-none-eabi-4_8-2013q4, there are no other components stored in system folders.

 

A GDB client is available within the toolchain. In a cross-compiling environment, this command is used to connect the host (the computer used for development) to a GDB server (see here), a program acting as a proxy between the host and the target device (the STM32VL Discovery board)

 

 

ST-LINK driver, programmer and GDB server

Texane’s stlink is a STM32 command line programmer for Linux (and OSX). It provides the user with a flashing utility (st-flash) and a GDB server (st-util) among other features. Instruction on how to compile and build are available at:

  • texane/stlink homepage and in the README

Some old info (dated back to 2011) are also available from cu.rious.org:

OS X

Install the device driver for the STM32VL Discovery board (.kext) from texane GitHub page Refer to the README file for additional info.

NOTE – The .kext file installation should avoid the manual setup (modprobe,udev) described in the main README file.

NOTE – Normally no third-party software is required to install the .kext file. On Mavericks, a tool like Kext Utility will be required to authorize the file.

See also the kext requirements and the kext manual installation for an even more advanced insight.

Once done st-util, etc… can be moved to /usr/local/bin folder to allow them to be executed no matter what the current location will be.

Once plugged in test the board as follow

Please note the ST-LINK on the STM32VL is version 1, so the use of “-1” argument at the command line “st-util -1” is advised; failing to do that can lead to error upon file loading (and again). The red COM LED on the board will turn on to indicate the GDB server is connected to the board and listening on the default port 424

With the GNU ARM Eclipse plugin installed no further configuration is required to code for the STM32. Follow the documentation on the project page for a quick start. Before any flashing or debugging attempt the GDB server previously installed must be up and running: an External Tools configuration can be defined to launch st-util from Eclipse toolbar. See

Then create a Debug configuration and use it (when launching for debugging) to connect to the GDB server.

 

Did you find apk for android? You can find new Free Android Games and apps.

Leave a Reply

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