Loading...
 

SW4STM32 and SW4Linux fully supports the STM32MP1 asymmetric multicore Cortex/A7+M4 MPUs

   With System Workbench for Linux, Embedded Linux on the STM32MP1 family of MPUs from ST was never as simple to build and maintain, even for newcomers in the Linux world. And, if you install System Workbench for Linux in System Workbench for STM32 you can seamlessly develop and debug asymmetric applications running partly on Linux, partly on the Cortex-M4.
You can get more information from the ac6-tools website and download (registration required) various documents highlighting:

System Workbench for STM32


Openocd does not work as expected

Hi

I’m trying to setup a project for a little dev board
http://www.ebay.de/itm/Arduino-IDE-kompatibles-Board-STM32-STM32f103C8T6-ST-ARM-32-bit-Cortex-M3-039-/221812183158?hash=item33a5095076:g:tI4AAOSwHnFVj5AqQuestion

Using this Adapter
http://www.ebay.de/itm/ST-LINK-V2-ST-LINK-STM8-STM32-kompatibler-Emulator-USB-Programmer-Debugger-/171689684649?hash=item27f980aea9:g:iTsAAOSwMmBVpNesQuestion

I can upload sketches in the Arduino_STM32 environment with this thing.

I have installed “System Workbench for STM32” and its tools in eclipse now and have used a stand alone CubeMX for creating a project.

The project includes freeRTOS and builds without errors.

When I try to debug or just click on “run” Openocd throws errors (1)(2)

When I use Target -> Program Chip in the Project Explorers context menu nothing at all happens.

The config file for Openocd currently is:

# This is an STM32F103C8T6-mini board with a single STM32F103C8Tx chip.
# Generated by System Workbench for STM32

  source [find interface/stlink-v2.cfg]

  set WORKAREASIZE 0x5000
  transport select "hla_swd"

#source [find target/stm32f1x_stlink.cfg] # deprecated ?
  source [find target/stm32f1x.cfg]

# use hardware reset, connect under reset
#reset_config srst_only srst_nogate
  reset_config srst_nogate


When initial created by “System Workbench for STM32” using the instructions
from here http://www.openstm32.org/Importing+a+STCubeMX+generated+projectQuestion it looked a bit diffent.
After my modifications it runs at least on the command line (3)

1. console (openocd) output when “debug” was started

Open On-Chip Debugger 0.9.0-dev-dirty (2015-11-13-11:40)
Licensed under GNU GPL v2
For bug reports, read
        http://openocd.org/doc/doxygen/bugs.html
Info : The selected transport took over low-level target control. The results might differ compared to plain JTAG/SWD
adapter speed: 1000 kHz
adapter_nsrst_delay: 100
srst_only separate srst_nogate srst_open_drain connect_assert_srst
srst_only separate srst_nogate srst_open_drain connect_assert_srst
Info : Unable to match requested speed 1000 kHz, using 950 kHz
Info : Unable to match requested speed 1000 kHz, using 950 kHz
Info : clock speed 950 kHz
Info : STLINK v2 JTAG v17 API v2 SWIM v4 VID 0x0483 PID 0x3748
Info : using stlink api v2
Info : Target voltage: 3.240795
Info : stm32f1x.cpu: hardware has 6 breakpoints, 4 watchpoints
Info : accepting 'gdb' connection on tcp/3333
Error: timed out while waiting for target halted
TARGET: stm32f1x.cpu - Not halted
in procedure 'reset'
in procedure 'ocd_bouncer'



Info : device id = 0x20036410
Warn : STM32 flash size failed, probe inaccurate - assuming 128k flash
Info : flash size = 128kbytes
Error: timed out while waiting for target halted
TARGET: stm32f1x.cpu - Not halted
in procedure 'reset'
in procedure 'ocd_bouncer'


Error: timed out while waiting for target halted
TARGET: stm32f1x.cpu - Not halted
in procedure 'reset'
in procedure 'ocd_bouncer'



Error: Target not halted
Error: failed erasing sectors 0 to 6
Error: flash_erase returned -304


2. console output after “run” was started

Open On-Chip Debugger 0.9.0-dev-dirty (2015-11-13-11:40)
Licensed under GNU GPL v2
For bug reports, read
        http://openocd.org/doc/doxygen/bugs.html
