1. External Use
TM
Exploring SoC Peripherals with
Eclipse™ C/C++ IDE
Eclipse DemoCamp Bucharest, 2014
Valentin Ciocoi
J U L . 0 2 . 2 0 1 4
2. TM
External Use 1
Agenda
• Overview
• Explore peripherals with CDT Registers View
• Explore peripherals with open source
Embedded System Registers plug-in
• Explore peripherals with your custom plug-in
3. TM
External Use 2
Overview
• Most embedded devices have peripherals (accelerators, IO interfaces, etc)
that are mapped in global memory address space in the form of memory
mapped registers
• Developers can debug the state of a peripheral by dumping or visualizing the
memory area corresponding to the peripheral
• It can be difficult to decode a memory dump in order to identify the value of a
specific bit-field that caused the peripheral to misbehave
• Eclipse™ C/C++ IDE can be used to enhance the peripheral debugging
experience
4. TM
External Use 3
Explore peripherals with CDT Registers View
• The standard Eclipse CDT registers view only shows the processor core registers:
general purpose registers, floating point registers and some core state registers.
• Additional registers can be displayed in standard CDT registers view by adding their
description in the GDB target description file.
https://sourceware.org/gdb/onlinedocs/gdb/Target-Descriptions.html#Target-
Descriptions
• The GDB server must be updated to access those registers by reading the
corresponding memory location
CDT
register
details
5. TM
External Use 4
Explore peripherals with CDT Registers View
• Example:
<feature name="Peripheral1">
<reg name="REG_NAME1" bitsize="32" type="uint32" group="general" regnum="166"/>
<reg name="REG_NAME2" bitsize="32" type="uint32" group="general" regnum="167"/>
</feature>
• Advantages:
− Easy to add/remove register groups as long as GDB server is aware of them
− Common view for displaying all registers: core and peripherals
− Common GDB shell commands for accessing all registers
− Suitable for adding a small set of custom registers
• Disadvantages:
− Support for the additional registers must be present or added in GDB server
− CDT registers view shows all registers retrieved from GDB in a single group
− Not suitable for adding large set of custom registers
− At each target state change (suspend, memory change, etc) GDB will read from target all registers
present in the target description file => this can greatly impact the debugger speed
6. TM
External Use 5
Explore peripherals with Embedded System Registers
• An open source Eclipse plug-in similar to CDT registers view:
http://sourceforge.net/projects/embsysregview/
• EmbSysRegisters has two plugins: the view itself and a data plugin that contains several device
description XML files for various chips
• The description files come in a custom DTD format or in CMSIS-SVD (System View Description)
format which is the standard introduced by ARM™
http://www.keil.com/pack/doc/CMSIS/SVD/html/index.html
• The view displays peripheral memory mapped registers based on these device XML description files
7. TM
External Use 6
Explore peripherals with Embedded System Registers
• Installation:
− Use this Eclipse update site http://embsysregview.sourceforge.net/update to install the plugins
• Configuration:
− The data plugin installs XML files describing the devices peripherals in the following folder:
eclipsepluginsorg.eclipse.cdt.embsysregview.data_0.2.4.r168data
− Add your own device description file containing the peripherals you want to explore
• Using the Plugin
− Open the ‘EmbSys Registers’ view (menu Window > Show View > Others > Debug > EmbSys Registers)
− select the device by pressing the settings icon in the view or from menu Window > Preferences > C/C++ > Debug
> EmbSys Registers
− To read the register values from the device, double-click on the register/group (the icon turns green)
• Advantages:
− Open source, easy to install Eclipse plug-in
− Tree-view user interface similar with CDT registers view
− Supports CMSIS-SVD - ARM standard device description format
• Disadvantages:
− GPLv3 license (extending, bug-fixing)
− The values are not automatically loaded – user has to double-click on the registers
− Crowded view – the details are blended in the view – there is no details pane as in CDT view
− Few devices already supported – description file must be added for other devices
− Tree-view is not lazy
8. TM
External Use 7
Explore peripherals with your custom plug-in
• Example of creating a custom plugin working with CDT-DSF
− The view:
Create your custom view by sub-classing org.eclipse.ui.part.ViewPart
Create a jface TreeViewer in the view and set its content provider, label provider and input
− The tree content provider:
Recommended to be lazy as should be the TreeViewer
Should listen to DSF session suspend/resume notification in order to update the register values
Listen to debug context changed platform events to load the peripheral register set
− Accessing target using GDB console and MI commands
get DSF session from current debug context
create a DsfServicesTracker for the current session
Get IMICommandControl from service tracker
Queue CLI/MI command in the command control service - https://sourceware.org/gdb/onlinedocs/gdb/GDB_002fMI.html#GDB_002fMI
9. TM
External Use 8
Explore peripherals with your custom plug-in
Host PC
Eclipse IDE
CDT-DSF
GDB (client)
Python extensions
GDB Server
Peripheral
SQLite
DB
JDBC
GDB-RSP
GDB-MI
Debug Probe
JTAG
sqlite3
• This is Freescale solution for
exploring peripherals with Eclipse
CDT-DSF.
• Debug usecases:
− Baremetal
− U-boot
− Hypervisor
− Linux™ kernel