I have a STLink V3 on order should arrive next week. I have been doing it using J-llink mini which works some, but you have to add file to each sketch....
I will second that - using the same CMSIS-DAP SWD debugger as you. Do get a bit more info on whats going on with the peripherials but without does not show where any lower than top calls to mbedos.
for instance if I look at the I2C clock issue, Shows me it dies in Wire.cpp - setClock -> wire.cpp( master->frequency(freq) but thats it. So as long as you are using it to debug your sketch you are ok.
I agree that it would be nice if they provided some easy mechanism for developers to rebuild and debug the main core code base.
The only other boards I remember doing much with, that their Arduino boards manager code would install the majority of their core with a static library, was some of the Robotis boards, like OpenCM 9.04.
One thing that was nice, though was reasonably easy to setup a developers version, in your /hardware directory where if you use the main (or might have been master) branch it built the same way as their release, but if you changed to the dev branch, it was setup to build all of the code from sources, which was both great for debugging as well as fixing or extending the core base code. When you issued a Pull Request, you would copy the header files to a specific location as well as the generated archive file.
@ptillisch and other Arduino developers... Wonder if something like this is possible here?
I saw you already got it working by installing the proprietary SEGGER software and adjusting the debugger configuration via a debug_custom.json file added to the sketch. In case you find that inconvenient, you might be glad to hear that, since Arduino IDE 2.3.0, it is now possible to use a J-Link debug probe without installing the SEGGER software or adding a debug_custom.json file to the sketch. The platform has been configured to configure the free open source OpenOCD tool that is installed along with the "Arduino Mbed OS Giga Boards" platform appropriately for use with a J-Link debug probe.
Select Tools > Programmer > JLink from the Arduino IDE menus.
Click the "Start Debugging" button on the Arduino IDE toolbar.
If you are using Windows, the debugger initialization might fail with the following error message shown in the "gdb-server" panel at the bottom of the Arduino IDE window:
Warn : Failed to open device: LIBUSB_ERROR_NOT_SUPPORTED.
Error: No J-Link device found.
The reason is that the drivers provided by SEGGER are incompatible with OpenOCD it is necessary to replace them with the WinUSB drivers.
I'll provide instructions you can follow to install the WinUSB driver:
From the dropdown menu in the "Zadig" window, select "J-Link". If it doesn't show up on the menu, then select Options > List all devices from the Zadig menus and check again.
Click the up or down arrows next to the Driver selection box on the right side until you see "WinUSB".
Click the "Replace Driver" button.
Wait for the driver replacement process to finish.
Close the "Zadig" window.
Now click the "Start Debugging" button on the Arduino IDE toolbar again. Hopefully this time it will start up and work as expected.
In case you wish to continue using the debug_custom.json approach, you should be aware of this:
Sure. It is supported starting from Arduino IDE 2.3.0, with the latest version of the "Arduino Mbed OS Giga Boards" platform. I'll provide instructions:
Connect the ST-LINK to the GIGA R1 WiFi board.
Connect the ST-LINK to your computer with a USB cable.
Select Tools > Programmer > STMicroelectronics STLINK from the Arduino IDE menus.
Click the "Start Debugging" button on the Arduino IDE toolbar.
Does "CN" mean connector??? If so, then connect it to the header marked "JTAG" on the board's silkscreen.
I have also verified it is working with a DAPLink-based debug probe (with Tools > Programmer > ARM CMSIS-DAP Compatible selected from the Arduino IDE menus).
I bought a manufactured probe, but in theory it should be possible to make DIY one since the ARM DAPLink firmware is open source:
I gave it a try with a dodgy Chinese "Blue Pill" board I happened to have in my board hoard, but unfortunately never managed to get it working as a debug probe even though I was able to flash the firmware.
Thanks @ptillisch - I updated the solved marking to one of your new ones here as it gives a lot more information to the users, on how to use several different debugging probes.
So with j-link, it seems like there are two ways to go here. One is OpenOCD / Zadig, and the other is Segger. The devil is in the details; I respect the work you guys put into this, and would love to avoid re-inventing any wheels here. Is there any consensus as to which is easier / better to achieve? I just want to get started debugging my giga project that's overdue. (That is, I don't care about Ford vs. Chevy - just want to reach the destination on time.) I hope this is a reasonable question to ask on the forum...
Hi @laramsey. In my opinion, the OpenOCD approach I described is easier.
However, if you are also using the proprietary tools provided by Segger for applications other than debugging the GIGA R1 WiFi board via Arduino IDE, then the debug_custom.json approach described by @KurtEhere (with this modification applied) will be best since it might be that the Segger tools won't work with the WinUSB driver that is used with the OpenOCD approach.
Hi ptillisch,
Thanks so much for jumping in here. I did go down the Segger software path. It's not my preference, but I hesitate to de-install it since it's all I have working at the moment. So if the debug_custom.json can work, I'd like to use it. I never found the file "JLinkGDBServerCL.*, but I did find the path below. Just a few dll's in there. Anyway, here is my debug_custom.json:
Blockquote
[2024-05-14T21:43:19.898Z] SERVER CONSOLE DEBUG: onBackendConnect: gdb-server session connected. You can switch to "DEBUG CONSOLE" to see GDB interactions.
"C:/Program Files/SEGGER/JLink_V796g/GDBServer" -singlerun -nogui -if swd -port 50000 -swoport 50001 -telnetport 50002 -device STM32H747XIH6
[2024-05-14T21:43:22.437Z] SERVER CONSOLE DEBUG: GDBServerConsole: onBackendConnect: gdb-server program client error Error: read ECONNRESET
[2024-05-14T21:43:22.439Z] SERVER CONSOLE DEBUG: onBackendConnect: gdb-server session closed
GDB server session ended. This terminal will be reused, waiting for next session to start...
Failed to launch undefined GDB Server: Error: spawn C:/Program Files/SEGGER/JLink_V796g/GDBServer ENOENT
You can see why I say the OpenOCD approach is more simple
Are you certain the file C:/Program Files/SEGGER/JLink_V796g/JLinkGDBServerCL.exe doesn't exist? If so, there is something wrong with your installation of the "J-Link Software and Documentation Pack". I just installed version 7.96 on my Windows machine and that file is present in my installation.
Likewise, there is no GDBServer executable in the installation. There is a folder of that name. This field of the debug_custom.json is the path of the J-Link GDB Server executable file.
Yes, I had the path screwed up. Thanks for keeping me straight on that. Guess I was doing that too late at night. Anyway, fixed that (and verified the file is there), but still don't have blast off:
Blockquote
Failed to launch undefined GDB Server: Timeout.
Silent mode: off
Single run mode: on
Target connection timeout: 0 ms
------J-Link related settings------
J-Link Host interface: USB
J-Link script: none
J-Link settings file: none
------Target related settings------
Target device: STM32H747XIH6
Target device parameters: none
Target interface: SWD
Target interface speed: 4000kHz
Target endian: little
At least I can say the probe itself is good, because it works with Ozone.
Blockquote
Open On-Chip Debugger 0.11.0+dev-gab95bac57-dirty (2021-05-11-10:45)
Licensed under GNU GPL v2
For bug reports, read OpenOCD: Bug Reporting
CDRTOSConfigure
embedded:startup.tcl:26: Error: Can't find interface/{programmer.protocol}.cfg
in procedure 'script'
at file "embedded:startup.tcl", line 26
[2024-05-19T02:07:11.898Z] SERVER CONSOLE DEBUG: onBackendConnect: gdb-server session closed
GDB server session ended. This terminal will be reused, waiting for next session to start...