Info : The selected transport took over low-level target control. The results might differ compared to plain JTAG/SWD
adapter speed: 1000 kHz
adapter_nsrst_delay: 100
srst_only separate srst_nogate srst_open_drain connect_assert_srst
srst_only separate srst_nogate srst_open_drain connect_assert_srst
Info : Unable to match requested speed 1000 kHz, using 950 kHz
Info : Unable to match requested speed 1000 kHz, using 950 kHz
Info : clock speed 950 kHz
Info : STLINK v2 JTAG v17 API v2 SWIM v4 VID 0x0483 PID 0x3748
Info : using stlink api v2
Info : Target voltage: 3.237616
Info : stm32f1x.cpu: hardware has 6 breakpoints, 4 watchpoints
Error: timed out while waiting for target halted
TARGET: stm32f1x.cpu - Not halted
in procedure 'program'
in procedure 'reset' called at file "embedded:startup.tcl", line 478
in procedure 'ocd_bouncer'

** Unable to reset target **
shutdown command invoked


3. command line and then telnet connecting port 4444 on another terminal giving “reset halt”

db@zweistein:/opt/gnuarmeclipse/openocd/0.9.0-201505190955/scripts> /home/db/.p2/pool/plugins/fr.ac6.mcu.externaltools.openocd.linux64_1.7.0.201602121841/tools/openocd/bin/openocd  -f /home/db/STM32-projekte/STM32F103C8T6-first/SW4STM32/STM32F103C8T6-first/STM32F103C8T6-mini2.cfg
Open On-Chip Debugger 0.9.0-dev-dirty (2015-11-13-11:40)
Licensed under GNU GPL v2
For bug reports, read
        http://openocd.org/doc/doxygen/bugs.html
Info : The selected transport took over low-level target control. The results might differ compared to plain JTAG/SWD
adapter speed: 1000 kHz
adapter_nsrst_delay: 100
none separate
none separate
Info : Unable to match requested speed 1000 kHz, using 950 kHz
Info : Unable to match requested speed 1000 kHz, using 950 kHz
Info : clock speed 950 kHz
Info : STLINK v2 JTAG v17 API v2 SWIM v4 VID 0x0483 PID 0x3748
Info : using stlink api v2
Info : Target voltage: 3.239762
Info : stm32f1x.cpu: hardware has 6 breakpoints, 4 watchpoints
Info : accepting 'telnet' connection on tcp/4444
target state: halted
target halted due to debug-request, current mode: Thread
xPSR: 0x01000000 pc: 0x08000144 msp: 0x20000400


But the last has the “scripts” directory of an installation of Openocd outside the eclipse plugin stuff as current directory.

When trying the same while inside the scripts directory of the eclipes SWFSTM32’s plugin installation of Openocd and then telneting 4444 it gives the same error when saying “reset halt”

db@zweistein:~/.p2/pool/plugins/fr.ac6.mcu.debug_1.7.0.201602121829/resources/openocd/scripts> /home/db/.p2/pool/plugins/fr.ac6.mcu.externaltools.openocd.linux64_1.7.0.201602121841/tools/openocd/bin/openocd  -f /home/db/STM32-projekte/STM32F103C8T6-first/SW4STM32/STM32F103C8T6-first/STM32F103C8T6-mini2.cfg
Open On-Chip Debugger 0.9.0-dev-dirty (2015-11-13-11:40)
Licensed under GNU GPL v2
For bug reports, read
        http://openocd.org/doc/doxygen/bugs.html
Info : The selected transport took over low-level target control. The results might differ compared to plain JTAG/SWD
adapter speed: 1000 kHz
adapter_nsrst_delay: 100
srst_only separate srst_nogate srst_open_drain connect_assert_srst
srst_only separate srst_nogate srst_open_drain connect_assert_srst
Info : Unable to match requested speed 1000 kHz, using 950 kHz
Info : Unable to match requested speed 1000 kHz, using 950 kHz
Info : clock speed 950 kHz
Info : STLINK v2 JTAG v17 API v2 SWIM v4 VID 0x0483 PID 0x3748
Info : using stlink api v2
Info : Target voltage: 3.240795
Info : stm32f1x.cpu: hardware has 6 breakpoints, 4 watchpoints
Info : accepting 'telnet' connection on tcp/4444
Error: timed out while waiting for target halted
TARGET: stm32f1x.cpu - Not halted
in procedure 'reset' 
in procedure 'ocd_bouncer'


