Beruflich Dokumente
Kultur Dokumente
Introduction
This application note will show you how to install Eclipse on Windows and set
up a simple project. Compiling and finally debugging the code on an EFM32
microcontroller is demonstrated. All the software components used in this
application note are free of charge.
This application note includes:
This PDF document
Eclipse support files (zip)
Eclipse Embedded Systems Register View (EmbSys) plugin
Eclipse GDB Hardware Debugging plugin
Eclipse Cortex CPU register view patch
1 Prerequisites
You will need a kit with an EFM32 Cortex-M3 microcontroller and the following tools:
Version
Version: 7.0.0.201202111925
2012.03-56
gcc version 4.6.3
gdb version 7.2.50.20100908-cvs
0.2.0
Simplicity Studio
1.08
2012-08-13 - an0023_Rev1.10
www.energymicro.com
It is now time to connect the kit to your machine via the supplied USB cable and check that the J-Link
device driver was properly installed.
From the start menu, launch the program called J-Link GDB Server via SWD found in the SEGGER
folder. If everything is OK, the server should be able to connect to the board and the GUI should look
something like:
2012-08-13 - an0023_Rev1.10
www.energymicro.com
2012-08-13 - an0023_Rev1.10
www.energymicro.com
The installation process may take a while... When asked to restart Eclipse, do so.
2012-08-13 - an0023_Rev1.10
www.energymicro.com
2012-08-13 - an0023_Rev1.10
www.energymicro.com
2012-08-13 - an0023_Rev1.10
www.energymicro.com
and select Debug Configurations.... Highlight GDB Hardware Debugging and hit the New launch
configuration button.
Fill in as shown below:
Figure 2.4. Debug launch configuration details - Main tab
2012-08-13 - an0023_Rev1.10
www.energymicro.com
in the Initialization Commands text box. Replace the device identificator with your own. Consult GDB's
and J-Link's manual for an explanation of these commands. The set tdesc filename command makes
Eclipse's CPU register view show the correct registers. The xml-file target-m3.xml needed for this is
included in an0023_efm32_eclipse_toolchain.zip. Put it in your root eclipse directory.
Startup tab: Check the Set breakpoint at: checkbox in the Runtime Options frame, and write main in
the textbox.
Common tab: Check Debug checkbox in the Display in favorites menu frame.
2012-08-13 - an0023_Rev1.10
www.energymicro.com
Now you can flash your microcontroller and start debugging your code directly by selecting blink from
the Debug button dropdown menu.
Remember that you always need to have the J-Link GDB Server running to be able to flash and debug.
2012-08-13 - an0023_Rev1.10
10
www.energymicro.com
These are all you need to do simple debugging. Breakpoints are set by doubleclicking in the left gutter
in the source code tab. Set a breakpoint on the Delay(100) function call in the end of main() in blink.c,
hit F8 several times and observe how the LED's on the STK/DK blink. (Hint: You must Terminate before
reflashing and starting a new debug session. Exit and restart the GDB server if you get stuck).
2012-08-13 - an0023_Rev1.10
11
www.energymicro.com
2012-08-13 - an0023_Rev1.10
12
www.energymicro.com
Under Behavior you should increase the number of elements EmbSys Register View will show in the
dropdown menu for a register to the maximal amount.
To open a register viewer in the debug view, select Show View -> Other... in Eclipse's Window pulldown
menu. Then expand the Debug node and select EmbSys Registers.
2012-08-13 - an0023_Rev1.10
13
www.energymicro.com
Double click on a register to start viewing its content. Registers which you have selected get a green font.
Changes in register contents are shown with red values. When hovering over a register's description
column you see documentation for that register. To change a register, click on a cell in the Hex column,
or the Bin column.
2012-08-13 - an0023_Rev1.10
14
www.energymicro.com
2012-08-13 - an0023_Rev1.10
15
www.energymicro.com
2012-08-13 - an0023_Rev1.10
16
www.energymicro.com
3 Eclipse summary
This has just been an introduction to the basic steps of installing, configuring and using Eclipse as a code
development environment for writing programs for EFM32 microcontrollers. Keep in mind that Eclipse
is an advanced tool with hundreds of configuration options. The reader is encouraged to experiment
further to finetune Eclipse. Use a search engine on the internet and you will find lots of articles, tutorials
and books on using Eclipse.
2012-08-13 - an0023_Rev1.10
17
www.energymicro.com
4 Revision History
4.1 Revision 1.10
2012-08-13
New versions of Eclipse, Sourcery CodeBench and EmbSysRegView.
Recommend installing Simplicity Studio.
Use C/C++ GDB Hardware Debugging plugin instead of Zylin.
Use GDB for programming directly instead of eA Commander.
New target-m3.xml.
2012-08-13 - an0023_Rev1.10
18
www.energymicro.com
2012-08-13 - an0023_Rev1.10
19
www.energymicro.com
B Contact Information
B.1 Energy Micro Corporate Headquarters
Postal Address
Visitor Address
Technical Support
Energy Micro AS
P.O. Box 4633 Nydalen
N-0405 Oslo
NORWAY
Energy Micro AS
Sandakerveien 118
N-0484 Oslo
NORWAY
support.energymicro.com
Phone: +47 40 10 03 01
www.energymicro.com
Phone: +47 23 00 98 00
Fax: + 47 23 00 98 01
www.energymicro.com/americas www.energymicro.com/emea
2012-08-13 - an0023_Rev1.10
20
www.energymicro.com/asia
www.energymicro.com
Table of Contents
1. Prerequisites ............................................................................................................................................ 2
1.1. A note on versions .......................................................................................................................... 2
1.2. Installing the tools ........................................................................................................................... 2
2. Working with Eclipse .................................................................................................................................. 6
2.1. Create a project ............................................................................................................................. 6
2.2. Build the code ................................................................................................................................ 7
2.3. Download and debug application code ................................................................................................ 8
2.4. Tweaking Eclipse .......................................................................................................................... 15
3. Eclipse summary ..................................................................................................................................... 17
4. Revision History ...................................................................................................................................... 18
4.1. Revision 1.10 ............................................................................................................................... 18
4.2. Revision 1.04 ............................................................................................................................... 18
4.3. Revision 1.03 ............................................................................................................................... 18
4.4. Revision 1.02 ............................................................................................................................... 18
4.5. Revision 1.01 ............................................................................................................................... 18
4.6. Revision 1.00 ............................................................................................................................... 18
A. Disclaimer and Trademarks ....................................................................................................................... 19
A.1. Disclaimer ................................................................................................................................... 19
A.2. Trademark Information ................................................................................................................... 19
B. Contact Information ................................................................................................................................. 20
B.1. Energy Micro Corporate Headquarters .............................................................................................. 20
B.2. Global Contacts ............................................................................................................................ 20
2012-08-13 - an0023_Rev1.10
21
www.energymicro.com
List of Figures
1.1. Simplicity Studio and example SW file structure ........................................................................................... 3
1.2. J-Link GDB Server GUI ........................................................................................................................... 4
1.3. GDB Hardware Debugging plugin installation ............................................................................................... 5
2.1. The Eclipse Workbench View .................................................................................................................... 6
2.2. The Eclipse Project Properties window ....................................................................................................... 7
2.3. Debug button ......................................................................................................................................... 8
2.4. Debug launch configuration details - Main tab .............................................................................................. 8
2.5. Debug launch configuration details - Startup tab ......................................................................................... 10
2.6. A typical debug session launch ................................................................................................................ 11
2.7. Debug button ....................................................................................................................................... 11
2.8. Debug with breakpoint ........................................................................................................................... 12
2.9. EmbSys register viewer device selection ................................................................................................... 13
2.10. EmbSys register viewer in action ............................................................................................................ 14
2.11. Eclipse Memory Monitor ....................................................................................................................... 15
2.12. Hovering a function call gives you the beginning of its definition ................................................................... 16
2012-08-13 - an0023_Rev1.10
22
www.energymicro.com
List of Tables
1.1. Tool version information ........................................................................................................................... 2
2012-08-13 - an0023_Rev1.10
23
www.energymicro.com