DeqingSun / Debugging-Arduino-Uno

12 stars 3 forks source link

Uploading & PlatformIO #1

Closed Gasman2014 closed 3 years ago

Gasman2014 commented 3 years ago

Thank you for your work on this. It looks very close to what I would like to achieve but there are a couple of outstanding issues.

How are you uploading to the target board? Are you doing this with avrdude outside of VSCode? Is there any way of editing the source, recompiling and updating the board without leaving VSCode? I can do this easily with an STM32 toolchain.

Have you looked at using PlatformIO to manage the upload/debug cycle? I wonder if it might be possible to support debugWire directly in PlatformIO - it offers a great variety of configuration options.

DeqingSun commented 3 years ago

Debugwire will upload code in every debug session. That is exactly what the load command do. So it is as simple as edit code. stop debugging and press F5.

No I've never used the PlatformIO before.

Gasman2014 commented 3 years ago

To clarify, I appreciate that I cannot upload when the reset pin is controlled by debugWire but could the DWEN fuse switching be controlled automatically to switch between SPI upload and debug mode?

DeqingSun commented 3 years ago

In the new build of dwiredebug, you can use dwen parameter to enable dwen. Disable dwen without dwiredebug require support from the debugger firmware. I do have an implementation in CH552 that can do it. But it is using Adafruit's USB ID and I only got grant for educational use for it.

Gasman2014 commented 3 years ago

OK, I have now done some further experimentation and have your solution working and debugging/uploading. I might still investigate if I can achieve this with PlatformIO which is very flexible. Thank you for this.