Most of the examples in this chapter assume that you have a PSOC™ Edge MCU target connected to the PC via the KitProg3/MiniProg4 or J-Link debug probe. The current working directory is the default install directory (for example,

c:\Infineon\Tools\ModusToolboxProgtools-1.6\openocd\bin

on Windows).

For convenience, the pse8_kp3_board.cfg config file has been created in the same directory as the OpenOCD executable. The file contains the default configuration suitable for the PSOC™ Edge MCU kits:

source [ find interface/kitprog3.cfg ]
set SMIF_BANKS { 0 {addr 0x60000000 size 0x01000000 psize 0x00000200 esize 0x00040000} }
source [ find target/infineon/pse84xgxs2.cfg]
init
reset init

See

Supported target configurations

for a detailed list of available target devices and corresponding OpenOCD configuration files.

Erase main flash rows 0…10 of PSOC™ Edge MCU

openocd -s ../scripts -f psoc6_kp3_board.cfg -c "flash erase_sector 0 0 10; exit" 

A possible output of OpenOCD:



Display memory contents of PSOC™ Edge MCU

In this example, OpenOCD reads memory contents of the RAM memory as well as a flash memory.

openocd -s ../scripts -f pse8_kp3_board.cfg -c "init; reset init; mdw 0x34080000 32; flash mdw 0x70000000 32; exit"

A possible output of OpenOCD:



Program the PSOC™ Edge MCU with verification (Intel HEX file)

OpenOCD supports programming of the ELF, Intel HEX, Motorola SREC, and binary file formats. For binary files, the relocation offset must be specified as an argument to the

program

command.

openocd -s ../scripts -f pse8_kp3_board.cfg -c "program c:/firmware/app_combined.hex verify reset; exit"

A possible output of OpenOCD:



Program the EFuse region of PSOC™ 6 MCU

This example writes a single bit of data to the EFuse region of the PSOC™ 6 MCU at address 0x907003FE:

openocd -s ../scripts -f interface/kitprog3.cfg -f target/infineon/cy8c6xxx.cfg -c "init; reset init; psoc6 allow_efuse_program on; flash fillb 0x907003FE 1 1; flash read_bank 3 d:/dump_efuse.bin 0x3FE 0x1; exit"

A possible output of OpenOCD:




Modify individual bytes of PSOC™ Edge MCU in main flash and display results

openocd -s ../scripts -f pse8_kp3_board.cfg -c "mdw 0x22011800 8; flash rmw 0x22011800 11223344; flash mdw 0x22011800 8; exit"

A possible output of OpenOCD:



Read the memory of PSOC™ Edge MCU to binary file

The example reads 1024 KB of the QSPI PSOC™ Edge MCU memory to a file named

dump_mem.bin

.

openocd -s ../scripts -f pse8_kp3_board.cfg -c "dump_image d:/dump_mem.bin 0x70000000 0x100000; exit"

A possible output of OpenOCD:



Start the GDB server and leave it running

openocd -s ../scripts -f pse8_kp3_board.cfg

A possible output of OpenOCD:



Power example

This example cycles between setting different voltage levels (1800, 2500, 0, and lastly 2500).

openocd -s ../scripts -f interface/kitprog3.cfg -f target/infineon/cy8c6xx.cfg -c "kitprog3 power_config on 1800; init; kitprog3 get_power; kitprog3 power_config on 2500;kitprog3 get_power;kitprog3 power_config off;kitprog3 get_power;kitprog3 power_config on;kitprog3 get_power; shutdown"

A possible output of OpenOCD:



Define and use QSPI flashloader

While some devices support several external memories or patched flashloaders, which contain data about how external memory is configured, the mechanism to changeswitch between default flashloaders and custom/patched ones is created -the enablement requires them the QSPI_FLASHLOADER and SMIF_BANKS should be redefined. For example, to program

See QSPI Configurator user guide for more information about patching flashloaders.

openocd -s ../scripts -c "set QSPI_FLASHLOADER C:/firmware/PSE84_OCTAL_DDR_SMIF.FLM" -f pse8_kp3_board.cfg -c "init; reset init; program c:/firmware/app_combined.hex verify; exit"

A possible output of OpenOCD: