debugging in intel® system studio for microcontrollers...openocd log will appear in the openocd...

9
Debugging in Intel® System Studio for Microcontrollers Introduction This article provides an overview of debugging capabilities of Intel System Studio for Microcontrollers. This suite of tools provides all the necessary tools to develop on Intel® Quark™ D1000 microcontroller or Intel® Quark™ D2000 microcontroller. Requirements For Using Quark D1000: Hardware Intel® Quark™ D1000 microcontroller based board (I.E. customer reference board (CRB)) USB cable for connecting MCU board to the host system Software Host OS: 64-bit Linux Installation** (Fedora* 19 or Ubuntu* 12.04 LTS and 14.04 LTS) or 32-/64-bit Windows* 7 and Windows* 8 Target OS: Bare Metal Intel® System Studio for Microcontrollers Eclipse* IDE for C/C++ Developers - Version: Luna Service Release JAVA JRE 1.7 (for plug-in installation) A serial terminal emulator (for example, PuTTY). **Physical system or virtual machine See the Intel® System Studio for microcontrollers D1000 Firmware Release Notes for instructions on connecting serially. The Release Notes are located in <install_dir>/FW/, the file name is Release_Notes.pdf. For Using Quark D2000: Hardware Intel® Quark D2000 microcontroller based board (I.E. customer reference board (CRB)) USB cable for connecting MCU board to the host system Software Host OS: Linux Ubuntu (64bit, version 14.04 LTS) Target OS: Bare Metal* with QMSI Intel® System Studio for Microcontrollers JAVA JRE 1.7 (for plug-in installation) Memory Requirements on the Host System 2 GB RAM (minimum)

Upload: others

Post on 23-Aug-2021

10 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Debugging in Intel® System Studio for Microcontrollers...OpenOCD log will appear in the OpenOCD Session window, and the GDB output will be shown in Console window. If “project name

Debugging in Intel® System Studio for Microcontrollers

Introduction This article provides an overview of debugging capabilities of Intel System Studio for Microcontrollers.

This suite of tools provides all the necessary tools to develop on Intel® Quark™ D1000 microcontroller or

Intel® Quark™ D2000 microcontroller.

Requirements

For Using Quark D1000:

Hardware

Intel® Quark™ D1000 microcontroller based board (I.E. customer reference board (CRB))

USB cable for connecting MCU board to the host system

Software

Host OS: 64-bit Linux Installation** (Fedora* 19 or Ubuntu* 12.04 LTS and 14.04 LTS) or

32-/64-bit Windows* 7 and Windows* 8

Target OS: Bare Metal

Intel® System Studio for Microcontrollers

Eclipse* IDE for C/C++ Developers - Version: Luna Service Release

JAVA JRE 1.7 (for plug-in installation)

A serial terminal emulator (for example, PuTTY).

**Physical system or virtual machine

See the Intel® System Studio for microcontrollers D1000 Firmware Release Notes for instructions on

connecting serially. The Release Notes are located in <install_dir>/FW/, the file name is

Release_Notes.pdf.

For Using Quark D2000:

Hardware

Intel® Quark D2000 microcontroller based board (I.E. customer reference board (CRB))

USB cable for connecting MCU board to the host system

Software

Host OS: Linux Ubuntu (64bit, version 14.04 LTS)

Target OS: Bare Metal* with QMSI

Intel® System Studio for Microcontrollers

JAVA JRE 1.7 (for plug-in installation)

Memory Requirements on the Host System 2 GB RAM (minimum)

Page 2: Debugging in Intel® System Studio for Microcontrollers...OpenOCD log will appear in the OpenOCD Session window, and the GDB output will be shown in Console window. If “project name

Overview Intel® Quark™ D1000 and Intel® Quark™ D2000 implement debugging using a JTAG hardware interface.

This interface can be used with software tools like OpenOCD and GDB to debug the microcontroller’s

firmware. To simplify the debugging process Intel® System Studio for Microcontrollers provides these

debugging tools integrated in the Eclipse* IDE.

Hardware Setup

JTAG Adapter Intel® Quark™ D1000 and Intel® Quark™ D2000 customer reference boards (CRBs) include a FTDI USB-

to-JTAG adapter (FT2232HL for D1000 and FT232HL for D2000). This removes the need for any

additional JTAG adapters and the board can be connected to the host system using a simple USB cable.

Intel® Quark™ D2000 CRB has several jumpers that connect the FT232HL to either JTAG or UART

interfaces on the MCU. Table below shows the jumper settings for both modes:

Jumper JTAG UART_B

J7 2-3 1-2

J9 2-3 1-2

J10 2-3 1-2

J12 closed closed

J13 closed closed

If you use a custom board without a built-in JTAG adapter then an external JTAG adapter would be

