cancel
Showing results for 
Search instead for 
Did you mean: 

Wi-Fi Combo

Anonymous
Not applicable

Are there any plans to support st-link interface in the future versions of WICED SDK? I would like to run WICED software on stm32f4-discovery board with Murata SN8000 module. OpenOCD support st-link, I even managed to configure SDK to connect to board, but I am getting stuck in hard faults while debugging. Has anyone succeeded in running WICED on stm32f4-discovery board?

0 Likes
29 Replies
SeyhanA_31
Employee

Hi Jakub,

There are no plans to support st-link interface in WICED SDK yet. Sounds like you have already connected the Murata SN8000 to stm32f4 discovery board.

For the hard faults while debugging, perhaps info from this link may help stm32f4discovery - STM32F4xx with GDB and OpenOCD bugs - Stack Overflow :

"I already had the same problem with an STM32F1, I was using gdb and OpenOCD and the debugger was directly jumping in the hard fault handler when starting to debug. In my case the problem was that the entry point was not defined in the LD linker script. I defined it with the ENTRY directive and then it worked. Without that ENTRY directive I needed to manually do set $pc=Reset_Handler in GDB (set program counter to the reset handler) to be able to debug. 

Another problem can be how OpenOCD is configured to reset the microcontroller, you need to pass the correct command line parameter when starting OpenOCD, have a look here:

OpenOCD Reset Configuration"

Hope it helps.

Anonymous
Not applicable

Thanks for reply. Finally I managed to fix this. The problem was I increased cpu clock frequency without changing the amount of flash wait cycles. If anyone has problems with st-link in WICED SDK I think I can help.

AnSa_1225656
Contributor

I need to use an STLink/V2 programmer from within WICED.  It sounds like you have been able to configure this?  Did you have to update the OpenOCD?  Can you give me some hints on setting this up?

0 Likes
Anonymous
Not applicable

Yes, you should update OpenOCD since the old version used in Wiced SDK 2.4.1 doesn't support st-link. You should also make changes in several makefiles in root directory:

  • wiced_toolchain_common.mk -variables OPENOCD_PATH, OPENOCD_INTERFACE, OPENOCD_TARGET, OPENOCD_FULL_NAME
  • wiced_toolchain_ARM_GNU.mk -
    GDBINIT_STRING = shell start /B $(OPENOCD_FULL_NAME) -c "reset_config trst_and_srst srst_push_pull srst_nogate" -f $(OPENOCD_INTERFACE) -f $(OPENOCD_TARGET) -c init -c "reset halt" -l $(OPENOCD_LOG_FILE)
  • Makefile - all commands launching OpenOCD

There are used HOST_MICRO and HOST_ARCH variables in files above to determine target and interface. I used fixed paths.

To make OpenOCD closing automatically after terminating debugger session use following command for OpenOCD:

$_TARGETNAME configure -event gdb-detach { soft_reset_halt; sleep 5; resume; shutdown }

The "Search" eclipse command is very useful in configuring.

0 Likes
AnSa_1225656
Contributor

Thanks for your response!  With your notes, I was able to spot all (I hope) spots I needed to tweak in the make files.  I am stuck on updating OpenOCD.  My MinGW/msys set up had to be hacked (added paths to other bins to each profile) to get msys-git since the build script uses git.  Still can fully build OpenOCD.  Did you use the MinGW approach as outlined in WICED, or did you use another method to update your OpenOCD?

0 Likes
Anonymous
Not applicable

I didn't manage to build OpenOCD on my own, I used binary (for Windows only) downloaded here: Download

0 Likes
AnSa_1225656
Contributor

Interesting.  I tried 0.8.0 but I could not get it to work.  I thought it was because it was missing some of the patches, like "verify_image_checksum", for example.  I guess I'll go back and fight it since you were able to make it work.

Typical output of the openOCD portion of the build (How does this compare to what you saw?):

==================================

Downloading Bootloader ...

OPENOCD -f ./Tools/OpenOCD/stlink-v2.cfg -f ./Tools/OpenOCD/stm32f2x_stlink.cfg -f ./Tools/OpenOCD/stm32f2x-flash-app.cfg -c "verify_image_checksum build/waf_bootloader-NoOS-NoNS-ISM43362_M3G_L44-SDIO/Binary/waf_bootloader-NoOS-NoNS-ISM43362_M3G_L44-SDIO.stripped.elf" -c shutdown

Open On-Chip Debugger 0.8.0 (2014-04-28-08:39)

Licensed under GNU GPL v2

For bug reports, read

  http://openocd.sourceforge.net/doc/doxygen/bugs.html

Info : This adapter doesn't support configurable speed

Info : STLINK v2 JTAG v17 API v2 SWIM v4 VID 0x0483 PID 0x3748

Info : using stlink api v2

Info : Target voltage: 3.288363

Info : stm32f2x.cpu: hardware has 6 breakpoints, 4 watchpoints

target state: halted

target halted due to debug-request, current mode: Thread

xPSR: 00000000 pc: 0x00095b10 msp: 0x00000200

invalid command name "verify_image_checksum"

Open On-Chip Debugger 0.8.0 (2014-04-28-08:39)

Licensed under GNU GPL v2

For bug reports, read

  http://openocd.sourceforge.net/doc/doxygen/bugs.html

adapter speed: 1000 kHz

adapter_nsrst_delay: 100

Runtime Error: ./Tools/OpenOCD/stm32f2x.cfg:38: invalid command name "jtag_ntrst_delay"

in procedure 'script'

at file "embedded:startup.tcl", line 58

at file "./Tools/OpenOCD/stm32f2x.cfg", line 38

I am very grateful for your help thus far!

0 Likes
Anonymous
Not applicable

In stm32f2x-flash-app.cfg comment out jtag commands. The error is because OpenOCD reads somehow stm32f2x.cfg (also with jtag commands) from old version instead of reading stm32f2x_stlink.cfg. Check paths to scripts. The error with "verify_image_checksum" command can be resolved by changing it to "verify_image" (in Makefile).

0 Likes
AnSa_1225656
Contributor

Success!  Thank you so much!

I did have to comment out the "verify_image_checksum" since it does not seem to be supported in this version of OpenOCD?

0 Likes
Anonymous
Not applicable

No, just change it to "verify_image" - does almost the same. Verification is performed to determine whether image was changed or not before writing it into flash.

0 Likes
DaCi_2122796
New Contributor II

Were you able to resolve the "init mode failed" issue reported on the mailing list?

0 Likes
AnSa_1225656
Contributor

Yes, I did get the init mode failed issue resolved.  Our first test program re-purposed some pins that were needed for the JTAG, but my current OpenOCD set up in WICED does not do a connect under reset, so the JTAG failed.  I used the ST tool to directly clear the flash of the device and then was able to connect and program from WICED.  If anyone has the majic config for programming under reset, let me know.

0 Likes
DaCi_2122796
New Contributor II

I'm encountering an issue using the standalone stlink v2 with this. I'm getting errors

===========================================================

Open On-Chip Debugger 0.8.0 (2014-04-28-08:39)

Licensed under GNU GPL v2

For bug reports, read

  http://openocd.sourceforge.net/doc/doxygen/bugs.html

Info : This adapter doesn't support configurable speed

Info : STLINK v2 JTAG v19 API v2 SWIM v4 VID 0x0483 PID 0x3748

Info : using stlink api v2

Info : Target voltage: 3.224021

Error: init mode failed

in procedure 'transport'

Runtime Error: ./Tools/OpenOCD/stm32f2x-flash-app.cfg:1:

in procedure 'script'

at file "embedded:startup.tcl", line 58

in procedure 'init' called at file "./Tools/OpenOCD/stm32f2x-flash-app.cfg", line 1

===========================================================

My download line is

===========================================================

D:/openocd-0.8.0/bin/openocd-0.8.0.exe -f D:/openocd-0.8.0/scripts/interface/stlink-v2.cfg -f D:/openocd-0.8.0/scripts/target/stm32f2x_stlink.cfg -f ./Tools/OpenOCD/stm32f2x-flash-app.cfg  -c "verify_image $(BOOTLOADER_OUTFILE).stripped.elf"

0 Likes
GregG_16
Employee

Do you have a follow up question here? It may be best to create a new discussion and reference this one, since it was already marked as correct.  I unmarked it as correct for now.

0 Likes
DaCi_2122796
New Contributor II

The follow up is: I followed these same steps. It's not working for me, but my error is different. Why?

0 Likes
GregG_16
Employee

OK. The discussion is opened again.

0 Likes
Anonymous
Not applicable

Is this still issue for you?

0 Likes
Anonymous
Not applicable

Hi

Can you please specify the exact changes(variable ) that we need to perform on the make files( wiced_toolchain_common.mk etc.). Also please let me know is it possible to flash the bin file generated using Wiced IDE with the help of ST link?. What all changes that I need to do for that.

Please share thoughts on the above.

Thanks,

0 Likes
Anonymous
Not applicable

################

# Windows settings

################

COMMON_TOOLS_PATH := $(TOOLS_ROOT)/common/Win32/

export SHELL       = cmd.exe

EXECUTABLE_SUFFIX  := .exe

OPENOCD_FULL_NAME := $(OPENOCD_PATH)Win32/openocd-all-brcm-libftdi.exe

#IAR defines

########  Define your IAR path here if auto detection fails ############

