Before logging an issue, please update to the latest release of Visual Micro from the Downloads Page.

When Logging a Support Issue in the Forum, please ensure you have also:-

  • Enabled vMicro > Compiler > Show Build Properties
  • Re-Compile your program with these settings enabled
 
Save the new Output to a Text File and....
  • Click the Reply button and attach as .txt file OR
  • Click here to Email us with the file attached, and a link to your post
Support requests without the output above may be impossible to answer, so please help us to help you
 
Page Index Toggle Pages: 1 [2]  Send TopicPrint
Very Hot Topic (More than 25 Replies) Using the nucleo-64 SWD interface to debug another stm32? (Read 9432 times)
Bambo
Member
***
Offline


Posts: 146
Location: Liverpool, UK
Joined: Jan 13th, 2020
Re: Using the nucleo-64 SWD interface to debug another stm32?
Reply #20 - Feb 26th, 2020 at 1:31pm
Print Post  
Here are the settings it is building with and here is my board.txt

Quote:
tools.gdb.pre_init.tool=openocd
tools.gdb.cmd=arm-none-eabi-gdb.exe
tools.gdb.path={runtime.tools.arm-none-eabi-gcc.path}/bin
tools.gdb.pattern="{path}/{cmd}" -interpreter=mi -d "{build.project_path}"
tools.gdb.openocd.cmd=bin/openocd.exe
00213/
tools.gdb.openocd.params.verbose=-d2
tools.gdb.openocd.params.quiet=-d0
tools.gdb.openocd.pattern="{path}/{cmd}" -l "{{build.path}/{build.project_name}_DebugOpenOCD.log}" -s "{path}/scripts/" -f "{path}/scripts/{build.openocdscript}" -c "init"
tools.openocd.debug.path={runtime.tools.openocd-0.10.0.1.path}
tools.openocd.debug.cmd=bin/openocd.exe
tools.openocd.debug.cmd.windows=bin/openocd.exe
tools.openocd.debug.params.verbose=-d2
tools.openocd.debug.params.quiet=-d0
tools.openocd.debug.args={params.verbose} -l "{{build.path}/{build.project_name}_DebugOpenOCD.log}" -s"{path}/scripts/" -f "{path}/scripts/interface/{build.openocddebugger}" -f "{path}/scripts/{build.openocdscript}" -c "init"
tools.openocd.debug.address=localhost:3333


board.txt
Quote:
# SAIN build property overrides
#




## GDB:     Example...
##          Arduino compatible GDB build variables can be used in conjunction with an optional debugger_launch.json
##                vNicro supports these settings as variables using the same as the microsoft mi json spec. 
##                        for example:- $(debugServerPath) is the full ocd exe file name and path
##                  Remove the # to activate these settings. This one variation of gdb + opencd as an example
##                  Actual settings might differ for the various hardware.
##          Use 'vMicro>Compiler>Show Build Properties' to see existing build properties to assist
##

#debug.tool=gdb
#tools.gdb.pre_init.tool=openocd
#tools.gdb.cmd=arm-none-eabi-gdb.exe
#tools.gdb.path={runtime.tools.arm-none-eabi-gcc.path}/bin
#tools.gdb.pattern="{path}/{cmd}" -interpreter=mi -d "{build.project_path}"
#tools.gdb.openocd.cmd=bin-64/openocd.exe
#tools.gdb.openocd.path={runtime.vm.ide.tools.openocd.path}
#tools.gdb.openocd.params.verbose=-d2
#tools.gdb.openocd.args={params.verbose} -s"{path}/scripts/" -f "board/your_OCD_BOARD.cfg"



build.openocdscript = stlink.cfg
00213/
0200213/

build.openocdscript=target/stm32l4x.cfg
tools.openocd.upload.openocdscript=target/stm32l4x.cfg
  
Back to top
 
IP Logged
 
Bambo
Member
***
Offline


Posts: 146
Location: Liverpool, UK
Joined: Jan 13th, 2020
Re: Using the nucleo-64 SWD interface to debug another stm32?
Reply #21 - Feb 26th, 2020 at 1:35pm
Print Post  
It's very close to working, i don't think its correctly setting the stlink.cfg. I'm now using the external stlink-v2 as the debugger, here is where the debugger reaches.

Problem is non of the debug things are working e.g. breakpoints, callstack.etc. it doesn't hit any breakpoints.




Quote:
WARNING: interface/stlink-v2.cfg is deprecated, please switch to interface/stlink.cfg
Info : auto-selecting first available session transport "hla_swd". To override use 'transport select <transport>'.
Info : The selected transport took over low-level target control. The results might differ compared to plain JTAG/SWD
Info : clock speed 500 kHz
Info : STLINK V2J35S7 (API v2) VID:PID 0483:3748
Info : Target voltage: 3.193167
Info : stm32l4x.cpu: hardware has 6 breakpoints, 4 watchpoints
Info : Listening on port 3333 for gdb connections
Info : Listening on port 6666 for tcl connections
Info : Listening on port 4444 for telnet connections
Info : accepting 'gdb' connection on tcp/3333
target halted due to debug-request, current mode: Thread 
xPSR: 0x21000000 pc: 0x08019b10 msp: 0x20027e08
Info : device idcode = 0x20016462 (STM32L45/L46xx - Rev: Y)
Info : flash size = 512kbytes
Info : flash mode : single-bank
Error: Can not find free FPB Comparator!
Error: can't add breakpoint: resource not available
Info : The target is not running when halt was requested, stopping GDB.
Info : The target is not running when halt was requested, stopping GDB.
Info : The target is not running when halt was requested, stopping GDB.
« Last Edit: Feb 26th, 2020 at 1:43pm by Bambo »  
Back to top
 
IP Logged
 
Bambo
Member
***
Offline


Posts: 146
Location: Liverpool, UK
Joined: Jan 13th, 2020
Re: Using the nucleo-64 SWD interface to debug another stm32?
Reply #22 - Feb 26th, 2020 at 1:51pm
Print Post  
Bambo wrote on Feb 26th, 2020 at 1:35pm:
It's very close to working, i don't think its correctly setting the stlink.cfg. I'm now using the external stlink-v2 as the debugger, here is where the debugger reaches.

Problem is non of the debug things are working e.g. breakpoints, callstack.etc. it doesn't hit any breakpoints.

https://i.imgur.com/XLX7Kks.png
https://i.imgur.com/BZ5j2DQ.png

Quote:
WARNING: interface/stlink-v2.cfg is deprecated, please switch to interface/stlink.cfg
Info : auto-selecting first available session transport "hla_swd". To override use 'transport select <transport>'.
Info : The selected transport took over low-level target control. The results might differ compared to plain JTAG/SWD
Info : clock speed 500 kHz
Info : STLINK V2J35S7 (API v2) VID:PID 0483:3748
Info : Target voltage: 3.193167
Info : stm32l4x.cpu: hardware has 6 breakpoints, 4 watchpoints
Info : Listening on port 3333 for gdb connections
Info : Listening on port 6666 for tcl connections
Info : Listening on port 4444 for telnet connections
Info : accepting 'gdb' connection on tcp/3333
target halted due to debug-request, current mode: Thread 
xPSR: 0x21000000 pc: 0x08019b10 msp: 0x20027e08
Info : device idcode = 0x20016462 (STM32L45/L46xx - Rev: Y)
Info : flash size = 512kbytes
Info : flash mode : single-bank
Error: Can not find free FPB Comparator!
Error: can't add breakpoint: resource not available
Info : The target is not running when halt was requested, stopping GDB.
Info : The target is not running when halt was requested, stopping GDB.
Info : The target is not running when halt was requested, stopping GDB.



Quote:

WARNING: interface/stlink-v2.cfg is deprecated, please switch to interface/stlink.cfg
Info : auto-selecting first available session transport "hla_swd". To override use 'transport select <transport>'.
Info : The selected transport took over low-level target control. The results might differ compared to plain JTAG/SWD
Info : clock speed 500 kHz
Info : STLINK V2J35S7 (API v2) VID:PID 0483:3748
Info : Target voltage: 3.199474
Info : stm32l4x.cpu: hardware has 6 breakpoints, 4 watchpoints
Info : Listening on port 3333 for gdb connections
Info : Listening on port 6666 for tcl connections
Info : Listening on port 4444 for telnet connections
Error: jtag status contains invalid mode value - communication failure
Polling target stm32l4x.cpu failed, trying to reexamine
Examination failed, GDB will be halted. Polling again in 100ms
Info : Previous state query failed, trying to reconnect
Error: jtag status contains invalid mode value - communication failure
Polling target stm32l4x.cpu failed, trying to reexamine
Examination failed, GDB will be halted. Polling again in 300ms
Info : Previous state query failed, trying to reconnect
Error: jtag status contains invalid mode value - communication failure
Polling target stm32l4x.cpu failed, trying to reexamine
Examination failed, GDB will be halted. Polling again in 700ms
Info : Previous state query failed, trying to reconnect
Error: jtag status contains invalid mode value - communication failure
Polling target stm32l4x.cpu failed, trying to reexamine
Examination failed, GDB will be halted. Polling again in 1500ms
Info : Previous state query failed, trying to reconnect
Error: jtag status contains invalid mode value - communication failure
Polling target stm32l4x.cpu failed, trying to reexamine
Examination failed, GDB will be halted. Polling again in 3100ms
Info : Previous state query failed, trying to reconnect
Error: jtag status contains invalid mode value - communication failure
Polling target stm32l4x.cpu failed, trying to reexamine
Examination failed, GDB will be halted. Polling again in 6300ms
Info : Previous state query failed, trying to reconnect
Error: jtag status contains invalid mode value - communication failure
Polling target stm32l4x.cpu failed, trying to reexamine
Examination failed, GDB will be halted. Polling again in 6300ms
Info : Previous state query failed, trying to reconnect
Error: jtag status contains invalid mode value - communication failure
Polling target stm32l4x.cpu failed, trying to reexamine
Examination failed, GDB will be halted. Polling again in 6300ms
Info : Previous state query failed, trying to reconnect
Error: jtag status contains invalid mode value - communication failure
Polling target stm32l4x.cpu failed, trying to reexamine
Examination failed, GDB will be halted. Polling again in 6300ms


  
Back to top
 
IP Logged
 
Bambo
Member
***
Offline


Posts: 146
Location: Liverpool, UK
Joined: Jan 13th, 2020
Re: Using the nucleo-64 SWD interface to debug another stm32?
Reply #23 - Feb 26th, 2020 at 1:55pm
Print Post  
I think i managed to get it running with stlink.cfg however these errors occur.

Quote:
Info : auto-selecting first available session transport "hla_swd". To override use 'transport select <transport>'.
Info : The selected transport took over low-level target control. The results might differ compared to plain JTAG/SWD
Info : clock speed 500 kHz
Info : STLINK V2J35S7 (API v2) VID:PID 0483:3748
Info : Target voltage: 3.193688
Info : stm32l4x.cpu: hardware has 6 breakpoints, 4 watchpoints
Info : Listening on port 3333 for gdb connections
Info : Listening on port 6666 for tcl connections
Info : Listening on port 4444 for telnet connection
???????????????????????????????????????????????????????????????????????
Error executing event gdb-attach on target stm32l4x.cpu:

Error: Failed to enable the FPB
Error: can't add breakpoint: unknown reason
Error: Failed to enable the FPB
Error: can't add breakpoint: unknown reason
Info : Previous state query failed, trying to reconnect
Error: jtag status contains invalid mode value - communication failure
Polling target stm32l4x.cpu failed, trying to reexamine
Examination failed, GDB will be halted. Polling again in 6300ms
Info : Previous state query failed, trying to reconnect
Error: jtag status contains invalid mode value - communication failure
Polling target stm32l4x.cpu failed, trying to reexamine
Examination failed, GDB will be halted. Polling again in 6300ms
Info : dropped 'gdb' connection
Info : Previous state query failed, trying to reconnect
Error: jtag status contains invalid mode value - communication failure
Polling target stm32l4x.cpu failed, trying to reexamine
Examination failed, GDB will be halted. Polling again in 6300ms
Info : Previous state query failed, trying to reconnect
Error: jtag status contains invalid mode value - communication failure
  
Back to top
 
IP Logged
 
Bambo
Member
***
Offline


Posts: 146
Location: Liverpool, UK
Joined: Jan 13th, 2020
Re: Using the nucleo-64 SWD interface to debug another stm32?
Reply #24 - Feb 26th, 2020 at 2:24pm
Print Post  
I will try again with the on-board stlinkv2.1 and see if that one works.
  
Back to top
 
IP Logged
 
Bambo
Member
***
Offline


Posts: 146
Location: Liverpool, UK
Joined: Jan 13th, 2020
Re: Using the nucleo-64 SWD interface to debug another stm32?
Reply #25 - Feb 26th, 2020 at 2:53pm
Print Post  
Great news! Using the STLink-v2.1 onboard the Nucleo-64, the debugging works!

Here's the fix (added to the boards.txt):
Quote:


#This requires the new openocd folder to be placed in the tools directory.
#It fixes the error to do with starting the "Error executing event gdb-attach on target #stm32l4x.cpu:
#Error: Failed to enable the FPB"

00213/
0200213/



#This fixes the error related to unknown targets.
#****[vMicro]**** Uploading ELF :none separate
#Error: libusb_open() failed with LIBUSB_ERROR_NOT_SUPPORTED
#The uploader process failed
# Copy build result to 'Project>Property Pages>Intermediate Directory'
#Error: libusb_open() failed with LIBUSB_ERROR_NOT_SUPPORTED
# Destination: /


#Error: expected 1 of 1: 0x1ba01477
#in procedure 'program'
#in procedure 'init' called at file "embedded:startup.tcl", line 495
#in procedure 'ocd_bouncer'
#** OpenOCD init failed **
#shutdown command invoked

build.openocdscript=target/stm32l4x.cfg
tools.openocd.upload.openocdscript=target/stm32l4x.cfg


« Last Edit: Feb 26th, 2020 at 2:54pm by Bambo »  

Please Register or Login to the Forum to see File Attachments
Back to top
 
IP Logged
 
Bambo
Member
***
Offline


Posts: 146
Location: Liverpool, UK
Joined: Jan 13th, 2020
Re: Using the nucleo-64 SWD interface to debug another stm32?
Reply #26 - Mar 3rd, 2020 at 1:06pm
Print Post  
Update for Visual Micro 20.03.01.1 for Vs2017/2019.
This issue has been fixed in the version 20.03.01.1. You no longer need to manually update openocd or have a custom boards.txt.

The hardware debugger works out-of-the-box when a nucleo-64 board is used as an external debugger.


« Last Edit: Mar 3rd, 2020 at 1:11pm by Bambo »  
Back to top
 
IP Logged
 
Simon@Visual Micro
Administrator
*****
Offline


Posts: 2175
Joined: Feb 13th, 2019
Re: Using the nucleo-64 SWD interface to debug another stm32?
Reply #27 - Mar 3rd, 2020 at 5:21pm
Print Post  
Sorry for not notifying you of the update, it contains all of the changes we advanced to your machine manually.

Glad to hear its all still working as expected.
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1 [2] 
Send TopicPrint