Tools/Eclipse4STM32

From UIT
(Difference between revisions)
Jump to: navigation, search
(Windows)
(Linux (Ubuntu based))
 
(41 intermediate revisions by 4 users not shown)
Line 1: Line 1:
 
{{TOC right}}
 
{{TOC right}}
 +
 +
'''''<span style="color: red;">The setup for windows is outdated, please go to [[Tools/EclipseArmebs4/SetupWindows/Latest|setup for windows]]</span>'''''
 +
 +
= Goal =
 +
Install a click-and-run IDE for stm32f4 based boards.
 +
 +
This HOWTO has been tested on:
 +
* ubuntu 13.04 64 bits
 +
* windows xp sp3
 +
* windows 7 64 bits
 +
* OS X 10.9
 +
Using :
 +
* HEIVs armebs4 (stm32_camera board).
 +
* ST's stm32f4discovery board.
 +
'''Feel free to contribute (by editing or by email).'''
 +
 +
= The big picture =
 +
Here is an overview of the tools :
 +
 +
[[File:eclipse_stm32.png|border|800px]]
 +
== Detailed description ==
 +
Hardware:
 +
* JTAG adapter
 +
  * Connects physically the host computer to the target, usually from USB to JTAG.
 +
  * Can be integrated into the target
 +
 +
* Target board
 +
  * HEIVs ARMEBS4 integrates a "jtagusb" JTAG adapter
 +
  * ST stm32f4discovery integrates a st-link v2 JTAG adapter
 +
 +
Software:
 +
* Eclipse + CDT
 +
  * IDE with c/c++ support
 +
* make
 +
  * The classical program builder
 +
* gcc, ld, as, ...
 +
  * GNU compiler, linker, assembler, ...
 +
* gdb
 +
  * GNU debugger
 +
* openocd
 +
  * Tranlate GDB orders into JTAG commands
 +
 +
Source files
 +
* Application source file
 +
  * Your application
 +
* libheivs_stm32
 +
  * Collection of source files from various vendors (ST, ARM, ..., HEIVs) to be used on stm32 boards
 +
 
= Toolchain =
 
= Toolchain =
 
