1 2 Previous Next 29 Replies Latest reply on Feb 22, 2016 11:29 PM by suhuc_2189621 Branched to a new discussion.

    stm32f4-discovery st-link support

      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?

        • 1. Re: stm32f4-discovery st-link support
          SeyhanA_31

          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.

          • 2. Re: stm32f4-discovery st-link support

            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.

            • 3. Re: stm32f4-discovery st-link support
              AnSa_1225656

              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?

              • 4. Re: stm32f4-discovery st-link support

                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.

                • 5. Re: stm32f4-discovery st-link support
                  AnSa_1225656

                  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?

                  • 6. Re: stm32f4-discovery st-link support

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

                    • 7. Re: stm32f4-discovery st-link support
                      AnSa_1225656

                      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!

                      • 8. Re: stm32f4-discovery st-link support

                        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).

                        • 9. Re: stm32f4-discovery st-link support
                          AnSa_1225656

                          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?

                          • 10. Re: stm32f4-discovery st-link support

                            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.

                            • 11. Re: stm32f4-discovery st-link support
                              DaCi_2122796

                              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"

                              • 12. Re: stm32f4-discovery st-link support
                                DaCi_2122796

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

                                • 13. Re: stm32f4-discovery st-link support
                                  GregG_16

                                  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.

                                  • 14. Re: stm32f4-discovery st-link support
                                    DaCi_2122796

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

                                    1 2 Previous Next