Error: jtag status contains invalid mode value - communication failure
Polling target stm32f1x.cpu failed, GDB will be halted. Polling again in 100ms
...


How should I proceed debugging this thing.
I even can not find “embedded:startup.tcl on my disk.
The installation of “System Workbench for STM32” inside Eclipse
following the instructions from here
http://www.openstm32.org/Installing+System+Workbench+for+STM32+from+Eclipse?structure=DocumentationQuestion
was without any error messages.

Kind regards
Dieter

Hi

I have solved the problem by copying the file target/stm32f1x.cf from the foreign installation of Openocd to the scripts directory of the ac6 openocd plugin path.

Diff is as follows

db@zweistein:~/.p2/pool/plugins/fr.ac6.mcu.debug_1.7.0.201602121829/resources/openocd/scripts> diff -u target/stm32f1x-back.cfg target/stm32f1x.cfg
--- target/stm32f1x-back.cfg    2016-03-03 14:35:11.841740803 +0100
+++ target/stm32f1x.cfg 2016-03-03 14:35:53.041409345 +0100
@@ -87,9 +87,7 @@
  jtag_ntrst_delay 100
 }
 
-# use hardware reset, connect under reset
-# connect_assert_srst needed if low power mode application running (WFI...)
-reset_config srst_only srst_nogate connect_assert_srst
+reset_config srst_nogate
 
 if {![using_hla]} {
     # if srst is not fitted use SYSRESETREQ to
@@ -98,19 +96,11 @@
 }
 
 $_TARGETNAME configure -event examine-end {
-       # Enable debug during low power modes
-       # Stop watchdog counters during halt
        # DBGMCU_CR |= DBG_WWDG_STOP | DBG_IWDG_STOP |
        #              DBG_STANDBY | DBG_STOP | DBG_SLEEP
        mmw 0xE0042004 0x00000307 0
 }
 
