-
-
Notifications
You must be signed in to change notification settings - Fork 431
[ INFO ] Debug functionality: an update #87
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
It seems arduino-pro-ide shares a lot of code with VScode. |
hey @DeqingSun @kittaakos can you also take a look on the Theia side? |
What exactly, @ubidefeo? |
@ubidefeo I got the CLI work nicely with debugger package on https://raw.githubusercontent.com/DeqingSun/unoDebugTestPackage/main/package_uno_debug_index.json The set up is the same to https://github.com/DeqingSun/Debugging-Arduino-Uno without the VScode part. However the pro-ide gave me |
@DeqingSun |
@ubidefeo Is there a timeline for the next release? If it can be released in 2 week I will try to use the pro IDE for my class, otherwise I'll keep using VScode for teaching this semester. |
@DeqingSun |
@ubidefeo I tried again with alpha 0.1.3 and it returns error "The debug session type "arduino" is not supported." Is this something I can fix with editing launch.json or edit board.txt? |
Hi @DeqingSun, thanks for reaching out again and helping us in making the new IDE better!
Can you please help me in understanding how to reproduce your problem providing:
Thanks! |
@rsora I tried "Arduino Zero programming port", "Arduino Zero USB port", "Arduino M0 pro programming port", and the avr board I defined. They have the same error. Deqing |
@DeqingSun Can you please upgrade the samd core and try again? Thanks! |
@rsora Thanks, seems the Arduino IDE can start openOCD at least. I'll take a look to see how to get it working for Uno. |
@rsora
But using the debug panel on the left will not create such a template. Just mentioning. |
Hi @rsora, it seems I got some progress. So far I got 2 issues. First the IDE is always looking for Also the server is called with argument I used this setting
Update, refering to the code on https://github.com/Marus/cortex-debug/blob/a5a07dbbfa6acf53b157a62f4215b36c1ff854ca/src/openocd.ts , the serverArguments are hard coded. |
@DeqingSun |
Hi @ubidefeo I got the Pro IDE debug the Uno. Which is quite simple for use in the Pro IDE. Just add a board support, compile and debug. It is easier than VScode because the Launch.json can automatically fill the correct path for the debugging tools. However, the Marus/cortex-debug did hardcoded the gdb file name and the openocd parameters. So there is a few dirty tricky involved in this work. |
hi @DeqingSun sorry for the late reply, this is awesome! Please be patient, on January we'll work on adding a new feature which is allowing the user to specify custom parameters to merge into the automatically generated launch file. thank you so much for being a part of this, we appreciate users who push the limits :) |
In 0.1.3 (windows), Should this work with a arduino mkr 1010 wifi? Compile and run works fine, but attempting debug produces the following:
|
@ronnyek The error you get is due to no interface being found. |
hey @DeqingSun sorry for getting back to you so late. In order to use it you'll need to create a local {
"servertype": "jlink",
"device": "ATSAMD21G18",
"interface": "swd",
"serverpath": "/usr/local/bin/JLinkGDBServer"
} hope you'll like it :) |
Hi @ubidefeo Thanks for the update. It is cool to change the launch.json parameters, but my problem is not caused by launch.json. As launch.json can load data correctly from platform.txt . I have no complain about it. The real problem is cortex-debug plugin. As I mentioned on Dec 17, the armToolchainPrefix is fixed in package.json, and the parameters calling debug server is hardcoded in openocd.ts. My solution is, make a copy of avr-gdb, and name it as arm-none-eabi-gdb to cheat the cortex-debug. And since I'm compiling my own debug server, I just check if the parameters matches the hardcoded one from cortex-debug. If so, just replace them with correct ones. These problems for me will not be a problem for most of the ARM based board, as the ARM board is using arm-none-eabi-gdb and real openocd. I can not blame cortex-debug because I'm using it for an unrelated target device. So my dirty fix did work for 0.1.3 and the nightly build. The fixes are dirty but the user won't notice it. The setup process for end-user are fairly easy. Let me know if you would like to try it and I can send you a few samples to test it right away. |
@DeqingSun I thought what we implemented would work, because an automatically generated configuration from the platform is {
"cwd": "${workspaceRoot}",
"name": "Arduino",
"request": "launch",
"type": "cortex-debug",
"executable": "/var/folders/fg/55rcspkj0s53_kwrpyfl2bbh0000gn/T/arduino-sketch-10B418473B33AE139482A9628244D2F4/GartnerDemo.ino.elf",
"servertype": "openocd",
"serverpath": "/Users/ubi/Library/Arduino15/packages/arduino/tools/openocd/0.10.0-arduino7/bin/openocd",
"armToolchainPath": "/Users/ubi/Library/Arduino15/packages/arduino/tools/arm-none-eabi-gcc/7-2017q4/bin/",
"configFiles": [
"/Users/ubi/Library/Arduino15/packages/arduino/hardware/samd/1.8.11/variants/nano_33_iot/openocd_scripts/arduino_zero.cfg"
]
} and you can override (or add) everything you need in there by making your own {
"servertype": "gdb",
"device": "DEVICE_ID",
"interface": "DEBUGWIRE(?)",
"serverpath": "/PATH/TO/AVR_GDB"
} and add all you need? Let me know |
@ubidefeo The Uno debugger adaptor is an expanded USBTinyISP by dcwbrown. The debug server can talk in OPENOCD protocol, that's make it easy to use an ARM config. The hardware is either work with a attiny85 or a CH552 port. Both of them works. Again, there is nothing wrong with the generated launch.json, the automatic generated file did load platform.txt correctly. The problem is the debug plugin. VScode's Arduino plugin is way more versatile than the cortex-debug (currently in Pro IDE) plugin. The cortex-debug has a lot of configurations hard coded and I don't think the launch.json in the sketch folder will be capable to change it. The VScode config is on here. If you don't have the right hardware with you, I can also send you a few boards like this. And you may try debugging on it directly. |
Has anyone been able to get this working with an Arduino Zero? ...something I purchased hoping this would be pretty painless. I have tried to setup my json file based on picking from examples and by looking at similar threads for various errors I have gotten each time I've tweaked it. I haven't kept these as nothing seemed strongly enough in the right direction to pursue. Would be fantastic if someone had something that will work with the zero out of the box they could share? |
@kptb we use the Arduino Zero all the time through the programming port (EDBG) and you don't need any customisation. |
The tested the Uno setup for Pro IDE also works for the IDE 2.0. And the 2.0 can choose the board automatically (I guess using PID/VID?), which make things even more easier. |
@DeqingSun |
yes it works perfectly. |
@DeqingSun Does your solution also work with the Atmel-ICE? If not, it would be great to have some documentation on the debug hooks. That way we could just use AVaRICE to spawn the GDB server and let the IDE connect to it. |
happy to see you join the conversation, @SomeGeek ;) |
I don't think my setup will work with Atmel-ICE. And I've never used AVaRICE. You can check this repo to see how it works. The configuration is in platform.txt and board.txt. As I mentioned before, the debugger module in Arduino IDE will call the debugger server with |
@DeqingSun great, I will check into it next week and report back. |
@SomeGeek |
I'm excited to see this, and excited to see @DeqingSun contributing to it. It will take some really good documentation to make sure beginners in the IDE 2.0 don't mess up their SAMD boards by trying to use the debugger. I would suggest two things:
This is as good a way as any I've found to make your SAMD-based board totally unresponsive, and there's no error message telling you what you did wrong. And it's likely the default behavior for someone who's never used a debugger (feel free to move this to a more appropriate thread, @ubidefeo ) |
I finally got some time to continue with this. Using the packages @DeqingSun provided and the prepared digispark, I was able to get it to debug on VSCode. On the Arduino IDE however, clicking launch spawns a cursor inside launch.json with a selection of debug templates (and I already have defined one). I don't know what I'm missing. The same happens using an modified avarice build which corrects the parameters. |
Hi @SomeGeek
The interface of the debugger is not yet as user friendly and intuitive as we would like. It is essential that you initialize the debugger by clicking the "Start Debugging" button on the button bar: The "Debug" button on the activity bar should only be used for toggling the visibility of the debugger panel. If you open the debugger via the "Debug" button on the activity bar without first clicking the "Start Debugging" button on the button bar, then the debugger is unconfigured. If you then click the "Start Debugging" button (▷) in the "DEBUG" view, it creates an empty In order to make debugging accessible to the target user, the Arduino IDE automagically generates a Even though it is possible to override all keys under https://github.com/arduino/ArduinoCore-samd/blob/1.8.12/platform.txt#L129-L140 The IDE is smart enough to disable the "Start Debugging" button on the button bar if the platform does not define a |
Some update about Uno debugging. I've tested Arduino 2.0.0/2.0.1 in a class and the IDE worked very well with ATMega328P with the board support. The students can debug the ATMega328P and see how the code works. The "Request 4 cancelled on connection closed" error appeared once while I did the demo and it was fixed with the method mentioned in the Arduino Forum. Not sure the root of cause but maybe related to some settings. |
Hi @DeqingSun there is a known bug that can cause this error: A more convenient workaround is described under the "Additional context" section of that issue. |
These defects were fixed long ago (perhaps by e7b1a27).
Fixed by e7b1a27 |
We have received a lot of confusing requests from users who had issues with the Debug feature of this new IDE,
From hard to decipher errors to unsupported hardware.
We are aware of the fact that such functionality can create confusion in both novice and advanced users, so the team and I decided to put together this update.
As we move towards a Beta release (it will be announced when we feel comfortable with giving it the monicker), we have been investigating the behaviour of the included debugger and plan to offer a much better working solution in the near future.
Please try not to ask "are we there yet" every week, just know that we're at work and we're not a big team.
A better debugger is coming, we look forward to releasing it into your hands, but we want it to be good :)
For the current debugger functionality you have to know the following:
Last but not lease: we know that the debug button in the UI is active no matter which board you select, and we're working on this because we don't like it either 😬
Please feel free to ask more questions below, we're more than happy to update this issue and help you get more clarity.
Thank you for reading us
Arduino Tooling Team
The text was updated successfully, but these errors were encountered: