Using an ST-Link with Chibios and Eclipse on Linux / Mac OS X

This guide is not finished

This guide applies to Ubuntu 12.04 and Mac OS X Lion 10.7, with Eclipse Indigo. Using an ST-Link device requires minimal config compared to using OpenOCD.

Install eclipse into home directory

this makes updating + installing plugins easier on Ubuntu.

  1. Extract somewhere in your home directory, use the launcher to start eclipse
  2. Suggested directory structure for Chibios development. This allows for multiple Chibios based projects to share one Chibios codebase and also coexist in the same workspace within eclipse.
    1. ./src                               Use this as your eclipse workspace
      ./src/chibios                       Check out the chibios source code here
      ./src/proj1                         project directory
      ./src/proj2                         project directory
      ./src/proj1/chibios -> ../chibios   symbolic link to chibios
      ./src/proj1/MakeFile                project files
      ./src/proj1/main.c
      ./src/proj1/chconf.h
      ./src/proj1/mcuconf.h
      ./src/proj1/halconf.h
  3. Set Remote Target port as 4242

Install ST-Link

  1. Clone the st-link repo:
    1. git clone https://github.com/texane/stlink
  2. compile and install. Here I install to my home directory so that it doesn't conflict with the rest of the system.
    1. $ cd stlink
      $ ./autogen.sh
      $ ./configure --prefix=/home/user/apps
      $ make
      $ make install
  3. Add ~/apps/bin to your path
  4. Test it:
    1. tom@Z77A-GD65:~/projects/rc/src$ st-util
      2012-06-26T11:16:13 INFO src/stlink-common.c: Loading device parameters....
      2012-06-26T11:16:13 INFO src/stlink-common.c: Device connected is: F4 device, id 0x20006411
      2012-06-26T11:16:13 INFO src/stlink-common.c: SRAM size: 0x30000 bytes (192 KiB), Flash: 0x100000 bytes (1024 KiB) in pages of 16384 bytes
      Chip ID is 00000413, Core ID is  2ba01477.
      KARL - should read back as 0x03, not 60 02 00 00
      init watchpoints
      Listening at *:4242...
 
chibios/community/setup/stlink.txt · Last modified: 2012/06/26 12:46 by badger
 
Except where otherwise noted, content on this wiki is licensed under the following license:GNU Free Documentation License 1.3