Cypress Programmer 2.0 OpenOCD CLI Guide
User Manual:
Open the PDF directly: View PDF .
Page Count: 24

Cypress Programmer 2.0 OpenOCD
CLI User Guide
Document No.: 002-25294 Rev. **
Cypress Semiconductor
198 Champion Court
San Jose, CA 95134-1709
http://www.cypress.com

Copyrights
Cypress Programmer 2.0 OpenOCD
CLI User Guide, Document No.: 002-25294 Rev. ** 2
Copyrights
© Cypress Semiconductor Corporation, 2018. This document is the property of Cypress Semiconductor Corporation
and its subsidiaries, including Spansion LLC (“Cypress”). This document, including any software or firmware
included or referenced in this document (“Software”), is owned by Cypress under the intellectual property laws and
treaties of the United States and other countries worldwide. Cypress reserves all rights under such laws and
treaties and does not, except as specifically stated in this paragraph, grant any license under its patents, copyrights,
trademarks, or other intellectual property rights. If the Software is not accompanied by a license agreement and you
do not otherwise have a written agreement with Cypress governing the use of the Software, then Cypress hereby
grants you a personal, non-exclusive, nontransferable license (without the right to sublicense) (1) under its copyright
rights in the Software (a) for Software provided in source code form, to modify and reproduce the Software solely for
use with Cypress hardware products, only internally within your organization, and (b) to distribute the Software in
binary code form externally to end users (either directly or indirectly through resellers and distributors), solely for
use on Cypress hardware product units, and (2) under those claims of Cypress’s patents that are infringed by the
Software (as provided by Cypress, unmodified) to make, use, distribute, and import the Software solely for use with
Cypress hardware products. Any other use, reproduction, modification, translation, or compilation of the Software is
prohibited.
TO THE EXTENT PERMITTED BY APPLICABLE LAW, CYPRESS MAKES NO WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, WITH REGARD TO THIS DOCUMENT OR ANY SOFTWARE OR ACCOMPANYING
HARDWARE, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
FITNESS FOR A PARTICULAR PURPOSE. To the extent permitted by applicable law, Cypress reserves the right
to make changes to this document without further notice. Cypress does not assume any liability arising out of the
application or use of any product or circuit described in this document. Any information provided in this document,
including any sample design information or programming code, is provided only for reference purposes. It is the
responsibility of the user of this document to properly design, program, and test the functionality and safety of any
application made of this information and any resulting product. Cypress products are not designed, intended, or
authorized for use as critical components in systems designed or intended for the operation of weapons, weapons
systems, nuclear installations, life-support devices or systems, other medical devices or systems (including
resuscitation equipment and surgical implants), pollution control or hazardous substances management, or other
uses where the failure of the device or system could cause personal injury, death, or property damage (“Unintended
Uses”). A critical component is any component of a device or system whose failure to perform can be reasonably
expected to cause the failure of the device or system, or to affect its safety or effectiveness. Cypress is not liable, in
whole or in part, and you shall and hereby do release Cypress from any claim, damage, or other liability arising from
or related to all Unintended Uses of Cypress products. You shall indemnify and hold Cypress harmless from and
against all claims, costs, damages, and other liabilities, including claims for personal injury or death, arising from or
related to any Unintended Uses of Cypress products.
Cypress, the Cypress logo, Spansion, the Spansion logo, and combinations thereof, WICED, PSoC, CapSense, EZ-
USB, F-RAM, and Traveo are trademarks or registered trademarks of Cypress in the United States and other
countries. For a more complete list of Cypress trademarks, visit cypress.com. Other names and brands may be
claimed as property of their respective owners.

Cypress Programmer 2.0 OpenOCD
CLI User Guide, Document No.: 002-25294 Rev. ** 3
Contents
1 Introduction ........................................................................................................................................... 5
Overview ........................................................................................................................................... 5
Acronyms and Abbreviations ............................................................................................................. 5
Supported OS ................................................................................................................................... 6
Supported MCU Devices ................................................................................................................... 6
Supported Hardware (Probes) ........................................................................................................... 6
Installation ......................................................................................................................................... 6
Document Convention ....................................................................................................................... 6
Revision History ................................................................................................................................ 7
2 Command-Line Options ....................................................................................................................... 8
-f (--file) <filename.cfg> ..................................................................................................................... 8
-d (--debug) <n> ................................................................................................................................ 8
-c (--command) <”cmd1; cmd2; ...”> .................................................................................................. 8
-l (--log_output) <logfile.txt> ............................................................................................................... 8
-s (--search) <directory> .................................................................................................................... 8
3 Running TCL Commands..................................................................................................................... 9
Using Configuration File Only ............................................................................................................ 9
Using Command Line Only ................................................................................................................ 9
Combined – Configuration File Plus Command Line .......................................................................... 9
4 KitProg3/MiniProg4 Driver Commands ............................................................................................ 10
kitprog3 acquire_config <status> [target_type] [mode] [attempts] ..................................................... 10
kitprog3 acquire_psoc ..................................................................................................................... 10
kitprog3 power_config <status> [voltage] ......................................................................................... 10
kitprog3 power_control <status> ...................................................................................................... 11
kitprog3 led_control <type> ............................................................................................................. 11
kitprog3 get_power .......................................................................................................................... 11
5 Flash Driver Commands .................................................................................................................... 12
psoc6 allow_unsafe_sflash <on|off> ................................................................................................ 12
psoc6 allow_efuse_program <on|off> .............................................................................................. 12
psoc6 reset_halt <mode> ................................................................................................................ 12
psoc6 mass_erase <bank> .............................................................................................................. 12
traveo2 ecc_error_reporting <on|off> ............................................................................................... 13