The toolchain we use comes from [https://launchpad.net/gcc-arm-embedded https://launchpad.net/gcc-arm-embedded]. This is a toolchain maintained by ARM employees and is available for Linux, Windows and OS X.
 
The toolchain we use comes from [https://launchpad.net/gcc-arm-embedded https://launchpad.net/gcc-arm-embedded]. This is a toolchain maintained by ARM employees and is available for Linux, Windows and OS X.
Line 8: Line 56:
 
sudo add-apt-repository ppa:terry.guo/gcc-arm-embedded
 
sudo add-apt-repository ppa:terry.guo/gcc-arm-embedded
 
sudo apt-get update
 
sudo apt-get update
sudo apt-get install build-essential gcc-arm-none-eabi
+
sudo apt-get install build-essential gcc-arm-none-eabi arm-none-eabi-gdb
 
</source>
 
</source>
  
Line 16: Line 64:
  
 
== Windows ==
 
== Windows ==
* download [https://launchpad.net/gcc-arm-embedded/4.7/4.7-2013-q2-update/+download/gcc-arm-none-eabi-4_7-2013q2-20130614-win32.zip gcc-arm-none-eabi-4_7-2013q2-20130614-win32.zip]
+
* download [https://launchpad.net/gcc-arm-embedded/4.7/4.7-2013-q3-update/+download/gcc-arm-none-eabi-4_7-2013q3-20130916-win32.zip gcc-arm-none-eabi-4_7-2013q3-20130916-win32.zip] (arm-none-eabi-gcc.exe should be in C:\xdev\tools\gcc-arm\4.7_2013q3\bin)
* unzip in C:\xdev\tools\gcc-arm\4.7_2013q2 (arm-none-eabi-gcc.exe should be in C:\xdev\tools\gcc-arm\4.7_2013q2\bin)
+
* download [http://sourceforge.net/projects/gnuwin32/files/make/3.81/make-3.81.exe/download gnuwin-make-3.81.zip]
* download [http://downloads.sourceforge.net/project/gnuwin32/make/3.81/make-3.81-bin.zip?r=http%3A%2F%2Fgnuwin32.sourceforge.net%2Fpackages%2Fmake.htm&ts=1373870479&use_mirror=surfnet gnuwin-make-3.81.zip]
+
* download [http://gnuwin32.sourceforge.net/downlinks/make-dep-zip.php gnuwin-make-dep.zip]
* unzip in c:\xdev\tools\gnuwin\make\3.81 (make.exe should be in c:\xdev\tools\gnuwin\make\3.81\bin)
+
* unzip in c:\xdev\tools\gnuwin\make\3.81 (make.exe and the .dll) should be in c:\xdev\tools\gnuwin\make\3.81\bin)
 
* add make.exe to your PATH.
 
* add make.exe to your PATH.
 +
 +
== OS X ==
 +
* download [https://launchpad.net/gcc-arm-embedded/4.8/4.8-2014-q2-update/+download/gcc-arm-none-eabi-4_8-2014q2-20140609-mac.tar.bz2 gcc-arm-none-eabi-4_8-2014q2-20140609-mac.tar.bz2], extract it and copy it to /opt
 +
Alternatively you can just type in a terminal:
 +
<source lang='bash'>
 +
sudo bash -c 'curl -L https://launchpad.net/gcc-arm-embedded/4.8/4.8-2014-q2-update/+download/gcc-arm-none-eabi-4_8-2014q2-20140609-mac.tar.bz2 | bunzip2 | tar -zxf -'
 +
</source>
 +
  
 
= openocd =
 
= openocd =
Line 28: Line 84:
  
 
<source lang='bash'>
 
<source lang='bash'>
# STM32f407 discovery (stlink and DFU mode)
+
#
ATTRS{idProduct}=="cff8", ATTRS{idVendor}=="0403", MODE="666", GROUP="plugdev"
+
# \file /etc/udev/rules.d/10-jtag.rules
ATTRS{idProduct}=="3748", ATTRS{idVendor}=="0483", MODE="666", GROUP="plugdev"
+
# \brief udev rules for drivers and ownership for ARMEBS4-like boards
 +
# \author marc dot pignat at hevs dot ch
 +
# \rev 1.0
 +
#
 +
# The ownership will be set to the 'plugdev' group
 +
#
  
# Amontec JTAGkey 2
+
#
 +
# AMREBS4-like (FTDI) integrated debugger and serial port
 +
#
 +
ATTRS{idProduct}=="3100", ATTRS{idVendor}=="08ee", MODE="666", GROUP="plugdev", RUN="/etc/udev/armebs4-serial.sh"
 +
 
 +
#
 +
# STM32F4 discovery board (stlink-v2 and DFU)
 +
#
 +
ATTRS{idProduct}=="3748", ATTRS{idVendor}=="0483", MODE="666", GROUP="plugdev"
 
ATTRS{idProduct}=="df11", ATTRS{idVendor}=="0483", MODE="666", GROUP="plugdev"
 
ATTRS{idProduct}=="df11", ATTRS{idVendor}=="0483", MODE="666", GROUP="plugdev"
 +
 +
#
 +
# Amontec JTAGkey 2
 +
#
 +
ATTRS{idProduct}=="cff8", ATTRS{idVendor}=="0403", MODE="666", GROUP="plugdev"
 
</source>
 
</source>
* make sure you're in the plugdev group
+
 
 +
* create the file /etc/udev/armebs4-serial.sh whith the following content:
 +
 
 +
<source lang='bash'>
 +
#!/bin/sh
 +
#
 +
# \file        /etc/udev/armebs4-serial.sh
 +
# \brief        Load the ftdi sio (CDC) driver and add the ARMEBS4 VID+PID
 +
# \author      marc dot pignat at hevs dot ch
 +
# \rev          1.1
 +
#
 +
 
 +
# Constants
 +
ID="08ee 3100 ff"
 +
SYS_FILE=/sys/bus/usb-serial/drivers/ftdi_sio/new_id
 +
 
 +
# modrpobe can be called with already loaded driver
 +
modprobe ftdi_sio
 +
 
 +
# add our ID only if necessary
 +
if ! grep -q "$ID" $SYS_FILE; then
 +
        echo  $ID > $SYS_FILE
 +
fi
 +
</source>
 +
 
 +
* make the file /etc/udev/armebs4-serial.sh executable
 +
** <code>sudo chmod +x /etc/udev/armebs4-serial.sh</code>
 +
* make sure you're in the <code>plugdev</code> and <code>dialout</code> groups
 +
** verify: <code>id <i>username</i></code>
 +
 
 
== Windows ==
 
== Windows ==
* Download and install [http://www.freddiechopin.info/en/download/category/4-openocd?download=99%3Aopenocd-0.7.0 openocd-0.7.0]
+
* Download and install [http://www.freddiechopin.info/en/download/category/4-openocd?download=109%3Aopenocd-0.8.0 openocd-0.8.0]
* Unzip into c:\xdev\tools\openocd\0.7 (openocd-0.7.0.exe should be in C:\xdev\tools\openocd\0.7.0\bin)
+
* Unzip into c:\xdev\tools\openocd\0.8 (openocd-0.8.0.exe should be in C:\xdev\tools\openocd\0.8.0\bin)
* rename openocd-0.7.0.exe into openocd.exe
+
* rename openocd-0.8.0.exe into openocd.exe
* <strike>For the stm32f4 discovery board (st-link) : Download and install this driver [[File:libusb-win32_stlink_driver-120229.zip]]</strike>
+
 
* Download and install the ST-LINK/V2 USB driver from [http://www.st.com/web/en/catalog/tools/PF258167 here] (STSW-LINK003)
+
* For HEIVS Armebs4 download this driver : [[File:armebs4_windows_drivers.zip]]
** Optional: Test the connection with the STM32 ST-LINK Utility V2
+
** login as administrator
* For the other boards FIXME
+
** unzip the file
 +
** connect the armebs4 (usb debug port)
 +
**** windows will fail installing drivers that is normal
 +
** open the device manager
 +
*** on every ARMEBS4 devices do ( == 4 times) :
 +
**** right-click update driver software... > browse my computer > search in the previously unzipped folder > install this driver anyway
 +
**** redo-it on the 3 "usb serial port" which seem to have problems in the device manager (don't ask me why there are only 3...)
 +
*** run zadig-2.10.exe from [http://zadig.akeo.ie zadig site]
 +
**** options > show all
 +
**** select armebs4 v01 interface0
 +
**** select Winusb
 +
**** click Install driver
 +
 
 +
* for the stm32f4 discovery
 +
* Download and run zadig from [http://zadig.akeo.ie zadig site]
 +
** There is a version for XP and another for newer windows.
 +
** Connect the board to the host machine
 +
** Run zadig
 +
** Show all devices (options->List all devices)
 +
** Select "stlink" from the list
 +
** Select "WinUSB" driver
 +
** Install it
 +
 
 +
== OS X ==
 +
The simplest way to install Open-OCD is to install it via [http://brew.sh Homebrew]:
 +
<source lang='bash'>
 +
brew install open-ocd
 +
</source>
  
 
= Eclipse =
 
= Eclipse =
Tested with eclipse 4.3 (Kepler), but at least works with Juno (4.2) and Indigo (4.1)
+
Tested with eclipse 4.3 (Kepler) and 4.4 (Luna), but at least works with Juno (4.2) and Indigo (4.1)
* Help -> Install new software ... -> work with "-- All available sites --" and add at least :
+
* Help -> Install new software ... -> add site/repository: http://gnuarmeclipse.sourceforge.net/updates
  * Programming Languages : C/C++ development Tools
+
* Help -> Install new software ... -> work with "-- All available sites --" and add at least : <br/>(Some of the items below might already be installed, e.g. if you installed Eclipse for C/C++. To make them appear in the list uncheck <code>Hide items that are already installed</code>.
  * Mobile and Device Development : C/C++ Hardware Debugging
+
*; Collaboration
  * Mobile and Device Development : C/C++ Cross compiler support
+
*: Subversive SVN Team provider + subversive connector
  * Subversive SVN Team provider + subversive connector
+
*;GNU ARM C/C++ Cross Development Tools  
 +
*: GNU ARM OpenOCD Debugging
 +
*; Mobile and Device Development
 +
*: C/C++ GCC Cross Compiler Support
 +
*: C/C++ GDB Hardware Debugging
 +
*; Programming Languages
 +
*: C/C++ Development Tools
 
* After setup and restart, subversive should ask to choose a connector, choose:
 
* After setup and restart, subversive should ask to choose a connector, choose:
  * SVNkit 1.7.9
+
** SVNkit (same version as the subversion installed on your system)
 +
 
 +
= Openocd from eclipse =
 +
* Run->External Tools->External Tools Configuration...
 +
* Program -> new
 +
  * Location:
 +
    * linux : /usr/bin/openocd
 +
    * windows : c:\xdev\tools\openocd/0.8.0/bin/openocd.exe
 +
  * Working directory : empty
 +
  * arguments :
 +
    * ARMEBS4 : -f "${workspace_loc}/libheivs_stm32/armebs4.cfg"
 +
    * stm32f4discovery : -f board/stm32f4discovery.cfg
  
 
= Project Setup =
 
= Project Setup =
 
In the project properties make sure
 
In the project properties make sure
* C/C++ build > settings -> Settings tab : "Cross settings" :
+
* C/C++ Build > Settings -> Tool Settings tab : "Cross Settings" :
    * prefix : "arm-none-eabi-"
+
** prefix : "arm-none-eabi-"
    * path (windows) : "C:\xdev\tools\gcc-arm\4.7_2013q2\bin"
+
** path (windows) : "C:\xdev\tools\gcc-arm\4.7_2013q2\bin"
    * path (Linux generic) : "/opt/xdev/gcc-arm-none-eabi-4_7-2013q2/bin/"
+
** path (Linux generic) : "/opt/xdev/gcc-arm-none-eabi-4_7-2013q2/bin/"
    * path (Unbutu based) : arm-none-eabi- tools are in the PATH.
+
** path (Unbutu based) : arm-none-eabi- tools are in the PATH.
* C/C++ build > settings -> Settings tab : "Cross GCC compiler" :
+
* C/C++ Build > Settings -> Tool Settings tab : "Cross GCC compiler" :
  * Symbols :
+
** Symbols :
    * STM32F4XX=1
+
*** BOARD_STM32_CAMERA or BOARD_STM32_CAMERA or BOARD_ARMEBS4 depending on your board
    * ARM_MATH_CM4=1
+
** Includes :
    * __FPU_PRESENT=1
+
*** "${workspace_loc:/${ProjName}/libheivs_stm32/include}"
    * USE_STM324xG_EVAL=1
+
*** "${workspace_loc:/${ProjName}}"
  * Includes :
+
** Optimization : -O2 for normal use and -O0 for laboratories
    * "${workspace_loc:/${ProjName}/libheivs_stm32/include}"
+
** Debugging:  
    * "${workspace_loc:/${ProjName}}"
+
*** Maximum -g3
  * Debugging:  
+
** Warnings:
    * Maximum -g3
+
*** -Wall
  * Warnings:
+
** Miscellaneous
    * -Wall
+
*** "-c -fmessage-length=0 -mthumb -mcpu=cortex-m4 -mfloat-abi=hard -mfpu=fpv4-sp-d16"
  * Miscellaneous
+
* C/C++ Build > Settings -> Tool Settings tab : "Cross GCC Linker" :
    * "-c -fmessage-length=0 -mthumb -mcpu=cortex-m4 -mfloat-abi=hard -mfpu=fpv4-sp-d16"
+
** General :
* C/C++ build > settings -> Settings tab : "Cross GCC linker" :
+
*** No shared libraries (-static)
  * General :
+
** Libraries
    * No shared libraries (-static)
+
*** "m", "c" and "nosys"
  * Libraries
+
** Miscellaneous
    * m
+
*** Linker flags : "-T "${workspace_loc:/${ProjName}/libheivs_stm32/stm32f407ig_flash.ld}" -mthumb -mcpu=cortex-m4 -mfloat-abi=hard -mfpu=fpv4-sp-d16"
  * Miscellaneous
+
*** Other options (-Xlinker [option])
    * Linker flags : "-T "${workspace_loc:/${ProjName}/libheivs_stm32/stm32f407ig_flash.ld}" -mthumb -mcpu=cortex-m4 -mfloat-abi=hard -mfpu=fpv4-sp-d16"
+
**** -Map=linker.map
    * Other options (-Xlinker [option])
+
**** --gc-sections
      * -Map=linker.map
+
* C/C++ Build > Settings -> -Tool Settings tab : "Cross GCC Assembler" :
      * --gc-sections
+
** General:
* C/C++ build > settings -> Settings tab : "Cross GCC assembler" :
+
*** Assembler flags : "-mthumb -mcpu=cortex-m4 -mfloat-abi=hard -mfpu=fpv4-sp-d16 -g3"
  * General:
+
 
    * Assembler flags : "-mthumb -mcpu=cortex-m4 -mfloat-abi=hard -mfpu=fpv4-sp-d16 -g3"
+
= Debug Settings =
= Debug settings =
+
* Debug Configuration -> GDB Hardware Debugging
* Debug configuration -> GDB Hardware debugging
+
** At the bottom of the page, make sure the project uses "Standard Hardware Debugging Laucher" (DSF won't work).
* At the bottom of the page, make sure the project uses "Standard Hardware Debugging Laucher" (DSF won't work).
+
** Debugger tab
* Debugger tab
+
*** GDB command (Ubuntu based) : "arm-none-eabi-gdb"
  * GDB command (Ubuntu based) : "arm-none-eabi-gdb"
+
*** GDB command (Linux generic) : "/opt/xdev/gcc-arm-none-eabi-4_7-2013q2/bin/arm-none-eabi-gdb"
  * GDB command (Linux generic) : "/opt/xdev/gcc-arm-none-eabi-4_7-2013q2/bin/arm-none-eabi-gdb"
+
*** GDB command (Windows) : "C:\xdev\tools\gcc-arm\4.7_2013q2\bin\arm-none-eabi-gdb.exe"
  * GDB command (Windows) : "C:\xdev\tools\gcc-arm\4.7_2013q2\bin\arm-none-eabi-gdb.exe"
+
*** Use remote target : checked
  * Use remote target : checked
+
*** JTAG Device : Generic TCP/IP, localhost 3333
  * JTAG Device (via pipe)
+
** Startup tab
  * GDB Connection string (stlink): "| openocd -f interface/stlink-v2.cfg -f target/stm32f4x_stlink.cfg -c "gdb_port pipe""
+
*** [[File:eclipse-gdb_hardware_debugging-startup.png]]
  * GDB Connection string (jtagkey2): "| openocd -f interface/jtagkey2.cfg -f board/stm3241g_eval.cfg -c "gdb_port pipe""
+
*** disable Reset and delay (this command is not supported by openocd)
* Startup tab
+
*** disable halt
  * Reset and delay : 1
+
*** commands (This will make sure the core is in a known state)
  * halt
+
**** monitor reset halt
    monitor flash erase_sector 0 0 0
+
**** monitor flash erase_sector 0 0 0
    monitor reset halt
+
**** monitor reset halt
  * Load image (use project binary)
+
*** Load image : use project binary (this will load the software to flash)
  * Load symbols (use project binary)
+
*** Load symbols : use project binary (no debugging without symbols)
  * Set breakpoint at main
+
*** Set breakpoint at main
  * Run commands
+
*** Run commands ( 1) reset the cpu -> reload PC 2) enable clock when in WFI 3) run to main
    monitor reset halt
+
**** monitor reset halt
    continue
+
**** set *(uint32_t *)0xe0042004 = 0x00000001
* Common tab
+
**** continue
  Save as shared file, so the debugging parameters will be saved into the project.
+
** Common tab
 +
*** Save as shared file, so the debugging parameters will be saved into the project.

Latest revision as of 07:59, 21 April 2015

Contents

The setup for windows is outdated, please go to setup for windows

Goal

Install a click-and-run IDE for stm32f4 based boards.

This HOWTO has been tested on:

* ubuntu 13.04 64 bits
* windows xp sp3
* windows 7 64 bits
* OS X 10.9

Using :

* HEIVs armebs4 (stm32_camera board).
* ST's stm32f4discovery board.

Feel free to contribute (by editing or by email).

The big picture

Here is an overview of the tools :

Eclipse stm32.png

Detailed description

Hardware:

* JTAG adapter
  * Connects physically the host computer to the target, usually from USB to JTAG.
  * Can be integrated into the target
* Target board
  * HEIVs ARMEBS4 integrates a "jtagusb" JTAG adapter
  * ST stm32f4discovery integrates a st-link v2 JTAG adapter

Software:

* Eclipse + CDT
  * IDE with c/c++ support
* make
  * The classical program builder
* gcc, ld, as, ...
  * GNU compiler, linker, assembler, ...
* gdb
  * GNU debugger
* openocd
  * Tranlate GDB orders into JTAG commands

Source files

* Application source file
  * Your application
* libheivs_stm32
  * Collection of source files from various vendors (ST, ARM, ..., HEIVs) to be used on stm32 boards

Toolchain

The toolchain we use comes from https://launchpad.net/gcc-arm-embedded. This is a toolchain maintained by ARM employees and is available for Linux, Windows and OS X.

Linux (Ubuntu based)

There is a PPA for gcc-arm-embedded.

sudo add-apt-repository ppa:terry.guo/gcc-arm-embedded
sudo apt-get update
sudo apt-get install build-essential gcc-arm-none-eabi arm-none-eabi-gdb

Linux (generic)

Windows

OS X

Alternatively you can just type in a terminal:

sudo bash -c 'curl -L https://launchpad.net/gcc-arm-embedded/4.8/4.8-2014-q2-update/+download/gcc-arm-none-eabi-4_8-2014q2-20140609-mac.tar.bz2 | bunzip2 | tar -zxf -'


openocd

Linux

  • install openocd (should be in the repository of your favorite distribution)
  • create the file /etc/udev/rules.d/10-jtag.rules whith the following content:
#
# \file /etc/udev/rules.d/10-jtag.rules
# \brief udev rules for drivers and ownership for ARMEBS4-like boards
# \author marc dot pignat at hevs dot ch
# \rev 1.0
#
# The ownership will be set to the 'plugdev' group
#
 
#
# AMREBS4-like (FTDI) integrated debugger and serial port
#
ATTRS{idProduct}=="3100", ATTRS{idVendor}=="08ee", MODE="666", GROUP="plugdev", RUN="/etc/udev/armebs4-serial.sh"
 
#
# STM32F4 discovery board (stlink-v2 and DFU)
#
ATTRS{idProduct}=="3748", ATTRS{idVendor}=="0483", MODE="666", GROUP="plugdev"
ATTRS{idProduct}=="df11", ATTRS{idVendor}=="0483", MODE="666", GROUP="plugdev"
 
#
# Amontec JTAGkey 2
#
ATTRS{idProduct}=="cff8", ATTRS{idVendor}=="0403", MODE="666", GROUP="plugdev"
  • create the file /etc/udev/armebs4-serial.sh whith the following content:
#!/bin/sh
#
# \file         /etc/udev/armebs4-serial.sh
# \brief        Load the ftdi sio (CDC) driver and add the ARMEBS4 VID+PID
# \author       marc dot pignat at hevs dot ch
# \rev          1.1
#
 
# Constants
ID="08ee 3100 ff"
SYS_FILE=/sys/bus/usb-serial/drivers/ftdi_sio/new_id 
 
# modrpobe can be called with already loaded driver
modprobe ftdi_sio
 
# add our ID only if necessary
if ! grep -q "$ID" $SYS_FILE; then
        echo  $ID > $SYS_FILE
fi
  • make the file /etc/udev/armebs4-serial.sh executable
    • sudo chmod +x /etc/udev/armebs4-serial.sh
  • make sure you're in the plugdev and dialout groups
    • verify: id username

Windows

  • Download and install openocd-0.8.0
  • Unzip into c:\xdev\tools\openocd\0.8 (openocd-0.8.0.exe should be in C:\xdev\tools\openocd\0.8.0\bin)
  • rename openocd-0.8.0.exe into openocd.exe
  • For HEIVS Armebs4 download this driver : File:Armebs4 windows drivers.zip
    • login as administrator
    • unzip the file
    • connect the armebs4 (usb debug port)
        • windows will fail installing drivers that is normal
    • open the device manager
      • on every ARMEBS4 devices do ( == 4 times) :
        • right-click update driver software... > browse my computer > search in the previously unzipped folder > install this driver anyway
        • redo-it on the 3 "usb serial port" which seem to have problems in the device manager (don't ask me why there are only 3...)
      • run zadig-2.10.exe from zadig site
        • options > show all
        • select armebs4 v01 interface0
        • select Winusb
        • click Install driver
  • for the stm32f4 discovery
  • Download and run zadig from zadig site
    • There is a version for XP and another for newer windows.
    • Connect the board to the host machine
    • Run zadig
    • Show all devices (options->List all devices)
    • Select "stlink" from the list
    • Select "WinUSB" driver
    • Install it

OS X

The simplest way to install Open-OCD is to install it via Homebrew:

brew install open-ocd

Eclipse

Tested with eclipse 4.3 (Kepler) and 4.4 (Luna), but at least works with Juno (4.2) and Indigo (4.1)

  • Help -> Install new software ... -> add site/repository: http://gnuarmeclipse.sourceforge.net/updates
  • Help -> Install new software ... -> work with "-- All available sites --" and add at least :
    (Some of the items below might already be installed, e.g. if you installed Eclipse for C/C++. To make them appear in the list uncheck Hide items that are already installed.
    Collaboration
    Subversive SVN Team provider + subversive connector
    GNU ARM C/C++ Cross Development Tools
    GNU ARM OpenOCD Debugging
    Mobile and Device Development
    C/C++ GCC Cross Compiler Support
    C/C++ GDB Hardware Debugging
    Programming Languages
    C/C++ Development Tools
  • After setup and restart, subversive should ask to choose a connector, choose:
    • SVNkit (same version as the subversion installed on your system)

Openocd from eclipse

  • Run->External Tools->External Tools Configuration...
  • Program -> new
 * Location:
   * linux : /usr/bin/openocd
   * windows : c:\xdev\tools\openocd/0.8.0/bin/openocd.exe
 * Working directory : empty
 * arguments :
   * ARMEBS4 : -f "${workspace_loc}/libheivs_stm32/armebs4.cfg"
   * stm32f4discovery : -f board/stm32f4discovery.cfg

Project Setup

In the project properties make sure

  • C/C++ Build > Settings -> Tool Settings tab : "Cross Settings" :
    • prefix : "arm-none-eabi-"
    • path (windows) : "C:\xdev\tools\gcc-arm\4.7_2013q2\bin"
    • path (Linux generic) : "/opt/xdev/gcc-arm-none-eabi-4_7-2013q2/bin/"
    • path (Unbutu based) : arm-none-eabi- tools are in the PATH.
  • C/C++ Build > Settings -> Tool Settings tab : "Cross GCC compiler" :
    • Symbols :
      • BOARD_STM32_CAMERA or BOARD_STM32_CAMERA or BOARD_ARMEBS4 depending on your board
    • Includes :
      • "${workspace_loc:/${ProjName}/libheivs_stm32/include}"
      • "${workspace_loc:/${ProjName}}"
    • Optimization : -O2 for normal use and -O0 for laboratories
    • Debugging:
      • Maximum -g3
    • Warnings:
      • -Wall
    • Miscellaneous
      • "-c -fmessage-length=0 -mthumb -mcpu=cortex-m4 -mfloat-abi=hard -mfpu=fpv4-sp-d16"
  • C/C++ Build > Settings -> Tool Settings tab : "Cross GCC Linker" :
    • General :
      • No shared libraries (-static)
    • Libraries
      • "m", "c" and "nosys"
    • Miscellaneous
      • Linker flags : "-T "${workspace_loc:/${ProjName}/libheivs_stm32/stm32f407ig_flash.ld}" -mthumb -mcpu=cortex-m4 -mfloat-abi=hard -mfpu=fpv4-sp-d16"
      • Other options (-Xlinker [option])
        • -Map=linker.map
        • --gc-sections
  • C/C++ Build > Settings -> -Tool Settings tab : "Cross GCC Assembler" :
    • General:
      • Assembler flags : "-mthumb -mcpu=cortex-m4 -mfloat-abi=hard -mfpu=fpv4-sp-d16 -g3"

Debug Settings

  • Debug Configuration -> GDB Hardware Debugging
    • At the bottom of the page, make sure the project uses "Standard Hardware Debugging Laucher" (DSF won't work).
    • Debugger tab
      • GDB command (Ubuntu based) : "arm-none-eabi-gdb"
      • GDB command (Linux generic) : "/opt/xdev/gcc-arm-none-eabi-4_7-2013q2/bin/arm-none-eabi-gdb"
      • GDB command (Windows) : "C:\xdev\tools\gcc-arm\4.7_2013q2\bin\arm-none-eabi-gdb.exe"
      • Use remote target : checked
      • JTAG Device : Generic TCP/IP, localhost 3333
    • Startup tab
      • Eclipse-gdb hardware debugging-startup.png
      • disable Reset and delay (this command is not supported by openocd)
      • disable halt
      • commands (This will make sure the core is in a known state)
        • monitor reset halt
        • monitor flash erase_sector 0 0 0
        • monitor reset halt
      • Load image : use project binary (this will load the software to flash)
      • Load symbols : use project binary (no debugging without symbols)
      • Set breakpoint at main
      • Run commands ( 1) reset the cpu -> reload PC 2) enable clock when in WFI 3) run to main
        • monitor reset halt
        • set *(uint32_t *)0xe0042004 = 0x00000001
        • continue
    • Common tab
      • Save as shared file, so the debugging parameters will be saved into the project.
Personal tools
Namespaces
Variants
Actions
Navigation
Browse
Toolbox