-$_TARGETNAME configure -event gdb-attach {
-       # Needed to be able to use the connect_assert_srst in reset_config
-       # otherwise, wrong value when reading device flash size register
-       reset init
-}
-
 $_TARGETNAME configure -event trace-config {
        # Set TRACE_IOEN; TRACE_MODE is set to async; when using sync
        # change this value accordingly to configure trace pins


Versions of Openocd, the first is from gnuarmeclipse-openocd-debian64-0.9.0-201505190955.tgz https://github.com/gnuarmeclipse/openocd/releasesQuestion

db@zweistein:~> /opt/gnuarmeclipse/openocd/0.9.0-201505190955/bin/openocd --version
GNU ARM Eclipse 64-bits Open On-Chip Debugger 0.9.0-00073-gdd34716-dirty (2015-05-19-09:57)

db@zweistein:~> /home/db/.p2/pool/plugins/fr.ac6.mcu.externaltools.openocd.linux64_1.7.0.201602121841/tools/openocd/bin/openocd --version
Open On-Chip Debugger 0.9.0-dev-dirty (2015-11-13-11:40)


After solving this problem I found out that some of the devices which I have bought were protected.
How can one handle this in “STM32 Workbench”?

A telnet session to openocd was the solution for me:

Connected to localhost.
Escape character is '^]'.
Open On-Chip Debugger
> reset halt
target state: halted
target halted due to debug-request, current mode: Thread 
xPSR: 0x01000000 pc: 0xfffffffe msp: 0xfffffffc
> flash probe 0
device id = 0x20036410
STM32 flash size failed, probe inaccurate - assuming 128k flash
flash size = 128kbytes
flash 'stm32f1x' found at 0x08000000
> flash protect 0 0 127 off
Device Security Bit Set
target state: halted
target halted due to breakpoint, current mode: Thread 
xPSR: 0x61000000 pc: 0x2000003a msp: 0xfffffffc
cleared protection for sectors 0 through 127 on flash bank 0


Have a nice day
Dieter


I have just solved this problem working on Ac6 SW for STM32:

- the Blue Pill board:
http://www.ebay.de/itm/Arduino-IDE-kompatibles-Board-STM32-STM32f103C8T6-ST-ARM-32-bit-Cortex-M3-039-/221812183158?hash=item33a5095076:g:tI4AAOSwHnFVj5AqQuestion

- the adapter St-Link/V2:
http://www.ebay.de/itm/ST-LINK-V2-ST-LINK-STM8-STM32-kompatibler-Emulator-USB-Programmer-Debugger-/171689684649?hash=item27f980aea9:g:iTsAAOSwMmBVpNesQuestion

One can find a lot of useful information (inclyding the schematic and the detailed board layout with explanations) at
Blue Pill - STM32F103C8T6 Board - STM32duino wiki:
http://wiki.stm32duino.com/index.php?title=Blue_PillQuestion

I read somewhere in this forum that this budget St-Link/V2 adapter does not assert the low level on its RST pin, so connecting it to NRST pin of the STM32 MCU is useless. (By the way, when you use official St-Link/V2 adapter, for the hardware reset you need to connect its NRST pin (pin 15 of the 20-pin connector) to NRST pin of the MCU, in case of STM32F103C8T6 - to pin 7. On the Blue Pill board it is marked “R”).

Many recommend to edit .cfg file in your project directory to change
reset_config srst_only srst_nogate connect_assert_srst
to
reset_config none
to use software system reset.

However, the latest version of Ac6 SW for STM32 I started to work with offers the easiest option to set the software system reset. Go to the menu

Run->Debug Configuration

In the tab “Debug” set the radio button of “Configuration Script” to “User Defined” and press the button “Show Generator Options...”. There change “Hardware Reset” to “Software System Reset”. This will automatically change the line in .cfg script to “reset_config none”. Press Apply and Close.

After this, my Blue Pill board started to work, and it can be debugged!


Works for me also.

I just came to virtually the same conslusion as the proceedure in the post above.
I’m using a Nucleo-64 board with the -303RE chip...
If you are getting the error that looks like this:
>>>>>
...
adapter speed: 950 kHz
Error: timed out while waiting for target halted
TARGET: STM32F303RETx.cpu - Not halted
in procedure ‘program’
in procedure ‘reset’ called at file “embedded:startup.tcl”, line 478
in procedure ‘ocd_bouncer’

    • Unable to reset target **

shutdown command invoked
>>>>>

You can fix it by:
Opening the Run->”Debug Configuration” menu...

In the tab “Debugger”, set the radio button of “Configuration Script” to “Auto Generation” (this works in my case), and press the button “Show Generator Options...”. There, under “Mode Setup” change the “Reset Mode” entry from “Connect Under Reset” (in my case) to “Software System Reset”. This appears to let the connection process halt the processor if it is still running from a previous activity and get on with starting the code download.


Thanks a lot, worked for me too. Didnt happened in keil but in systemworkbench

I have 2 errors when starting the debuger with the following messages:
1) Unplugged target or STLink already in use or STLink USB driver not installed
Open On-Chip Debugger 0.10.0-dev-00005-g4030e1c-dirty (2017-10-25-10:55)
Licensed under GNU GPL v2
For bug reports, read
http://openocd.org/doc/doxygen/bugs.htmlQuestion
srst_only separate srst_nogate srst_open_drain connect_assert_srst
Info : The selected transport took over low-level target control. The results might differ compared to plain JTAG/SWD
adapter_nsrst_delay: 100
adapter speed: 1800 kHz
Info : tcl server disabled
Info : telnet server disabled
Info : clock speed 1800 kHz
Error: libusb_open() failed with LIBUSB_ERROR_ACCESS
Error: open failed (no matching adapter found)
in procedure ‘init’
in procedure ‘ocd_bouncer’
2) Error message from debugger back end:
Remote communication error. Target disconnected.: No error.
Remote communication error. Target disconnected.: No error.
I have a Windows 10 and a STM32F4-Diskovery with a MB997B board. I see ST-Link in the device manager. But I do not see my board under the disk devices. The ST-Link Utility correctly performs programming and reading of the programmable memory of the board.
What should I do?


Hi,

The error you get on libusb is seen when the STLink is already opened with another program (like STLink utility) :
Error: libusb_open() failed with LIBUSB_ERROR_ACCESS
Retry but close STLink utility before (or all other tools that can opened the STlink usb connection).

Rgds,
Laurent

Hi,
After downloading the computer, the STLink utility (or all other tools that can opened the STlink usb connection) was not used and was closed.


Then i don’t know, check if you can change usb port, are they all USB3 ?
Can you check if there is a driver issue like on some PC, the USB3 Renesas usb driver needed to be upgraded.
You can see the FAQ.


Hi all! I use latest sw-stm32? and i have no such tabs in Run -> Debug configurations ((
My eclipse version is
Version: Neon.3 Release (4.6.3)
Build id: 20170314-1500