Contents
Cypress Programmer 2.0 OpenOCD
CLI User Guide, Document No.: 002-25294 Rev. ** 4
6 Custom OpenOCD Commands ......................................................................................................... 14
flash rmw <address> <data> ........................................................................................................... 14
add_verify_range <target> <address> <size> .................................................................................. 14
7 Global Variables .................................................................................................................................. 15
ENABLE_ACQUIRE ........................................................................................................................ 15
ENABLE_POWER_SUPPLY ........................................................................................................... 15
ENABLE_CM0, ENABLE_CM4 ....................................................................................................... 15
SMIF_BANKS ................................................................................................................................. 15
8 Usage Examples ................................................................................................................................. 17
Erase Main Flash ............................................................................................................................ 17
Erase Work Flash ............................................................................................................................ 18
Erase Main Flash Rows 0…10 ........................................................................................................ 19
Display Memory Contents (32 words at address 0x08000000) ......................................................... 20
Program Device with Verification (Intel HEX file) .............................................................................. 21
Modify Individual Bytes in Main Flash and Display Results............................................................... 22
Start GDB Server and Leave It Running .......................................................................................... 23

Cypress Programmer 2.0 OpenOCD
CLI User Guide, Document No.: 002-25294 Rev. ** 5
1 Introduction
Overview
Cypress Programmer (CYP) 2.0 is a flexible, cross-platform, integrated application to allow programming
Cypress devices. It can perform Program, Erase, Verify, and Read operations on the flash of the target
device. It can target an entire device, a specific region, sector, and even byte of a device.
The CYP 2.0 command-line interface (CLI) is based on the Open On-Chip Debugger (OpenOCD) project.
OpenOCD is a powerful tool whose interface interacts with the target device via the JTAG/SWD debug
ports. It allows programming internal and external flash memories of a wide range of target devices, CFI-
compatible flashes, and some CPLD/FPGA devices.
OpenOCD was originally developed by Dominic Rath at the University of Applied Sciences in Augsburg.
The OpenOCD source code is now available through the GNU General Public License (GPL).
This document covers the Cypress-specific CLI extensions of OpenOCD. For more details about
OpenOCD, refer to the official documentation available at http://openocd.org/documentation/.
Acronyms and Abbreviations
CYP – Cypress Programmer.
CLI – A Command-line interface.
MPN – There is a marketing part number associated with each specific device. This number is
used to order a device or find information about a device from Cypress. Exp. CY8C616FMI-
BL603, CY8C616FMI-BL673.
SWD – A Serial Wire Debug interface.
JTAG – Joint Test Action Group. Specifies the use of a dedicated debug port implementing a
serial communication interface for low-overhead access without requiring direct external access
to the system address and data buses.
PSoC – The Programmable System-on-Chip is a family of microcontroller integrated circuits by
Cypress. These chips include a CPU core and mixed-signal arrays of configurable integrated
analog and digital peripherals.
MCU – Microcontroller Unit.
UDD – Universal Device Database.
FLD – Flash Loader Database.
AP – The Access Port register of ARM Cortex CPU. Used for programming and debugging, along
with the corresponding SWD address bit selections.
DP – The Debug Port register of ARM Cortex CPU. Used for programming and debugging, along
with the corresponding SWD address bit selections.
Region – Logical areas within the target device the programmer operates on.

Introduction
Cypress Programmer 2.0 OpenOCD
CLI User Guide, Document No.: 002-25294 Rev. ** 6
Supported OS
Windows 7 SP1 (x86 / x64)
Windows 8.1 (x86 / x64)
Windows 10 (x86 / x64)
Linux
MacOS X
Supported MCU Devices
PSoC 6
Traveo-II
STM32xxx
Supported Hardware (Probes)
SEGGER J-Link
Cypress KitProg3
Cypress MiniProg4
Installation
The CYP 2.0 OpenOCD CLI software is installed as part of the ModusToolbox software installation. Refer
to the ModusToolbox Installation Guide for more details.
Note There is also a Cypress Programmer 2.0 GUI, which is installed separately from ModusToolbox.
Refer to the Cypress Programmer 2.0 GUI User Guide for more details.
Document Convention
This guide uses the following conventions:
Convention
Usage
Courier New
Displays file locations and source code:
C:\ …cd\icc\, user entered text
Italics
Displays file names and reference documentation:
sourcefile.hex
[bracketed, bold]
Displays keyboard commands in procedures:
[Enter] or [Ctrl] [C]
File > New Project
Represents menu paths:
File > New Project > Clone
Bold
Displays commands, menu paths and selections, and icon names in procedures:
Click the Debugger icon, and then click Next.
Text in gray boxes
Displays cautions or functionality unique to the software or the device.

Introduction
Cypress Programmer 2.0 OpenOCD
CLI User Guide, Document No.: 002-25294 Rev. ** 7
Revision History
Document Title: Cypress Programmer 2.0 OpenOCD CLI User Guide
Document Number: 002-xxxxx
Revision
Date
Description of Change
**
9/27/18
New document.

Cypress Programmer 2.0 OpenOCD
CLI User Guide, Document No.: 002-25294 Rev. ** 8
2 Command-Line Options
Although OpenOCD is a command-line tool, it only has few command-line options. The most important of
these include:
-f (--file) <filename.cfg>
Specifies the configuration file to use. Multiple configuration files can be specified from the command line.
They are interpreted in the order they are specified in the command line.
-d (--debug) <n>
Specifies the debug level. Debug level is 2 by default.
-c (--command) <”cmd1; cmd2; ...”>
Execute the TCL commands cmd1, cmd2… Multiple TCL commands can be executed by either specifying
the multiple -c options or passing several commands to the single -c options. In the latter case, separate
the commands with a semicolon.
-l (--log_output) <logfile.txt>
Redirect the log output to the file <logfile.txt>.
-s (--search) <directory>
Specifies the directory to search for configuration files. Multiple -s options can be specified. Configuration
files and scripts are searched for in the following paths The first found file with a matching file name is
used.
the current directory
any search dir specified on the command line using the -s option
any search dir specified using the add_script_search_dir command
$HOME/.openocd (not on Windows)
a directory in the OPENOCD_SCRIPTS environment variable (if set)
the site wide-script library $pkgdatadir/site
the OpenOCD-supplied script library $pkgdatadir/scripts.

Cypress Programmer 2.0 OpenOCD
CLI User Guide, Document No.: 002-25294 Rev. ** 9
3 Running TCL Commands
The Tool Command Language (TCL) commands can be passed to OpenOCD in several ways:
Using Configuration File Only
All configuration is stored in a single sample.cfg configuration file. For example, the following
configuration file describes the PSoC 6 device connected using the KitProg3 debug probe. This file
initializes the target device, programs flash with “firmware.hex” file, verifies programmed data, and finally
shuts down OpenOCD.
source [find interface/kitprog3.cfg]
transport select swd
source [find target/psoc6.cfg]
program firmware.hex verify exit
The command line appears as follows:
openocd -s scripts -f path/to/sample.cfg
Using Command Line Only
All commands from the configuration file can be specified in the command line directly using the -c option.
openocd -s ../scripts -c "source [find interface/kitprog3.cfg]; transport select
swd; source [find target/psoc6.cfg]; program firmware.hex verify exit"
Combined – Configuration File Plus Command Line
A significant part of the configuration file specifies the debug adapter, transport type, target chip, SWD
frequency, reset type, etc. This part of the file reflects the hardware configuration and thus stays
unchanged between sessions. In some cases, it can be more convenient to use a combined method of
passing the TCL commands:
Example sample.cfg file contents:
source [find interface/cmsis-dap.cfg]
transport select swd
source [find target/psoc6.cfg]
The OpenOCD command line:
openocd -s ../scripts -f path/to/sample.cfg -c "program firmware.hex verify exit"

Cypress Programmer 2.0 OpenOCD
CLI User Guide, Document No.: 002-25294 Rev. ** 10
4 KitProg3/MiniProg4 Driver Commands
The KitProg3/MiniProg4 (KP3/MP4) probe implements the CMSIS-DAP protocol defined by Arm with
some extensions. Consequently, the KP3/MP4 driver in OpenOCD is a wrapper around the native
CMSIS-DAP driver that extends its functionality with the KP3-specific extensions.
A full list of the CMSIS-DAP-specific configuration commands can be found in the OpenOCD official
documentation.
Besides the standard CMSIS-DAP options, the KP3 driver exposes several custom TCL configuration
commands. All commands in this section must be prefixed with the name of the driver – “kitprog3”.
kitprog3 acquire_config <status> [target_type] [mode] [attempts]
The command controls device acquisition parameters and optionally enables acquisition during the early
initialization phase. Can be called at any time.
Parameters:
status – A mandatory parameter, enables or disables the acquisition procedure during the
initialization phase. The possible values: On, Off.
target_type – Specifies the target device type. This parameter is mandatory only if status=on. The
possible values:
0 – PSoC4
1 – PSoC5
2 – PSoC6
3 – Traveo-II
mode – Specifies Acquisition mode. This parameter is mandatory only if status=on. The possible
values: 0 – Reset, 1 – Power Cycle.
attempts – The number of attempts to acquire the target device. This parameter is mandatory
only if status=on.
kitprog3 acquire_psoc
The command performs device acquisition. Can be called only after the initialization phase. The
acquisition procedure must be configured using acquire_config prior to calling this command.
kitprog3 power_config <status> [voltage]
The command controls the KP3 internal power supply parameters and optionally enables power during
the early initialization phase. Can be called at any time.
Parameters:

KitProg3/MiniProg4 Driver Commands
Cypress Programmer 2.0 OpenOCD
CLI User Guide, Document No.: 002-25294 Rev. ** 11
status – A mandatory parameter, enables or disables power supply during the initialization phase.
The possible values: On, Off.
voltage – The power supply voltage in millivolts. This parameter is mandatory only if status=on.
kitprog3 power_control <status>
The command turns on or off the KP3 internal power supply. Can be called only after the initialization
phase. The voltage must be configured using power_config prior to calling this command.
Parameters:
status – A mandatory parameter, enables or disables power supply.
kitprog3 led_control <type>
The command controls the KP3 LEDs. Can be called only after the initialization phase.
Parameters:
type – A mandatory parameter, specifies the type of the LED indication. The possible values:
0 – READY
1 – PROGRAMMING
2 – SUCCESS
3 – ERROR.
kitprog3 get_power
The command reports the target voltage in millivolts. Can be called only after the initialization phase.

Cypress Programmer 2.0 OpenOCD
CLI User Guide, Document No.: 002-25294 Rev. ** 12
5 Flash Driver Commands
This chapter contains flash driver commands for PSoC 6 and Traveo II.
psoc6 allow_unsafe_sflash <on|off>
The command enables or disables Writes to SFlash regions other than USER, NAR, TOC2, and KEY. The
command can be called at any time. Writes to these regions are possible only on the VIRGIN silicon, so
the command is mostly intended for internal use. It is useful for Flash Boot developers and validation
teams. Note that erasure (performed by programming with zeros) is performed only for the USER, NAR,
TOC2, and KEY regions; it is skipped for other SFlash regions regardless of this command.
psoc6 allow_efuse_program <on|off>
The command allows or disallows Writes to the EFuse region. Can be called any time. Writes to EFuse
region are skipped by default. EFuse programming must be allowed for Life Cycle transitions to work.
psoc6 reset_halt <mode>
The command simulates a broken Vector Catch on PSoC6 devices. The command retrieves the address
of the Vector Table from the VECTOR_TABLE_BASE registers, detects the location of the application
entry points, sets a hardware breakpoint at that location and performs a reset of the target. The type of
the reset can be specified by the optional <mode> parameter.
Parameters:
mode – The type of the reset to be performed. The possible values are sysresetreq and
vectreset. This parameter is optional. If it is not specified, SYSRESETREQ is used for the CM0
core and VECTRESET is used for other cores in the system.
psoc6 mass_erase <bank>
The command performs mass erase of the given flash bank.
Parameters:
bank – The index of the flash bank. The possible values can be shown by running the flash
banks command.

Flash Driver Commands
Cypress Programmer 2.0 OpenOCD
CLI User Guide, Document No.: 002-25294 Rev. ** 13
traveo2 ecc_error_reporting <on|off>
Enables or Disables the ECC error reporting during Flash Read operations (applicable for Traveo-II only).
OpenOCD supports the detection and reporting of ECC errors during the Flash Read operation. In the
current implementation, the CYP reads word-by-word a requested amount of data and checks for the
ECC status after each Read. This ensures all ECC errors for all memory locations are properly detected.
If an ECC error occurs, the CYP retrieves the address of the faulty location from the hardware. All ECC
errors along with their locations are reported to the user by means of warning messages. This process will
be performed until all requested data has been read.

Cypress Programmer 2.0 OpenOCD
CLI User Guide, Document No.: 002-25294 Rev. ** 14
6 Custom OpenOCD Commands
This section documents the custom TCL commands implemented in OpenOCD to extend its functionality.
flash rmw <address> <data>
The command is intended to modify flash individual bytes. The command can be used when some data
must be programmed to an arbitrary flash address preserving all data that belongs to the same flash
sector.
Parameters:
address – The start address for the programming.
data – The hexadecimal string with data to be programmed. The format of the string is shown in
the following example:
flash rmw 0x10001234 DEADBEEFBAADC0DE
add_verify_range <target> <address> <size>
The command allows specifying memory regions to be compared during verify operation. By default,
when no regions are defined, all the regions present in the firmware image file are compared with
corresponding target memory. This breaks the verification process for some non-memory-mapped regions
such as EFuses. When the target has at least one verify region specified, only data that belongs to that
verify region is verified.
Parameters:
target – The target device to assign verify regions.
target – The start address of the region.
size – The size of the region, in bytes.