IAR_VERSIONS_FOUND := $(sort $(filter-out C:/Program Files/IAR Systems/Embedded Workbench, $(wildcard   C:/Program\ Files/IAR\ Systems/*)))

ifneq ($(IAR_VERSIONS_FOUND),)

IAR_LATEST_VERSION := $(word $(words $(IAR_VERSIONS_FOUND)),$(IAR_VERSIONS_FOUND))

IAR_ARM_WORKBENCH_PATH := C:\Program Files\IAR Systems\Embedded Workbench $(IAR_LATEST_VERSION)

IAR_TOOLCHAIN_PATH := "C:\Program Files\IAR Systems\Embedded Workbench $(IAR_LATEST_VERSION)\arm\bin\"

else

ifeq ($(IAR),1)

$(error could not auto detect IAR toolchain path. please set manually in wiced_toolchain_common.mk)

endif

endif

IAR_WORKBENCH_BIN_PATH := $(IAR_ARM_WORKBENCH_PATH)\common\bin

IAR_WORKBENCH_EXECUTABLE := $(IAR_WORKBENCH_BIN_PATH)\IarIdePM.exe

ifneq ($(IAR),1)

SLASH_QUOTE_START :=\"

SLASH_QUOTE_END :=\"

else

SLASH_QUOTE_START :="\"

SLASH_QUOTE_END :=\""

endif

ESC_QUOTE:="

ESC_SPACE:=$(SPACE)

CAT               := type

ECHO_BLANK_LINE   := "$(COMMON_TOOLS_PATH)echo$(EXECUTABLE_SUFFIX)"

ECHO_NO_NEWLINE   := "$(COMMON_TOOLS_PATH)echo$(EXECUTABLE_SUFFIX)" -n

ECHO              := echo

QUOTES_FOR_ECHO   :=

CMD_TRUNC         := "$(COMMON_TOOLS_PATH)trunc$(EXECUTABLE_SUFFIX)"

PERL              := "$(COMMON_TOOLS_PATH)perl$(EXECUTABLE_SUFFIX)"

LINT_EXE          := "$(TOOLS_ROOT)/splint/splint/bin/splint$(EXECUTABLE_SUFFIX)"

PYTHON              := C:\Python27\python.exe

PERL_ESC_DOLLAR   :=$$

CLEAN_COMMAND     := if exist build $(call CONV_SLASHES,$(COMMON_TOOLS_PATH))rmdir /s /q build

MKDIR              = if not exist $(subst /,\,$1) mkdir $(subst /,\,$1)

CONV_SLASHES       = $(subst /,\,$1)

DIR                = $(dir $(subst /,\,$1))

TOUCH              = $(ECHO) >

CYGWIN :=

DEV_NULL          := nul

TRUE_CMD          := call

FALSE_CMD         := fail > nul 2>&1

# $(1) is the content, $(2) is the file to print to.

define PRINT

@$(ECHO) $(1)>>$(2)

endef

WRITE_FILE_CREATE =$(file >$(1),$(2))

WRITE_FILE_APPEND =$(file >>$(1),$(2))

else  # Win32

ifeq ($(HOST_OS),Linux32)


This i how my "wiced_toolchain_common.mk" looks like. i could not find OPENOCD_INTERFACE, OPENOCD_TARGET, here

0 Likes
Anonymous
Not applicable

I too am stuck at Hard faults while debugging. It is directly going to hard fault handler. Please help me in solving this.

I am using SN8200x Wifi module from murata and STLink V2 for debugging and WICED-SDK-2.4.0

Thanks in advance.

0 Likes
Anonymous
Not applicable

So st-link is working? Hard faults probably have nothing to do with st-link interface. If you have DEBUG defined, debugger should go to hard fault handler which saves registers when hard fault occurs, including program counter. It can be improper number of flash delay cycles (platform_common_config.h) or voltage.

0 Likes
Anonymous
Not applicable

Hi,

Thanks for the reply. I use WICED-SDK only for building the code. I am using STLink Utility for programming and openocd installed externally in linux for debugging.

During single stepping, it starts with bootloader main and goes into hard fault handler (Imprecise data bus error). I am not able to continue from that.

The flash delay cycles (INT_FLASH_WAIT_STATE) are 2. Is it correct ? Please help me in this regard.

0 Likes
Anonymous
Not applicable

Number of flash delay cycles depends on mcu clock frequency, it should be specified in datasheet.

Anonymous
Not applicable

Hi,

The MCU clock is 72MHz and the Number of flash wait cycles specified for the range 48 to 72MHz in datasheet is 2. My code also has the same number of cycles.

What can be the other possible problems ?

Thanks.

0 Likes
Anonymous
Not applicable

There is a hard fault handler (hardfault_handler.c) which saves values of registers (including program counter) when hard fault occurs. Here you can get information which assembler instruction makes a fault. Nevertheless, it is often still difficult to fix this kind of bugs. It could be bus error, memory access error, etc.

0 Likes
Anonymous
Not applicable

Hi Raghu,

I got the same problem with going to hardfault directly.

Did you solve the problem already ?

If yes, would you please share with me ?

0 Likes
Anonymous
Not applicable

Hi mills_pan,

No still working on that issue. Ya I would definitely post if I got some leads.

rakjak2   I am getting "Imprecise Data Bus Error". I saw, with this error it is difficult to say which instruction made the fault. Can we do anything about that ?

0 Likes
Anonymous
Not applicable

Hi

Can We directly flash the wiced binary file in to SN8000x with the help of ST-link utility and ST-link programmer? Or do we need to perform any changes on 1) linker file 2) output binary file ( binary to hex file conversion)  or anything else.

Please share your thoughts on the above.

Thanks,

Hari.

0 Likes
Anonymous
Not applicable

Hi rakjak2,

I am trying to connect the STM32F discovery board using the WICED SDK 2.4.1. I am getting the following error while it tries to download the code.

"**** OpenOCD failed - ensure you have installed the driver from the drivers directory, and that the debugger is not running **** In Linux this may be due to USB access permissions. In a virtual machine it may be due to USB passthrough settings. Check in the task list that another OpenOCD process is not running. Check that you have the correct target and JTAG device plugged in. ****"

Can you help us to proceed.

Thanks in advance,

Suchitra

0 Likes