Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob

Adding ST-Link support in WICED

lock attach
Attachments are accessible only for community members.

Adding ST-Link support in WICED

500 replies posted 250 replies posted 100 replies posted


This blog provides a guideline to add support ST-Link (ST Micro’s programming & debug hardware) in an existing WICED SDK framework.



Consider this document as a guideline, which has not been extensively tested and the procedure mentioned below could differ for different versions of WICED Studio & ST-Link.



ST-Link is the on-board programmer used to program the code in ST MCU, details of which can be found at ST website. WICED uses OpenOCD to download the programs to the target MCU (ST host MCU, CYW43907, PSoC 6). In most of the standard WICED EVBs, an FTDI chip (FT2232H) has been used to provide the USB-UART  / USB-JTAG bridge functionality which is what has been the standard download procedure followed by the OpenOCD in WICED.

Brief Introduction about OpenOCD


Open On-Chip Debugger (OpenOCD) is a free open-source project that facilitates downloading, debugging by using a debug adapter like ST-Link, FT2232H etc. OpenOCD works either by using commands or by using configuration files. When configuration is done and a connection to the target is established, OpenOCD will start running as a daemon in the background. The OpenOCD directory file has a folder called “scripts”. In this folder, you will see "interface", "board", and "target" folders. These are pretty much the only folders you need.

  • Interface: Configuration files for hardware adapters, for example “stlink-v2-1.cfg”.
  • Board: Configuration files for common development boards like “stm32f469discovery.cfg” .. etc. You can see that these files reuse configuration files from interface and target.
  • Target: Configuration files for MCU Chips.

For detailed understanding of OpenOCD procedure and syntax, one can find their documentation at http://openocd.org/doc/html/index.html

WICED Download and debug procedure:


  In WICED, an OpenOCD command is put into the .gdbinit file by the makefile system during compilation.
Wiced Eclipse has an optional component "GDB Hardware Debugging" installed.  This allows it to instruct GDB to access a "GDB remote protocol server" via TCP.
Hence when Eclipse starts a debug session, it starts GDB, which in turn causes the .gdbinit OpenOCD command to be executed. OpenOCD is a "GDB remote protocol server", and next, Eclipse instructs GDB to connect to it.
During the startup of OpenOCD, it uses various JTAG & ARM protocols to interrogate the target chip. Once this initial interrogation is done, OpenOCD receives requests over TCP from GDB and services those requests on the target chip as needed details about this remote GDB can be found at GDB documentation.

How to add support for ST-Link:


WICED Environment uses the makefiles, configuration files as located in 43xxx_Wi-Fi/tools/makefiles and 43xxx_Wi-Fi/tools/OpenOCD respectively to download the code to the target MCU. Some changes have been made in the makefiles responsible for the download process and rest of the modifications were done in the OpenOCD directory, details of which can be found in the attached. Please note that modifying the existing makefiles, OpenOCD directory to enable ST-Link support is a one-way approach; i.e, you can’t program the other WICED boards (using a FT2232H chip) normally without restoring both directories back to the one shipped with SDK. So, it’s always recommended to make a back-up of the directories before replacing them with the attached.


In the example implementation, a custom JTAG macro was defined in the platform makefile (platform.mk) in the following way.



Based on the custom JTAG macro, openocd binary (openocd-all-brcm-libftdi.exe), as located in 43xxx_Wi-Fi/tools/OpenOCD/Win32/openocd-all-brcm-libftdi.exe expects a <custom JTAG macro>.cfg file in the 43xxx_Wi-Fi/tools/OpenOCD directory as shown in the figure below.


In this case, the stm32f469discovery.cfg file was copied from 43xxx_Wi-Fi/tools/OpenOCD/scripts/board/stm32f469discovery.cfg directory to the 43xxx_Wi-Fi/tools/OpenOCD directory. This stm32f469discovery.cfg has all the necessary interface, transport, target, reset_config specified. For a created platform, customer needs to create their own .cfg file based on the JTAG macro chosen and place them in 43xxx_Wi-Fi/tools/OpenOCD directory. If the created .cfg file has some error, a good place to start the debug procedure would be the openocd log generated as part of the build system which can be found at 43xxx_Wi-Fi/build/openocd_log.txt.


Refer to the files attached to this blog. We suggest you do a ‘Diff’ of the existing WICED Studio files and the attached files to understand the changes.

Level 3
Level 3
10 replies posted 5 replies posted 10 questions asked


How to add ST-Link support when using external ST-LINK V3 or ST-LINK V2  debugger with a proprietary STM32F412 controlled platform?

500 replies posted 250 replies posted 100 replies posted

You can add the following lines in your STM32F412 based platform.mk

JTAG := scripts/interface/stlink-v2

HOST_OPENOCD := scripts/target/stm32f4x_stlink

There is no default support for stlink-v3 in the openocd present in WICED. To workaround this issue, you can get the latest openocd package from their git and copy the stlink-v3.cfg in scripts/interface folder. Additionally, you would need to add

set CHIP_FLASH_START 0x08000000

set CHIP_RAM_START   0x20000000

in stm32f4x_stlink.cfg. To debug any possible failure, please put additional echo statements in each of the .cfg file to understand whether the correct .cfg file is being picked up and this log(openocd_log.txt) can be found in the generated build directory.

Hope this helps!

Level 1
Level 1

i have my own NUCLEO-F429ZI and in Nebula board has same stm32f429ZI controller

so how can i program Nebula board apk on NUCLEO-F429ZI board useing WICED IDE ?

i will try to test my CY4343 chip using stm32