Cypress Programmer 2.0 OpenOCD
CLI User Guide, Document No.: 002-25294 Rev. ** 15
7 Global Variables
Global variables listed below control the behavior of target configuration file (psoc6.cfg, traveo2.cfg, etc.).
They should be set in the command line prior to any configuration file, such as kitprog3.cfg or psoc6.cfg
ENABLE_ACQUIRE
Enables or disables acquisition of the target device in Test Mode.
Possible values:
1 – Acquisition enabled (default with KitProg3/MiniProg4)
0 – Acquisition disabled (default for other debug adapters)
ENABLE_POWER_SUPPLY
Controls internal power supply of KitProg3/MiniProg4 adapters. If this command is specified, kitprog3
driver will enable power supply thus powering on the target during initialization.
Possible values:
0 – Power supply disabled
Any other value defines target voltage in millivolts
ENABLE_CM0, ENABLE_CM4
Allow to specify CPU cores which will be visible to OpenOCD. OpenOCD will not touch disabled cores in
any way.
Possible values:
1 – Corresponding core is enabled
0 – Core is disabled
SMIF_BANKS
Defines QSPI Memory banks. This variable is a two-dimensional associative TCL array of the following
format:
set SMIF_BANKS {
1 {addr <XIPaddr1> size <BankSz1> psize <ProgramSz1> esize <EraseSz1>}
2 {addr <XIPaddr2> size <BankSz2> psize <ProgramSz2> esize <EraseSz2>}
...
N {addr <XIPaddrN> size <BankSzN> psize <ProgramSzN> esize <EraseSzN>}
}

Global Variables
Cypress Programmer 2.0 OpenOCD
CLI User Guide, Document No.: 002-25294 Rev. ** 16
Where:
XIPaddrN – XIP mapping address
BankSzN – total size of this flash bank, in bytes
ProgramSzN – minimal programming granularity (program block size), in bytes
EraseSzN – minimal erase granularity (erase block size), in bytes.

Cypress Programmer 2.0 OpenOCD
CLI User Guide, Document No.: 002-25294 Rev. ** 17
8 Usage Examples
All the examples in this chapter assume you have a PSoC 6 target device connected to the PC via the
KitProg3 or MiniProg4 debug probe. The current working directory is the default install directory (for
example, c:\Program Files (x86)\Cypress\Cypress OpenOCD\ on Windows).
For convenience, the board.cfg config file has been created in the same directory ad OpenOCD
executable. File contains default configuration suitable for the majority of the PSoC 6 kits. The file
contains the following configuration:
source [ find interface/kitprog3.cfg ]
transport select swd
source [ find target/psoc6.cfg ]
init
reset init
Erase Main Flash
>bin\openocd.exe -s ../scripts -f board.cfg -c "psoc6 mass_erase 0; exit"
A possible output of OpenOCD:
Open On-Chip Debugger 0.10.0+dev-1.0.0.181 (2018-09-24-10:46)
Licensed under GNU GPL v2
For bug reports, read
http://openocd.org/doc/doxygen/bugs.html
adapter speed: 1500 kHz
Warn : Transport "swd" was already selected
adapter speed: 1000 kHz
** Auto-acquire enabled, use "set ENABLE_ACQUIRE 0" to disable
cortex_m reset_config sysresetreq
cortex_m reset_config vectreset
Info : CMSIS-DAP: SWD Supported
Info : CMSIS-DAP: FW Version = 2.0.0
Info : CMSIS-DAP: Interface Initialised (SWD)
Info : SWCLK/TCK = 1 SWDIO/TMS = 1 TDI = 0 TDO = 0 nTRST = 0 nRESET = 1
Info : CMSIS-DAP: Interface ready
Info : VTarget = 3.292 V
Info : kitprog3: acquiring PSoC device...
Info : clock speed 1000 kHz
Info : SWD DPIDR 0x6ba02477
Info : psoc6.cpu.cm0: hardware has 4 breakpoints, 2 watchpoints
Info : psoc6.cpu.cm4: hardware has 6 breakpoints, 4 watchpoints
Info : Listening on port 3333 for gdb connections
Info : Listening on port 3334 for gdb connections

Usage Examples
Cypress Programmer 2.0 OpenOCD
CLI User Guide, Document No.: 002-25294 Rev. ** 18
Warn : Only resetting the Cortex-M core, use a reset-init event handler to reset
any peripherals or configure hardware srst support.
Info : kitprog3: acquiring PSoC device...
target halted due to debug-request, current mode: Thread
xPSR: 0x21000000 pc: 0x00001f2c msp: 0x08047790
** Device acquired successfully
** SFlash SiliconID: 0xE2062200
** Flash Boot version: 0x021D8001
** psoc6.cpu.cm4: Ran after reset and before halt...
target halted due to debug-request, current mode: Thread
xPSR: 0x61000000 pc: 0x1600400c msp: 00000000
[100%] [################################] [ Erasing ]
Erase Work Flash
>bin\openocd.exe -s ../scripts -f board.cfg -c "psoc6 mass_erase 1; exit"
A possible output of OpenOCD:
Open On-Chip Debugger 0.10.0+dev-1.0.0.181 (2018-09-24-10:46)
Licensed under GNU GPL v2
For bug reports, read
http://openocd.org/doc/doxygen/bugs.html
adapter speed: 1500 kHz
Warn : Transport "swd" was already selected
adapter speed: 1000 kHz
** Auto-acquire enabled, use "set ENABLE_ACQUIRE 0" to disable
cortex_m reset_config sysresetreq
cortex_m reset_config vectreset
Info : CMSIS-DAP: SWD Supported
Info : CMSIS-DAP: FW Version = 2.0.0
Info : CMSIS-DAP: Interface Initialised (SWD)
Info : SWCLK/TCK = 1 SWDIO/TMS = 1 TDI = 0 TDO = 0 nTRST = 0 nRESET = 1
Info : CMSIS-DAP: Interface ready
Info : VTarget = 3.297 V
Info : kitprog3: acquiring PSoC device...
Info : clock speed 1000 kHz
Info : SWD DPIDR 0x6ba02477
Info : psoc6.cpu.cm0: hardware has 4 breakpoints, 2 watchpoints
Info : psoc6.cpu.cm4: hardware has 6 breakpoints, 4 watchpoints
Info : Listening on port 3333 for gdb connections
Info : Listening on port 3334 for gdb connections
Warn : Only resetting the Cortex-M core, use a reset-init event handler to reset
any peripherals or configure hardware srst support.
Info : kitprog3: acquiring PSoC device...
target halted due to debug-request, current mode: Thread
xPSR: 0x21000000 pc: 0x00001f2c msp: 0x08047790
** Device acquired successfully
** SFlash SiliconID: 0xE2062200
** Flash Boot version: 0x021D8001
** psoc6.cpu.cm4: Ran after reset and before halt...
target halted due to debug-request, current mode: Thread
xPSR: 0x61000000 pc: 0x1600400c msp: 00000000

Usage Examples
Cypress Programmer 2.0 OpenOCD
CLI User Guide, Document No.: 002-25294 Rev. ** 19
[100%] [################################] [ Erasing ]
Erase Main Flash Rows 0…10
>bin\openocd.exe -s ../scripts -f board.cfg -c "flash erase_sector 0 0 10; exit"
A possible output of OpenOCD:
Open On-Chip Debugger 0.10.0+dev-1.0.0.181 (2018-09-24-10:46)
Licensed under GNU GPL v2
For bug reports, read
http://openocd.org/doc/doxygen/bugs.html
adapter speed: 1500 kHz
Warn : Transport "swd" was already selected
adapter speed: 1000 kHz
** Auto-acquire enabled, use "set ENABLE_ACQUIRE 0" to disable
cortex_m reset_config sysresetreq
cortex_m reset_config vectreset
Info : CMSIS-DAP: SWD Supported
Info : CMSIS-DAP: FW Version = 2.0.0
Info : CMSIS-DAP: Interface Initialised (SWD)
Info : SWCLK/TCK = 1 SWDIO/TMS = 1 TDI = 0 TDO = 0 nTRST = 0 nRESET = 1
Info : CMSIS-DAP: Interface ready
Info : VTarget = 3.297 V
Info : kitprog3: acquiring PSoC device...
Info : clock speed 1000 kHz
Info : SWD DPIDR 0x6ba02477
Info : psoc6.cpu.cm0: hardware has 4 breakpoints, 2 watchpoints
Info : psoc6.cpu.cm4: hardware has 6 breakpoints, 4 watchpoints
Info : Listening on port 3333 for gdb connections
Info : Listening on port 3334 for gdb connections
Warn : Only resetting the Cortex-M core, use a reset-init event handler to reset
any peripherals or configure hardware srst support.
Info : kitprog3: acquiring PSoC device...
target halted due to debug-request, current mode: Thread
xPSR: 0x21000000 pc: 0x00001f2c msp: 0x08047790
** Device acquired successfully
** SFlash SiliconID: 0xE2062200
** Flash Boot version: 0x021D8001
** psoc6.cpu.cm4: Ran after reset and before halt...
target halted due to debug-request, current mode: Thread
xPSR: 0x61000000 pc: 0x1600400c msp: 00000000
[100%] [################################] [ Erasing ]
erased sectors 0 through 10 on flash bank 0 in 0.174531s

Usage Examples
Cypress Programmer 2.0 OpenOCD
CLI User Guide, Document No.: 002-25294 Rev. ** 20
Display Memory Contents (32 words at address 0x08000000)
>bin\openocd.exe -s ../scripts -f board.cfg -c "mdw 0x08000000 32; exit"
A possible output of OpenOCD:
Open On-Chip Debugger 0.10.0+dev-1.0.0.181 (2018-09-24-10:46)
Licensed under GNU GPL v2
For bug reports, read
http://openocd.org/doc/doxygen/bugs.html
adapter speed: 1500 kHz
Warn : Transport "swd" was already selected
adapter speed: 1000 kHz
** Auto-acquire enabled, use "set ENABLE_ACQUIRE 0" to disable
cortex_m reset_config sysresetreq
cortex_m reset_config vectreset
Info : CMSIS-DAP: SWD Supported
Info : CMSIS-DAP: FW Version = 2.0.0
Info : CMSIS-DAP: Interface Initialised (SWD)
Info : SWCLK/TCK = 1 SWDIO/TMS = 1 TDI = 0 TDO = 0 nTRST = 0 nRESET = 1
Info : CMSIS-DAP: Interface ready
Info : VTarget = 3.297 V
Info : kitprog3: acquiring PSoC device...
Info : clock speed 1000 kHz
Info : SWD DPIDR 0x6ba02477
Info : psoc6.cpu.cm0: hardware has 4 breakpoints, 2 watchpoints
Info : psoc6.cpu.cm4: hardware has 6 breakpoints, 4 watchpoints
Info : Listening on port 3333 for gdb connections
Info : Listening on port 3334 for gdb connections
Warn : Only resetting the Cortex-M core, use a reset-init event handler to reset
any peripherals or configure hardware srst support.
Info : kitprog3: acquiring PSoC device...
target halted due to debug-request, current mode: Thread
xPSR: 0x21000000 pc: 0x00001f2c msp: 0x08047790
** Device acquired successfully
** SFlash SiliconID: 0xE2062200
** Flash Boot version: 0x021D8001
** psoc6.cpu.cm4: Ran after reset and before halt...
target halted due to debug-request, current mode: Thread
xPSR: 0x61000000 pc: 0x1600400c msp: 00000000
0x08000000: fee7fee7 0c00ec67 18c94d83 a74c2428 e2b12b65 3a700842 899247ef c9360ab2
0x08000020: 1418a661 b61ae5bd f228a811 11fa46c1 15a6ce0e 6b170d80 13f586f0 4493a476
0x08000040: 119b597b a548e4e2 c0903b6c bea3fede 41b59b19 69ee5c5f 2b6b440d 3719620a
0x08000060: c20051b1 8db4d1ad cd49c0f0 5ecdc0aa 9edeeba2 be5fdda4 19ea06a6 f7e52c03

Usage Examples
Cypress Programmer 2.0 OpenOCD
CLI User Guide, Document No.: 002-25294 Rev. ** 21
Program Device with Verification (Intel HEX file)
OpenOCD supports programming of elf, Intel HEX, Motorola SREC and binary file formats. For binary
files relocation offset must be specified as an argument to ‘program’ command.
>bin\openocd.exe -s ../scripts -f board.cfg -c "program c:/BlinkyLED.hex verify
reset; exit"
A possible output of OpenOCD:
Open On-Chip Debugger 0.10.0+dev-1.0.0.181 (2018-09-24-10:46)
Licensed under GNU GPL v2
For bug reports, read
http://openocd.org/doc/doxygen/bugs.html
adapter speed: 1500 kHz
Warn : Transport "swd" was already selected
adapter speed: 1000 kHz
** Auto-acquire enabled, use "set ENABLE_ACQUIRE 0" to disable
cortex_m reset_config sysresetreq
cortex_m reset_config vectreset
Info : CMSIS-DAP: SWD Supported
Info : CMSIS-DAP: FW Version = 2.0.0
Info : CMSIS-DAP: Interface Initialised (SWD)
Info : SWCLK/TCK = 1 SWDIO/TMS = 1 TDI = 0 TDO = 0 nTRST = 0 nRESET = 1
Info : CMSIS-DAP: Interface ready
Info : VTarget = 3.292 V
Info : kitprog3: acquiring PSoC device...
Info : clock speed 1000 kHz
Info : SWD DPIDR 0x6ba02477
Info : psoc6.cpu.cm0: hardware has 4 breakpoints, 2 watchpoints
Info : psoc6.cpu.cm4: hardware has 6 breakpoints, 4 watchpoints
Info : Listening on port 3333 for gdb connections
Info : Listening on port 3334 for gdb connections
Warn : Only resetting the Cortex-M core, use a reset-init event handler to reset
any peripherals or configure hardware srst support.
Info : kitprog3: acquiring PSoC device...
target halted due to debug-request, current mode: Thread
xPSR: 0x01000000 pc: 0x00001f2c msp: 0x080477a8
** Device acquired successfully
** SFlash SiliconID: 0xE2062200
** Flash Boot version: 0x021D8001
** psoc6.cpu.cm4: Ran after reset and before halt...
target halted due to debug-request, current mode: Thread
xPSR: 0x61000000 pc: 0x1600400c msp: 00000000
Warn : Only resetting the Cortex-M core, use a reset-init event handler to reset
any peripherals or configure hardware srst support.
Info : kitprog3: acquiring PSoC device...
target halted due to debug-request, current mode: Thread
xPSR: 0x01000000 pc: 0x00001f2c msp: 0x080477a8
** Device acquired successfully
** SFlash SiliconID: 0xE2062200
** Flash Boot version: 0x021D8001
** psoc6.cpu.cm4: Ran after reset and before halt...
target halted due to debug-request, current mode: Thread
xPSR: 0x61000000 pc: 0x1600400c msp: 00000000

Usage Examples
Cypress Programmer 2.0 OpenOCD
CLI User Guide, Document No.: 002-25294 Rev. ** 22
** Programming Started **
auto erase enabled
Info : Flash write discontinued at 0x10002200, next section at 0x10080000
[100%] [################################] [ Erasing ]
[100%] [################################] [ Programming ]
[100%] [################################] [ Erasing ]
[100%] [################################] [ Programming ]
Warn : no flash bank found for address 0x90300000
Warn : no flash bank found for address 0x90500000
wrote 15360 bytes from file c:/BlinkyLED.hex in 0.779366s (19.246 KiB/s)
** Programming Finished **
** Verify Started **
verified 15360 bytes in 0.074616s (201.029 KiB/s)
** Verified OK **
** Resetting Target **
Warn : Only resetting the Cortex-M core, use a reset-init event handler to reset
any peripherals or configure hardware srst support.
Modify Individual Bytes in Main Flash and Display Results
>bin\openocd.exe -s ../scripts -f board.cfg -c "mdw 0x10000000 8; flash rmw
0x10000002 11223344; mdw 0x10000000 8; exit"
A possible output of OpenOCD:
Open On-Chip Debugger 0.10.0+dev-1.0.0.181 (2018-09-24-10:46)
Licensed under GNU GPL v2
For bug reports, read
http://openocd.org/doc/doxygen/bugs.html
adapter speed: 1500 kHz
Warn : Transport "swd" was already selected
adapter speed: 1000 kHz
** Auto-acquire enabled, use "set ENABLE_ACQUIRE 0" to disable
cortex_m reset_config sysresetreq
cortex_m reset_config vectreset
Info : CMSIS-DAP: SWD Supported
Info : CMSIS-DAP: FW Version = 2.0.0
Info : CMSIS-DAP: Interface Initialised (SWD)
Info : SWCLK/TCK = 1 SWDIO/TMS = 1 TDI = 0 TDO = 0 nTRST = 0 nRESET = 1
Info : CMSIS-DAP: Interface ready
Info : VTarget = 3.292 V
Info : kitprog3: acquiring PSoC device...
Info : clock speed 1000 kHz
Info : SWD DPIDR 0x6ba02477
Info : psoc6.cpu.cm0: hardware has 4 breakpoints, 2 watchpoints
Info : psoc6.cpu.cm4: hardware has 6 breakpoints, 4 watchpoints
Info : Listening on port 3333 for gdb connections
Info : Listening on port 3334 for gdb connections
Warn : Only resetting the Cortex-M core, use a reset-init event handler to reset
any peripherals or configure hardware srst support.
Info : kitprog3: acquiring PSoC device...
target halted due to debug-request, current mode: Thread
xPSR: 0x01000000 pc: 0x00001f2c msp: 0x080477a8

Usage Examples
Cypress Programmer 2.0 OpenOCD
CLI User Guide, Document No.: 002-25294 Rev. ** 23
** Device acquired successfully
** SFlash SiliconID: 0xE2062200
** Flash Boot version: 0x021D8001
** psoc6.cpu.cm4: Ran after reset and before halt...
target halted due to debug-request, current mode: Thread
xPSR: 0x61000000 pc: 0x1600400c msp: 00000000
0x10000000: 08024000 10000159 0000000d 100001bd 00000000 00000000 00000000 00000000
[100%] [################################] [ Erasing ]
[100%] [################################] [ Programming ]
modified 4 byte(s) in 512 byte region at 0x10000000 in 0.051963s (9.622 KiB/s)
0x10000000: 22114000 10004433 0000000d 100001bd 00000000 00000000 00000000 00000000
Start GDB Server and Leave It Running
>bin\openocd.exe -s ../scripts -f board.cfg
A possible output of OpenOCD:
Open On-Chip Debugger 0.10.0+dev-1.0.0.181 (2018-09-24-10:46)
Licensed under GNU GPL v2
For bug reports, read
http://openocd.org/doc/doxygen/bugs.html
adapter speed: 1500 kHz
Warn : Transport "swd" was already selected
adapter speed: 1000 kHz
** Auto-acquire enabled, use "set ENABLE_ACQUIRE 0" to disable
cortex_m reset_config sysresetreq
cortex_m reset_config vectreset
Info : CMSIS-DAP: SWD Supported
Info : CMSIS-DAP: FW Version = 2.0.0
Info : CMSIS-DAP: Interface Initialised (SWD)
Info : SWCLK/TCK = 1 SWDIO/TMS = 1 TDI = 0 TDO = 0 nTRST = 0 nRESET = 1
Info : CMSIS-DAP: Interface ready
Info : VTarget = 3.297 V
Info : kitprog3: acquiring PSoC device...
Info : clock speed 1000 kHz
Info : SWD DPIDR 0x6ba02477
Info : psoc6.cpu.cm0: hardware has 4 breakpoints, 2 watchpoints
Info : psoc6.cpu.cm4: hardware has 6 breakpoints, 4 watchpoints
Info : Listening on port 3333 for gdb connections
Info : Listening on port 3334 for gdb connections
Warn : Only resetting the Cortex-M core, use a reset-init event handler to reset
any peripherals or configure hardware srst support.
Info : kitprog3: acquiring PSoC device...
target halted due to debug-request, current mode: Thread
xPSR: 0x01000000 pc: 0x00001f2c msp: 0x080477a8
** Device acquired successfully
** SFlash SiliconID: 0xE2062200
** Flash Boot version: 0x021D8001
** psoc6.cpu.cm4: Ran after reset and before halt...
target halted due to debug-request, current mode: Thread
xPSR: 0x61000000 pc: 0x1600400c msp: 00000000
Info : Listening on port 6666 for tcl connections

Usage Examples
Cypress Programmer 2.0 OpenOCD
CLI User Guide, Document No.: 002-25294 Rev. ** 24
Info : Listening on port 4444 for telnet connections