VS Arduino | |
>> >> Using the nucleo-64 SWD interface to debug another stm32?
https://www.visualmicro.com/forums/YaBB.pl?num=1582384250 Message started by Bambo on Feb 22nd, 2020 at 3:10pm |
Title: Using the nucleo-64 SWD interface to debug another stm32? Post by Bambo on Feb 22nd, 2020 at 3:10pm
Hi,
Is it possible to use the nucleo-64 SWD pins as a hardware debugger, to debug a seperate stm32? |
Title: Re: Using the nucleo-64 SWD interface to debug another stm32? Post by Simon Hopkinson on Feb 24th, 2020 at 10:11am
This should be possible as the STLink attached to the Nucleo is a separate board, though I have not tried this myself at present. The below STLink Manual section shows how to wire up the SWD interface to an external board:
6.3.4 Using ST-LINK/V2-1 to program and debug an external STM32 application STLink Documentation An alternative may be to create a BMP with STLink Firmware from an STM32 Bluepill, as these can be re-flashed to be a debugger, then back again to be a normal board. STM32 Blue Pill Custom Debugger creation |
Title: Re: Using the nucleo-64 SWD interface to debug another stm32? Post by Bambo on Feb 24th, 2020 at 12:58pm
I see, the documentation says it is possible yes. But which options would be used in this configuration?
- edit - I guess it would be the ST-Link v2 External correct? |
Title: Re: Using the nucleo-64 SWD interface to debug another stm32? Post by Simon Hopkinson on Feb 24th, 2020 at 1:19pm
It would still be the STLink v2.1 in this case, as it is still the same debugger, though we are using it differently.
(the USB identifiers are slightly different between this device and the external STLink, and are labelled only for their most common usage in the IDE). You will also need to change to the right target board as well (I'm assuming it isn't another Nucleo-64 board), and I believe the jumpers also need removing on the STLink board to disconnect it from the on-board Nucleo (shown connected in the first image). |
Title: Re: Using the nucleo-64 SWD interface to debug another stm32? Post by Bambo on Feb 24th, 2020 at 5:01pm Simon@Visual Micro wrote on Feb 24th, 2020 at 1:19pm:
Ok thanks Simon! i will experiment with it and see how far i get :) I will keep this thread updated Only problem is i don't know which board to select since it's just a single STM32 L452RE without the nucleo board, i'll try a few different options and see what happens. |
Title: Re: Using the nucleo-64 SWD interface to debug another stm32? Post by Bambo on Feb 24th, 2020 at 5:24pm
Strange, i'm getting some errors about openocd.exe
Quote:
The DebugOpenOCD.log contains: Quote:
I'm going to try a different board although non match my "STM32 L452RE" chip specifically. |
Title: Re: Using the nucleo-64 SWD interface to debug another stm32? Post by Bambo on Feb 24th, 2020 at 5:30pm
Here's the list of boards, which one do i use for just STM32 L452RE without nucelo-64?
|
Title: Re: Using the nucleo-64 SWD interface to debug another stm32? Post by Bambo on Feb 24th, 2020 at 5:32pm
Here's another log output when trying to build and upload using stlink 2.1
Quote:
|
Title: Re: Using the nucleo-64 SWD interface to debug another stm32? Post by Bambo on Feb 24th, 2020 at 5:37pm
Here is the configuration
|
Title: Re: Using the nucleo-64 SWD interface to debug another stm32? Post by Simon Hopkinson on Feb 24th, 2020 at 6:03pm
Thanks for the additional information, and I don't know enough about these specific boards and configurations, however you should always be able to flash it back if its not right.
With the Nucleo L4x board selected, the issue with the "embedded:startup.tcl:60: Error: Can't find C:\ProgramData\vmicro\tools\openocd-0.10.0.1/scripts/{build.openocdscript}" can be resolved by adding a local board.txt and the below lines before starting the debugger / uploader (will add fixes in next release) [code] build.openocdscript=target/stm32l4x.cfg tools.openocd.upload.openocdscript=target/stm32l4x.cfg [/code] That should at least align the Debug/Upload OpenOCD tool with the correct chip for your board. |
Title: Re: Using the nucleo-64 SWD interface to debug another stm32? Post by Bambo on Feb 24th, 2020 at 8:21pm
Hi, the custom board.txt worked! However i am getting this error. I'm trying to troubleshoot it but i'm not sure what to do using this https://www.visualmicro.com/page/Troubleshooting-Debugging.aspx
|
Title: Re: Using the nucleo-64 SWD interface to debug another stm32? Post by Bambo on Feb 24th, 2020 at 9:34pm
I have attached the debug information with this configuration:
Board: Nucleo-64 Board part number : Nucleo L452RE Debug: Hardware Optimize: Smallest Upload method: STLink v2.1 + OpenOCD (vmicro) https://www.visualmicro.com/forums/YaBB.pl?action=downloadfile;file=build_009.txt ( 981 KB | 1
Download )
|
Title: Re: Using the nucleo-64 SWD interface to debug another stm32? Post by Simon Hopkinson on Feb 24th, 2020 at 9:40pm
There should be a log created when the debugging starts, in the build directory, which all of the output is sent to when debugging (search for "build.path" in the build output with Show Build Properties Enabled).
Code (]e.g. build.path=C:\Users\Simon\AppData\Local\Temp\VMBuilds\STM32-NUCLEO_STLLINKv21_BLINK_GDB\STM32_Nucleo_64\Debug [/code):
This is also useful as you can run the command in the prompt separately, and remove the "-l {logfilelocation}" part of the command and have it output to the prompt. This will hopefully tell us something more about what the issue is between the OpenOCD software and the debugger / target (configuration, voltage, signals etc...) |
Title: Re: Using the nucleo-64 SWD interface to debug another stm32? Post by Bambo on Feb 24th, 2020 at 10:07pm
Here is the output of OpenOCD.
Quote:
Note the upload only works with the Upload Method "STM32CubeProgrammer: SWD "option, it does not work with the "STLink v2.1 + OpenOCD (vmicro) option". |
Title: Re: Using the nucleo-64 SWD interface to debug another stm32? Post by Bambo on Feb 25th, 2020 at 8:05pm
I have resorted to purchasing an STLink v2 just to simplify things :)
|
Title: Re: Using the nucleo-64 SWD interface to debug another stm32? Post by Simon Hopkinson on Feb 25th, 2020 at 8:48pm
Sorry for the delayed reply, all I could think to try now would be an updated OpenOCD version, but this still may be problematic.
The STLink is a good choice, and it removes so many connections and other potential issues it should be well worth it. Let us know if you have any further issues, or if you want to try the OpenOCD update before it is released in the next major build. |
Title: Re: Using the nucleo-64 SWD interface to debug another stm32? Post by Bambo on Feb 25th, 2020 at 9:00pm
No problem Simon, i learnt lots :) Sure i can try a newer version of openocd, which version?
|
Title: Re: Using the nucleo-64 SWD interface to debug another stm32? Post by Simon Hopkinson on Feb 26th, 2020 at 12:43am
The updated version is detailed below, I'd just try it from the command line for now (steps 2+3):
1) [urlhttps://www.visualmicro.com/downloads/tools/openocd-0.10.0.20200213/openocd-0.10.0.20200213.zip]Download Updated OpenOCD ZIP[/url] and Extract to a folder e.g. "C:\ProgramData\vmicro\tools\" (so you should have a new openocd-0.10.0.20200213 folder within tools) 2) Alter the paths in the command line from before for this new folder (it has the same internal structure) 3) Alter the configuration from "stlink-v2-1.cfg" to just "stlink.cfg" Ideally the output will improve (or recognise it as the correct family at least), and there is potentially more logging which can be enabled using -d3 instead of -d2 in the command, however this is extremely verbose and may not reveal more than the messages we see already. |
Title: Re: Using the nucleo-64 SWD interface to debug another stm32? Post by Bambo on Feb 26th, 2020 at 9:17am
Yep, that resolved the errors, here's what the command line output looks like. How do i connect it to vmicro?
|
Title: Re: Using the nucleo-64 SWD interface to debug another stm32? Post by Simon Hopkinson on Feb 26th, 2020 at 12:31pm
Brilliant, this can be added in for debugging easily: (will only affect this project + board configuration)
1) Ensure vMicro > Upload > Verbose is checked 2) Try and attach the Debugger (there will be some JSON output in the Output > Micro Debug window) 3) Right Click on Project and Add > Add Custom GDB Debugger (Advanced) 4) Replace the contents of the file with the JSON copied from step 2 output (including outer {} brackets) 5) Edit the paths/commands in the JSON file to match the updates which have worked 6) Save the JSON file and try the Debug > Attach to Process again Ill let you know when I have had another look at the programmer entries, and how they can be easily edited. In theory now you can run the Upload command and then perform the same edits and run it at the command prompt to try the upload as well. |
Title: Re: Using the nucleo-64 SWD interface to debug another stm32? Post by Bambo on Feb 26th, 2020 at 1:31pm
Here are the settings it is building with and here is my board.txt
Quote:
board.txt Quote:
|
Title: Re: Using the nucleo-64 SWD interface to debug another stm32? Post by Bambo 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. Quote:
|
Title: Re: Using the nucleo-64 SWD interface to debug another stm32? Post by Bambo on Feb 26th, 2020 at 1:51pm Bambo wrote on Feb 26th, 2020 at 1:35pm:
Quote:
|
Title: Re: Using the nucleo-64 SWD interface to debug another stm32? Post by Bambo on Feb 26th, 2020 at 1:55pm
I think i managed to get it running with stlink.cfg however these errors occur.
Quote:
|
Title: Re: Using the nucleo-64 SWD interface to debug another stm32? Post by Bambo on Feb 26th, 2020 at 2:24pm
I will try again with the on-board stlinkv2.1 and see if that one works.
|
Title: Re: Using the nucleo-64 SWD interface to debug another stm32? Post by Bambo on Feb 26th, 2020 at 2:53pm
Great news! Using the STLink-v2.1 onboard the Nucleo-64, the debugging works!
Here's the fix (added to the boards.txt): Quote:
|
Title: Re: Using the nucleo-64 SWD interface to debug another stm32? Post by Bambo on Mar 3rd, 2020 at 1:06pm
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. |
Title: Re: Using the nucleo-64 SWD interface to debug another stm32? Post by Simon Hopkinson on Mar 3rd, 2020 at 5:21pm
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. |
VS Arduino » Powered by YaBB 2.6.12! YaBB Forum Software © 2000-2024. All Rights Reserved. |