User manual

UM0036 In-circuit debugging
Doc ID 7705 Rev 11 223/385
7 In-circuit debugging
In-circuit debugging (ICD) allows you to debug an application in its final environment by
communicating with the microcontroller. There are two protocols for in-circuit debugging:
ICC (in-circuit communication) for ST7 microcontroller families
SWIM (single wire interface module) for STM8 microcontroller families
With the necessary connection hardware, these protocols enable STVD to program and
read your microcontrollers Flash memory, and control the running of your application on
your microcontroller. Once you have configured and programmed your microcontroller, you
can debug your application using the microcontroller’s on-chip debug modules.
Available in-circuit debugging features depend on your MCU’s memory type (HDFlash,
XFlash, RAM or ROM) and its debugging resources, notably the number of debug modules.
In this section, you will find information about:
Section 7.1: Connecting to and configuring the microcontroller
Section 7.2: Using breakpoints
Section 7.3: Creating a break on trigger input (TRIGIN)
Section 7.4: In-circuit debugging in hot plug mode (SWIM only)
Section 7.5: In-circuit debugging limitations
Overview of in-circuit debugging with ICC
ST7 microcontrollers include a dedicated hardware cell (the debug module) for in-circuit
debugging, and also a software monitor that manages ICC communications.
When you enter a debugging session, STVD resets your microcontroller in ICC mode. The
entry into ICC Mode starts the ICC monitor — an on-chip firmware that is located in the
system memory and manages the ICC protocol. STVD, interfacing via the ICC monitor,
programs your microcontroller and allows you to configure it by setting the values of the
option bytes.
To debug your application, STVD then resets your microcontroller in User mode. However,
your microcontroller continues to run the ICC monitor, thereby allowing you to:
control the running of your application
set breakpoints by using TRAP instructions or debug modules
read and write variables, memory contents and core registers when the application is
stopped
Overview of in-circuit debugging with SWIM
STM8 microcontrollers include a debug module for in-circuit debugging, and also a SWIM
hardware cell that manages communications with the host.