required, such as Flyswatter2 (http://www.tincantools.com/JTAG/Flyswatter2.html).

UART - Console

For Intel® Quark™ D1000 CRB:

This board uses dual port FT2232HL which provides access to both JTAG and UART interfaces.

For Intel® Quark™ D2000 CRB:

Use an external UART to serial adapter, for example an FTDI cable with 3.3V I/O (FTDI part name TTL-

232R-3V3).

Connect the cable as follows:

Signal Name Intel® Quark™ D2000 CRB FTDI TTL-232R-3V3 header

RX J4 - pin 0 (RX) Pin 4 (orange)

TX J4 - pin 1 (RX) Pin 5 (yellow)

GND J3 – pin 14 (GND) Pin 1 (black)

Software Setup

USB to Serial and JTAG Drivers – Windows Connect the MCU board to the host system. It will detect new USB devices and install FTDI serial to USB

drivers. If these drivers are not installed automatically – download them from FTDI web site

(http://www.ftdichip.com/Drivers/CDM/CDM%20v2.12.06%20WHQL%20Certified.exe) and install them

manually.

Page 3: Debugging in Intel® System Studio for Microcontrollers...OpenOCD log will appear in the OpenOCD Session window, and the GDB output will be shown in Console window. If “project name

For Intel® Quark™ D1000 CRB:

Download Zadig (http://zadig.akeo.ie/) and run it.

Go to Options -> List All Devices and choose Dual RS232-HS.

Select and install WinUSB driver for interface 1 (Important Note: Install on Interface 1 and not Interface

0).

Re-plug the CRB, and confirm that Dual RS232-HS is shown under Universal Serial Bus devices.

USB to Serial and JTAG Drivers – Linux The FTDI Serial to USB is normally supported by modern Linux distributions out of the box. It is needed

though to make sure that your user has access to the /dev/ttyUSB* devices. It is usually owned by

dialout group. Use sudo usermod -a -G dialout $USER command to add your user to dialout group.

OpenOCD needs read/write access to /dev/bus/usb which can be configured by adding an udev rule:

Create a text file in the rules directory: sudo vim /etc/udev/rules.d/99-openocd.rules

Add the following lines to this file:

# JTAG adapter - FTDI FT2232HL Dual USB-UART/FIFO IC

SUBSYSTEM=="usb", ATTR{idVendor}=="0403", ATTR{idProduct}=="6010", MODE="0666"

# JTAG adapter - FTDI FT232HL USB-UART/FIFO IC

SUBSYSTEM=="usb", ATTR{idVendor}=="0403", ATTR{idProduct}=="6014", MODE="0666"

Debugging in Intel® System Studio for Microcontrollers Graphical User Interface

Setting up Debug Session 1. Launch Intel® System Studio for Microcontrollers, and open the project to debug.

2. Build the project using Main Menu -> Project -> Build Project or by clicking on the hammer

toolbar icon.

Page 4: Debugging in Intel® System Studio for Microcontrollers...OpenOCD log will appear in the OpenOCD Session window, and the GDB output will be shown in Console window. If “project name

3. Switch to Debug perspective using Main Menu -> Window -> Open Perspective -> Debug

4. Select Main Menu -> Run -> Debug Configurations… to open Debug Configuration dialog. Find

and select suitable debug configuration under GDB Hardware Debugging item: By default Intel®

System Studio for Microcontrollers creates two debug configurations per project – one named

as “project name (flashing)” will flash the firmware to MCU prior to debugging, another one

named as “project name” will not flash the firmware, and assumes that firmware is already

programmed into MCU.

5. Once the configuration is selected you can review and change settings in the tabs on the right

pane of the dialog. Click Debug button on lower right side of the dialog windows to start

debugging.

Page 5: Debugging in Intel® System Studio for Microcontrollers...OpenOCD log will appear in the OpenOCD Session window, and the GDB output will be shown in Console window. If “project name

6. Intel® System Studio for Microcontrollers will automatically start OpenOCD and GDB. The

OpenOCD log will appear in the OpenOCD Session window, and the GDB output will be shown in

Console window. If “project name (flashing)” configuration was selected, Intel® System Studio

for Microcontrollers will flash the microcontroller at this time, which might take several

seconds.

7. The Intel® System Studio for Microcontrollers will setup a breakpoint at function main() and

start executing the firmware. Eventually it will stop at that breakpoint.

8. Use debug controls on the toolbar, Main Menu -> Run, or keyboard shortcuts to control the

debugging (F5 - Step Into, F6 – Step Over, F7 – Step Return, F8 – Resume)

Managing Breakpoints There are several ways to manage breakpoints from the IDE:

1. Right click on the bar on the left of the source code window to toggle breakpoints. It is also

possible to do this from Disassembly tab (see Viewing Disassembly section below)

Page 6: Debugging in Intel® System Studio for Microcontrollers...OpenOCD log will appear in the OpenOCD Session window, and the GDB output will be shown in Console window. If “project name

2. Use Breakpoints tab to view set breakpoints. Use dropdown menu (click on triangle pointing

down) in the Breakpoints tab to manage breakpoints.

Viewing Registers Use Registers tab to view x86 registers:

Page 7: Debugging in Intel® System Studio for Microcontrollers...OpenOCD log will appear in the OpenOCD Session window, and the GDB output will be shown in Console window. If “project name

Use EmbSys Registers tab (next to OpenOCD Session tab) to view SoC peripherals registers

Viewing and Modifying Variables and Memory Use Variables tab to view variables and modify variables. To view variable location in memory right click

on variable to bring context menu, and then select View Memory.

Page 8: Debugging in Intel® System Studio for Microcontrollers...OpenOCD log will appear in the OpenOCD Session window, and the GDB output will be shown in Console window. If “project name

It is also possible to display Memory tab using Main Menu -> Window -> Show View -> Memory

Viewing Disassembly Use Main Menu -> Window -> Show View -> Disassembly to show Disassembly tab.

Page 9: Debugging in Intel® System Studio for Microcontrollers...OpenOCD log will appear in the OpenOCD Session window, and the GDB output will be shown in Console window. If “project name

If you accidently close a window in Eclipse and want to reopen it, you can do so by clicking Window-

>Show view->Other… and selecting the window you want to open.

To learn more about what you can do with Intel® System Studio for Microcontrollers see these related

articles:

Getting Started Guide

Sample Project using a button