cancel
Showing results for 
Search instead for 
Did you mean: 

SW4STM32 compiles a STM32CubeG0 example, but fails when trying to flash it to a STM32G0 board

LBode.1
Associate II

I imported an example project from STM32CubeG0 and got the project to build, but when hitting the Debug button I get this in the console:

Info : The selected transport took over low-level target control. The results might differ compared to plain JTAG/SWD
padded zone erase set to 1
adapter speed: 8000 kHz
adapter_nsrst_delay: 100
Info : Listening on port 6666 for tcl connections
Info : Listening on port 4444 for telnet connections
Info : clock speed 8000 kHz
Info : STLINK v2 JTAG v36 API v2 SWIM v7 VID 0x0483 PID 0x3748
Info : using stlink api v2
Info : Target voltage: 3.256233
Info : Unable to match requested speed 8000 kHz, using 4000 kHz
Info : Stlink adapter speed set to 4000 kHz
Info : STM32G071RBTx.cpu: hardware has 4 breakpoints, 2 watchpoints
Info : Listening on port 3333 for gdb connections
Info : accepting 'gdb' connection on tcp/3333
Error: timed out while waiting for target halted
TARGET: STM32G071RBTx.cpu - Not halted
in procedure 'reset' 
in procedure 'ocd_bouncer'
 
 
 
Info : Device id = 0x20006460
Info : STM32L4xx flash size is 128kb, base address is 0x8000000
Error: failed erasing sectors 0 to 3
Error: flash_erase returned -304

And this in the Debugger Console:

GNU gdb (GNU Tools for ARM Embedded Processors) 7.10.1.20160923-cvs
Copyright (C) 2015 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "--host=x86_64-apple-darwin10 --target=arm-none-eabi".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word".
 
 
Remote communication error.  Target disconnected.: Connection reset by peer.

And this in the Debug tab next to that:

<terminated>DAC_SignalsGeneration Debug [Ac6 STM32 Debugging]	
	<terminated, exit value: 143>openocd	
	<terminated, exit value: 0>gdb	

I have an ST-Link V2 probe that I've used with STM32CubeProgrammer. The firmware on it is up to date.

In fact I can manually flash the .elf file to the board using STM32CubeProgrammer and it works.

Is there somewhere in SystemWorkBench I should configure this? Is OpenOCD out of date? Also why is it mentioning a STM32L4xx when I have an STM32G071KB connected?

I read through the Getting Started guide and performed all the actions in there. Is there something I'm missing?

1 REPLY 1
KnarfB
Principal III

Works for me with latest STM32CubeIDE Version: 1.3.0

Build: 5720_20200220_1053 (UTC):

Open On-Chip Debugger 0.10.0+dev-01193-g5ce997d (2020-02-20-10:57)
Licensed under GNU GPL v2
For bug reports, read
	http://openocd.org/doc/doxygen/bugs.html
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 speed: 8000 kHz
adapter_nsrst_delay: 100
Info : Listening on port 6666 for tcl connections
Info : Listening on port 4444 for telnet connections
Info : clock speed 8000 kHz
Info : STLINK V2J36S26 (API v2) VID:PID 0483:374B
Info : using stlink api v2
Info : Target voltage: 3.251765
Info : SRST line asserted
Info : STM32G071RBTx.cpu: hardware has 4 breakpoints, 2 watchpoints
Info : Listening on port 3333 for gdb connections
Info : accepting 'gdb' connection on tcp/3333
Info : SRST line released
target halted due to debug-request, current mode: Thread 
xPSR: 0xf1000000 pc: 0x08000974 msp: 0x20009000
Info : Unable to match requested speed 8000 kHz, using 4000 kHz
Info : Unable to match requested speed 8000 kHz, using 4000 kHz
adapter speed: 4000 kHz
Info : device idcode = 0x20006460 (STM32G07/G08xx - Rev: B)
Info : flash size = 128kbytes
Info : flash mode : single-bank
Info : SRST line asserted
Info : SRST line released
target halted due to debug-request, current mode: Thread 
xPSR: 0xf1000000 pc: 0x08000974 msp: 0x20009000
Info : Unable to match requested speed 8000 kHz, using 4000 kHz
Info : Unable to match requested speed 8000 kHz, using 4000 kHz
adapter speed: 4000 kHz
target halted due to breakpoint, current mode: Thread 
xPSR: 0x61000000 pc: 0x20000050 msp: 0x20009000
Info : block write succeeded
Info : SRST line asserted
Info : SRST line released
target halted due to debug-request, current mode: Thread 
xPSR: 0xf1000000 pc: 0x08000974 msp: 0x20009000