analogdevicesinc / VSCode-Maxim

VSCode project folders for the Analog Devices MSDK
https://github.com/Analog-Devices-MSDK/msdk
Other
24 stars 5 forks source link

VSCode + JLink-SWD Debugger Setting #12

Closed Bruce-Tang closed 8 months ago

Bruce-Tang commented 2 years ago

Customer are using VS Code in their developing, JLink debugger will be used instead of PICO debugger, we have a setting procedure based on Eclipse + JLink for MSDK, yet the VS Code + JLink setting procedure is needed for project debugging and firmware downloading regarding OpenOCD has different interfaces with these IDEs and debuggers.

Jake-Carter commented 2 years ago

Thanks @Bruce-Tang, I've created the Segger-J-Link-Setup-Guide and the v1.5.0-beta release page. I'll close out this ticket once v1.5.0 is officially released.

jeremiahrex commented 9 months ago

What happened to this? It seems like the content wasn't pulled into the User Guide when the wiki moved, but I was able to pull it from an old commit of the wiki. There's also no build task for J-Link built into the V1.6.2 project files as far as I can tell.

Jake-Carter commented 9 months ago

Hi @jeremiahrex, since this ticket we've been working on turning this project into an official VS Code extension. Since the J-Link setup requires a completely different set of project files and build tasks, it was difficult to expose to users in a consistent way. I wanted to avoid having multiple versions of the tasks specific to each debugger. With the extension, we have a much better way to select a different debugger through a UI that will handle the heavy lifting, so I held off on updating the J-Link settings after v1.5.0.

However, the extension has taken longer to get to a public release than expected, so this slipped through the cracks. In the meantime, I'll re-add the setup guide and J-Link starter project to the UG in the next release

jeremiahrex commented 9 months ago

Thank you, I'll be happy to test it on Linux in the next release.

Jake-Carter commented 9 months ago

@jeremiahrex I did some Linux re-testing today and was able to simplify the setup significantly to get the existing flash tasks working. Now all projects should work just by setting the jlink.cfg file.

However, I believe I updated my debugger's USB drivers to WinUSB a while back so if you could test on your machine I'd very much appreciate it. They seem to work fine with Linux, but I'm not sure if the native USB drivers will.

Pre-release package is here: https://github.com/Analog-Devices-MSDK/VSCode-Maxim/releases/tag/v1.7.0-pre

I'm not sure how much value the J-Link debug profile adds, since the others should work now. I also found a VS Code bug that makes me hesitant to add JLINK_PATH to all the project's paths (https://github.com/microsoft/vscode/issues/204889). So going with our native OpenOCD is the most attractive option atm. The only downside is that flashing is much slower.

Let me know if you have any issues.

jeremiahrex commented 9 months ago

@Jake-Carter I was able to test today with the following config: VSCode-Maxim v1.7.0-pro VSCode 1.85.2 J-Link software V7.92o

I had a pre-existing project that I wanted to test with. I copied jlink.cfg to Tools/OpenOCD/scripts/interface/ and set M4_OCD_interface_file to point to jlink.cfg in my project settings. I was able to flash, flash/run, debug and erase without issue.

I did not try to set with adding JLINK_PATH and adding the additional debug profiles.

Jake-Carter commented 9 months ago

Thanks @jeremiahrex. Since the USB drivers only seem necessary on Windows I'm leaning towards this setup. Maintaining the extra copies of the flash tasks and launch profile doesn't seem worth it for the native J-Link tools.

jeremiahrex commented 9 months ago

I agree. I am but a single user, loading programs that aren't very big, and I am not anxious to use the full speed of my J-Link until I'm waiting ~30 seconds to load. I was seeing ~20ish kB/s and that would be 600 kB of code. Not a big deal. The fact this this just works with a couple lines of code is way more important to me.

Thanks for your effort here. I used this for a couple hours today without issue. At one point I got a connection error and wondered if I found a bug. But no, I had left the debugger running and then tried to "flash and run".

Let me know if I can do any other testing.

Jake-Carter commented 8 months ago

Thanks again @jeremiahrex, released as of VSCode-Maxim v1.7.0 and the MSDK Feb 2024 Release